You are here

public function InstapageCmsPluginDrupal8Connector::getRow in Instapage plugin 8.3

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

Executes the query and returns the first row.

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

mixed first row of results of the query.

1 call to InstapageCmsPluginDrupal8Connector::getRow()
InstapageCmsPluginDrupal8Connector::lastInsertId in core/connectors/InstapageCmsPluginDrupal8Connector.php
Gets the last ID of an insert query.

File

core/connectors/InstapageCmsPluginDrupal8Connector.php, line 153

Class

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

Code

public function getRow($sql) {
  $args = func_get_args();
  array_shift($args);
  $args = $this
    ->prepareFunctionArgs($args);
  try {
    $statement = $this
      ->prepare($sql);
    if (count($args)) {
      $statement
        ->execute($args);
    }
    else {
      $statement
        ->execute();
    }
    return $statement
      ->fetch(PDO::FETCH_OBJ);
  } catch (Exception $e) {
    $this
      ->logDbError($e, $sql);
    return false;
  }
}