MySQL
mysqli driver
This driver is located at \ADOdb\database\drivers\mysqli\ADOConnection.php
** This is the preferred driver for connections to the following databases:**
This driver uses the PHP mysqli interface and supports all table types, with full support for transactions and rollback when the table type supports it.
OEM Flags
OEM Flags for this driver can be retrieved from ADOdb\database\drivers\mysqli\ADOOemFlags.php
final class ADOOemFlags { /* * Allows an SSL Based connection */ public $ssl = array( 'ssl_key'=>null, 'ssl_cert'=>null, 'ssl_ca' => null, 'ssl_capath' => null, 'ssl_cipher' => null ); /* * Change the port number */ public int $port = 3306; /* * Change the socket */ public $socket = null; /* * For real_connect flags, e.g. MYSQLI_CLIENT_COMPRESS */ public int $flags = 0; /* * mysqli_option settings, e.g. MYSQLI_SERVER_PUBLIC_KEY * use Key=>Value */ public array $options = array(MYSQLI_READ_DEFAULT_GROUP=>0); /* * Enable multiquery. beware of sql injections */ public bool $multiQuery = false; }
Connecting With SSL
To make an SSL connection to MySQL, you need to push the SSL configuration into the driver in the following way:
/* * Retrieve an OEM class to modify */ $oemFlagsClass = new ADOdb\database\drivers\mysqli\ADOOemFlags; /* * Set the SSL parameters */ $oemFlagsClass->ssl['ssl_key'] = "key.pem"; $oemFlagsClass->ssl['ssl_cert'] = "cert.pem"; $oemFlagsClass->ssl['ssl_ca'] = "cacert.pem"; $oemFlagsClass->ssl['ssl_capath'] = null; $oemFlagsClass->ssl['ssl_cipher'] = null; /* * Create a standard connection */ $acd = new ADOdb\ADOConnectionDefinitions; $acd->driver = 'mysqli'; /* * Push the oem flags into the connection definition */ $acd->oemFlags = $oemFlagsClass; $obj = new ADOdb\connector($acd); /* * Open the connection */ $db = $obj->connect('127.0.0.1',"adodb","adodb",'employees');
Driver Specific Issues
renameColumnSql
The method renameColumnSql normally takes 3 parameters, $tableName,
$oldColumnName and $newColumnName. When used with the mysql provider, a full definition of the column must be provided, as if creating the column new
Usage
/* * We are going to rename a column from col9 to col6. */ $flds = 'col6 C(50) NOTNULL DEFAULT "BILL"'; # Then create a data dictionary object, using this connection $dict = NewDataDictionary($db); $sql = $dict->renameColumnSql($table,'col9','col6', $flds);
