function wpsql_query($sql) { if (!$GLOBALS['pg4wp_conn']) { // Catch SQL to be executed as soon as connected $GLOBALS['pg4wp_pre_sql'][] = $sql; return true; } $initial = $sql; $sql = pg4wp_rewrite($sql); $GLOBALS['pg4wp_result'] = pg_query($sql); if ((PG4WP_DEBUG || PG4WP_LOG_ERRORS) && $GLOBALS['pg4wp_result'] === false && ($err = pg_last_error())) { $ignore = false; if (defined('WP_INSTALLING') && WP_INSTALLING) { global $table_prefix; $ignore = strpos($err, 'relation "' . $table_prefix); } if (!$ignore) { error_log('[' . microtime(true) . "] Error running :\n{$initial}\n---- converted to ----\n{$sql}\n----> {$err}\n---------------------\n", 3, PG4WP_LOG . 'pg4wp_errors.log'); } } return $GLOBALS['pg4wp_result']; }
function wpsql_query($sql) { if (!$GLOBALS['pg4wp_conn']) { // Catch SQL to be executed as soon as connected $GLOBALS['pg4wp_pre_sql'][] = $sql; return true; } $sql = pg4wp_rewrite($sql); $GLOBALS['pg4wp_result'] = pg_query($sql); if ((PG4WP_DEBUG || PG4WP_LOG_ERRORS) && $GLOBALS['pg4wp_result'] === false && ($err = pg_last_error())) { if (false === strpos($err, 'relation "' . $wpdb->options . '"')) { error_log("Error running :\n{$initial}\n---- converted to ----\n{$sql}\n----\n{$err}\n---------------------\n", 3, PG4WP_LOG . 'pg4wp_errors.log'); } } return $GLOBALS['pg4wp_result']; }