Detect OraSession.Options.CharLength don't work

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
nschmied
Posts: 72
Joined: Mon 09 May 2005 08:03
Location: Suisse

Detect OraSession.Options.CharLength don't work

Post by nschmied » Thu 23 Jun 2005 07:29

Hello,
In your help file you say
Setting CharLength to zero will instruct TOraSession to interrogate Oracle server for the actual character length.
OK greats, I have test this fonction

Code: Select all

  OraSession1.Open;
  OraSession1.Options.CharLength := 0;
  SHowMessage('CharLength '+IntToStr(OraSession1.Options.CharLength));
But ShowMessage display always "CharLength 0".

You make work this option CharLength ????

Tanks you,

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Fri 24 Jun 2005 14:40

This is designed behaviour, value 0 in CharLength property indicates that next time we will query CharLength from server again. This can be useful when you connect to different servers using one TOraSession object.

nschmied
Posts: 72
Joined: Mon 09 May 2005 08:03
Location: Suisse

Post by nschmied » Mon 27 Jun 2005 07:05

OK it's a designed behaviour.
I place value 0 in design time, and in runtime I open the session.

Code: Select all

  OraSession1.Open; 
  //OraSession1.Options.CharLength := 0;
  SHowMessage('CharLength '+IntToStr(OraSession1.Options.CharLength));
But the value is always 0. I have make test with different server was different char length, but the property return 0 !!!!!

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Mon 27 Jun 2005 15:08

As I mentioned earlier it is designed behaviour that CharLength property doesn't change its value from 0 to exact server char length, the value 0 indicates to user and ODAC that exact value will be obtained automatically. If you need to get charlentgh you should do it manually, for example with such SQL :

Code: Select all

BEGIN
  SELECT Nvl(Lengthb(Chr(65536)), Nvl(Lengthb(Chr(256)), 1)) INTO :CharLength FROM dual
END

nschmied
Posts: 72
Joined: Mon 09 May 2005 08:03
Location: Suisse

Post by nschmied » Thu 30 Jun 2005 06:02

OK well but I does not understand for which reason, you return 0 value whereas you know the real value.

Code: Select all

function TOCIConnection.GetProp(Prop: integer; var Value: variant): boolean;
begin
  Result := True;
  case Prop of
    prMaxStringSize:
      Value := GetMaxStringSize;
    prCharLength:
      if FQueryCharLength then
        Value := 0
      else
        Value := FCharLength;
    prCharset:
{...}  else
    Result := inherited GetProp(Prop, Value);
  end;
end;
whats happen if I puts this in comment

Code: Select all

//      if FQueryCharLength then
//        Value := 0
//      else

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Thu 30 Jun 2005 09:28

This will bring unsatisfactory design-time behaviour : when you set CharLength property to 0, connect and get other property value. There is an opportunity to split design-time and run-time CharLength behaviour, but such decision is out of ODAC concept.

nschmied
Posts: 72
Joined: Mon 09 May 2005 08:03
Location: Suisse

Post by nschmied » Thu 30 Jun 2005 09:56

OK, but finally I have My own property CharacterSize, and I use
your code

Code: Select all

BEGIN
  SELECT Nvl(Lengthb(Chr(65536)), Nvl(Lengthb(Chr(256)), 1)) INTO :Result FROM dual;
END;
It's better for ODAC Update :wink:

Post Reply