56 define(
'MDB2_AUTOQUERY_INSERT', 1);
57 define(
'MDB2_AUTOQUERY_UPDATE', 2);
58 define(
'MDB2_AUTOQUERY_DELETE', 3);
59 define(
'MDB2_AUTOQUERY_SELECT', 4);
103 return $db->prepare(
$query, $types, $result_types);
132 $where =
false, $types = null, $result_class =
true, $result_types =
MDB2_PREPARE_MANIP)
134 $fields_values = (array)$fields_values;
136 if (is_array($result_types)) {
137 $keys = array_keys($result_types);
138 }
elseif (!empty($fields_values)) {
139 $keys = $fields_values;
144 $keys = array_keys($fields_values);
146 $params = array_values($fields_values);
160 $stmt = $this->
autoPrepare($table, $keys, $mode, $where, $types, $result_types);
201 if ($db->options[
'quote_identifier']) {
202 $table = $db->quoteIdentifier($table);
205 if (!empty($table_fields) && $db->options[
'quote_identifier']) {
206 foreach ($table_fields as
$key => $field) {
207 $table_fields[
$key] = $db->quoteIdentifier($field);
211 if ($where !==
false && !is_null($where)) {
212 if (is_array($where)) {
213 $where = implode(
' AND ', $where);
215 $where =
' WHERE '.$where;
220 if (empty($table_fields)) {
222 'Insert requires table fields', __FUNCTION__);
224 $cols = implode(
', ', $table_fields);
225 $values =
'?'.str_repeat(
', ?', (count($table_fields) - 1));
226 return 'INSERT INTO '.$table.
' ('.$cols.
') VALUES ('.$values.
')';
229 if (empty($table_fields)) {
231 'Update requires table fields', __FUNCTION__);
233 $set = implode(
' = ?, ', $table_fields).
' = ?';
234 $sql =
'UPDATE '.$table.
' SET '.$set.$where;
238 $sql =
'DELETE FROM '.$table.$where;
242 $cols = !empty($table_fields) ? implode(
', ', $table_fields) :
'*';
243 $sql =
'SELECT '.$cols.
' FROM '.$table.$where;
248 'Non existant mode', __FUNCTION__);
268 $result_wrap_class =
false)
275 $result = $db->setLimit($limit, $offset);
279 $result =& $db->query(
$query, $types, $result_class, $result_wrap_class);
341 $param_types = null, $colnum = 0)
349 settype(
$type,
'array');
364 $one =
$result->fetchOne($colnum);
397 return $db->queryRow(
$query, $types, $fetchmode);
400 $stmt = $db->prepare(
$query, $param_types, $types);
434 $param_types = null, $colnum = 0)
442 settype(
$type,
'array');
457 $col =
$result->fetchCol($colnum);
490 $rekey =
false, $force_array =
false, $group =
false)
499 return $db->queryAll(
$query, $types, $fetchmode, $rekey, $force_array, $group);
502 $stmt = $db->prepare(
$query, $param_types, $types);
512 $all =
$result->fetchAll($fetchmode, $rekey, $force_array, $group);
604 return $db->queryAll(
$query, $types, $fetchmode,
true, $force_array, $group);
607 $stmt = $db->prepare(
$query, $param_types, $types);
617 $all =
$result->fetchAll($fetchmode,
true, $force_array, $group);
643 for ($i = 0, $j = count(
$params); $i < $j; $i++) {
667 function getBeforeID($table, $field = null, $ondemand =
true, $quote =
true)
674 if ($db->supports(
'auto_increment') !==
true) {
675 $seq = $table.(empty($field) ?
'' :
'_'.$field);
676 $id = $db->nextID($seq, $ondemand);
680 return $db->quote($id,
'integer');
707 if ($db->supports(
'auto_increment') !==
true) {
710 return $db->lastInsertID($table, $field);