|
| quoteTableAs ($ident, $alias=null, $auto=false) |
|
| listTables () |
|
| describeTable ($tableName, $schemaName=null) |
|
| lastSequenceId ($sequenceName) |
|
| nextSequenceId ($sequenceName) |
|
| lastInsertId ($tableName=null, $primaryKey=null) |
|
| limit ($sql, $count, $offset=0) |
|
| isConnected () |
|
| closeConnection () |
|
| prepare ($sql) |
|
| lastInsertId ($tableName=null, $primaryKey=null) |
|
| query ($sql, $bind=array()) |
|
| exec ($sql) |
|
| setFetchMode ($mode) |
|
| supportsParameters ($type) |
|
| getServerVersion () |
|
| __construct ($config) |
|
| getConnection () |
|
| getConfig () |
|
| setProfiler ($profiler) |
|
| getProfiler () |
|
| getStatementClass () |
|
| setStatementClass ($class) |
|
| query ($sql, $bind=array()) |
|
| beginTransaction () |
|
| commit () |
|
| rollBack () |
|
| insert ($table, array $bind) |
|
| update ($table, array $bind, $where='') |
|
| delete ($table, $where='') |
|
| select () |
|
| getFetchMode () |
|
| fetchAll ($sql, $bind=array(), $fetchMode=null) |
|
| fetchRow ($sql, $bind=array(), $fetchMode=null) |
|
| fetchAssoc ($sql, $bind=array()) |
|
| fetchCol ($sql, $bind=array()) |
|
| fetchPairs ($sql, $bind=array()) |
|
| fetchOne ($sql, $bind=array()) |
|
| quote ($value, $type=null) |
|
| quoteInto ($text, $value, $type=null, $count=null) |
|
| quoteIdentifier ($ident, $auto=false) |
|
| quoteColumnAs ($ident, $alias, $auto=false) |
|
| quoteTableAs ($ident, $alias=null, $auto=false) |
|
| getQuoteIdentifierSymbol () |
|
| lastSequenceId ($sequenceName) |
|
| nextSequenceId ($sequenceName) |
|
| foldCase ($key) |
|
| __sleep () |
|
| __wakeup () |
|
| listTables () |
|
| describeTable ($tableName, $schemaName=null) |
|
| isConnected () |
|
| closeConnection () |
|
| prepare ($sql) |
|
| lastInsertId ($tableName=null, $primaryKey=null) |
|
| setFetchMode ($mode) |
|
| limit ($sql, $count, $offset=0) |
|
| supportsParameters ($type) |
|
| getServerVersion () |
|
Definition at line 39 of file Oci.php.
describeTable |
( |
|
$tableName, |
|
|
|
$schemaName = null |
|
) |
| |
Returns the column descriptions for a table.
The return value is an associative array keyed by the column name, as returned by the RDBMS.
The value of each array element is an associative array with the following keys:
SCHEMA_NAME => string; name of schema TABLE_NAME => string; COLUMN_NAME => string; column name COLUMN_POSITION => number; ordinal position of column in table DATA_TYPE => string; SQL datatype name of column DEFAULT => string; default expression of column, null if none NULLABLE => boolean; true if column can have nulls LENGTH => number; length of CHAR/VARCHAR SCALE => number; scale of NUMERIC/DECIMAL PRECISION => number; precision of NUMERIC/DECIMAL UNSIGNED => boolean; unsigned property of an integer type PRIMARY => boolean; true if column is part of the primary key PRIMARY_POSITION => integer; position of column in primary key IDENTITY => integer; true if column is auto-generated with unique values
- Todo:
- Discover integer unsigned property.
- Parameters
-
string | $tableName | |
string | $schemaName | OPTIONAL |
- Returns
- array
Use FETCH_NUM so we are not dependent on the CASE attribute of the PDO connection
Oracle does not support auto-increment keys.
Definition at line 180 of file Oci.php.
184 $sql =
"SELECT TC.TABLE_NAME, TC.OWNER, TC.COLUMN_NAME, TC.DATA_TYPE, 185 TC.DATA_DEFAULT, TC.NULLABLE, TC.COLUMN_ID, TC.DATA_LENGTH, 186 TC.DATA_SCALE, TC.DATA_PRECISION, C.CONSTRAINT_TYPE, CC.POSITION 187 FROM ALL_TAB_COLUMNS TC 188 LEFT JOIN (ALL_CONS_COLUMNS CC JOIN ALL_CONSTRAINTS C 189 ON (CC.CONSTRAINT_NAME = C.CONSTRAINT_NAME AND CC.TABLE_NAME = C.TABLE_NAME AND CC.OWNER = C.OWNER AND C.CONSTRAINT_TYPE = 'P')) 190 ON TC.TABLE_NAME = CC.TABLE_NAME AND TC.COLUMN_NAME = CC.COLUMN_NAME 191 WHERE UPPER(TC.TABLE_NAME) = UPPER(:TBNAME)";
194 $sql .=
' AND UPPER(TC.OWNER) = UPPER(:SCNAME)';
195 $bind[
':SCNAME'] = $schemaName;
197 $sql .=
' ORDER BY TC.COLUMN_ID';
199 $subSql=
"SELECT AC.OWNER, AC.TABLE_NAME, ACC.COLUMN_NAME, AC.CONSTRAINT_TYPE, ACC.POSITION 200 from ALL_CONSTRAINTS AC, ALL_CONS_COLUMNS ACC 201 WHERE ACC.CONSTRAINT_NAME = AC.CONSTRAINT_NAME 202 AND ACC.TABLE_NAME = AC.TABLE_NAME 203 AND ACC.OWNER = AC.OWNER 204 AND AC.CONSTRAINT_TYPE = 'P' 205 AND UPPER(AC.TABLE_NAME) = UPPER(:TBNAME)";
208 $subSql .=
' AND UPPER(ACC.OWNER) = UPPER(:SCNAME)';
209 $bind[
':SCNAME'] = $schemaName;
211 $sql=
"SELECT TC.TABLE_NAME, TC.OWNER, TC.COLUMN_NAME, TC.DATA_TYPE, 212 TC.DATA_DEFAULT, TC.NULLABLE, TC.COLUMN_ID, TC.DATA_LENGTH, 213 TC.DATA_SCALE, TC.DATA_PRECISION, CC.CONSTRAINT_TYPE, CC.POSITION 214 FROM ALL_TAB_COLUMNS TC, ($subSql) CC 215 WHERE UPPER(TC.TABLE_NAME) = UPPER(:TBNAME) 216 AND TC.OWNER = CC.OWNER(+) AND TC.TABLE_NAME = CC.TABLE_NAME(+) AND TC.COLUMN_NAME = CC.COLUMN_NAME(+)";
218 $sql .=
' AND UPPER(TC.OWNER) = UPPER(:SCNAME)';
220 $sql .=
' ORDER BY TC.COLUMN_ID';
223 $stmt = $this->
query($sql, $bind);
240 $constraint_type = 10;
245 list ($primary, $primaryPosition, $identity) = array(
false,
null,
false);
246 if (
$row[$constraint_type] ==
'P') {
248 $primaryPosition =
$row[$position];
258 'COLUMN_POSITION' =>
$row[$column_id],
259 'DATA_TYPE' =>
$row[$data_type],
260 'DEFAULT' =>
$row[$data_default],
261 'NULLABLE' => (
bool) (
$row[$nullable] ==
'Y'),
262 'LENGTH' =>
$row[$data_length],
263 'SCALE' =>
$row[$data_scale],
264 'PRECISION' =>
$row[$data_precision],
266 'PRIMARY' => $primary,
267 'PRIMARY_POSITION' => $primaryPosition,
268 'IDENTITY' => $identity
query($sql, $bind=array())
lastInsertId |
( |
|
$tableName = null , |
|
|
|
$primaryKey = null |
|
) |
| |
Gets the last ID generated automatically by an IDENTITY/AUTOINCREMENT column.
As a convention, on RDBMS brands that support sequences (e.g. Oracle, PostgreSQL, DB2), this method forms the name of a sequence from the arguments and returns the last id generated by that sequence. On RDBMS brands that support IDENTITY/AUTOINCREMENT columns, this method returns the last value generated for such a column, and the table name argument is disregarded.
Oracle does not support IDENTITY columns, so if the sequence is not specified, this method returns null.
- Parameters
-
string | $tableName | OPTIONAL Name of table. |
string | $primaryKey | OPTIONAL Name of primary key column. |
- Returns
- string
- Exceptions
-
Definition at line 322 of file Oci.php.
327 $sequenceName .= $this->
foldCase(
"_$primaryKey");
329 $sequenceName .= $this->
foldCase(
'_seq');
lastSequenceId($sequenceName)