BenMorel / mysql-replication-check

A tool to checksum a MySQL slave against its master
MIT License
7 stars 1 forks source link

PDO exception: SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected #3

Closed mokraemer closed 2 years ago

mokraemer commented 2 years ago

quoteIdentifier does not respect databasename.

e.g. 'LOCK TABLES ' . quoteIdentifier($table) . ' READ' results in LOCK TABLES `database.table` READ and NOT LOCK TABLES `database`.`table` READ

I wonder this code ever worked...

mokraemer commented 2 years ago

suggest changing quoteIdentifier to:

function quoteIdentifier($name) { return '`' . strtr($name,['`'=>'``','.'=>'`.`']) . '`'; }

mokraemer commented 2 years ago

bug3.txt

BenMorel commented 2 years ago

Fixed in b4b715282ac6d7ba42b0b579003fe4565f3ac10b.