|
| setTransactionIsolationLevel ($level=null) |
|
| isConnected () |
|
| closeConnection () |
|
| prepare ($sql) |
|
| lastInsertId ($tableName=null, $primaryKey=null) |
|
| insert ($table, array $bind) |
|
| listTables () |
|
| describeTable ($tableName, $schemaName=null) |
|
| setFetchMode ($mode) |
|
| limit ($sql, $count, $offset=0) |
|
| 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 Sqlsrv.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
Discover metadata information about this table.
Discover primary key column(s) for this table.
Definition at line 433 of file Sqlsrv.php.
439 $stmt = $this->
query($sql);
443 $stmt->closeCursor();
458 $column_position = 16;
463 $tableOwner =
$result[0][$owner];
464 $sql =
"exec sp_pkeys @table_owner = " . $tableOwner
466 $stmt = $this->
query($sql);
469 $primaryKeyColumn = array();
475 $pkey_column_name = 3;
477 foreach ($primaryKeysResult as $pkeysRow) {
478 $primaryKeyColumn[$pkeysRow[$pkey_column_name]] = $pkeysRow[$pkey_key_seq];
485 $words = explode(
' ',
$row[$type_name], 2);
486 if (isset($words[0])) {
488 if (isset($words[1])) {
489 $identity = (bool) preg_match(
'/identity/', $words[1]);
493 $isPrimary = array_key_exists(
$row[$column_name], $primaryKeyColumn);
495 $primaryPosition = $primaryKeyColumn[
$row[$column_name]];
497 $primaryPosition =
null;
501 'SCHEMA_NAME' =>
null,
504 'COLUMN_POSITION' => (
int)
$row[$column_position],
505 'DATA_TYPE' =>
$type,
506 'DEFAULT' =>
$row[$column_def],
507 'NULLABLE' => (
bool)
$row[$nullable],
508 'LENGTH' =>
$row[$length],
509 'SCALE' =>
$row[$scale],
510 'PRECISION' =>
$row[$precision],
512 'PRIMARY' => $isPrimary,
513 'PRIMARY_POSITION' => $primaryPosition,
514 'IDENTITY' => $identity,
query($sql, $bind=array())
quoteIdentifier($ident, $auto=false)