dolphinscheduler icon indicating copy to clipboard operation
dolphinscheduler copied to clipboard

[BUG] bug title sql组建插入语句换成一个变量就不能插入这个语句在sql客户端执行没问题

Open xiaot502 opened this issue 7 years ago • 0 comments

[INFO] 2019-11-12 16:31:18.612 cn.escheduler.server.worker.log.TaskLogger:[173] - [taskAppId=TASK_2_16642_16642] SqlParameters{type='MYSQL', datasource=1, sql='

insert into t2(item) values("test"); insert into t2(item) values(${biz_time}); ', sqlType=1, udfs='', showType='', connParams='', title='', receivers='', receiversCc='', preStatements=[], postStatements=[]} [INFO] 2019-11-12 16:31:18.612 cn.escheduler.server.worker.log.TaskLogger:[188] - [taskAppId=TASK_2_16642_16642] sql type : MYSQL, datasource : 1, sql :

insert into t2(item) values("test"); insert into t2(item) values(${biz_time}); , localParams : [Property{prop='biz_time', direct=IN, type=INTEGER, value='${system.biz.date}'}],udfs : ,showType : ,connParams : [INFO] 2019-11-12 16:31:18.615 cn.escheduler.server.worker.log.TaskLogger:[188] - [taskAppId=TASK_2_16642_16642] datasource name : 192.168.251.94 , type : MYSQL , desc : area , user_id : 1 , parameter : {"address":"jdbc:mysql://192.168.251.94:3306","database":"mysql_ods","jdbcUrl":"jdbc:mysql://192.168.251.94:3306/mysql_ods","user":"root","password":"hl.Data2018","other":"characterEncoding=utf-8"} [INFO] 2019-11-12 16:31:18.619 cn.escheduler.server.worker.log.TaskLogger:[178] - [taskAppId=TASK_2_16642_16642] after replace sql , preparing :

insert into t2(item) values("test"); insert into t2(item) values(?);

[INFO] 2019-11-12 16:31:18.619 cn.escheduler.server.worker.log.TaskLogger:[173] - [taskAppId=TASK_2_16642_16642] replaced sql , parameters:20191111(INTEGER) [INFO] 2019-11-12 16:31:18.631 cn.escheduler.server.worker.log.TaskLogger:[178] - [taskAppId=TASK_2_16642_16642] prepare statement replace sql:

insert into t2(item) values("test"); insert into t2(item) values(20191111);

[ERROR] 2019-11-12 16:31:18.632 cn.escheduler.server.worker.log.TaskLogger:[313] - [taskAppId=TASK_2_16642_16642] 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 'insert into t2(item) values(20191111)' at line 2 com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'insert into t2(item) values(20191111)' at line 2 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:377) at com.mysql.jdbc.Util.getInstance(Util.java:360) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:978) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3887) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3823) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2435) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2530) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1907) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2141) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2077) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2062) at cn.escheduler.common.task.sql.LoggableStatement.executeUpdate(LoggableStatement.java:118)

Which version of Easy Scheduler: -[1.1.0-preview]

Additional context Add any other context about the problem here.

**Requirement or improvement

  • Please describe about your requirements or improvement suggestions.

还有像这样的复合语句执行也是报错的。 insert into t2(item) select count(1) cnt from t1; 这样是需要先执行一个查询sql把变量保存下来,然后再使用一个非查询sql来实现吗? 如果是这个原因,那么针对复杂的处理实现就比较复杂了。希望给出解答。

xiaot502 avatar Nov 12 '19 08:11 xiaot502