# NB 09.04.16 'd' => 'db',
# NB 09.04.16 't' => 'table',
'f' => 'format',
+ 'o' => 'format',
+ 'out' => 'format',
# NB 09.04.16 'l' => 'limit',
# NB 09.04.16 'a' => 'action',
# NB 09.04.16 'h' => 'header',
#!/usr/bin/env sh
-NAME="$(basename "${0}")"
+##############################################################################
+#
+# NB 12.08.16
+#
+# dbq-shell
+#
+# To use in /etc/passwd
+#
+##############################################################################
+#NAME="$(basename "${0}")"
PATH="$PATH:$(cd "$(dirname "${0}")"; echo $(pwd))"
while read line;
do eval "dbq $line"
* @param [FILES] $files Files to load
* @return ARRAY the new/existing value of $this->db
*/
- static function conf_dbs($files=array(),&$first=false) {
+ public static function conf_dbs($files=array(),&$first=false) {
if (empty($files)) return array();
# Load all files into a $h if #files is not a hash
return $this->databases;
}
+ public static function pinit() {
+ Db::paliases(array(
+ 'd' => 'db',
+ 't' => 'table',
+ 'f' => 'format',
+ 'out' => 'format',
+ 'l' => 'limit',
+ 'a' => 'action',
+ 'h' => 'header',
+ ));
+
+ #if($format = out::client_type()) Db::pset('format',$format);
+
+ # Param - Extract dbname from table
+ if (preg_match('/^(\w+)\.(.*?)$/',Db::p('table'),$m)) {
+ Db::pset('db',$m[1]);
+ Db::pset('table',$m[2]);
+ }
+
+ }
+
} # < Class
?>
require_once(realpath(dirname(__FILE__).'/../config.php'));
require_once(realpath(dirname(__FILE__).'/../db.php'));
-Db::paliases(array(
- 'd' => 'db',
- 't' => 'table',
- 'f' => 'format',
- 'out' => 'format',
- 'l' => 'limit',
- 'a' => 'action',
- 'h' => 'header',
-));
-
+Db::pinit();
# Set format from client Accept if != html
#bye(out::client_type());
Db::pdef('format',out::client_type());
-#if($format = out::client_type()) Db::pset('format',$format);
-
-# Param - Extract dbname from table
-if (preg_match('/^(\w+)\.(.*?)$/',Db::p('table'),$m)) {
- Db::pset('db',$m[1]);
- Db::pset('table',$m[2]);
-}
if(defined('DB_NO_INIT') and DB_NO_INIT) return true;
#bye(Db::conf_dbs(array( Db::ROOT_DIR.'/etc/dbs.yaml','/etc/dbs.yaml' )));
*/
public static function paliases($aliases) {
foreach ($aliases as $short=>$long) {
- DB::pdef($long,Db::p($short));
+ if (!preg_match('/^\s*$/',self::p($short))) DB::pset($long,Db::p($short));
+ #echo "===$short => $long\n";
Db::pset($short,null);
}
}