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
Next revisionBoth sides next revision
v5:database:pdo [2019/01/06 04:12] mnewnhamv5:database:pdo [2019/12/28 19:24] – [pdo_sqlsrv] mnewnham
Line 1: Line 1:
 ====== PDO ====== ====== PDO ======
 ~~NOTOC~~ ~~NOTOC~~
-<WRAP right box> 
-== See Also == 
-[[http://wiki.hashphp.org/PDO_Tutorial_for_MySQL_Developers|Tutorial On PDO Connections]] 
-</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:
Line 25: Line 21:
 $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('mysql:' . $dsnString,$user,$password);
  
Line 68: Line 64:
 ^ADOdb V6|Yes| ^ADOdb V6|Yes|
 </WRAP> </WRAP>
 +
   * Some **//Meta//** functions are unavailable   * Some **//Meta//** functions are unavailable
 +
 +
 ------------------------------------------------------- -------------------------------------------------------
-==== Sample Connection String ====+=== Sample Connection String ===
 <code php> <code php>
 include 'adodb-dir/adodb.inc.php'; include 'adodb-dir/adodb.inc.php';
Line 89: Line 88:
 ^Driver Name|pdo| ^Driver Name|pdo|
 ^Data Provider|pdo| ^Data Provider|pdo|
-^Status|Inactive((This driver is not supported by ADOdb project members, but you can contribute to this driver if you have the expertise))|+^Status|Active((This driver is supported by ADOdb project members))|
 ^Windows|Yes| ^Windows|Yes|
-^Unix|No|+^Unix|Yes|
 ^ADOdb V5|Yes| ^ADOdb V5|Yes|
 ^ADOdb V6|Yes| ^ADOdb V6|Yes|
 </WRAP> </WRAP>
-The current status of this driver is unknown+== Limitations == 
 + 
 + 
 +  * There is no support for the complex binding features available in the Native Driver 
 +  * Some MetaFunctions are unavailable 
 + 
 +---------------------------------------- 
 +=== Sample Connection String === 
 +If you are using the instantclient, and there is no tsnames.ora defined, you can define a connection like this 
 +<code php> 
 + 
 +//Connecting to Oracle Express on 192.168.86.86 
 +$tns = "  
 +(DESCRIPTION = 
 +    (ADDRESS_LIST = 
 +      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.86.86)(PORT = 1521)) 
 +    ) 
 +    (CONNECT_DATA = 
 +      (SERVICE_NAME = XEPDB1) 
 +    ) 
 +  ) 
 +"; 
 +$dsnString="oci:dbname=$tns"; 
 +$db->connect($dsnString,$userName,$password); 
 + 
 +</code>
 ------------------------------------------ ------------------------------------------
 ==== pdo_pgsql ==== ==== pdo_pgsql ====
Line 110: Line 134:
 ^ADOdb V6|Yes| ^ADOdb V6|Yes|
 </WRAP> </WRAP>
-===== Status =====+=== Status ===
 Some features are not supported Some features are not supported
 --------------------------------------------------------------- ---------------------------------------------------------------
-===== Sample Connection String =====+=== Sample Connection String ===
 <code php> <code php>
 $db = newAdoConnection('pdo'); $db = newAdoConnection('pdo');
Line 139: Line 163:
 </WRAP> </WRAP>
 ---------------------------------------------------------------- ----------------------------------------------------------------
-==== Sample Connection String ====+=== Sample Connection String ===
 <code php> <code php>
 include 'adodb-dir/adodb.inc.php'; include 'adodb-dir/adodb.inc.php';
Line 149: Line 173:
 $db->connect($dsn,$user); $db->connect($dsn,$user);
 </code> </code>
----------------------------------------+ 
 +------------------------------------------------- 
 ==== pdo_sqlsrv ==== ==== pdo_sqlsrv ====
 <WRAP right box round 300px> <WRAP right box round 300px>
Line 168: Line 194:
   * Dates are always returned as strings   * Dates are always returned as strings
   * Most //**Meta**// functions are unsupported   * Most //**Meta**// functions are unsupported
-  * [[v5:reference:connection:setconnectionparameter|setConnectionParameter()]] is not supported, so changing the character set at run-time is not available.+  * [[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
 +  * No support for parameter binding
  
 ---------------------------------------------------------------------------- ----------------------------------------------------------------------------
  
-==== Sample Connection String ====+=== Sample Connection String ===
 <code php> <code php>
 include 'adodb-dir/adodb.inc.php'; include 'adodb-dir/adodb.inc.php';
Line 206: Line 234:
  
 ------------------------------------------------------------ ------------------------------------------------------------
-==== Sample Connection String ====+=== Sample Connection String === 
 <code php> <code php>
 include 'adodb-dir/adodb.inc.php'; include 'adodb-dir/adodb.inc.php';
v5/database/pdo.txt · Last modified: 2022/02/20 23:47 by mnewnham