Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread Query and blob field
Thu, Apr 18 2013 4:53 PMPermanent Link

Beni

Hello,

I have a table in which I want to insert records using a query. One of the fields is a blob field in which I want to import images. Is it possible to do this using INSERT INTO query?

INSERT INTO ATableName (APKField, ABLOBField)
VALUES (NULL, <what should be here?>)

Thanks,
Beni
Fri, Apr 19 2013 4:22 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Beni

>I have a table in which I want to insert records using a query. One of the fields is a blob field in which I want to import images. Is it possible to do this using INSERT INTO query?
>
>INSERT INTO ATableName (APKField, ABLOBField)
>VALUES (NULL, <what should be here?>)

Where from and how are you going to get the image. If its coming from the disk then ElevateDB SQL doesn't support disk operations of that nature and you'd have to write a custom function for it.

Roy Lambert [Team Elevate]
Fri, Apr 19 2013 7:15 AMPermanent Link

Beni

Roy Lambert wrote:

Beni

>I have a table in which I want to insert records using a query. One of the fields is a blob field in which I want to import images. Is it possible to do this using INSERT INTO query?
>
>INSERT INTO ATableName (APKField, ABLOBField)
>VALUES (NULL, <what should be here?>)

Where from and how are you going to get the image. If its coming from the disk then ElevateDB SQL doesn't support disk operations of that nature and you'd have to write a custom function for it.

Roy Lambert [Team Elevate]

I execute the query in the client application and yes, the image is also on the local machine (on the disk).
As a workaround should I run a sensitive query and use the LoadFromFile procedure?
Fri, Apr 19 2013 8:16 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Beni


Search these newsgroups for a thread titled Importing Images Into BLOB there's a post by Adam Brett which should get you moving in the right direction.

Roy Lambert [Team Elevate]
Mon, Apr 22 2013 11:04 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Beni,

<< I execute the query in the client application and yes, the image is also
on the local machine (on the disk). >>

In that case, just use a parameterized query, like this:

with MyEDBQuery do
   begin
   SQL.Text:='INSERT INTO ATableName (APKField, ABLOBField) VALUES (NULL,
:BlobField)';
   Prepare;
   ParamByName('BlobField').LoadFromFile('c:\myimage.png',ftBlob);
   ExecSQL;
   end;

That is the easiest way to load a BLOB from the local machine via an INSERT
statement.

Tim Young
Elevate Software
www.elevatesoft.com

Mon, Apr 22 2013 11:34 AMPermanent Link

Adam Brett

Orixa Systems

Beni,

I regularly do this from a delphi EXE file using the method Tim describes.

If you want to write a raw SQL statement passing in a BLOB field (i.e. within EDBMgr) it is harder.

Really the best way I can think of would be to create an external module which could drive a function in EDB to return the data which you could pass into a parameter within a SQL script. This is pretty hard work ... though once set up it would run fine.

There may well be a better way.
Image