Charset OCTETS and parameters

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
upscene
Posts: 306
Joined: Thu 19 Oct 2006 08:13

Charset OCTETS and parameters

Post by upscene » Mon 28 Mar 2011 12:29

Hi,

I'm trying to move the byte values for a CHAR(16), charset OCTETS from one table to another by using a parameterized INSERT statement and setting the blob value.

However, this raises a "SQLcode -303, internal error" on .Execute of the insert.

The simplest version to reproduce is:

Code: Select all

var b: TBytes;
begin
  qrySrc.Open;
  qryDest.Prepare;
  while not qrySrc.EOF
  do begin
       b := qrySrc.Fields[0].AsBytes;
       qryDest.Params[0].SetBlobData(b, Length(b));
       qryDest.Execute;
       qrySrc.Next;
     end;
"qrySrc" has a SELECT FROM mytable
"qryDest" has an INSERT INTO mytable2 VALUES (:g)

How is this supposed to work? What's going on?


With regards,

Martijn Tonies
Upscene Productions

AndreyZ

Post by AndreyZ » Mon 28 Mar 2011 14:53

Hello,

The SetBlobData method is used to work with BLOB fields. After calling it the DataType parameter property is assigned to ftBlob, that causes this error. To solve the problem, please use the following code:

Code: Select all

qryDest.Params[0].AsBytes := b;

upscene
Posts: 306
Joined: Thu 19 Oct 2006 08:13

Post by upscene » Mon 28 Mar 2011 15:17

Hmm, I thought I tried that already, apparently not. Seems to work, thanks.

AndreyZ

Post by AndreyZ » Mon 28 Mar 2011 15:23

It is good to see that this problem was solved. If any other questions come up, please contact us.

Post Reply