#1 Today 01:16:02

bigheart
Member
Registered: 2014-08-01
Posts: 58

About error occurrence when executing TSqlRequest.step

Hello,

If i run a select query using LEFT JOIN in sqlite, the result value returned may have a null value, If there is no data in table b as below sql statement.

"SELECT a.name, b.desc from adb a LEFT JOIN bdb b ON a.key = b.key"

When using TSqlRequest for this sql statement, it seems that the ACCESS-VIOLATION error occurs at stmt.step because of the null value.

According to Codex, in TSqlRequest.FieldUtf8 implementation as below:

P := sqlite3.column_text(Request, Col);
FastSetString(Result, P, StrLen(P));

If the SQLite column value is NULL, sqlite3.column_text() can return nil, then StrLen(nil) will get AV.

Please let me know the solution.

Offline

#2 Today 08:00:42

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,494
Website

Re: About error occurrence when executing TSqlRequest.step

Don't trust what the AI says.
Use the source, Luke!
StrLen(nil) always returns 0 by design.

0) don't loose time trusting sloppy LLM.
1) provide a minimum reproducible project.
2) put the stack trace as a picture or as a gist.

Offline

Board footer

Powered by FluxBB