stringdelphinexusdb

Delphi/Query component - assign a long string (800 char) to a sql.text property trim the sql to 326 char only


I use Delphi/NexusDB and I build SQL (about 800 char long) at run time then I pass it to the nexusdb query.sql.text property to execute it but I found error of invalid token on execution.

I pass SQL like this

Query.SQL.Text := VarStrSQL; // <<---- string variable holding the SQL

when I traced I found SQL string in the Query.SQL.Text is trimmed to 326 character !! While the string variable that hold the SQL is complete and fine but when I assign that variable to query.sql.text only 326 character passed and of course this result in an error for invalid SQL syntax

Please advise why the SQL string trimmed like that ?

Update: *I tried memo1.lines.text := VarStrSQL and the memo component also display the string trimmed !! is it possible a character in my string cause that !! a bug in Delphi 2010 that cause TStrings to trim my string ?*

Thanks


Solution

  • I found the problem: It is nxtChar Fields when they are null they have the value #0 and that cause string trimming

    however although I check for null like this varisnull() the char fields was able to skip this trap function !!! which makes me go around myself for hours finally I now check them like this

    If <nxtChar field> = #0 then <nxtChar field> = '' (or <nxtChar field> = null)