Dan wrote:
> It's a hexadecimal representation of a blob of data. The literal X'ABCD'
> is a blob of length 2 bytes. The first byte is 0xAB, the second is 0xCD.
>
>    
OK, that makes sense, but I'm still having issues. Let me explain 
exactly what I'm doing so hopefully it can help you help me. :)

I'm using DataMapper which, at the moment, has no BLOB support or any 
significant SQLite-specific functionality. I'm trying to add support for 
binary data to DM. Internally I'm representing binary data as strings, 
and DM's custom types mechanism lets me define serialize/deserialize 
methods for the new type.

At the moment I have binary data correctly serializing/deserializing to 
hex that works fine in ruby. My current project uses spatialite and 
georuby, manipulating geometry objects in binary form. The geom binary 
is being correctly serialized/deserialized such that georuby can 
manipulate the object fine when it is pulled back out of the database, 
so my hex is fime, but sqlite just isn't storing it as binary.

When I drop to the sqlite console, spatialite doesn't recognize the 
binary data as valid. Similarly, when I select from the tables, I get an 
actual string of the hex rather than nothing at all for the binary 
column, the latter being what I see in the spatial test database.

I tried some experiments from the command line, basically attempting to 
set the geometry column to:
"0x010x020x00", '0x000x010x020x00', "X00X01X02X00", 'x00x01x02x03'
Basically any variation of quoting and hex notation I could think of. No 
dice.

> If possible, it is easier to use sqlite3_bind_blob() (or whatever the
> ruby equivalent is) to insert binary data.
>
>    

Unfortunately I think this may be a bit too low-level for DM. There 
isn't much database-specific functionality, so I'm looking at using 
strings and serializing/deserializing my binary data via ruby. Is this 
possible?

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to