I notice that ISQL is able to get the line number that an error was found on when running bad SQL. What ODBC API calls does it use to achieve this? With other databases you would use a combination of SQLGetDiagRec and SQLGetDiagField. This doesn't seem to be the case for SQL Anywhere. Thanks, Error message from Interactive SQL... How does it know that the error is on line 4 column 1 |
While DBISQL does parse its input to determine the rudiments of the input SQL syntax, DBISQL has no idea precisely where an error in a statement or procedure occurred - only the server does. There is no specific mechanism for the server to return a line number or statement offset when an SQL statement is rejected, short of the error message itself. This is true with both JDBC/ODBC and with jConnect. What you're seeing in DBISQL V7 is an estimate from DBISQL as to where the error occurred. That estimate, in your case, is simply the last line of the input. If you connect the V7 DBISQL client to a Version 11 server, try the following statement:
and you'll see that DBISQL again reports the error on line 4, column 1 (the last line of the input) but the server message (properly) says Error -131: Syntax error near 'flum' on line 3 1
FLUM is ANSI-compliant, is it not? Is it planned for a future version? Okay, fair enough. Thanks for your help. @Breck: That's why they are introducing the "reserved_keywords" option... cf. Glenn's article http://iablog.sybase.com/paulley/2010/04/keywords-and-upgrades :) |
Just to confirm, this is from ASA V7, right? And is this DBISQL session using the JDBC-ODBC bridge, or is it using jConnect?
This is ASA 7. In Interactive SQL I just connect to a registered ODBC data source. Now I see on the advanced tab that there is an option selected called jConnect 5. I guess that's what it's using.