/** * Gets the TableSchema for this model. * * @return TableSchema */ public function getTableSchema() { if (empty($this->tableSchema)) { if (empty($this->schema)) { $this->getSchema(); } $this->tableSchema = $this->schema->getTable($this->table); } return $this->tableSchema; }
public static function formatValue($value, $type) { if ('int' === $type && '' === $value) { // Postgresql strangely returns "" for null integers return null; } return parent::formatValue($value, $type); }
public static function formatValue($value, $type) { $value = parent::formatValue($value, $type); if (' ' === $value) { // SQL Anywhere strangely returns empty string as a single space string return ''; } return $value; }
/** * 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)); }
/** * 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(['[', ']'], '', $name1); $name2 = str_replace(['[', ']'], '', $name2); return parent::compareTableNames(strtolower($name1), strtolower($name2)); }
/** * @param ColumnSchema $field_info * @param bool $as_quoted_string * @param string $out_as * * @return string */ public function parseFieldForSelect($field_info, $as_quoted_string = false, $out_as = null) { $field = $as_quoted_string ? $this->quoteColumnName($field_info->name) : $field_info->name; $alias = $as_quoted_string ? $this->quoteColumnName($field_info->getName(true)) : $field_info->getName(true); switch ($field_info->dbType) { case 'datetime': case 'datetimeoffset': return "(CONVERT(nvarchar(30), {$field}, 127)) AS {$alias}"; case 'geometry': case 'geography': case 'hierarchyid': return "({$field}.ToString()) AS {$alias}"; default: return parent::parseFieldForSelect($field_info, $as_quoted_string, $out_as); } }
/** * {@InheritDoc} */ public function addForeignKey($name, $table, $columns, $refTable, $refColumns, $delete = null, $update = null) { // ON UPDATE not supported by Oracle return parent::addForeignKey($name, $table, $columns, $refTable, $refColumns, $delete, null); }
public static function formatValue($value, $type) { switch (strtolower(strval($type))) { case 'int': case 'integer': if ('' === $value) { // Postgresql strangely returns "" for null integers return null; } } return parent::formatValue($value, $type); }