[Seed7-users] Seed7 - DB2 Backslash-Test Error
Interpreter and compiler for the Seed7 programming language.
Brought to you by:
thomas_mertes
|
From: Zachary M. <za...@ma...> - 2025-10-29 20:55:17
|
Hey Thomas,
I was using Seed7 again to connect to a DB2/AS400 via an ODBC connection
using something like this:
connection := openDatabase(DB_ODBC, "", "", "DSN", "user", "password");
But it was producing the following error:
[IBM][System i Access ODBC Driver][DB2 for i5/OS]SQL0104 - Token
<END-OF-STATEMENT> was not valid. Valid tokens: , FROM INTO.
SQLState: 42000
NativeError: -104
I thought it strange, since the error was thrown on connection--I hadn't
run any queries yet. But using a trace and doing some digging, I found
the issue was related to a select statement that gets automatically
called in "src/sql_cli.c" at line 6394:
statementStri = cstri_to_stri("SELECT '\\\\'");
It seems the reason for this is that DB2-based databases don't permit
selecting from nothing. However, I was able to fix the issue by changing
the line to select from a CTE:
statementStri = cstri_to_stri("WITH slashes AS (VALUES('\\\\')) SELECT *
FROM slashes");
Would you be willing to implement a similar fix into the source?
Thanks,
Zachary
|