function _db_query_callback in Drupal 5
Same name and namespace in other branches
- 4 includes/database.inc \_db_query_callback()
- 6 includes/database.inc \_db_query_callback()
Helper function for db_query().
Related topics
7 calls to _db_query_callback()
- db_query in includes/
database.inc - Runs a basic query in the active database.
- db_query_range in includes/
database.mysqli.inc - Runs a limited-range query in the active database.
- db_query_range in includes/
database.mysql.inc - Runs a limited-range query in the active database.
- db_query_range in includes/
database.pgsql.inc - Runs a limited-range query in the active database.
- db_query_temporary in includes/
database.mysqli.inc - Runs a SELECT query and stores its results in a temporary table.
7 string references to '_db_query_callback'
- db_query in includes/
database.inc - Runs a basic query in the active database.
- db_query_range in includes/
database.mysqli.inc - Runs a limited-range query in the active database.
- db_query_range in includes/
database.mysql.inc - Runs a limited-range query in the active database.
- db_query_range in includes/
database.pgsql.inc - Runs a limited-range query in the active database.
- db_query_temporary in includes/
database.mysqli.inc - Runs a SELECT query and stores its results in a temporary table.
File
- includes/
database.inc, line 141 - Wrapper for database interface code.
Code
function _db_query_callback($match, $init = FALSE) {
static $args = NULL;
if ($init) {
$args = $match;
return;
}
switch ($match[1]) {
case '%d':
// We must use type casting to int to convert FALSE/NULL/(TRUE?)
return (int) array_shift($args);
// We don't need db_escape_string as numbers are db-safe
case '%s':
return db_escape_string(array_shift($args));
case '%%':
return '%';
case '%f':
return (double) array_shift($args);
case '%b':
// binary data
return db_encode_blob(array_shift($args));
}
}