Problems with TOraSQL and CRLF

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jfudickar
Posts: 202
Joined: Fri 10 Mar 2006 13:03
Location: Oberursel / Germany

Problems with TOraSQL and CRLF

Post by jfudickar » Mon 04 Aug 2008 18:03

Hi,

i i try to execute the following statement with TOraSQL i've got an error:

begin
execute immediate 'begin
null;
end;';
end;

The problem is that the string inside execute immediate contains a crlf and this is not allowed.

Any Chance to fix this?

Greetings
Jens

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 05 Aug 2008 07:11

Oracle SQL syntax does not allow CRLF inside normal string constants. But in Oracle 10 you can use the alternative quoting. For example:

Code: Select all

begin 
execute immediate q'[begin 
null; 
end;]'; 
end;

jfudickar
Posts: 202
Joined: Fri 10 Mar 2006 13:03
Location: Oberursel / Germany

Post by jfudickar » Tue 05 Aug 2008 07:35

I know, that it's not allowed.

The problem is: you have a text editor and use the

Code: Select all

OraQuery.Sql := Memo.Lines; 
Assignment to assign the strings.

Then you got such a problem.

It's the same in your odac demo sample application.


What about changing the #13#10 to #10 using the ConvertEOL property of the session whenever a OraQuery Statement is executed.

Which other way exists to remove the #13 after a

Code: Select all

OraQuery.Sql := Memo.Lines;
Greetings
Jens

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 05 Aug 2008 08:20

The current version of ODAC has special code that leaves CRLF in string constants as is. We think that using the ConvertEOL option in this code can break compatibitity with previous ODAC versions.

If you want we can send you changes to the ODAC source code that will enable replacing CRLF in string constants.

jfudickar
Posts: 202
Joined: Fri 10 Mar 2006 13:03
Location: Oberursel / Germany

Post by jfudickar » Tue 05 Aug 2008 08:32

Hi Oleg,

yes please.

But what about adding an additional property.

I use the components to create/execute pl/sql code in the database.
And here it is realy important to fix this crlf problematic.

And to patch your software every time is not the best solution.

Greetings
Jens

jfudickar
Posts: 202
Joined: Fri 10 Mar 2006 13:03
Location: Oberursel / Germany

Post by jfudickar » Tue 05 Aug 2008 21:22

The question is: how can i assign such a peace of code to a tOraSQL.SQL property without having crlf in the sql.

Greetings
Jens

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Wed 06 Aug 2008 12:04

In the next ODAC build we'll add the RemoveCRInStringLiterals global variable to the OraClasses unit. You can set it to True in the initialization section of any of your units.

initialization
RemoveCRInStringLiterals := True;

I have send the changes to OraClasses.pas to your e-mail.

Post Reply