“无效语句:正在等待评论、使用、设置或删除”

时间:2022-09-23 13:06:55

Environment

环境

Fedora 19 and MariaDB on VirtualBox in Windows 7

Fedora 19和MariaDB在Windows 7的VirtualBox上。

Installation

安装

yum install perl-SQL-Translator

yum安装perl-SQL-Translator

Steps

步骤

Generate dump with:

生成转储文件:

[username@hostname ~] mysqldump -u root -pmysql_root_password database_name > example.sql

Generate diagram with:

生成图:

[username@hostname ~]  sqlt-graph -f MySQL -o example.png -t png example.sql

Error

错误

ERROR (line 36): Invalid statement: Was expecting comment, 
or use, or set, or drop, or create, or alter, or insert, or 
delimiter, or empty statement
Error: translate: Error with parser 'SQL::Translator::Parser::MySQL':  
no results at /usr/bin/sqlt-graph line 195.

Links

链接

SQLFairy

SQLFairy

Edit

编辑

Error also occurs in the following SQL on line 5:

在第5行下面的SQL中也会发生错误:

DROP TABLE IF EXISTS `test_table`;
CREATE TABLE `test_table` (
  `my_id` int(11) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`my_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
LOCK TABLES `test_table` WRITE;
UNLOCK TABLES;

1 个解决方案

#1


4  

The solution for this would be that you export only your table defintions of your schema. The error in your example should btw. not occur on line five but on line six where the table gets locked for inserting data.

对此的解决方案是,您只能导出您的模式的表定义。您的示例中的错误应该是顺便说一句。不是在第5行,而是在第6行,该表被锁定用于插入数据。

As a solution dump your schema without the data, given your example above you can do the following to get a dump which is working with the fairy:

作为一种没有数据的模式转储的解决方案,考虑到上面的示例,您可以执行以下操作以获得与仙女一起工作的转储:

mysqldump -u root -pmysql_root_password --no-data database_name > example.sql

#1


4  

The solution for this would be that you export only your table defintions of your schema. The error in your example should btw. not occur on line five but on line six where the table gets locked for inserting data.

对此的解决方案是,您只能导出您的模式的表定义。您的示例中的错误应该是顺便说一句。不是在第5行,而是在第6行,该表被锁定用于插入数据。

As a solution dump your schema without the data, given your example above you can do the following to get a dump which is working with the fairy:

作为一种没有数据的模式转储的解决方案,考虑到上面的示例,您可以执行以下操作以获得与仙女一起工作的转储:

mysqldump -u root -pmysql_root_password --no-data database_name > example.sql