Page 1 of 1

Read blob fields in Firebird.

Posted: 06.11.2008, 14:40
by Tommi
If I do:

SELECT myblobvalue FROM mytable WHERE id=2

I receive a null answer.
How can I do ?

Thank You

Posted: 06.11.2008, 22:37
by seawolf
Hi,

You need to add more infos:

1. Which Zeos version do you use?
2. Is that field a not null field?
3. Silly questions .. is there some data on that field? and if you type
"select * FROM mytable WHERE id=2" the result is one or more record?

4. Is a blob subtype 0 or 1? (I mean is a binary or text blob)?

Posted: 07.11.2008, 09:24
by Tommi
seawolf wrote:Hi,

You need to add more infos:

1. Which Zeos version do you use?
2. Is that field a not null field?
3. Silly questions .. is there some data on that field? and if you type
"select * FROM mytable WHERE id=2" the result is one or more record?

4. Is a blob subtype 0 or 1? (I mean is a binary or text blob)?
1. 6.6.3 Stable
2. Yes, is a not null field
3. Yes there are datas and there are more than one record (ID is not primary key)
4. Blob Field contains binary data, when I create it in my CREATE statement I define it:
...,MyBlobField BLOB NOT NULL);

When I fill my fields I do:

(For example Stringa:='INSERT INTO originali (crclink,dati) VALUES(336426043390699390,:kBlob0)'
and ValoreStr is an array of strings)

Code: Select all

  ...
  ...
  try
    ZQuery1.SQL.Clear;
    ZQuery1.Params.Clear;
    ZQuery1.SQL.Add(stringa);
    if NumStr > 0 then
      for a:=0 to NumStr -1 do
      begin
        ZQuery1.Params.CreateParam(ftBlob,'kBlob'+inttostr(a),ptInput);
   Query1.Params.ParamByName('kBlob'+inttostr(a)).AsBlob:=ValoreStr[a];
      end;
    ZQuery1.ExecSQL;
    result:=true;
  except
  ....
  ....
  ....

Posted: 08.11.2008, 21:20
by seawolf
It looks like Blob is a primary key or a part of .. why don't you use a generator instead of a Blob? (or something else)?

Posted: 18.11.2008, 18:22
by Tommi
seawolf wrote:It looks like Blob is a primary key or a part of .. why don't you use a generator instead of a Blob? (or something else)?
I finally solved my issue, thank you