Re: [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-30 14:55:10
|
Yes, that results in no error.
However, I'm not sure that this produces the correct result for DB2. The
error was not due to backslashes being selected, but rather due to the
lack of a FROM clause. DB2 seems to require one, as even "select 1"
would fail with the same error (prior to doPrepare and doExecute); which
would result in your check giving a flawed result.
I did some digging, and it looks like DB2 is about the only one that
requires a FROM clause. This could be solved by doing something like:
SELECT * FROM (VALUES('\\\\'))
But apparently that would cause a similar problem for MySQL (which can't
use the VALUES expression like that).
So (though preventing a database error from propagating might still be a
good idea), would it be possible to also adjust the check when the
database type is DB2 to include a FROM clause?
Thanks,
Zachary
On 2025-10-30 09:05, Thomas Mertes wrote:
> Hi Zachary,
>
> The statement "SELECT '\\\\'" is on purpose.
> MySQL databases might allow a backslash as escape character in string
> literals (in a prepared statement).
> This depends on the setting of a MySQL database.
> The statement should determine if backslash is an escape character or not.
> As such it should never trigger a DATABASE_ERROR.
> If something goes wrong the backslash is obviously not an escape character.
>
> I just commited "Introduce doPrepare() and doExecute()"
> (see:https://github.com/ThomasMertes/seed7/commit/d3a24aaef0179b0031e9cbcb864b5f1bc243a244
> ).
>
> With this commit the statement "SELECT '\\\\'" is prepared with
> doPrepare() and executed with doExecute().
> These functions do not raise a DATABASE_ERROR if something fails.
>
> Please test accessing DB2 again with this FIX and tell me the results.
>
> Best regards
> Thomas
>
>
> _______________________________________________
> Seed7-users mailing list
> See...@li...
> https://lists.sourceforge.net/lists/listinfo/seed7-users
--
Zachary Menzies
/Developer | 519.323.4289/
Maple Lane Farm Service
/9545 Concession 6 N | Mount Forest, ON | N0G 2L0/ |