/** * Loads the columns for this table. * @return void */ protected function initColumns() { include_once 'creole/metadata/ColumnInfo.php'; include_once 'creole/drivers/mssql/MSSQLTypes.php'; if (!@mssql_select_db($this->dbname, $this->conn->getResource())) { throw new SQLException('No database selected'); } $res = mssql_query("sp_columns " . $this->name, $this->conn->getResource()); if (!$res) { throw new SQLException('Could not get column names', mssql_get_last_message()); } while ($row = mssql_fetch_array($res)) { $name = $row['COLUMN_NAME']; $type = $row['TYPE_NAME']; $length = $row['LENGTH']; $is_nullable = $row['NULLABLE']; $default = $row['COLUMN_DEF']; $precision = $row['PRECISION']; $scale = $row['SCALE']; $identity = false; if (strtolower($type) == "int identity") { $identity = true; } $this->columns[$name] = new ColumnInfo($this, $name, MSSQLTypes::getType($type), $type, $length, $precision, $scale, $is_nullable, $default, $identity); } $this->colsLoaded = true; }
public static function getNativeType($creoleType) { if (self::$reverseMap === null) { self::$reverseMap = array_flip(self::$typeMap); } return @self::$reverseMap[$creoleType]; }