PDO::getAttribute

(no version information, might be only in CVS)

PDO::getAttribute --  Retrieve a database connection attribute

Opis

mixed PDO::getAttribute ( long attribute )

Ostrzeżenie

Ta funkcja jest w stadium EKSPERYMENTALNYM. Oznacza to, że zachowanie funkcji, jej nazwa, w zasadzie wszystko udokumentowane tutaj może zostać zmienione w przyszłych wersjach PHP bez wcześniejszego uprzedzenia. Używaj tej funkcji na własne ryzyko.

This function returns the value of a database connection attribute. To retrieve PDOStatement attributes, refer to PDOStatement::getAttribute().

Note that some databases may not support all of the database connection attributes.

Parametry

attribute

One of the PDO_ATTR_* constants. The constants that apply to database connections are as follows:

PDO_ATTR_AUTOCOMMIT
PDO_ATTR_CASE
PDO_ATTR_CLIENT_VERSION
PDO_ATTR_CONNECTION_STATUS
PDO_ATTR_ERRMODE
PDO_ATTR_ORACLE_NULLS
PDO_ATTR_PERSISTENT
PDO_ATTR_PREFETCH
PDO_ATTR_SERVER_INFO
PDO_ATTR_SERVER_VERSION
PDO_ATTR_TIMEOUT

Zwracane wartości

A successful call returns the value of the requested PDO attribute. An unsuccessful call returns null.

Przykłady

Przykład 1. Retrieving database connection attributes

<?php
$conn
= new PDO('odbc:sample', 'db2inst1', 'ibmdb2');

print
"\nPDO_ATTR_AUTOCOMMIT: ";
print
$conn->getAttribute(PDO_ATTR_AUTOCOMMIT);

print
"\nPDO_ATTR_ERRMODE: ";
print
$conn->getAttribute(PDO_ATTR_ERRMODE);

print
"\nPDO_ATTR_CASE: ";
print
$conn->getAttribute(PDO_ATTR_CASE);

print
"\nPDO_ATTR_CLIENT_VERSION: ";
print
$conn->getAttribute(PDO_ATTR_CLIENT_VERSION);

print
"\nPDO_ATTR_CONNECTION_STATUS: ";
print
$conn->getAttribute(PDO_ATTR_CONNECTION_STATUS);

print
"\nPDO_ATTR_ORACLE_NULLS: ";
print
$conn->getAttribute(PDO_ATTR_ORACLE_NULLS);

print
"\nPDO_ATTR_PERSISTENT: ";
print
$conn->getAttribute(PDO_ATTR_PERSISTENT);

print
"\nPDO_ATTR_PREFETCH: ";
print
$conn->getAttribute(PDO_ATTR_PREFETCH);

print
"\nPDO_ATTR_SERVER_INFO: ";
print
$conn->getAttribute(PDO_ATTR_SERVER_INFO);

print
"\nPDO_ATTR_SERVER_VERSION: ";
print
$conn->getAttribute(PDO_ATTR_SERVER_VERSION);

print
"\nPDO_ATTR_TIMEOUT: ";
print
$conn->getAttribute(PDO_ATTR_TIMEOUT);
?>

Patrz także

PDO::setAttribute()
PDOStatement::getAttribute()
PDOStatement::setAttribute()

Hosting by: Hurra Communications Sp. z o.o.
Generated: 2007-01-26 18:02:53