[MonetDB-users] how to read/write blob data ?
I want to store image files into monetdb sql server. I think there are two approaches to do it: the first one is to store the file's full path in a column with varchar type, the second one is to store the image data in a column with blob type. I don't want to see a lot of small image files in the directory, so I choose the second approach. After reading the monetdb manual, I find some examples like this: sql> insert into t1 values (1, blob '012'); I think this is not enough. I also try to use odbc api to store binary data into monetdb, but failed. So please help me to write the blob data into monetdb, as well as the read operation. Maybe there are other ways I don't know, please tell me, thanks!
李坤 wrote:
I want to store image files into monetdb sql server. I think there are two approaches to do it: the first one is to store the file's full path in a column with varchar type, the second one is to store the image data in a column with blob type. I don't want to see a lot of small image files in the directory, so I choose the second approach.
After reading the monetdb manual, I find some examples like this:
sql> insert into t1 values (1, blob '012');
This is almost correct. The blob string is a hex-encoded list of bytes. Each byte in the data is represented by two hex digits, so you need to have an even number of hex digits. This should work: insert into t1 values (1, blob '0102030405060708090A0B0C0D0E0F');
I think this is not enough. I also try to use odbc api to store binary data into monetdb, but failed.
That should work the same. We don't yet have specific support for BLOBs in the ODBC driver, but using the above statement (with the fix for the number of digits) should work.
So please help me to write the blob data into monetdb, as well as the read operation. Maybe there are other ways I don't know, please tell me, thanks!
------------------------------------------------------------------------
------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
------------------------------------------------------------------------
_______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- Sjoerd Mullender
participants (2)
-
Sjoerd Mullender
-
李坤