8 include_once (
"MDB2.php");
55 "text" => array(
"length",
"notnull",
"default",
"fixed"),
56 "integer" => array(
"length",
"notnull",
"default",
"unsigned"),
57 "float" => array(
"notnull",
"default"),
58 "date" => array(
"notnull",
"default"),
59 "time" => array(
"notnull",
"default"),
60 "timestamp" => array(
"notnull",
"default"),
61 "clob" => array(
"notnull",
"default"),
62 "blob" => array(
"notnull",
"default")
83 $this->db_user = $a_user;
103 $this->db_port = $a_port;
113 return $this->db_port;
123 $this->db_host = $a_host;
143 $this->db_password = $a_password;
153 return $this->db_password;
163 $this->db_name = $a_name;
179 abstract function getDSN();
209 $this->db->setOption(
'result_buffering',$a_status);
218 global $ilClientIniFile;
221 if (is_object($tmpClientIniFile))
222 $clientIniFile = $tmpClientIniFile;
224 $clientIniFile = $ilClientIniFile;
226 if (is_object($clientIniFile ))
228 $this->
setDBUser($clientIniFile ->readVariable(
"db",
"user"));
229 $this->
setDBHost($clientIniFile ->readVariable(
"db",
"host"));
230 $this->
setDBPort($clientIniFile ->readVariable(
"db",
"port"));
231 $this->
setDBPassword($clientIniFile ->readVariable(
"db",
"pass"));
232 $this->
setDBName($clientIniFile ->readVariable(
"db",
"name"));
239 function connect($a_return_false_for_error =
false)
246 if ($this->
getDSN() ==
"")
281 array(
"use_transactions" =>
true));
289 $this->db->disconnect();
332 array(
"use_transactions" =>
true));
344 $this->db->setOption(
"portability", $this->db->getOption(
"portability") - $cur);
347 $this->db->setOption(
"portability", $this->db->getOption(
"portability") - $cur);
385 $a_level = $this->error_class->FATAL;
395 $stack = $e->getTraceAsString();
398 if(is_object($ilLog))
401 $a_res->getMessage().
"<br />".$a_res->getUserInfo().
"<br />".$stack, $a_level);
415 $a_level = $this->error_class->FATAL;
430 $this->db->loadModule(
'Extended');
455 if ($a_collation !=
"")
457 $sql =
"CREATE DATABASE ".$a_name.
458 " CHARACTER SET ".$a_charset.
459 " COLLATE ".$a_collation;
463 $sql =
"CREATE DATABASE ".$a_name.
464 " CHARACTER SET ".$a_charset;
467 return $this->
query($sql,
false);
478 function createTable($a_name, $a_definition_array, $a_drop_table =
false,
479 $a_ignore_erros =
false)
482 if ($a_options ==
"")
484 $a_options = array();
490 $this->
raisePearError(
"ilDB Error: createTable(".$a_name.
")<br />".
497 $this->
raisePearError(
"ilDB Error: createTable(".$a_name.
")<br />".
506 $manager = $this->db->loadModule(
'Manager');
507 $r = $manager->createTable($a_name, $a_definition_array, $a_options);
509 return $this->
handleError($r,
"createTable(".$a_name.
")");
518 function dropTable($a_name, $a_error_if_not_existing =
true)
520 if (!$a_error_if_not_existing)
523 if (!in_array($a_name, $tables))
529 $manager = $this->db->loadModule(
'Manager');
534 $constraints = $manager->listTableConstraints($a_name);
535 $this->
handleError($constraints,
"dropTable(".$a_name.
"), listTableConstraints");
536 foreach ($constraints as $c)
538 if (
substr($c, 0, 4) !=
"sys_")
540 $r = $manager->dropConstraint($a_name, $c);
541 $this->
handleError($r,
"dropTable(".$a_name.
"), dropConstraint");
546 $indexes = $manager->listTableIndexes($a_name);
547 $this->
handleError($indexes,
"dropTable(".$a_name.
"), listTableIndexes");
548 foreach ($indexes as $i)
550 $r = $manager->dropIndex($a_name, $i);
551 $this->
handleError($r,
"dropTable(".$a_name.
"), dropIndex");
556 $seqs = $manager->listSequences();
557 if (in_array($a_name, $seqs))
559 $r = $manager->dropSequence($a_name);
560 $this->
handleError($r,
"dropTable(".$a_name.
"), dropSequence");
564 $r = $manager->dropTable($a_name);
566 return $this->
handleError($r,
"dropTable(".$a_name.
")");
576 if ($a_options ==
"")
578 $a_options = array();
581 $manager = $this->db->loadModule(
'Manager');
582 $r = $manager->alterTable($a_name, $a_changes,
false);
584 return $this->
handleError($r,
"alterTable(".$a_name.
")");
598 $manager = $this->db->loadModule(
'Manager');
602 $this->
raisePearError(
"ilDB Error: addTableColumn(".$a_table.
", ".$a_column.
")<br />".
607 $this->
raisePearError(
"ilDB Error: addTableColumn(".$a_table.
", ".$a_column.
")<br />".
613 $a_column => $a_attributes
617 $r = $manager->alterTable($a_table, $changes,
false);
619 return $this->
handleError($r,
"addTableColumn(".$a_table.
", ".$a_column.
")");
632 $manager = $this->db->loadModule(
'Manager');
640 $r = $manager->alterTable($a_table, $changes,
false);
642 return $this->
handleError($r,
"dropTableColumn(".$a_table.
", ".$a_column.
")");
655 $manager = $this->db->loadModule(
'Manager');
656 $reverse = $this->db->loadModule(
'Reverse');
657 $def = $reverse->getTableFieldDefinition($a_table, $a_column);
659 $this->
handleError($def,
"modifyTableColumn(".$a_table.
")");
661 if (is_file(
"./Services/Database/classes/class.ilDBAnalyzer.php"))
663 include_once(
"./Services/Database/classes/class.ilDBAnalyzer.php");
667 include_once(
"../Services/Database/classes/class.ilDBAnalyzer.php");
670 $best_alt = $analyzer->getBestDefinitionAlternative($def);
671 $def = $def[$best_alt];
672 unset($def[
"nativetype"]);
673 unset($def[
"mdb2type"]);
676 $type = ($a_attributes[
"type"] !=
"")
677 ? $a_attributes[
"type"]
679 foreach ($def as $k => $v)
681 if ($k !=
"type" && !in_array($k, $this->allowed_attributes[$type]))
687 foreach ($a_attributes as $k => $v)
689 $check_array[$k] = $v;
693 $this->
raisePearError(
"ilDB Error: modifyTableColumn(".$a_table.
", ".$a_column.
")<br />".
698 if ($this->getDbType() ==
"oracle")
700 if ($def[
"notnull"] ==
true && ($a_attributes[
"notnull"] ==
true
701 || !isset($a_attributes[
"notnull"])))
703 unset($def[
"notnull"]);
704 unset($a_attributes[
"notnull"]);
706 if ($def[
"notnull"] ==
false && ($a_attributes[
"notnull"] ==
false
707 || !isset($a_attributes[
"notnull"])))
709 unset($def[
"notnull"]);
710 unset($a_attributes[
"notnull"]);
713 foreach ($a_attributes as $a => $v)
718 $a_attributes[
"definition"] = $def;
722 $a_column => $a_attributes
726 $r = $manager->alterTable($a_table, $changes,
false);
728 return $this->
handleError($r,
"modifyTableColumn(".$a_table.
")");
744 $this->
raisePearError(
"ilDB Error: renameTableColumn(".$a_table.
",".$a_column.
",".$a_new_column.
")<br />".
748 $manager = $this->db->loadModule(
'Manager');
749 $reverse = $this->db->loadModule(
'Reverse');
750 $def = $reverse->getTableFieldDefinition($a_table, $a_column);
752 $this->
handleError($def,
"renameTableColumn(".$a_table.
",".$a_column.
",".$a_new_column.
")");
754 if (is_file(
"./Services/Database/classes/class.ilDBAnalyzer.php"))
756 include_once(
"./Services/Database/classes/class.ilDBAnalyzer.php");
760 include_once(
"../Services/Database/classes/class.ilDBAnalyzer.php");
764 $best_alt = $analyzer->getBestDefinitionAlternative($def);
765 $def = $def[$best_alt];
766 unset($def[
"nativetype"]);
767 unset($def[
"mdb2type"]);
769 $f[
"definition"] = $def;
770 $f[
"name"] = $a_new_column;
778 $r = $manager->alterTable($a_table, $changes,
false);
780 return $this->
handleError($r,
"renameTableColumn(".$a_table.
",".$a_column.
",".$a_new_column.
")");
794 $this->
raisePearError(
"ilDB Error: renameTable(".$a_name.
",".$a_new_name.
")<br />".
798 $manager = $this->db->loadModule(
'Manager');
799 $r = $manager->alterTable($a_name, array(
"name" => $a_new_name),
false);
801 $query =
"UPDATE abstraction_progress ".
802 "SET table_name = ".$this->db->quote($a_new_name,
'text').
" ".
803 "WHERE table_name = ".$this->db->quote($a_name,
'text');
806 return $this->
handleError($r,
"renameTable(".$a_name.
",".$a_new_name.
")");
818 $manager = $this->db->loadModule(
'Manager');
821 foreach ($a_fields as $f)
823 $fields[$f] = array();
825 $definition = array (
829 $r = $manager->createConstraint($a_table,
832 return $this->
handleError($r,
"addPrimaryKey(".$a_table.
")");
851 $manager = $this->db->loadModule(
'Manager');
853 $r = $manager->dropConstraint($a_table,
856 return $this->
handleError($r,
"dropPrimaryKey(".$a_table.
")");
866 function addIndex($a_table, $a_fields, $a_name =
"in", $a_fulltext =
false)
868 $manager = $this->db->loadModule(
'Manager');
873 $this->
raisePearError(
"ilDB Error: addIndex(".$a_table.
",".$a_name.
")<br />".
878 foreach ($a_fields as $f)
880 $fields[$f] = array();
882 $definition = array (
888 $r = $manager->createIndex($a_table, $this->
constraintName($a_table, $a_name), $definition);
898 return $this->
handleError($r,
"addIndex(".$a_table.
")");
926 $manager = $this->db->loadModule(
'Manager');
930 $r = $manager->dropIndex($a_table, $this->
constraintName($a_table, $a_name));
934 $this->dropFulltextIndex($a_table, $a_name);
937 return $this->
handleError($r,
"dropIndex(".$a_table.
")");
949 $manager = $this->db->loadModule(
'Manager');
954 $this->
raisePearError(
"ilDB Error: addUniqueConstraint(".$a_table.
",".$a_name.
")<br />".
959 foreach ($a_fields as $f)
961 $fields[$f] = array();
963 $definition = array (
968 $r = $manager->createConstraint($a_table, $this->
constraintName($a_table, $a_name), $definition);
970 return $this->
handleError($r,
"addUniqueConstraint(".$a_table.
")");
978 $manager = $this->db->loadModule(
'Manager');
980 $r = $manager->createSequence($a_table_name, $a_start);
982 return $this->
handleError($r,
"createSequence(".$a_table_name.
")");
991 $manager = $this->db->loadModule(
'Manager');
993 $r = $manager->dropSequence($a_table_name);
995 return $this->
handleError($r,
"dropSequence(".$a_table_name.
")");
1005 if (!preg_match (
"/^[a-z]+[_a-z0-9]*$/", $a_name))
1007 $this->error_str =
"Table name must only contain _a-z0-9 and must start with a-z.";
1013 $this->error_str =
"Invalid table name '".$a_name.
"' (Reserved Word).";
1017 if (strtolower(
substr($a_name, 0, 4)) ==
"sys_")
1019 $this->error_str =
"Invalid table name '".$a_name.
"'. Name must not start with 'sys_'.";
1023 if (strlen($a_name) > 22)
1025 $this->error_str =
"Invalid table name '".$a_name.
"'. Maximum table identifer lenght is 22 bytes.";
1039 foreach ($a_cols as $col => $def)
1076 if (!in_array($a_def[
"type"], array(
"text",
"integer",
"float",
"date",
"time",
"timestamp",
"clob",
"blob")))
1078 switch ($a_def[
"type"])
1081 $this->error_str =
"Invalid column type '".$a_def[
"type"].
"'. Use integer(1) instead.";
1085 $this->error_str =
"Invalid column type '".$a_def[
"type"].
"'. Use float or integer instead.";
1089 $this->error_str =
"Invalid column type '".$a_def[
"type"].
"'. Allowed types are: ".
1090 "text, integer, float, date, time, timestamp, clob and blob.";
1097 foreach ($a_def as $k => $v)
1101 $this->error_str =
"Attribute '".$k.
"' is not allowed for column type '".$a_def[
"type"].
"'.";
1107 switch ($a_def[
"type"])
1110 if ($a_def[
"length"] < 1 || $a_def[
"length"] > 4000)
1112 if (!$a_modify_mode || isset($a_def[
"length"]))
1114 $this->error_str =
"Invalid length '".$a_def[
"length"].
"' for type text.".
1115 " Length must be >=1 and <= 4000.";
1122 if (!in_array($a_def[
"length"], array(1, 2, 3, 4, 8)))
1124 if (!$a_modify_mode || isset($a_def[
"length"]))
1126 $this->error_str =
"Invalid length '".$a_def[
"length"].
"' for type integer.".
1127 " Length must be 1, 2, 3, 4 or 8 (bytes).";
1131 if ($a_def[
"unsigned"])
1133 $this->error_str =
"Unsigned attribut must not be true for type integer.";
1149 if (!preg_match (
"/^[a-z]+[_a-z0-9]*$/", $a_name))
1151 $this->error_str =
"Invalid column name '".$a_name.
"'. Column name must only contain _a-z0-9 and must start with a-z.";
1157 $this->error_str =
"Invalid column name '".$a_name.
"' (Reserved Word).";
1161 if (strtolower(
substr($a_name, 0, 4)) ==
"sys_")
1163 $this->error_str =
"Invalid column name '".$a_name.
"'. Name must not start with 'sys_'.";
1167 if (strlen($a_name) > 30)
1169 $this->error_str =
"Invalid column name '".$a_name.
"'. Maximum column identifer lenght is 30 bytes.";
1183 if (!preg_match (
"/^[a-z]+[_a-z0-9]*$/", $a_name))
1185 $this->error_str =
"Invalid column name '".$a_name.
"'. Column name must only contain _a-z0-9 and must start with a-z.";
1191 $this->error_str =
"Invalid column name '".$a_name.
"' (Reserved Word).";
1195 if (strlen($a_name) > 3)
1197 $this->error_str =
"Invalid index name '".$a_name.
"'. Maximum index identifer lenght is 3 bytes.";
1216 return $a_constraint;
1225 include_once(
"./Services/Database/classes/class.ilDBMySQL.php");
1227 if (in_array(strtoupper($a_word), $mysql_reserved_words))
1231 include_once(
"./Services/Database/classes/class.ilDBOracle.php");
1233 if (in_array(strtoupper($a_word), $oracle_reserved_words))
1237 include_once(
"./Services/Database/classes/class.ilDBPostgreSQL.php");
1239 if (in_array(strtoupper($a_word), $postgres_reserved_words))
1260 function query($sql, $a_handle_error =
true)
1264 if (is_object($ilBench))
1266 $ilBench->startDbBench($sql);
1268 $r = $this->db->query($sql);
1269 if (is_object($ilBench))
1271 $ilBench->stopDbBench();
1274 if ($a_handle_error)
1289 function queryF($a_query, $a_types, $a_values)
1291 if (!is_array($a_types) || !is_array($a_values) ||
1292 count($a_types) != count($a_values))
1294 $this->
raisePearError(
"ilDB::queryF: Types and values must be arrays of same size. ($a_query)");
1296 $quoted_values = array();
1297 foreach($a_types as $k =>
$t)
1299 $quoted_values[] = $this->
quote($a_values[$k],
$t);
1301 $query = vsprintf($a_query, $quoted_values);
1315 if (!is_array($a_types) || !is_array($a_values) ||
1316 count($a_types) != count($a_values))
1318 $this->
raisePearError(
"ilDB::manipulateF: types and values must be arrays of same size. ($a_query)");
1320 $quoted_values = array();
1321 foreach($a_types as $k =>
$t)
1323 $quoted_values[] = $this->
quote($a_values[$k],
$t);
1325 $query = vsprintf($a_query, $quoted_values);
1335 $pos1 = strpos(strtolower($sql),
"from ");
1339 $tablef =
substr($sql, $pos1+5);
1340 $pos2 = strpos(strtolower($tablef),
" ");
1343 $table =
substr($tablef, 0, $pos2);
1350 if (trim($table) !=
"")
1352 if (!is_array($this->ttt) || !in_array($table, $this->ttt))
1355 $this->ttt[] = $table;
1360 echo
"<br><b>".$sql.
"</b>";
1369 $this->db->setLimit($a_limit, $a_offset);
1380 $r = $this->db->nextId($a_table_name,
false);
1382 return $this->
handleError($r,
"nextId(".$a_table_name.
")");
1397 $r = $this->db->exec($sql);
1399 return $this->
handleError($r,
"manipulate(".$sql.
")");
1410 function prepare($a_query, $a_types = null, $a_result_types = null)
1412 $res = $this->db->prepare($a_query, $a_types, $a_result_types);
1442 $res = $a_stmt->execute($a_data);
1458 $res = $this->db->extended->executeMultiple($a_stmt,$a_data);
1460 return $this->
handleError(
$res,
"executeMultiple(".$a_stmt->query.
")");
1472 $field_values = array();
1473 $placeholders = array();
1478 foreach ($a_columns as $k => $col)
1481 $placeholders[] =
"%s";
1482 $placeholders2[] =
":$k";
1484 $values[] = $col[1];
1485 $field_values[$k] = $col[1];
1486 if ($col[0] ==
"blob" || $col[0] ==
"clob")
1494 $st = $this->db->prepare(
"INSERT INTO ".$a_table.
" (".implode($fields,
",").
") VALUES (".
1497 $this->
handleError($st,
"insert / prepare/execute(".$a_table.
")");
1499 $r = $st->execute($field_values);
1503 $this->
handleError($r,
"insert / prepare/execute(".$a_table.
")");
1508 $q =
"INSERT INTO ".$a_table.
" (".implode($fields,
",").
") VALUES (".
1509 implode($placeholders,
",").
")";
1523 function update($a_table, $a_columns, $a_where)
1526 $field_values = array();
1527 $placeholders = array();
1532 foreach ($a_columns as $k => $col)
1535 $placeholders[] =
"%s";
1536 $placeholders2[] =
":$k";
1538 $values[] = $col[1];
1539 $field_values[$k] = $col[1];
1540 if ($col[0] ==
"blob" || $col[0] ==
"clob")
1549 $q =
"UPDATE ".$a_table.
" SET ";
1551 foreach ($fields as $k => $field)
1553 $q.= $lim.$field.
" = ".$placeholders2[$k];
1558 foreach ($a_where as $k => $col)
1560 $q.= $lim.$k.
" = ".$this->
quote($col[1], $col[0]);
1564 $r = $st->execute($field_values);
1567 $this->
handleError($r,
"update / prepare/execute(".$a_table.
")");
1572 foreach ($a_where as $k => $col)
1575 $values[] = $col[1];
1576 $field_values[$k] = $col;
1578 $q =
"UPDATE ".$a_table.
" SET ";
1580 foreach ($fields as $k => $field)
1582 $q.= $lim.$field.
" = ".$placeholders[$k];
1587 foreach ($a_where as $k => $col)
1589 $q.= $lim.$k.
" = %s";
1605 function replace($a_table, $a_pk_columns, $a_other_columns)
1608 $a_columns = array_merge($a_pk_columns, $a_other_columns);
1610 $field_values = array();
1611 $placeholders = array();
1616 foreach ($a_columns as $k => $col)
1619 $placeholders[] =
"%s";
1620 $placeholders2[] =
":$k";
1622 $values[] = $col[1];
1623 $field_values[$k] = $col[1];
1624 if ($col[0] ==
"blob" || $col[0] ==
"clob")
1632 $st = $this->db->prepare(
"REPLACE INTO ".$a_table.
" (".implode($fields,
",").
") VALUES (".
1634 $this->
handleError($st,
"insert / prepare/execute(".$a_table.
")");
1635 $r = $st->execute($field_values);
1637 $this->
handleError($r,
"insert / prepare/execute(".$a_table.
")");
1642 $q =
"REPLACE INTO ".$a_table.
" (".implode($fields,
",").
") VALUES (".
1643 implode($placeholders,
",").
")";
1664 return $a_st->free();
1684 return $a_set->numRows();
1702 function in($a_field, $a_values, $negate =
false, $a_type =
"")
1704 if (count($a_values) == 0)
1710 $str = $a_field.(($negate) ?
" NOT" :
"").
" IN (?".str_repeat(
",?", count($a_values) - 1).
")";
1714 $str = $a_field.(($negate) ?
" NOT" :
"").
" IN (";
1716 foreach ($a_values as $v)
1718 $str.= $sep.$this->quote($v, $a_type);
1732 if (!is_array($a_arr))
1738 $type_arr = array_fill(0, $a_cnt, $a_type);
1742 $type_arr = array();
1744 return array_merge($a_arr, $type_arr);
1766 public function concat($a_values,$a_allow_null =
true)
1768 if(!count($a_values))
1773 $concat =
' CONCAT(';
1775 foreach($a_values as $field_info)
1777 $val = $field_info[0];
1786 $concat .=
'COALESCE(';
1808 function substr($a_exp, $a_pos = 1, $a_len = -1)
1813 $lenstr =
", ".$a_len;
1815 return " SUBSTR(".$a_exp.
", ".$a_pos.$lenstr.
") ";
1826 return " UPPER(".$a_exp.
") ";
1837 return " LOWER(".$a_exp.
") ";
1847 public function locate($a_needle,$a_string,$a_start_pos = 1)
1849 $locate =
' LOCATE( ';
1850 $locate .= $a_needle;
1852 $locate .= $a_string;
1854 $locate .= $a_start_pos;
1865 function like($a_col, $a_type, $a_value =
"?", $case_insensitive =
true)
1867 if (!in_array($a_type, array(
"text",
"clob",
"blob")))
1869 $this->
raisePearError(
"Like: Invalid column type '".$a_type.
"'.", $this->error_class->FATAL);
1871 if ($a_value ==
"?")
1873 if ($case_insensitive)
1875 return "UPPER(".$a_col.
") LIKE(UPPER(?))";
1879 return $a_col .
" LIKE(?)";
1884 if ($case_insensitive)
1887 return " UPPER(".$a_col.
") LIKE(UPPER(".$this->
quote($a_value,
'text').
"))";
1892 return " ".$a_col.
" LIKE(".$this->
quote($a_value,
'text').
")";
1901 function equals($a_col, $a_value, $a_type, $a_empty_or_null =
false)
1903 if (!$a_empty_or_null || $a_value !=
"")
1905 return $a_col.
" = ".$this->
quote($a_value, $a_type);
1909 return "(".$a_col.
" = '' OR $a_col IS NULL)";
1916 function equalsNot($a_col, $a_value, $a_type, $a_empty_or_null =
false)
1918 if (!$a_empty_or_null)
1920 return $a_col.
" <> ".$this->
quote($a_value, $a_type);
1924 return "(".$a_col.
" <> ".$this->
quote($a_value, $a_type).
" OR ".
1929 return "(".$a_col.
" <> '' AND $a_col IS NOT NULL)";
1941 return "FROM_UNIXTIME(".$a_expr.
")";
1949 return "UNIX_TIMESTAMP()";
1975 if (is_array($tables))
1977 if (in_array($a_table, $tables))
1995 $column_visibility =
false;
1996 $manager = $this->db->loadModule(
'Manager');
1997 $r = $manager->listTableFields($a_table);
2001 foreach($r as $field)
2003 if ($field == $a_column_name)
2005 $column_visibility =
true;
2010 return $column_visibility;
2020 $manager = $this->db->loadModule(
'Manager');
2021 $r = $manager->listTables();
2039 function quote($a_query, $a_type = null)
2041 if ($a_query ==
"" && is_null($a_type))
2047 if($a_type ==
'integer' && !is_null($a_query))
2049 return (
int) $a_query;
2051 if ($a_type ==
"blob" || $a_type ==
"clob")
2053 $this->
raisePearError(
"ilDB::quote: Quoting not allowed on type '".$a_type.
"'. Please use ilDB->insert and ilDB->update to write clobs.", $this->error_class->FATAL);
2056 return $this->db->quote($a_query, $a_type);
2068 return $this->db->quoteIdentifier($a_identifier);
2082 if (!$this->db->supports(
'transactions'))
2084 $this->
raisePearError(
"ilDB::beginTransaction: Transactions are not supported.", $this->error_class->FATAL);
2086 $res = $this->db->beginTransaction();
2096 $res = $this->db->commit();
2106 $res = $this->db->rollback();
2116 abstract public function lockTables($a_tables);
2141 $res = $this->db->autoExecute($a_tablename,$a_fields,$a_mode,$a_where);
2157 $res = $this->db->lastInsertId();
2177 $set = $this->db->query($sql);
2200 $set = $this->
query($sql);
2201 $r = $set->fetchRow($mode);