diff --git a/www/admin/class_test.php b/www/admin/class_test.php index 03bcadc2..0dc1b4a4 100644 --- a/www/admin/class_test.php +++ b/www/admin/class_test.php @@ -19,14 +19,14 @@ _spl_autoload('Class.'.$class.'.inc'); $lang = 'en_utf8'; - + DEFINE('LOG_FILE_ID', 'classTest'); $login = new login($DB_CONFIG[LOGIN_DB], $lang); // init with standard // $basic = new db_io($DB_CONFIG[MAIN_DB]); $basic = new AdminBackend($DB_CONFIG[MAIN_DB], $lang); $basic->db_info(1); - + // set + check edit access id $edit_access_id = 3; print "ACL UNIT: ".print_r(array_keys($login->acl['unit']), 1)."
"; @@ -46,15 +46,15 @@ print ''; // print the debug core vars - print "DEBUG OUT: ".$basic->debug_output."
"; - print "ECHO OUT: ".$basic->echo_output."
"; - print "PRINT OUT: ".$basic->print_output."
"; - print "NOT DEBUG OUT: ".$basic->debug_output_not."
"; - print "NOT ECHO OUT: ".$basic->echo_output_not."
"; - print "NOT PRINT OUT: ".$basic->print_output_not."
"; - print "DEBUG OUT ALL: ".$basic->debug_output_all."
"; - print "ECHO OUT ALL: ".$basic->echo_output_all."
"; - print "PRINT OUT ALL: ".$basic->print_output_all."
"; + print "DEBUG OUT: ".$basic->debug_output."
"; + print "ECHO OUT: ".$basic->echo_output."
"; + print "PRINT OUT: ".$basic->print_output."
"; + print "NOT DEBUG OUT: ".$basic->debug_output_not."
"; + print "NOT ECHO OUT: ".$basic->echo_output_not."
"; + print "NOT PRINT OUT: ".$basic->print_output_not."
"; + print "DEBUG OUT ALL: ".$basic->debug_output_all."
"; + print "ECHO OUT ALL: ".$basic->echo_output_all."
"; + print "PRINT OUT ALL: ".$basic->print_output_all."
"; print "CALLER BACKTRACE: ".$basic->get_caller_method()."
"; $basic->debug('SOME MARK', 'Some error output'); @@ -85,6 +85,9 @@ // $status = $basic->db_exec("INSERT INTO foo (test) values ('BAR 1 ".time()."'), ('BAR 2 ".time()."'), ('BAR 3 ".time()."') RETURNING foo_id"); $status = $basic->db_exec("INSERT INTO foo (test) values ('BAR 1 ".time()."'), ('BAR 2 ".time()."'), ('BAR 3 ".time()."') RETURNING foo_id, test"); print "DIRECT MULTIPLE INSERT STATUS: $status | PRIMARY KEYS: ".print_r($basic->insert_id, 1)." | PRIMARY KEY EXT: ".print_r($basic->insert_id_ext, 1)."
"; + // no returning, but not needed ; + $status = $basic->db_exec("INSERT INTO foo (test) VALUES ('FOO; TEST ".time()."');"); + print "DIRECT INSERT STATUS: $status | PRIMARY KEY: ".$basic->insert_id." | PRIMARY KEY EXT: ".print_r($basic->insert_id_ext, 1)."
"; # db write class test $table = 'foo'; diff --git a/www/libs/Class.DB.IO.inc b/www/libs/Class.DB.IO.inc index d28395ce..65111019 100644 --- a/www/libs/Class.DB.IO.inc +++ b/www/libs/Class.DB.IO.inc @@ -663,6 +663,8 @@ } if (!preg_match("/ returning /i", $this->query) && $this->pk_name && $this->pk_name != 'NULL') { + // check if this query has a ; at the end and remove it + $this->query = preg_replace("/(;\s*)$/", '', $this->query); $this->query .= " RETURNING ".$this->pk_name; $this->returning_id = true; }