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

执行存储过程报错 #642

Open
YangLiuMZ opened this issue Apr 22, 2024 · 7 comments
Open

执行存储过程报错 #642

YangLiuMZ opened this issue Apr 22, 2024 · 7 comments

Comments

@YangLiuMZ
Copy link

YangLiuMZ commented Apr 22, 2024

执行存储过程报错: err: line 1 column 186 near "CALL sp_count;; inception_magic_commit"
日志: time="2024/04/22 11:10:16.936" level=error msg="con: 13801 parsing failed! Line 1 column 186 near " call sp_count \ n; "File=session insertion. go fun=executeInc line=219"
Time="2024/04/22 11:10:16.936" level=error msg="/* -- user=mysql; -- password=024; -- host=10.5.1.3; -- port=3306; -- db=yl; -- enable check;; -- sleep=-1; -- sleep_rows=-1; /nception_mgic_start; use yl; call sp_count \ n; inception_mgic_commit" file=session insertion. go fun=executeInc line=220
Time="2024/04/22 11:10:16.936" level=info msg="[GENERAL-LOG] con: 13801 user: root@10.46.56.227 SQL:/
-- user=mysql-- Password=024-- Host=10.5.1.3-- Port=3306-- Db=yl-- Enable check-- Sleep=-1-- Sleep rows=-1*/ Inception_magicstart; Use yl; Call sp_count; Inception_magic.commit; "File=session. go fun=logQuery line=1606"
Time="2024/04/22 11:10:16.975" level=info msg="con: 13801 close connection" file=server. go fun=fun 1 line=321
使用"skip_sqls" 跳过CALL语句没有生效,请问这个skip_sqls参数可以控制不审核call语句吗,或者其他方式,可以直接执行call CALL sp_count;

@YangLiuMZ YangLiuMZ changed the title Executing stored procedure error 执行存储过程报错 Apr 22, 2024
@zmix999
Copy link

zmix999 commented Apr 22, 2024

这个参数的意思,添加参数 skip_sqls 以兼容不同客户端的默认sql, 可以看下我fork的分支,支持创建存储过程和执行存储过程,https://gitee.com/zhoujin826/goInception

@YangLiuMZ
Copy link
Author

这个参数的意思,添加参数 skip_sqls 以兼容不同客户端的默认sql, 可以看下我fork的分支,支持创建存储过程和执行存储过程,https://gitee.com/zhoujin826/goInception

好的,非常感谢,我下载安装一下

@YangLiuMZ
Copy link
Author

YangLiuMZ commented Apr 23, 2024

这个参数的意思,添加参数 skip_sqls 以兼容不同客户端的默认sql, 可以看下我fork的分支,支持创建存储过程和执行存储过程,https://gitee.com/zhoujin826/goInception

check的时候成功,execute执行的时候还是没有成功:
time="2024/04/23 18:15:40.083" level=warning msg="无匹配类型: ast.CallStmt\n" file=session_inception.go func=executeRemoteCommand line=1256
time="2024/04/23 18:15:40.083" level=info msg="[GENERAL_LOG] con:3 user:root@10.249.104.205 sql:/
--user=root;--password=63a9f0ea7bb980;--host=10.249.152.36;--execute=1;--port=11815;*/ inception_magic_start; use yl; call sp_update; inception_magic_commit;" file=session.go func=logQuery line=1612
time="2024/04/23 18:15:40.085" level=info msg="con:3 close connection" file=server.go func=func1 line=321

@YangLiuMZ
Copy link
Author

+----------+----------+-------------+----------------------+----------------------------------------+----------------+---------------+-----------------------------+---------------+--------------+---------+-------------+
| order_id | stage | error_level | stage_status | error_message | sql | affected_rows | sequence | backup_dbname | execute_time | sqlsha1 | backup_time |
+----------+----------+-------------+----------------------+----------------------------------------+----------------+---------------+-----------------------------+---------------+--------------+---------+-------------+
| 1 | EXECUTED | 0 | Execute Successfully | None | use yl | 0 | 1713867558_8093741_00000000 | None | 0.001 | None | 0 |
| 2 | EXECUTED | 2 | Audit Completed | Execute: Not supported statement type. | call sp_update | 0 | 0_0_00000001 | None | 0 | None | 0 |
+----------+----------+-------------+----------------------+----------------------------------------+----------------+---------------+-----------------------------+---------------+--------------+---------+-------------+

@zmix999
Copy link

zmix999 commented Apr 23, 2024

image
可以下载新的版本试下

@YangLiuMZ
Copy link
Author

image
可以下载新的版本试下

👍 已经可以执行存储过程了!
还有个问题:如果同时执行几十万条update语句,check的时候可能需要一两分钟的时间,请问这个有没有优化方式呢?比如修改哪个参数或者修改代码的方式

@zmix999
Copy link

zmix999 commented Apr 24, 2024

和数据库原理一样的,每条SQL都会检查语法语义,所以量大会比较慢,这种情况建议合并SQL语句

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