You are here

private function InstapageCmsPluginWPConnector::checkLastQuery in Instapage plugin 8.3

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

Checks if last executed query resulted in an SQL error. Error is saved in the debug log.

Return value

bool True if there was an SQL error.

3 calls to InstapageCmsPluginWPConnector::checkLastQuery()
InstapageCmsPluginWPConnector::getResults in core/connectors/InstapageCmsPluginWPConnector.php
Executes the query and returns a list of results.
InstapageCmsPluginWPConnector::getRow in core/connectors/InstapageCmsPluginWPConnector.php
Executes the query and returns the first row.
InstapageCmsPluginWPConnector::query in core/connectors/InstapageCmsPluginWPConnector.php
Executes a SQL query.

File

core/connectors/InstapageCmsPluginWPConnector.php, line 936

Class

InstapageCmsPluginWPConnector
Class that utilizes native WordPress functions to perform actions like remote requests and DB operations.

Code

private function checkLastQuery() {
  global $wpdb;
  $db = InstapageCmsPluginDBModel::getInstance();
  if (strpos($wpdb->last_query, $db->debugTable) === false && $wpdb->last_error !== '') {
    $messages = array(
      'Query: ' . $wpdb->last_query,
      'Error: ' . $wpdb->last_error,
    );
    InstapageCmsPluginHelper::writeDiagnostics(implode("\n", $messages), 'DB Error');
    return false;
  }
  return true;
}