You are here

function apdqc_escape_string in Asynchronous Prefetch Database Query Cache 7

Prepare input for use in a database query, preventing SQL injection attacks.

Parameters

string $string: String that needs to be sanitized.

Return value

string Sanitized version of the input string.

24 calls to apdqc_escape_string()
apdqc.session.inc in ./apdqc.session.inc
User session handling functions.
APDQCache::clear in ./apdqc.cache.inc
Implements DrupalCacheInterface::clear().
APDQCache::garbageCollection in ./apdqc.cache.inc
Generic garbage collection method.
APDQCache::getMultiple in ./apdqc.cache.inc
Implements DrupalCacheInterface::getMultiple().
APDQCache::set in ./apdqc.cache.inc
Implements DrupalCacheInterface::set().

... See full list

16 string references to 'apdqc_escape_string'
ApdqcPrefetchDrupalDefaultEntityController::__call in ./apdqc.module
Magic method; forward all calls to the original base class.
apdqc_boot in ./apdqc.module
Implements hook_boot().
apdqc_ctools_plugin_pre_alter in ./apdqc.module
Implements hook_ctools_plugin_pre_alter().
apdqc_entity_load in ./apdqc.module
Implements hook_entity_load().
apdqc_get_lang in ./apdqc.module
Returns the language shorthand escaped for database use.

... See full list

File

./apdqc.mysql.inc, line 663
APDQC Database interface code for MySQL database servers.

Code

function apdqc_escape_string($string) {
  static $mysqli;
  if (empty($mysqli) || !$mysqli instanceof mysqli) {
    $mysqli = apdqc_get_db_object(array(), array(), array(
      'fast_get' => TRUE,
    ));
  }
  if (empty($mysqli)) {
    unset($mysqli);
    return FALSE;
  }
  return $mysqli
    ->real_escape_string($string);
}