On 11.11.2011 13:00, Henrik Sperre Johansen wrote:
On 11.11.2011 12:16, Mariano Martinez Peck wrote:
Hi guys. I am trying to understand how to integrate this in the
OpenDBX driver, but I am a little bit lost.
First, I don't understand when this #byteArrayToSQLStringConverter is
used. What is the bytearray and what is the string? one is the
database type and the other one is the inst var of one you your
mapping class?
Yes.
Blobs in Postgres-SQL is basically byteStrings, where a single byte
can be encoded in one of two ways:
- Raw with some escaped
- As a hex string
So the method should be used by the driver when asked to store a
(smalltalk) byteArray into a (postgres) blob column.
Second, I don't know WHERE to put such conversion in the OpenDBX
driver. Why it should be there if #convertSQLStringToByteArray:
aString for: aType will continue to exist in Glorp. So it means I
should also modify Glorp?
Yes, it should be removed from Glorp.
If you want to store bytearrays to blobs in different backend
databases (or same backend, but different drivers), converting from
smalltalk object to what the database stores has to be the job of the
driver.
Otherwise, you might end up double-encoding in some cases, if both
Glorp and Driver does the conversion,
and if not in driver, duplicate the conversion in any users of the
driver if they are to work correctly.
How does the EXDI driver of VW work here?
Driver takes care of conversion.
Does not currently support hex-string format though.
Cheers,
Henry
Read the above as applicable to both storing/reading blobs to/from the
database, not just one of the cases :)
Cheers,
Henry