Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

建议在检测语句没有delimiter结尾时给出友好提示 #28

Closed
hhyo opened this issue May 10, 2019 · 2 comments
Closed

建议在检测语句没有delimiter结尾时给出友好提示 #28

hhyo opened this issue May 10, 2019 · 2 comments

Comments

@hhyo
Copy link
Contributor

hhyo commented May 10, 2019

描述您想要的功能:
希望在检测语句时,如果语句没有以delimiter结尾,可以给出比较友好的提示

  • 语句
INSERT INTO `archer_test`.`test0412`(`id`) VALUES(1);
INSERT INTO `archer_test`.`test0412`(`id`) VALUES(1)
  • 结果
    image

  • log

time="2019/05/10 03:42:29.037" level=error msg="解析失败! line 2 column 51 near \"\" (total length 103)" file=session_inception.go line=311
time="2019/05/10 03:42:29.037" level=error msg="INSERT INTO `archer_test`.`test0412`(`id`) VALUES(1)\n                            inception_magic_commit" file=session_inception.go line=312

描述您考虑的解决/替代方案:
使用更友好文案

可参考文档,资料,引用等:

  • Inception的结果
    image
@hanchuanchuan
Copy link
Owner

hanchuanchuan commented May 10, 2019

首先感谢建议!
可能有个更好的主意,因为我们没办法控制使用人员的输入,所以能否由程序控制结尾呢,
比如说

sql =sql.rstrip(';')

# 然后在使用时

sql = '''/*--host=%s;--port=%s;*/
 inception_magic_start;
 %s;
 inception_magic_commit;
''' % (host,
       port,       
   sql)

欢迎讨论~~

@hhyo
Copy link
Contributor Author

hhyo commented May 10, 2019

阔以,程序处理最后补;就好

@hhyo hhyo closed this as completed May 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants