Page 1 of 1

BLOB parameters - how do I use them?

Posted: Fri 09 Sep 2005 12:24
by upscene
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

Posted: Fri 09 Sep 2005 20:52
by Guest
PS: I think I was using the NET option on this one.

--
Martijn

Posted: Mon 12 Sep 2005 07:55
by Alex
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.

Posted: Mon 12 Sep 2005 09:49
by Guest
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

Posted: Tue 13 Sep 2005 06:54
by Alex
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.

Posted: Tue 13 Sep 2005 08:38
by Guest
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

Posted: Wed 14 Sep 2005 12:51
by Paul
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;

Posted: Wed 14 Sep 2005 17:02
by Guest
Paul,

That would be great.

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

Thanks!

--
Martijn Tonies
Upscene Productions

Posted: Thu 15 Sep 2005 09:30
by Paul
Yes, versions greater than 8.1.0

Posted: Fri 16 Sep 2005 10:52
by upscene
Thanks.

--
Martijn

Posted: Wed 19 Oct 2005 10:45
by Guest
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

Posted: Wed 19 Oct 2005 13:26
by Guest
Installed and checked, it's fixed!

Thanks!
--
Martijn Tonies
Upscene Productions