====== MySQL ===== ~~NOTOC~~ ===== mysqli driver ===== This driver is located at ''\ADOdb\database\drivers\mysqli\ADOConnection.php'' == Specification == ^Driver Name|mysqli| ^Data Provider|[[v6:userguide:learn_extensions:new_driver#Understanding The Data Provider|mysql]]| ^Status|Active((This driver is actively supported by ADOdb project members))| ^Windows|Yes| ^Unix|Yes| ^DSN Support|No| ** This is the preferred driver for connections to the following databases:** * [[http://mysql.com|MySQL]] * [[http://mariadb.com|MariaDB]] * [[http://percona.com|Percona]] 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 [[v6:dictionary:renamecolumnsql|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); {{tag>MySQL windows unix supported tier1 v6}} {{htmlmetatags>metatag-keywords=(php, programming, database, mysql, percona, mariadb)}}