ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v6: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
v6:database:pdo [2026/08/31 11:42] – [PDO] mnewnhamv6:database:pdo [2026/08/31 11:56] (current) – [Preferred Drivers] mnewnham
Line 1: Line 1:
 ====== PDO ====== ====== PDO ======
 ~~NOTOC~~ ~~NOTOC~~
-<WRAP> +<WRAP important> 
-There is a breaking change in the feature from V5+There is a breaking change in the feature from V5. The connection string has changed
 </WRAP> </WRAP>
 ===== Description ===== ===== Description =====
 This driver supports connections using the standardized [[http://php.net/manual/en/book.pdo.php|PHP Data Objects]] connection. The ''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]] connection. The ''pdo'' driver itself cannot be used, it must be used with one of the supported drivers:
  
-^PHP Driver^Description^ADOdb Connector^ +^ PHP Driver    ^ Description                             ^ ADOdb Connector  ^ 
-|pdo_firebird|Firebird|firebird| +| pdo_firebird  | Firebird                                | pdo\firebird     | 
-|pdo_mssql|SQL Server with FREETDS|mssql| +| pdo_ibm       | IBM DB2                                 | pdo\ibm          | 
-|pdo_mysql|MySQL|mysql| +| pdo_mysql     | MySQL                                   | pdo\mysql        | 
-|pdo_oci|Oracle|oci| +| pdo_oci       | Oracle                                  | pdo\oci          | 
-|pdo_pgsql|Postgresql|pgsql| +| pdo_pgsql     | Postgresql                              | pdo\pgsql        | 
-|pdo_sqlite|SQLite|sqlite| +| pdo_sqlite    | SQLite                                  | pdo\sqlite       | 
-|pdo_sqlsrv|SQL Server using Windows Native Client|sqlsrv|+| pdo_sqlsrv    | SQL Server using Windows Native Client  | pdo\sqlsrv       |
    
 ===== Establishing A Connection ===== ===== Establishing A Connection =====
Line 20: Line 20:
 <code php> <code php>
 include_once 'adodb/adodb.inc.php'; include_once 'adodb/adodb.inc.php';
-$db = ADOnewConnection('pdo');+$db = ADOnewConnection('pdo\mysql');
  
 $user     = 'pdo-user'; $user     = 'pdo-user';
 $password = 'pdo-pass'; $password = 'pdo-pass';
 $dsnString= 'host=localhost;dbname=employees;charset=utf8mb4'; $dsnString= 'host=localhost;dbname=employees;charset=utf8mb4';
-$db->connect('mysql:' . $dsnString,$user,$password);+$db->connect($dsnString,$user,$password);
  
 </code> </code>
Line 32: Line 32:
  
  
-===== Preferred Drivers ===== 
  
-Using ADOdb effectively eliminates the need to use the PHP PDO driver as it hides the PHP level command: 
- 
-  * It provides true database abstraction, for example, the ADOdb method ''selectLimit()'' provides a true abstraction of the row limiting and offset of all databases. With PDO, you still need to provide the database specific syntax. 
-  * In all cases, using native drivers (listed below) provide better functionality, as well as performance, than the equivalent PDO driver. This is true at both the ADOdb and PHP level 
 ===== The PDO setAttribute function ===== ===== The PDO setAttribute function =====
-As of ADOdb 5.21, the PDO::setAttribute() method can be emulated using [[v6:reference:connection:setconnectionparameter|setConnectionParameter()]].+The PDO::setAttribute() method can be emulated using [[v6:reference:connection:setconnectionparameter|setConnectionParameter()]]. 
 +===== Driver Functionality ===== 
 +Each supported driver offers the same functionality as the native mode one, unless specifically noted below 
 ===== Individual Driver Status ==== ===== Individual Driver Status ====
 ----------------------- -----------------------
v6/database/pdo.1788201741.txt.gz · Last modified: by mnewnham