You are here

function update_sql in Drupal 6

Same name and namespace in other branches
  1. 4 update.php \update_sql()
  2. 5 update.php \update_sql()

Perform an SQL query and return success or failure.

Parameters

$sql: A string containing a complete SQL query. %-substitution parameters are not supported.

Return value

An array containing the keys: success: a boolean indicating whether the query succeeded query: the SQL query executed, passed through check_plain()

Related topics

61 calls to update_sql()
book_update_6000 in modules/book/book.install
Drupal 5.x to 6.x update.
comment_update_6001 in modules/comment/comment.install
db_add_column in ./update.php
Add a column to a database using syntax appropriate for PostgreSQL. Save result of SQL commands in $ret array.
db_add_field in includes/database.mysql-common.inc
Add a new field to a table.
db_add_field in includes/database.pgsql.inc
Add a new field to a table.

... See full list

1 string reference to 'update_sql'
drupal_error_handler in includes/common.inc
Log errors as defined by administrator.

File

includes/database.inc, line 63
Wrapper for database interface code.

Code

function update_sql($sql) {
  $result = db_query($sql, true);
  return array(
    'success' => $result !== FALSE,
    'query' => check_plain($sql),
  );
}