我的代码类似于以下内容:
$sth = $dbh->prepare("CREATE TABLE IF NOT EXISTS ? (`id` bigint(100) unsigned NOT NULL AUTO_INCREMENT");
$sth->execute('test');
Run Code Online (Sandbox Code Playgroud)
我最终得到了错误:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''test'
Run Code Online (Sandbox Code Playgroud)
从跟踪中我发现perl DBI在表名周围放了单引号,mysql不喜欢.如何告诉DBI不要放任何引号或放(`)而不是单引号?