Skip to content

listTables() failing to use correct prefix #2210

Description

@MGatner

Linux, PHP 7.2, Latest develop branch, MySQLi

If I use $db->listTables(true) (for $constrainByPrefix) with a prefix that includes an _I get a SQL statement that doesn't work. Pseudo-code:

$db = db_connect(['DBPrefix' => 'dev_']);
$db->listTables(true);
echo (string)$db->getLastQuery();

I see that it is trying to escape the underscore with a bang (!):
SHOW TABLES FROM database LIKE 'dev!_%'

Tracing it back this is indeed what is set on the BaseConnection:

/**
 * ESCAPE character
 *
 * @var string
 */
public $likeEscapeChar = '!';

What am I missing? That doesn't work as an escape, should be \, right?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions