diff options
| author | Gold <github@evolved.net.nz> | 2021-10-15 21:02:31 +1300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-15 10:02:31 +0200 |
| commit | 72ffec3368d9e1de8f9af25b012f7d9bfcf6665d (patch) | |
| tree | b37ff89becad3914c9749bd3b54d89d110849261 | |
| parent | d86c75122e34329902d50f344ac58604fa93c5dd (diff) | |
| download | adodb-72ffec3368d9e1de8f9af25b012f7d9bfcf6665d.tar.gz adodb-72ffec3368d9e1de8f9af25b012f7d9bfcf6665d.tar.bz2 adodb-72ffec3368d9e1de8f9af25b012f7d9bfcf6665d.zip | |
mysql: Handle tables that are reserved words
Wrapping table names represented by `%s` in backticks so tables names
that are also reserved words don't cause issues.
These 2 locations have impacted our project. There are more in this
file but they have not impacted us yet so I have left them untouched.
I also updated the call to `$this->Execute()` in the first case. PHP is
case insensitive to this, but not all IDE's are so this should help
those.
Fixes #759
| -rw-r--r-- | drivers/adodb-mysqli.inc.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/adodb-mysqli.inc.php b/drivers/adodb-mysqli.inc.php index df76a9c8..16de1e56 100644 --- a/drivers/adodb-mysqli.inc.php +++ b/drivers/adodb-mysqli.inc.php @@ -565,7 +565,7 @@ class ADODB_mysqli extends ADOConnection { } // get index details - $rs = $this->execute(sprintf('SHOW INDEXES FROM %s',$table)); + $rs = $this->Execute(sprintf('SHOW INDEXES FROM `%s`',$table)); // restore fetchmode if (isset($savem)) { @@ -847,7 +847,7 @@ class ADODB_mysqli extends ADOConnection { $table = "$owner.$table"; } - $a_create_table = $this->getRow(sprintf('SHOW CREATE TABLE %s', $table)); + $a_create_table = $this->getRow(sprintf('SHOW CREATE TABLE `%s`', $table)); $this->setFetchMode($savem); |
