protected function tryDelimite($s) { $driver = $this->connection->getSupplementalDriver(); return preg_replace_callback('#(?<=[^\\w`"\\[]|^)[a-z_][a-z0-9_]*(?=[^\\w`"(\\]]|$)#i', create_function('$m', 'extract(NCFix::$vars[' . NCFix::uses(array('driver' => $driver)) . '], EXTR_REFS); return strtoupper($m[0]) === $m[0] ? $m[0] : $driver->delimite($m[0]); '), $s); }
protected function reloadForeignKeys($table) { foreach ($this->connection->getSupplementalDriver()->getForeignKeys($table) as $row) { $this->structure['belongsTo'][strtolower($table)][$row['local']] = $row['table']; $this->structure['hasMany'][strtolower($row['table'])][$row['local'] . $table] = array($row['local'], $table); } if (isset($this->structure['belongsTo'][$table])) { uksort($this->structure['belongsTo'][$table], create_function('$a, $b', ' return strlen($a) - strlen($b); ')); } }
/** * @return string */ public function getPrimarySequence() { if ($this->primarySequence === FALSE) { $this->primarySequence = NULL; $driver = $this->connection->getSupplementalDriver(); if ($driver->isSupported(ISupplementalDriver::SUPPORT_SEQUENCE)) { foreach ($driver->getColumns($this->name) as $column) { if ($column['name'] === $this->primary) { $this->primarySequence = $column['vendor']['sequence']; break; } } } } return $this->primarySequence; }
private function detectColumnTypes() { if ($this->types === NULL) { $this->types = array(); if ($this->connection->getSupplementalDriver()->isSupported(ISupplementalDriver::SUPPORT_COLUMNS_META)) { // workaround for PHP bugs #53782, #54695 $col = 0; while ($meta = $this->getColumnMeta($col++)) { if (isset($meta['native_type'])) { $this->types[$meta['name']] = DatabaseHelpers::detectType($meta['native_type']); } } } } return $this->types; }
public function __construct(Connection $connection) { $this->connection = $connection; $this->driver = $connection->getSupplementalDriver(); }