diff options
| author | Mark Newnham <mark@newnhams.com> | 2016-01-03 09:29:06 -0700 |
|---|---|---|
| committer | Damien Regad <dregad@mantisbt.org> | 2016-01-05 14:44:55 +0100 |
| commit | 68a36e661b5594d245d31d1439fcf5a09f8380d5 (patch) | |
| tree | bf44928de9bec694f0edf43cb83c3ab10a26a087 | |
| parent | fd55fe5aeff9b7e0020f802b7020e7773dae1def (diff) | |
| download | adodb-68a36e661b5594d245d31d1439fcf5a09f8380d5.tar.gz adodb-68a36e661b5594d245d31d1439fcf5a09f8380d5.tar.bz2 adodb-68a36e661b5594d245d31d1439fcf5a09f8380d5.zip | |
mysqli: method failed if $associative set true
Passing the associative flag attempted to control both how the data was
retrieved from the database and how it was returned from the method.
This caused inconsistencies due to the number of different combinations
available. Flag now only controls presentation of data, retrieval is
always done in same way.
Fixes #181
| -rw-r--r-- | drivers/adodb-mysqli.inc.php | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/adodb-mysqli.inc.php b/drivers/adodb-mysqli.inc.php index 679a0c45..c9c8455f 100644 --- a/drivers/adodb-mysqli.inc.php +++ b/drivers/adodb-mysqli.inc.php @@ -581,17 +581,25 @@ class ADODB_mysqli extends ADOConnection { // "Innox - Juan Carlos Gonzalez" <jgonzalez#innox.com.mx> function MetaForeignKeys( $table, $owner = FALSE, $upper = FALSE, $associative = FALSE ) { - global $ADODB_FETCH_MODE; + + global $ADODB_FETCH_MODE; - if ($ADODB_FETCH_MODE == ADODB_FETCH_ASSOC || $this->fetchMode == ADODB_FETCH_ASSOC) $associative = true; + if ($ADODB_FETCH_MODE == ADODB_FETCH_ASSOC + || $this->fetchMode == ADODB_FETCH_ASSOC) + $associative = true; + $savem = $ADODB_FETCH_MODE; + $this->setFetchMode(ADODB_FETCH_ASSOC); + if ( !empty($owner) ) { $table = "$owner.$table"; } + $a_create_table = $this->getRow(sprintf('SHOW CREATE TABLE %s', $table)); - if ($associative) { - $create_sql = isset($a_create_table["Create Table"]) ? $a_create_table["Create Table"] : $a_create_table["Create View"]; - } else $create_sql = $a_create_table[1]; + + $this->setFetchMode($savem); + + $create_sql = isset($a_create_table["Create Table"]) ? $a_create_table["Create Table"] : $a_create_table["Create View"]; $matches = array(); |
