ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:database:pdo

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
v5:database:pdo [2020/12/06 20:02] – [The PDO setAttribute function] mnewnhamv5:database:pdo [2022/02/20 23:47] (current) – [Setting Construction Parameters] mnewnham
Line 3: Line 3:
  
 ===== Description ===== ===== Description =====
-This driver supports connections using the standardized [[http://php.net/manual/en/book.pdo.php|PHP Data Objects]] connectionThe ''pdo'' driver itself cannot be used, it must be used with one of the supported drivers:+ 
 +This driver supports connections using the standardized [[http://php.net/manual/en/book.pdo.php|PHP Data Objects]].  
 + 
 +Supported drivers:
  
 ^PHP Driver^Description^ADOdb Connector^ ^PHP Driver^Description^ADOdb Connector^
Line 14: Line 17:
 |pdo_sqlsrv|SQL Server using Windows Native Client|sqlsrv| |pdo_sqlsrv|SQL Server using Windows Native Client|sqlsrv|
    
 +<WRAP important>
 +Note that the //pdo// driver cannot be used on its own. It is a technical component that is used internally by the above drivers. 
 +</WRAP>
 +
 +
 ===== Establishing A Connection ===== ===== Establishing A Connection =====
 To establish a connection, the **//DSN//** style of connection must be used, the first argument of the DSN string being the database type, e.g. to connect to a MySQL database: To establish a connection, the **//DSN//** style of connection must be used, the first argument of the DSN string being the database type, e.g. to connect to a MySQL database:
Line 39: Line 47:
  
 ===== Setting Construction Parameters ===== ===== Setting Construction Parameters =====
-Certain attributes need to be passed to the [[https://www.php.net/manual/en/pdo.construct.php|PDO Constructor]], for example, changing the error mode. To facilitate this, a PDO specific settable array **'' ADOConnection::pdoOptions ''** is provided:+Certain attributes need to be passed to the [[https://www.php.net/manual/en/pdo.construct.php|PDO Constructor]], for example, changing the error mode. To facilitate this, a PDO specific settable array **'' ADOConnection::pdoParameters ''** is provided:
  
 <code php> <code php>
 $db = newAdoConnection('pdo'); $db = newAdoConnection('pdo');
  
-$db->pdoOptions = [+$db->pdoParameters = [
 \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION
 ]; ];
Line 239: Line 247:
  
 ==== pdo_firebird ==== ==== pdo_firebird ====
-<WRAP info> 
-This driver is available from version 5.21 
-</WRAP> 
 <WRAP right box round 300px> <WRAP right box round 300px>
 == Native Driver == == Native Driver ==
v5/database/pdo.1607281361.txt.gz · Last modified: 2020/12/06 20:02 by mnewnham