ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:database:pdo_new

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_new [2022/03/20 18:41] mnewnhamv5:database:pdo_new [2023/01/24 04:00] (current) mnewnham
Line 1: Line 1:
-====== PDO ======+====== PDO (new) ====== 
 +<WRAP important> 
 +This is still [[https://github.com/ADOdb/ADOdb/pull/826|under development]].  
 +Feedback is welcome, just add your comments in the pull request. 
 +</WRAP> 
 ~~NOTOC~~ ~~NOTOC~~
 <WRAP right box round 300px> <WRAP right box round 300px>
Line 14: Line 19:
 ===== Description ===== ===== Description =====
  
-This driver supports connections using the standardized [[http://php.net/manual/en/book.pdo.php|PHP Data Objects]].This page refers to ADOdb release 5.23.0 and higher. For previous versions of ADOdb, see the [[v5:database:pdo_old|Previous Version Of This Page]].+This driver supports connections using the standardized [[http://php.net/manual/en/book.pdo.php|PHP Data Objects]].This page refers to ADOdb release 5.23.0 and higher. For previous versions of ADOdb, see the [[v5:database:pdo|Previous Version Of This Page]].
  
 Except for the ''pdo_odbc'' driver, all PDO drivers include support for full data dictionary functions (e.g. ''createTableSql()'',''addIndexSql()'', etc.) Except for the ''pdo_odbc'' driver, all PDO drivers include support for full data dictionary functions (e.g. ''createTableSql()'',''addIndexSql()'', etc.)
 +-------------------------------------------------------
 +===== Quick Upgrade Notes ====
 +<WRAP info>
 +  * Instead of ''newAdoConnection('pdo')'', use ''newAdoConnection('pdo\driver')''
 +  * Passing a DSN statement to ''newAdoConnection()'' is no longer supported
 +  * Do not start the DSN statement with the driver name
 +
 +</WRAP>
 ------------------------------------------------------------- -------------------------------------------------------------
 ====Supported drivers==== ====Supported drivers====
Line 22: Line 35:
 ^PHP Driver^Description^ADOdb Connector^ ^PHP Driver^Description^ADOdb Connector^
 |pdo_firebird|Firebird|firebird| |pdo_firebird|Firebird|firebird|
-|pdo_ibm|IBM DB2|db2|+|pdo_ibm|IBM DB2|ibm|
 |pdo_informix|IBM Informix|informix| |pdo_informix|IBM Informix|informix|
 |pdo_mysql|MySQL|mysql| |pdo_mysql|MySQL|mysql|
 |pdo_oci|Oracle|oci| |pdo_oci|Oracle|oci|
-|pdo_odbc|Generic ODBC|odbc+|pdo_odbc|Generic ODBC|odbc|
 |pdo_pgsql|Postgresql|pgsql| |pdo_pgsql|Postgresql|pgsql|
 |pdo_sqlite|SQLite|sqlite| |pdo_sqlite|SQLite|sqlite|
-|pdo_sqlsrv|SQL Server using Windows Native Client|sqlsrv|+|pdo_sqlsrv|Microsoft SQL Server|sqlsrv|
  
 ====Unsupported Drivers==== ====Unsupported Drivers====
Line 117: Line 130:
  
   * This driver requires the installation of the IBM DB2 client   * This driver requires the installation of the IBM DB2 client
 +  * See the [[v5:database:ibm_db2|Preferred Driver]] page for more information about building DSNs for use with DB2 connections.
  
 ------------------------------------------------------- -------------------------------------------------------
Line 124: Line 138:
 $db   = ADOnewConnection('pdo\ibm'); $db   = ADOnewConnection('pdo\ibm');
  
-$dsn = 'hostname=192.168.86.141;protocol=tcpip;port=50000;';+$dsn = 'hostname=192.168.86.141;protocol=tcpip;port=25010;';
 $dsn.= 'database=SAMPLE;uid=db2inst1;pwd=somepassword'; $dsn.= 'database=SAMPLE;uid=db2inst1;pwd=somepassword';
 $user = ''; $user = '';
Line 140: Line 154:
   * There is no native mode driver for IBM Informix Connections   * There is no native mode driver for IBM Informix Connections
   * This driver requires the installation of the IBM Informix Client   * This driver requires the installation of the IBM Informix Client
 +  * Supports Informix Databases version 12+
  
 ------------------------------------------------------- -------------------------------------------------------
Line 156: Line 170:
 </code> </code>
 ------------------------------------------ ------------------------------------------
-==== pdo_mysql ====+==== MySQL ====
 <WRAP right box round 300px> <WRAP right box round 300px>
 == PDO Name == == PDO Name ==
Line 175: Line 189:
  
 $db->connect($dsn,$user,$password); $db->connect($dsn,$user,$password);
 +</code>
 +----------------------------------------------
 +==== ODBC====
 +<WRAP right box round 300px>
 +== PDO Name ==
 +**pdo_odbc**
 +</WRAP>
 +  * This is a simple driver for connection to any ODBC compliant database.
 +  * It is useful for reading and simple writes to data sources such as Microsoft Access, Excel and Google Sheets
 +  * There is no support for Data Dictionary functions or database specific items such as sequences. 
 +
 +-------------------------------------------------------
 +=== Sample Connection String ===
 +<code php>
 +include 'adodb-dir/adodb.inc.php';
 +$db   = ADOnewConnection('pdo\odbc');
 +
 +/*
 +* Points directly at the DSN configuration in Windows Control Panel
 +*/
 +$dsn  = 'MYDSN'
 +
 +$db->connect($dsn);
 </code> </code>
 ---------------------------------------------- ----------------------------------------------
Line 232: Line 269:
  
 ----------------------------------------------- -----------------------------------------------
-==== pdo_sqlite ====+==== SQLite ====
 <WRAP right box round 300px> <WRAP right box round 300px>
 +== PDO Name ==
 +**pdo_sqlite**
 == Preferred Driver == == Preferred Driver ==
 [[v5:database:sqlite]]\\ [[v5:database:sqlite]]\\
-== Specification == 
-^Driver Name|pdo| 
-^Data Provider|pdo| 
-^Status|Active((This driver is supported by ADOdb project members))| 
-^Windows|Yes| 
-^Unix|No| 
-^ADOdb V5|Yes| 
-^ADOdb V6|Yes| 
 </WRAP> </WRAP>
 ---------------------------------------------------------------- ----------------------------------------------------------------
Line 249: Line 280:
 <code php> <code php>
 include 'adodb-dir/adodb.inc.php'; include 'adodb-dir/adodb.inc.php';
-$db = ADOnewConnection('pdo');+$db = ADOnewConnection('pdo\sqlite');
  
-$dsn  = 'sqlite:/home/sqlite/adodb-sqlite.db';+$dsn  = '/home/sqlite/adodb-sqlite.db';
 $user = 'root'; $user = 'root';
  
Line 259: Line 290:
 ------------------------------------------------- -------------------------------------------------
  
-==== pdo_sqlsrv ====+==== SQL Server ====
 <WRAP right box round 300px> <WRAP right box round 300px>
 +== PDO Name ==
 +**pdo_sqlsrv**
 == Preferred Driver == == Preferred Driver ==
 [[v5:database:microsoft_sql_server#mssqlnative|Native Mode Driver]]\\ [[v5:database:microsoft_sql_server#mssqlnative|Native Mode Driver]]\\
-== Specification == 
-^Driver Name|pdo| 
-^Data Provider|pdo| 
-^Status|Active((This driver is supported by ADOdb project members))| 
-^Windows|Yes| 
-^Unix|Yes| 
-^ADOdb V5|Yes| 
-^ADOdb V6|Yes| 
- 
  
 </WRAP> </WRAP>
   * This driver requires the installation of the Microsoft native client library, as well as the [[https://www.microsoft.com/en-us/download/details.aspx?id=20098|Microsoft SQL Server PDO drivers for PHP]]   * This driver requires the installation of the Microsoft native client library, as well as the [[https://www.microsoft.com/en-us/download/details.aspx?id=20098|Microsoft SQL Server PDO drivers for PHP]]
   * Dates are always returned as strings   * Dates are always returned as strings
-  * Most //**Meta**// functions are unsupported 
-  * [[v5:reference:connection:setconnectionparameter|setConnectionParameter()]] is not supported 
   * This driver can also be used on Linux platforms, beginning with PHP Version 7. The program relies on the Microsoft drivers for Linux. For more information, see the [[v5:database:microsoft_sql_server|mssqlnative driver]]   * This driver can also be used on Linux platforms, beginning with PHP Version 7. The program relies on the Microsoft drivers for Linux. For more information, see the [[v5:database:microsoft_sql_server|mssqlnative driver]]
   * You cannot change the character set in the driver. This is a limitation of the PDO driver, not ADOdb   * You cannot change the character set in the driver. This is a limitation of the PDO driver, not ADOdb
-  * No support for parameter binding 
  
 ---------------------------------------------------------------------------- ----------------------------------------------------------------------------
Line 287: Line 308:
 <code php> <code php>
 include 'adodb-dir/adodb.inc.php'; include 'adodb-dir/adodb.inc.php';
-$db = ADOnewConnection('pdo');+$db = ADOnewConnection('pdo\sqlsrv');
  
 $user = 'user'; $user = 'user';
 $pass = 'password'; $pass = 'password';
-$dsn  ='sqlsrv:server=SERVER\SQLEXPRESS;database=NORTHWND;';+$dsn  ='server=SERVER\SQLEXPRESS;database=NORTHWND;';
  
 $db->connect($dsn,$user,$password); $db->connect($dsn,$user,$password);
v5/database/pdo_new.1647798115.txt.gz · Last modified: 2022/03/20 18:41 by mnewnham