More about MySQL-protocol.r
[1/1] from: hallvard::ystad::oops-as::no at: 5-Mar-2004 20:51
Hi all, Nenad,
There is a global function 'change-type-handler to use when values from MySQL are to
be converted to rebol values in a customized manner. But for the other way around?
There is the 'to-sql function in mysql-protocol.r. Values that are not transformed explicitly
with a transformation rule, are FORMed. But mostly, this crashes my application, because
FORM doesn't add quotes or 'sql-escape. I had to change the default block to [to-sql
form value] (from [form value]).
Also, I wanted another handling of block!s. Default is
block! => 'ENUM(string1, string2, ...)'
But my blocks go straight in as strings. So I changed these lines:
block!
[
if empty? value: reduce value [return "(NULL)"]
res: append make string! 100 #"("
forall value [repend res [to-sql value/1 #","]]
head change back tail res #")"
]
into:
block!
[to-sql form value]
All of this is in 'to-sql at line 239 in my version of mysql-protocol.r. Thought I'd
tell, in case anyone else has experienced anything similar and might need the information.
Or in case someone can correct me an tell me that there is a 'change-type-handler like
function for convertion of rebol values into sql ones.
Regards,
HY