executeSQL() method problem

33 views
Skip to first unread message

noktone

unread,
Feb 1, 2013, 7:03:53 AM2/1/13
to scooter-...@googlegroups.com
Hello.

I get an error trying to insert the data using executeSQL() method.
If insert values has an SQL function or the value in which space is contained, the error occurs.

SQL:
INSERT INTO spots(latlang, created_at, updated_at) VALUES (POINT(33.587011,131.057598), '2013-01-30 22:00:00.000', '2013-01-30 22:00:00.000');

Spot.class:
public static int insertTest() {
    Map<String, Object> inputs = new HashMap<String, Object>();
    inputs.put("spotname_ja", "test");
    inputs.put("latlng", "33.587011,131.057598");
    String sql = "INSERT INTO spots(spotname_ja, latlng, created_at, updated_at) VALUES (?spotname_ja, POINT(" + inputs.get("latlng") +"), '2013-01-30 22:00:00.000', '2013-01-30 22:00:00.000')";
    return SqlServiceClient.executeSQL(sql, inputs);
}

all_dailyrolling.log:
JdbcStatementProcessor - [test] execute - parsed expecutable sql: INSERT INTO spots(spotname_ja, latlng, created_at, updated_at) VALUES (?           , POINT(33.587011,131.057598), '2013-01-30 22:00:00.000', '2013-01-30 22:00:00.000')
JdbcStatementProcessor - [test] execute - parsed inputs: {LATLNG=33.587011,131.057598, SPOTNAME_JA=test, latlng=33.587011,131.057598, spotname_ja=test}
JdbcStatementProcessor - [test] execute - outputFilters: {}
JdbcStatementProcessor - [test] Error in execute(): The number of columns does not match the number of values.
java.lang.IllegalArgumentException: The number of columns does not match the number of values.
at com.scooterframework.orm.sqldataexpress.parser.JdbcStatementParser.parseInsertStatement(JdbcStatementParser.java:306)
at com.scooterframework.orm.sqldataexpress.parser.JdbcStatementParser.parse(JdbcStatementParser.java:49)
at com.scooterframework.orm.sqldataexpress.processor.JdbcStatementProcessor.execute(JdbcStatementProcessor.java:109)
at com.scooterframework.orm.sqldataexpress.service.SqlServiceImpl.executeKeepConnection(SqlServiceImpl.java:679)


StringTokenizer class split insert values by " ,()\"".

parseInsertStatement() method, line 263 of JdbcStatementParser.java:
  StringTokenizer sti = new StringTokenizer(sql, " ,()\"");


I inserted the code into JdbcStatementParser.java to output debugging information as follows:
log.debug("colums:" + tokens[j]);
log.debug("values:" + tokens[k]);
log.debug("values.size:" + values.size());
log.debug("column.size:" + length);

all_dailyrolling.log:
JdbcStatementParser - [test] colums:spotname_ja
JdbcStatementParser - [test] colums:latlng
JdbcStatementParser - [test] colums:created_at
JdbcStatementParser - [test] colums:updated_at
JdbcStatementParser - [test] values:?spotname_ja
JdbcStatementParser - [test] values:POINT
JdbcStatementParser - [test] values:33.587011
JdbcStatementParser - [test] values:131.057598
JdbcStatementParser - [test] values:'2013-01-30
JdbcStatementParser - [test] values:22:00:00.000'
JdbcStatementParser - [test] values:'2013-01-30
JdbcStatementParser - [test] values:22:00:00.000'

JdbcStatementParser - [test] values.size:8
JdbcStatementParser - [test] column.size:4


I want this problem to be solved by the next release.

Thanks.

John Chen

unread,
Feb 2, 2013, 3:28:01 PM2/2/13
to scooter-...@googlegroups.com
This is a bug. I will fix it. Thanks!

--
You received this message because you are subscribed to the Google Groups "Scooter Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scooter-framew...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages