|
| isConnected () |
|
| closeConnection () |
|
| setLobAsString ($lobAsString) |
|
| getLobAsString () |
|
| prepare ($sql) |
|
| quoteTableAs ($ident, $alias=null, $auto=false) |
|
| lastSequenceId ($sequenceName) |
|
| nextSequenceId ($sequenceName) |
|
| lastInsertId ($tableName=null, $primaryKey=null) |
|
| listTables () |
|
| describeTable ($tableName, $schemaName=null) |
|
| setFetchMode ($mode) |
|
| limit ($sql, $count, $offset=0) |
|
| _getExecuteMode () |
|
| 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 40 of file Oracle.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 355 of file Oracle.php.
359 $sql =
"SELECT TC.TABLE_NAME, TC.OWNER, TC.COLUMN_NAME, TC.DATA_TYPE, 360 TC.DATA_DEFAULT, TC.NULLABLE, TC.COLUMN_ID, TC.DATA_LENGTH, 361 TC.DATA_SCALE, TC.DATA_PRECISION, C.CONSTRAINT_TYPE, CC.POSITION 362 FROM ALL_TAB_COLUMNS TC 363 LEFT JOIN (ALL_CONS_COLUMNS CC JOIN ALL_CONSTRAINTS C 364 ON (CC.CONSTRAINT_NAME = C.CONSTRAINT_NAME AND CC.TABLE_NAME = C.TABLE_NAME AND CC.OWNER = C.OWNER AND C.CONSTRAINT_TYPE = 'P')) 365 ON TC.TABLE_NAME = CC.TABLE_NAME AND TC.COLUMN_NAME = CC.COLUMN_NAME 366 WHERE UPPER(TC.TABLE_NAME) = UPPER(:TBNAME)";
369 $sql .=
' AND UPPER(TC.OWNER) = UPPER(:SCNAME)';
370 $bind[
':SCNAME'] = $schemaName;
372 $sql .=
' ORDER BY TC.COLUMN_ID';
374 $subSql=
"SELECT AC.OWNER, AC.TABLE_NAME, ACC.COLUMN_NAME, AC.CONSTRAINT_TYPE, ACC.POSITION 375 from ALL_CONSTRAINTS AC, ALL_CONS_COLUMNS ACC 376 WHERE ACC.CONSTRAINT_NAME = AC.CONSTRAINT_NAME 377 AND ACC.TABLE_NAME = AC.TABLE_NAME 378 AND ACC.OWNER = AC.OWNER 379 AND AC.CONSTRAINT_TYPE = 'P' 380 AND UPPER(AC.TABLE_NAME) = UPPER(:TBNAME)";
383 $subSql .=
' AND UPPER(ACC.OWNER) = UPPER(:SCNAME)';
384 $bind[
':SCNAME'] = $schemaName;
386 $sql=
"SELECT TC.TABLE_NAME, TC.OWNER, TC.COLUMN_NAME, TC.DATA_TYPE, 387 TC.DATA_DEFAULT, TC.NULLABLE, TC.COLUMN_ID, TC.DATA_LENGTH, 388 TC.DATA_SCALE, TC.DATA_PRECISION, CC.CONSTRAINT_TYPE, CC.POSITION 389 FROM ALL_TAB_COLUMNS TC, ($subSql) CC 390 WHERE UPPER(TC.TABLE_NAME) = UPPER(:TBNAME) 391 AND TC.OWNER = CC.OWNER(+) AND TC.TABLE_NAME = CC.TABLE_NAME(+) AND TC.COLUMN_NAME = CC.COLUMN_NAME(+)";
393 $sql .=
' AND UPPER(TC.OWNER) = UPPER(:SCNAME)';
395 $sql .=
' ORDER BY TC.COLUMN_ID';
398 $stmt = $this->
query($sql, $bind);
415 $constraint_type = 10;
420 list ($primary, $primaryPosition, $identity) = array(
false,
null,
false);
421 if (
$row[$constraint_type] ==
'P') {
423 $primaryPosition =
$row[$position];
433 'COLUMN_POSITION' =>
$row[$column_id],
434 'DATA_TYPE' =>
$row[$data_type],
435 'DEFAULT' =>
$row[$data_default],
436 'NULLABLE' => (
bool) (
$row[$nullable] ==
'Y'),
437 'LENGTH' =>
$row[$data_length],
438 'SCALE' =>
$row[$data_scale],
439 'PRECISION' =>
$row[$data_precision],
441 'PRIMARY' => $primary,
442 'PRIMARY_POSITION' => $primaryPosition,
443 '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
Definition at line 298 of file Oracle.php.
303 $sequenceName .=
"_$primaryKey";
305 $sequenceName .=
'_seq';
lastSequenceId($sequenceName)