Author | Message |
---|---|
linacute
Posts: 22
|
Posted 21:26 Nov 09, 2013 |
Does it mean we still keep the insert into tbl (field) values() work? and add " insert into tbl values()"
|
cysun
Posts: 2935
|
Posted 09:25 Nov 10, 2013 |
Yes, of course. |
talisunep
Posts: 140
|
Posted 17:20 Nov 10, 2013 |
Professor Sun |
cysun
Posts: 2935
|
Posted 17:35 Nov 10, 2013 |
I don't know what you mean by "creating two methods". You seem to think that you need to create one method for each possible syntax, and that's not how parsing works. |
harry_520
Posts: 76
|
Posted 21:58 Nov 10, 2013 |
Is this a correct output if the insert statement is incomplete like "insert into ", and the result is 0 records processed? Last edited by harry_520 at
21:58 Nov 10, 2013.
|
cysun
Posts: 2935
|
Posted 22:40 Nov 10, 2013 |
It should be an exception, just like any other syntax error in SimpleDB. |
harry_520
Posts: 76
|
Posted 22:55 Nov 10, 2013 |
I got "insert into tbl values (1, 'abcd')" out put correctly. It returns 1 record. But when I input an incomplete insert statement, it returns 0 records. So, is this a correct solution for this problem? |
cysun
Posts: 2935
|
Posted 22:58 Nov 10, 2013 |
No, as I said, it should throw an exception for syntax errors. Also instead of checking the "output" of an insert statement, you should do a select query to see if the record is inserted. |
harry_520
Posts: 76
|
Posted 23:08 Nov 10, 2013 |
The select query didn't retrieve the records I inserted. Thanks, Dr Sun. Last edited by harry_520 at
23:15 Nov 10, 2013.
|
cysun
Posts: 2935
|
Posted 23:11 Nov 10, 2013 |
Because that's what software is supposed to do? Have you ever seen a DBMS that silently accepts syntactically incorrect SQL statements? |
linacute
Posts: 22
|
Posted 13:26 Nov 12, 2013 |
Do we have to throw an error message if we input more column values than the fields? Since it works fine if input more than fields now |
cysun
Posts: 2935
|
Posted 13:39 Nov 12, 2013 |
No. It'll throw an exception later during execution, but not during parsing as it's syntactically correct. |