/** * This method will return a native type that corresponds to the specified * Creole (JDBC-like) type. * If there is more than one matching native type, then the LAST defined * native type will be returned. * @param int $creoleType * @return string Native type string. */ public static function getNativeType($creoleType) { if (self::$reverseMap === null) { self::$reverseMap = array_flip(self::$typeMap); } return @self::$reverseMap[$creoleType]; }
/** Loads the columns for this table. */ protected function initColumns() { include_once 'creole/metadata/ColumnInfo.php'; include_once 'creole/drivers/oracle/OCI8Types.php'; // To get all of the attributes we need, we'll actually do // two separate queries. The first gets names and default values // the second will fill in some more details. $sql = "\n\t\t\tSELECT column_name\n\t\t\t\t, data_type\n\t\t\t\t, data_precision\n\t\t\t\t, data_length\n\t\t\t\t, data_default\n\t\t\t\t, nullable \n\t\t\t\t, data_scale\n FROM all_tab_columns\n WHERE table_name = '{$this->name}'\n AND OWNER = '{$this->schema}'"; $statement = @oci_parse($this->conn->getResource(), $sql); $success = @oci_execute($statement, OCI_DEFAULT); if (!$success) { throw new SQLException("Could Not Get Columns"); } while ($statement && ($row = oci_fetch_array($statement, OCI_ASSOC + OCI_RETURN_NULLS))) { $row = array_change_key_case($row, CASE_LOWER); $this->columns[$row['column_name']] = new ColumnInfo($this, $row['column_name'], OCI8Types::getType($row['data_type']), $row['data_type'], $row['data_length'], $row['data_precision'], $row['data_scale'], $row['nullable'], $row['data_default']); } $this->colsLoaded = true; }