Data getting lost with TOraSession.Options.ConvertEOL

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jdorlon
Posts: 167
Joined: Fri 05 Jan 2007 22:07

Data getting lost with TOraSession.Options.ConvertEOL

Post by jdorlon » Wed 03 Mar 2021 16:16

Hello,

I am using version 11.4.1, Rad Studio 10.1 Berlin, compiling in 32 bit.

If TOraSession.Options.ConvertEOL = true, and a query selects multiline data, then 1 character per line is lost at the end of the data. I am using Oracle server version 19c and client 19c.

Sample project:

Code: Select all

program Project1;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.SysUtils,
  Ora,
  OraCall,
  orasmart;

var
  Sess: TOraSession;
  qry: TSmartQuery;
  str: String;
begin

  Sess := TOraSession.Create(nil);
  Sess.username := 'me';
  sess.password := 'secret';
  sess.server := 'test';
  sess.Options.ConvertEOL := False;
  sess.Loginprompt := false;
  sess.connected := true;

  qry := TSmartQuery.Create(nil);
  qry.Session := sess;

  Writeln('sess.Options.ConvertEOL := False;');
  Writeln('');

  Writeln('select listagg(''987543210'', chr(10)) within group (order by null) as data');
  Writeln('from dual');
  Writeln('connect by level <= 5;');
  Writeln('============================================================================');
  qry.sql.add('select listagg(''987543210'', chr(10)) within group (order by null) as data');
  qry.sql.add('from dual');
  qry.sql.add('connect by level <= 5');
  qry.execute;
  Writeln(qry.fieldByname('DATA').asString);
  Writeln('');

  qry.Close;
  sess.Connected := False;
  sess.Options.ConvertEOL := True;
  sess.Connected := True;


  Writeln('sess.Options.ConvertEOL := True;');
  Writeln('');

  Writeln('select listagg(''987543210'', chr(10)) within group (order by null) as data');
  Writeln('from dual');
  Writeln('connect by level <= 5;');
  Writeln('============================================================================');
  qry.sql.clear;
  qry.sql.add('select listagg(''987543210'', chr(10)) within group (order by null) as data');
  qry.sql.add('from dual');
  qry.sql.add('connect by level <= 5');
  qry.execute;
  Writeln(qry.fieldByname('DATA').asString);

  Writeln('');
  Write('hit any key to end');
  Readln(str);

  qry.free;
  sess.free;
end.
Output looks like this (Note: first section has last line like 98754321 and next section has last line like 98754):

Code: Select all

sess.Options.ConvertEOL := False;

select listagg('987543210', chr(10)) within group (order by null) as data
from dual
connect by level <= 5;
============================================================================
987543210
987543210
987543210
987543210
987543210

sess.Options.ConvertEOL := True;

select listagg('987543210', chr(10)) within group (order by null) as data
from dual
connect by level <= 5;
============================================================================
987543210
987543210
987543210
987543210
98754

hit any key to end
This is just a guess, but maybe it was caused by the fix made for this bug: viewtopic.php?f=5&t=42328

MaximG
Devart Team
Posts: 1650
Joined: Mon 06 Jul 2015 11:34

Re: Data getting lost with TOraSession.Options.ConvertEOL

Post by MaximG » Thu 04 Mar 2021 11:23

Thank you for the information. We have reproduced the issue and will investigate its origin. We will inform you about the results shortly.

Post Reply