);
}
+ /** Insert data into table
+ * @param string
+ * @param array
+ * @return bool
+ */
+ function insert_into($table, $set) {
+ return queries("INSERT INTO " . idf_escape($table) . " (" . implode(", ", array_keys($set)) . ")\nVALUES (" . implode(", ", $set) . ")");
+ }
+
/** Explain select
* @param Min_DB
* @param string
);
}
+ function insert_into($table, $set) {
+ return queries("INSERT INTO " . idf_escape($table) . ($set ? " (" . implode(", ", array_keys($set)) . ")\nVALUES (" . implode(", ", $set) . ")" : "DEFAULT VALUES"));
+ }
+
function explain($connection, $query) {
return $connection->query("EXPLAIN $query");
}
);
}
+ function insert_into($table, $set) {
+ return queries("INSERT INTO " . idf_escape($table) . ($set ? " (" . implode(", ", array_keys($set)) . ")\nVALUES (" . implode(", ", $set) . ")" : "DEFAULT VALUES"));
+ }
+
function explain($connection, $query) {
return $connection->query("EXPLAIN $query");
}
}
query_redirect("UPDATE" . limit1(idf_escape($TABLE) . " SET" . implode(",", $set) . "\nWHERE $where"), $location, lang('Item has been updated.'));
} else {
- query_redirect("INSERT INTO " . idf_escape($TABLE) . " (" . implode(", ", array_keys($set)) . ")\nVALUES (" . implode(", ", $set) . ")", $location, lang('Item has been inserted.'));
+ queries_redirect($location, lang('Item has been inserted.'), insert_into($TABLE, $set));
}
}
}
*/
function where($where) {
$return = array();
- foreach (array("where", "null") as $type) {
- foreach ((array) $where[$type] as $key => $val) {
- $key = bracket_escape($key, "back");
- $return[] = (preg_match('~^[A-Z0-9_]+\\(`(?:[^`]|``)+`\\)$~', $key) ? $key : idf_escape($key)) . ($type == "null" ? " IS NULL" : (ereg('\\.', $val) ? " LIKE " . exact_value(addcslashes($val, "%_")) : " = " . exact_value($val))); // LIKE because of floats, but slow with ints //! enum and set, columns looking like functions
- }
+ foreach ((array) $where["where"] as $key => $val) {
+ $return[] = idf_escape($key) . (ereg('\\.', $val) ? " LIKE " . exact_value(addcslashes($val, "%_")) : " = " . exact_value($val)); // LIKE because of floats, but slow with ints //! enum and set
+ }
+ foreach ((array) $where["null"] as $key) {
+ $return[] = idf_escape($key) . " IS NULL";
}
return implode(" AND ", $return);
}