/** * @return array */ public static function getSqlFunctions() { static $aFunctionsCache = null; if (null !== $aFunctionsCache) { return $aFunctionsCache; } $aFunctions = array(CDbSchema::functionDP1()); $aFunctionsCache = $aFunctions; return $aFunctionsCache; }
/** * @param CDbSchema $schema the schema for this command builder */ public function __construct($schema) { $this->_schema=$schema; $this->_connection=$schema->getDbConnection(); }
/** * Compares two table names. * The table names can be either quoted or unquoted. This method * will consider both cases. * @param string $name1 table name 1 * @param string $name2 table name 2 * @return boolean whether the two table names refer to the same table. */ public function compareTableNames($name1, $name2) { $name1 = str_replace(array('[', ']'), '', $name1); $name2 = str_replace(array('[', ']'), '', $name2); return parent::compareTableNames(strtolower($name1), strtolower($name2)); }
/** * Compares two table names. * The table names can be either quoted or unquoted. This method * will consider both cases. * @param string $name1 table name 1 * @param string $name2 table name 2 * @return boolean whether the two table names refer to the same table. */ public function compareTableNames($name1, $name2) { return parent::compareTableNames(strtolower($name1), strtolower($name2)); }
/** * Generates the mapping table between table names and class names. * @param CDbSchema $schema the database schema * @param string $pattern a regular expression that may be used to filter table names */ protected function generateClassNames($schema, $pattern = null) { $this->_tables = array(); foreach ($schema->getTableNames() as $name) { if ($pattern === null) { $this->_tables[$name] = $this->generateClassName($this->removePrefix($name)); } elseif (preg_match($pattern, $name, $matches)) { if (count($matches) > 1 && !empty($matches[1])) { $className = $this->generateClassName($matches[1]); } else { $className = $this->generateClassName($matches[0]); } $this->_tables[$name] = empty($className) ? $name : $className; } } }