You are here

public function InstapageCmsPluginDrupal7Connector::query in Instapage plugin 8.3

Same name and namespace in other branches
  1. 7.3 core/connectors/InstapageCmsPluginDrupal7Connector.php \InstapageCmsPluginDrupal7Connector::query()

Executes a SQL query.

@uses InstapageCmsPluginDrupal7Connector::prepare() to change '%s' to '?'.

Parameters

string $sql SQL to execute. %s can be used to output pre-formatted values. Values for %s can be passed as arguments for this function.:

Return value

bool True if the query is successful. DB error is logged and false if returned otherwise.

File

core/connectors/InstapageCmsPluginDrupal7Connector.php, line 250

Class

InstapageCmsPluginDrupal7Connector
Class that utilizes native Drupal 7 functions to perform actions like remote requests and DB operations.

Code

public function query($sql) {
  $args = func_get_args();
  array_shift($args);
  $args = $this
    ->prepareFunctionArgs($args);
  $sql = $this
    ->prepare($sql);
  try {
    db_query($sql, $args);
    return true;
  } catch (Exception $e) {
    $this
      ->logDbError($e, $sql);
    return false;
  }
}