/** * This function returns an associated array of default properties for the specified * SQL data type. * * @access public * @override * @param string $type the SQL data type * @return array an associated array of default properties * for the specified data type * * @license http://kohanaframework.org/license * @see https://github.com/xrado/kohana-mssql * @see http://msdn.microsoft.com/en-us/library/windows/desktop/ms713607%28v=vs.85%29.aspx * @see http://www.firebirdsql.org/manual/migration-mssql-data-types.html */ public function data_type($type) { static $types = array('BIT' => array('type' => 'Binary', 'max_length' => 1, 'nullable' => FALSE), 'DATETIME' => array('type' => 'Integer'), 'IMAGE' => array('type' => 'Blob', 'max_length' => 2147483647), 'MONEY' => array('type' => 'Decimal', 'precision' => 18, 'scale' => 4), 'NTEXT' => array('type' => 'Text', 'max_length' => '1073741823'), 'SMALLDATETIME' => array('type' => 'Integer'), 'SMALLMONEY' => array('type' => 'Decimal', 'precision' => 10, 'scale' => 4), 'SQL_VARIANT' => array('type' => 'Blob', 'varying' => TRUE), 'TINYINT' => array('type' => 'Integer', 'range' => array(0, 255)), 'UNIQUEIDENTIFIER' => array('type' => 'String', 'max_length' => 38)); $type = strtoupper($type); if (isset($types[$type])) { return $types[$type]; } return parent::data_type($type); }
/** * This function returns an associated array of default properties for the specified * SQL data type. * * @access public * @override * @param string $type the SQL data type * @return array an associated array of default properties * for the specified data type * * @license http://kohanaframework.org/license * * @see http://www.firebirdsql.org/manual/migration-mssql-data-types.html * @see http://web.firebirdsql.org/dotnetfirebird/firebird-and-dotnet-framework-data-types-mapping.html * @see http://www.promotic.eu/en/pmdoc/Subsystems/Db/FireBird/DataTypes.htm * @see http://www.ibphoenix.com/resources/documents/general/doc_54 */ public function data_type($type) { static $types = array('BLOB' => array('type' => 'Blob', 'max_length' => 2147483647), 'BLOB_ID' => array('type' => 'String'), 'BLOB SUB_TYPE 0' => array('type' => 'Blob', 'max_length' => 2147483647), 'BLOB SUB_TYPE 1' => array('type' => 'Text', 'max_length' => 2147483647), 'BLOB SUB_TYPE 2' => array('type' => 'Text', 'max_length' => 2147483647), 'BLOB SUB_TYPE 3' => array('type' => 'Text', 'max_length' => 2147483647), 'BLOB SUB_TYPE 4' => array('type' => 'Text', 'max_length' => 2147483647), 'BLOB SUB_TYPE 5' => array('type' => 'Blob', 'max_length' => 2147483647), 'BLOB SUB_TYPE 6' => array('type' => 'Text', 'max_length' => 2147483647), 'BLOB SUB_TYPE 7' => array('type' => 'Text', 'max_length' => 2147483647), 'BLOB SUB_TYPE 8' => array('type' => 'Text', 'max_length' => 2147483647), 'BLOB SUB_TYPE 9' => array('type' => 'Text', 'max_length' => 2147483647), 'BLOB SUB_TYPE ACL' => array('type' => 'Text', 'max_length' => 2147483647), 'BLOB SUB_TYPE BLR' => array('type' => 'Text', 'max_length' => 2147483647), 'BLOB SUB_TYPE EXTERNAL_FILE_DESCRIPTION' => array('type' => 'Text', 'max_length' => 2147483647), 'BLOB SUB_TYPE FORMAT' => array('type' => 'Text', 'max_length' => 2147483647), 'BLOB SUB_TYPE RANGES' => array('type' => 'Text', 'max_length' => 2147483647), 'BLOB SUB_TYPE SUMMARY' => array('type' => 'Blob', 'max_length' => 2147483647), 'BLOB SUB_TYPE TEXT' => array('type' => 'Text', 'max_length' => 2147483647), 'BLOB SUB_TYPE TEXT CHARACTER SET' => array('type' => 'Text', 'max_length' => 2147483647), 'BLOB SUB_TYPE TRANSACTION_DESCRIPTION' => array('type' => 'Text', 'max_length' => 2147483647), 'CSTRING' => array('type' => 'String'), 'D_FLOAT' => array('type' => 'Double'), 'INT64' => array('type' => 'Integer', 'range' => array('-9223372036854775808', '9223372036854775807')), 'QUAD' => array('type' => 'Integer', 'range' => array('-9223372036854775808', '9223372036854775807'))); $type = preg_match('/^BLOB SUB_TYPE TEXT CHARACTER SET.*$/i', $type) ? 'BLOB SUB_TYPE TEXT CHARACTER SET' : strtoupper($type); if (isset($types[$type])) { return $types[$type]; } return parent::data_type($type); }
/** * This function returns an associated array of default properties for the specified * SQL data type. * * @access public * @override * @param string $type the SQL data type * @return array an associated array of default properties * for the specified data type * * @license http://kohanaframework.org/license * * @see http://dev.mysql.com/doc/refman/5.0/en/data-types.html */ public function data_type($type) { static $types = array('BLOB' => array('type' => 'Blob', 'max_length' => 65535), 'BOOL' => array('type' => 'Boolean'), 'BIGINT UNSIGNED' => array('type' => 'Integer', 'range' => array(0, '18446744073709551615')), 'DEC UNSIGNED' => array('type' => 'Decimal', 'range' => array(0, NULL)), 'DECIMAL UNSIGNED' => array('type' => 'Decimal', 'range' => array(0, NULL)), 'DOUBLE PRECISION UNSIGNED' => array('type' => 'Double', 'range' => array(0, NULL)), 'DOUBLE UNSIGNED' => array('type' => 'Double', 'range' => array(0, NULL)), 'ENUM' => array('type' => 'String'), 'FIXED' => array('type' => 'Double'), 'FIXED UNSIGNED' => array('type' => 'Double', 'range' => array(0, NULL)), 'FLOAT UNSIGNED' => array('type' => 'Double', 'range' => array(0, NULL)), 'INT UNSIGNED' => array('type' => 'Integer', 'range' => array(0, '4294967295')), 'INTEGER UNSIGNED' => array('type' => 'Integer', 'range' => array(0, '4294967295')), 'LONGBLOB' => array('type' => 'Blob', 'max_length' => '4294967295'), 'LONGTEXT' => array('type' => 'Text', 'max_length' => '4294967295'), 'MEDIUMBLOB' => array('type' => 'Blob', 'max_length' => 16777215), 'MEDIUMINT' => array('type' => 'Integer', 'range' => array(-8388608, 8388607)), 'MEDIUMINT UNSIGNED' => array('type' => 'Integer', 'range' => array(0, 16777215)), 'MEDIUMTEXT' => array('type' => 'Text', 'max_length' => 16777215), 'NUMERIC UNSIGNED' => array('type' => 'Decimal', 'range' => array(0, NULL)), 'POINT' => array('type' => 'Binary'), 'REAL UNSIGNED' => array('type' => 'Double', 'range' => array(0, NULL)), 'SERIAL' => array('type' => 'Integer', 'range' => array(0, '18446744073709551615')), 'SET' => array('type' => 'String'), 'SMALLINT UNSIGNED' => array('type' => 'Integer', 'range' => array(0, 65535)), 'TEXT' => array('type' => 'Text', 'max_length' => 65535), 'TINYBLOB' => array('type' => 'Blob', 'max_length' => 255), 'TINYINT UNSIGNED' => array('type' => 'Integer', 'range' => array(0, 255)), 'TINYTEXT' => array('type' => 'String', 'max_length' => 255), 'YEAR' => array('type' => 'String')); $type = strtoupper($type); $type = trim(preg_replace('/ ZEROFILL/i', '', $type)); if (isset($types[$type])) { return $types[$type]; } return parent::data_type($type); }