You are here

protected function Statement::getColumnMetaCustom in Drupal driver for SQL Server and SQL Azure 8.2

Cached version of getColumnMeta().

Who knows why this was always profiled as being a memory hog, probably due some problem with the PDO driver.

Return value

mixed

1 call to Statement::getColumnMetaCustom()
Statement::fixColumnBindings in drivers/lib/Drupal/Driver/Database/sqlsrv/PDO/Statement.php
Make sure that SQL Server types are properly binded to PHP types.

File

drivers/lib/Drupal/Driver/Database/sqlsrv/PDO/Statement.php, line 166

Class

Statement
Turbocharged Statement class to work with MSSQL server.

Namespace

Drupal\Driver\Database\sqlsrv\PDO

Code

protected function getColumnMetaCustom() {
  $meta = false;
  if ($cache = $this->cnn
    ->Cache('sqlsrv_meta')
    ->Get($this->query_signature)) {
    return $cache->data;
  }

  // Just some safety to account for some schema
  // changes.
  $meta = [];
  for ($i = 0, $count = $this
    ->columnCount(); $i < $count; $i++) {
    $meta[$i] = $this
      ->getColumnMeta($i);
    $meta[$i]['sqlsrv_type'] = explode(' ', $meta[$i]['sqlsrv:decl_type'])[0];
  }
  $this->cnn
    ->Cache('sqlsrv_meta')
    ->Set($this->query_signature, $meta);
  return $meta;
}