Board index » delphi » conversion error from string "BLOB"

conversion error from string "BLOB"

conversion error from string "BLOB"

Is there someone that knows what may cause this error. It seems
it is caused when you try to open a TIBQuery or TIBDataset before
all the forms are created. But I'm not sure.

 

Re:conversion error from string "BLOB"


Quote
George Stephanov wrote:
> conversion error from string "BLOB"

> Is there someone that knows what may cause this error. It seems
> it is caused when you try to open a TIBQuery or TIBDataset before
> all the forms are created. But I'm not sure.

        This error is caused when you try to use a literal string for a Blob
value.  For example, the following line of SQL will cause this error:

INSERT INTO MY_TABLE (ID, SOME_BLOB_COLUMN)
   VALUES (100, 'Foobar');

        In order to pass a Blob value, you need to use a parameterized query:

INSERT INTO MY_TABLE (ID, SOME_BLOB_COLUMN)
   VALUES (100, :BlobValue);

        HTH,

        -Craig

--
  Craig Stuntz (TeamB) Vertex Systems Corp. Columbus, OH
      Delphi/InterBase WebLog: http://delphi.weblogs.com
      InterBase PLANalyzer (Free IB optimization tool):
           http://delphi.weblogs.com/IBPLANalyzer

Re:conversion error from string "BLOB"


My case is different. I have the following query:

            update users
            set ID='+IntToStr(i);
            where login='george'

The table users has a field which is of type BLOB but this
field is not used in this SQL statement. That's strange. I have this problem
when I try to open TIBDataset or TIBQuery but only when this is done at the
begginning of the program. In my case in the Create event of my datamodule.

Re:conversion error from string "BLOB"


Quote
George Stefanov wrote:
> My case is different. I have the following query:

>             update users
>             set ID='+IntToStr(i);
>             where login='george'

> The table users has a field which is of type BLOB but this
> field is not used in this SQL statement. That's strange. I have this problem
> when I try to open TIBDataset or TIBQuery but only when this is done at the
> begginning of the program. In my case in the Create event of my datamodule.

        Use TIBSQLMonitor to find out what is really causing the error.

        -Craig

--
  Craig Stuntz (TeamB) Vertex Systems Corp. Columbus, OH
      Delphi/InterBase WebLog: http://delphi.weblogs.com
      InterBase PLANalyzer (Free IB optimization tool):
           http://delphi.weblogs.com/IBPLANalyzer

Re:conversion error from string "BLOB"


I tried to catch the error using TIBSQLMonitor but what is strange there is
not sql statement or error executed at all at this point in the code. This
makes me tkink the problem might be caused by IBX.

Re:conversion error from string "BLOB"


Quote
George Stefanov wrote:
> I tried to catch the error using TIBSQLMonitor but what is strange there is
> not sql statement or error executed at all at this point in the code. This
> makes me tkink the problem might be caused by IBX.

        This error can only come from InterBase; it is not a Delphi error.  The
tricky thing about TIBSQLMonitor is that it doesn't always show you the
SQL statement which causes an error while you have the code stopped in
the de{*word*81}.  You may have to let the code run a little longer before
it shows up.

        Somewhere, there is a line of SQL which is causing this error, and you
should be able to reproduce the error by running the same line of SQL in
IBConsole.

        -Craig

--
  Craig Stuntz (TeamB) Vertex Systems Corp. Columbus, OH
      Delphi/InterBase WebLog: http://delphi.weblogs.com
      InterBase PLANalyzer (Free IB optimization tool):
           http://delphi.weblogs.com/IBPLANalyzer

Re:conversion error from string "BLOB"


I'm not sure I know how exectly to use SQL monitor and which (the program
from the Delphi IDE menu or the IBX component). I used the TIBSQLMonitor and
put a breakpoint in the OnSQL event. I put a breakpoint on the row which
causes the error and saw that the first breakpoint is not invoked after the
second. So I decided that this SQL statement does not reach Interbase at all
but after some debugging of IBX I saw that the error was caused by Interbase
but why I still don't know.

Re:conversion error from string "BLOB"


Quote
George Stefanov wrote:
> I'm not sure I know how exectly to use SQL monitor and which (the program
> from the Delphi IDE menu or the IBX component).

        For IBX, the TIBSQLMonitor component.  The one on the IDE menu is for BDE
apps.

Quote
> I used the TIBSQLMonitor and
> put a breakpoint in the OnSQL event. I put a breakpoint on the row which
> causes the error and saw that the first breakpoint is not invoked after the
> second.

        As I said, there is no guarantee that you'll get an OnSQL event
concurrent with the breakpoint.  You may have to run past the error in
your program before the OnSQL event shows up.

        The message 'Conversion error from string "Blob"' is *almost certainly*
caused by trying to assign a string literal to a Blob value.

        -Craig

--
  Craig Stuntz (TeamB) Vertex Systems Corp. Columbus, OH
      Delphi/InterBase WebLog: http://delphi.weblogs.com
      InterBase PLANalyzer (Free IB optimization tool):
           http://delphi.weblogs.com/IBPLANalyzer

Re:conversion error from string "BLOB"


Quote
"Craig Stuntz (TeamB)" wrote:

>         The message 'Conversion error from string "Blob"' is *almost certainly*
> caused by trying to assign a string literal to a Blob value.

It also happens (IIRC) if you try to assign NULL to a blob field declared as NOT
NULL.

Quote
>         -Craig

> --
>   Craig Stuntz (TeamB) Vertex Systems Corp. Columbus, OH
>       Delphi/InterBase WebLog: http://delphi.weblogs.com
>       InterBase PLANalyzer (Free IB optimization tool):
>            http://delphi.weblogs.com/IBPLANalyzer

--
Jeff Overcash (TeamB)
      (Please do not email me directly unless  asked. Thank You)
The fool escaped from paradise will look over his shoulder and cry
Sit and chew on daffodils and struggle to answer why?
As you grow up and leave the playground
Where you kissed your Prince and found your frog
Remember the jester that showed you tears, the script for tears. (Fish)

Re:conversion error from string "BLOB"


I found the problem. It is rather strange. Before my update query I have an
alter SQL statement which adds the field ID. If I don't close and open the
database again I'll have this error. I don't know what caused this error
but I'm happy I found some solution. Thanks for the help.

Re:conversion error from string "BLOB"


Try to commit your ALTER statement before executing the update statement.

Regards,
Thomas Steinmaurer
IB LogManager 2.0 - The Logging Tool for Interbase/Firebird
http://www.iblogmanager.com

"George Stefanov" <georgis...@yahoo.com> schrieb im Newsbeitrag
news:3c43e2f5_1@dnews...

Quote
> I found the problem. It is rather strange. Before my update query I have
an
> alter SQL statement which adds the field ID. If I don't close and open the
> database again I'll have this error. I don't know what caused this error
> but I'm happy I found some solution. Thanks for the help.

Re:conversion error from string "BLOB"


I've tried but the problem  does not disappear.

Re:conversion error from string "BLOB"


Are you using "Read Committed" as Transaction Isolation Level?

Sometime ago I had a similar problem, running a SQL-script with
an ALTER statement adding one column and filling this column
with an update in the next statement. Using "Read Committed" as
transaction isolation level and committing the ALTER statement
before executing the UPDATE statement solved the problem.

HTH,
Thomas Steinmaurer
IB LogManager 2.0 - The Logging Tool for Interbase/Firebird
http://www.iblogmanager.com

"George Stefanov" <georgis...@yahoo.com> schrieb im Newsbeitrag
news:3c444d1c_1@dnews...

Quote
> I've tried but the problem  does not disappear.

Other Threads