BLOB parameters - how do I use them?

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
upscene

BLOB parameters - how do I use them?

Post by upscene » Fri 09 Sep 2005 12:24

Hi there,

I'm trying an INSERT INTO statement with a blob.

When trying LoadFromStream on the parameter it just hangs.

When trying AsBlob - I get all sorts of messages, like "bloblocator needs to be inited" etc etc...

In short:

How do I use BLOB parameters?

--
Martijn Tonies
Upscene Productions

Guest

Post by Guest » Fri 09 Sep 2005 20:52

PS: I think I was using the NET option on this one.

--
Martijn

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

Post by Alex » Mon 12 Sep 2005 07:55

Please show your SQL and Delphi code that you use to insert blobs.
Also it would be useful to see "Working with BLOB and CLOB data types" topic of ODAC help.

Guest

Post by Guest » Mon 12 Sep 2005 09:49

Hmmm, using the EMPTY_LOB functions is not an option -- this code is generic for multiple database engines. I would expect ODAC to do this for me.

I tried:
(FCommand = TOraSQL)

Code: Select all

         FCommand.Params[Index].AsOraBlob.CreateTemporary(ltBLOB);
         ss := TStringStream.Create(Value);
         try
           FCommand.Params[Index].AsOraBlob.LoadFromStream(ss);
           //FCommand.Params[Index].LoadFromStream(ss, ftOraBLOB);
         finally
           ss.Free;
         end;
But this raises the error:
"Function is not supported"

This raises Access Violations:

Code: Select all

         FCommand.Params[Index].AsOraBlob.Init;
         FCommand.Params[Index].AsOraBlob.AllocLob;

         //FCommand.Params[Index].AsOraBlob.CreateTemporary(ltBLOB);
         ss := TStringStream.Create(Value);
         try
           FCommand.Params[Index].AsOraBlob.LoadFromStream(ss);
           //FCommand.Params[Index].LoadFromStream(ss, ftOraBLOB);
         finally
           ss.Free;
         end;
Switching the "Init" and "AllocLob" around raises:
"OraLob needs to be inited"
??

--
Martijn Tonies
Upscene Productions

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

Post by Alex » Tue 13 Sep 2005 06:54

The TOraLob.CreateTemporary method with Net option is not supported, so such solution can be used with Native (OCI) mode only. There is no any other way in ODAC with NET option to initialize Lob locator except using Empty_Lob explicitly.

Guest

Post by Guest » Tue 13 Sep 2005 08:38

Aaargh... :(

"yet another issue with the NET option"

Will it ever have this functionality?

I'm beginning to think I should remove the NET functionality from my application as I keep running into issues there...

I'll say, the NET option doesnt' "work as advertised" to me :-/

--
Martijn Tonies
Upscene Productions

Paul
Posts: 725
Joined: Thu 28 Oct 2004 14:06

Post by Paul » Wed 14 Sep 2005 12:51

We will implement CreateTemporary function for Net connection in the next ODAC build. The next is valid for OCI mode and the next build of ODAC with Oracle 9i.

Code: Select all

  

//INSERT INTO LOB_TYPES
//  (ID, F_BLOB)
//VALUES
//  (:ID, :F_BLOB)

  FCommand.Params[Index].ParamType := ptInput;
  FCommand.Params[Index].AsOraBlob.OCISvcCtx := OraSession1.OCISvcCtx;
  FCommand.Params[Index].AsOraBlob.CreateTemporary(ltBlob);
  ss := TStringStream.Create(Value);
  try
    FCommand.Params[Index].AsOraBlob.LoadFromStream(ss);
    FCommand.Params[Index].AsOraBlob.WriteLob;
  finally
    ss.Free;
  end;
  FCommand.Execute;

Guest

Post by Guest » Wed 14 Sep 2005 17:02

Paul,

That would be great.

You say "Oracle 9i", I hope it also works with 8i and 10g? :)

Thanks!

--
Martijn Tonies
Upscene Productions

Paul
Posts: 725
Joined: Thu 28 Oct 2004 14:06

Post by Paul » Thu 15 Sep 2005 09:30

Yes, versions greater than 8.1.0

upscene

Post by upscene » Fri 16 Sep 2005 10:52

Thanks.

--
Martijn

Guest

Post by Guest » Wed 19 Oct 2005 10:45

Is this fixed now?

I did not read anything about this in the "new build" post.

btw, don't registered customers get an e-mail when a new build has been released?

--
Martijn Tonies
Upscene Productions

Guest

Post by Guest » Wed 19 Oct 2005 13:26

Installed and checked, it's fixed!

Thanks!
--
Martijn Tonies
Upscene Productions

Post Reply