v5:database:mysql
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
database:mysql [2015/09/14 03:23] – mnewnham | v5:database:mysql [2024/04/30 13:07] (current) – Forcing emulated prepared statements dregad | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== MySQL ===== | ====== MySQL ===== | ||
- | Read the [[userguide: | + | ~~NOTOC~~ |
- | ====== mysqli driver | + | ===== mysqli driver ===== |
- | < | + | |
- | ** This is the preferred driver to connections to MySQL databases. ** | + | < |
- | |Driver Name|mysqli| | + | |
- | |Status|Active| | + | == Specification == |
- | |Windows|Yes| | + | ^Driver Name|mysqli| |
- | |Unix|Yes| | + | ^Data Provider|[[v5: |
+ | ^Status|Active((This driver is actively supported by ADOdb project members))| | ||
+ | ^Windows|Yes| | ||
+ | ^Unix|Yes| | ||
+ | ^ADOdb V5|Yes| | ||
+ | ^ADOdb V6|Yes| | ||
+ | |||
+ | == Alternatives == | ||
+ | [[v5: | ||
+ | |||
+ | == See Also == | ||
+ | [[v5: | ||
</ | </ | ||
- | This preferred driver uses the PHP mysqli interface and supports all MySQL table types, with full support for transactions and rollback when the MySQL table type supports it. | ||
- | ---------------------------------------------- | + | ** This is the preferred driver for connections to the following databases: |
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
- | ====== mysql driver | + | This driver |
- | <WRAP left 300px box> | + | |
- | |Driver Name|mysql| | + | It replaces [[v5: |
- | |Status|Deprecated| | + | |
- | |Windows|Yes| | + | <WRAP important> |
- | |Unix|Yes| | + | Starting with ADOdb 5.22, the mysqli driver requires the [[https:// |
</ | </ | ||
- | This driver uses the PHP original mysql driver and only provides support to non-transactional tables such as MyIsam. It cannot be used with the PHP ' | ||
- | -------------------------------------------- | ||
- | ====== mysqlt driver ====== | ||
- | <WRAP left 300px box> | ||
- | |Driver Name|mysqlt| | ||
- | |Status|Deprecated| | ||
- | |Windows|Yes| | ||
- | |Unix|Yes| | ||
- | </ | ||
- | This driver uses the PHP original mysql driver and provided support to transactional tables such as InnoDB. It cannot be used with the PHP ' | ||
- | -------------------------------- | ||
- | ====== mysqlpo driver ====== | ||
- | <WRAP left 300px box> | ||
- | |Driver Name|mysqlpo| | ||
- | |Status|Obsolete| | ||
- | |Windows|Yes| | ||
- | |Unix|Yes| | ||
- | </ | ||
- | This driver duplicates the functionality of the mysqlt driver and is not maintained. It will be removed in ADOdb version 6.0 | ||
- | {{tag> | + | |
+ | ------------------------------------------- | ||
+ | |||
+ | ===== Driver Specific Issues ===== | ||
+ | ==== renameColumnSql ==== | ||
+ | The method [[v5: | ||
+ | '' | ||
+ | ==== Usage ==== | ||
+ | <code php> | ||
+ | /* | ||
+ | * We are going to rename a column from col9 to col6. | ||
+ | */ | ||
+ | $flds = 'col6 C(50) NOTNULL DEFAULT " | ||
+ | |||
+ | # Then create a data dictionary object, using this connection | ||
+ | $dict = NewDataDictionary($db); | ||
+ | |||
+ | $sql = $dict-> | ||
+ | </ | ||
+ | ==== Connecting With SSL ==== | ||
+ | From ADOdb version 5.21, you can make an SSL connection to MySQL in the following way: | ||
+ | |||
+ | <code php> | ||
+ | /* | ||
+ | * Enable ADOdb | ||
+ | */ | ||
+ | $db = newAdoConnection(' | ||
+ | /* | ||
+ | * Set the SSL parameters | ||
+ | */ | ||
+ | $db-> | ||
+ | $db-> | ||
+ | $db-> | ||
+ | $db-> | ||
+ | $db-> | ||
+ | |||
+ | /* | ||
+ | * Open the connection | ||
+ | */ | ||
+ | $db-> | ||
+ | </ | ||
+ | |||
+ | ==== Connecting To A Microsoft Azure MySQL Instance ==== | ||
+ | <code php> | ||
+ | /* | ||
+ | * Enable ADOdb | ||
+ | */ | ||
+ | $db = newAdoConnection(' | ||
+ | |||
+ | $database = ' | ||
+ | $host = ' | ||
+ | $user = ' | ||
+ | $password = ' | ||
+ | |||
+ | $db-> | ||
+ | |||
+ | /* | ||
+ | * Open the connection | ||
+ | */ | ||
+ | $db-> | ||
+ | </ | ||
+ | |||
+ | ==== Forcing emulated prepared statements ==== | ||
+ | |||
+ | ADOdb 5.22 introduced support for " | ||
+ | [[https:// | ||
+ | see [[https:// | ||
+ | Before that, parameterized queries were emulated, which was a potential security risk. | ||
+ | |||
+ | When using database engines pretending to be MySQL but not implementing prepared statements such as | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | it is possible((starting with ADOdb 5.22.8)) to force usage of emulated queries (i.e. reverting to behavior of ADOdb 5.21 and older) by setting the '' | ||
+ | |||
+ | <code php> | ||
+ | $db = newAdoConnection(' | ||
+ | $db-> | ||
+ | $db-> | ||
+ | $db-> | ||
+ | </ | ||
+ | |||
+ | {{tag> | ||
+ | {{htmlmetatags> |
v5/database/mysql.txt · Last modified: 2024/04/30 13:07 by dregad