*** Z SQL Method and type LONG ***
Hi. Well, I have great surpri... no, rather trouble. Maybe I've something missed (though I'm sure I'm not :), but how to pass to the SQL Method *long* type? E.g. I need to pass to a DB a 999999999999999999999 as long, not as string and SQL Method always fails, because /lib/python/Shared/DC/ZRDB/sqltest.py can understand only "float", "string", "int" and "not blank". If you pass type="int" this, for sure, runs int(value) and, sure, crashes. Should I use _float_??? No! Once I've changed sqltest.py for "int" type make as long (always). And it's work, but I would not like use my own patches for Zope... So how to solve this in normal way? -- Regards, Bogdan 1 4m 5o 3l337! just got r00t on this <a href="127.0.0.1">k3wl site</a> j00 sux0r5!
On Mon, Nov 25, 2002 at 08:39:34PM +0200, Bo M. Maryniuck wrote:
Hi.
Well, I have great surpri... no, rather trouble. Maybe I've something missed (though I'm sure I'm not :), but how to pass to the SQL Method *long* type? E.g. I need to pass to a DB a 999999999999999999999 as long, not as string and SQL Method always fails, because /lib/python/Shared/DC/ZRDB/sqltest.py can understand only "float", "string", "int" and "not blank". If you pass type="int" this, for sure, runs int(value) and, sure, crashes. Should I use _float_??? No! Once I've changed sqltest.py for "int" type make as long (always). And it's work, but I would not like use my own patches for Zope...
So how to solve this in normal way?
pass as string and then do an explicit typecast. E.g. (notation is postgresql): <dtml-var my_big_int sql_quote>::int8 Notes: You must not use sqlvar ... type=string, as that would create extra quotes, that you do not want. You do want to sql_quote the string to avoid SQL injection problems. Jim Penny
-- Regards, Bogdan
1 4m 5o 3l337! just got r00t on this <a href="127.0.0.1">k3wl site</a> j00 sux0r5!
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
On Monday 25 November 2002 21:30, Jim Penny wrote:
pass as string and then do an explicit typecast. :-(
You must not use sqlvar ... type=string, as that would create extra quotes, that you do not want. Exactly. Seems that longs support are missed from ZSQLMethod somewhy. Then maybe it is much better idea do not use DTML in ZSQL but PyScript.
-- Regards, Bogdan Why use Windows, since there is a door? (By fachat@galileo.rhein-neckar.de, Andre Fachat)
Bo M. Maryniuck writes:
Well, I have great surpri... no, rather trouble. Maybe I've something missed (though I'm sure I'm not :), but how to pass to the SQL Method *long* type? E.g. I need to pass to a DB a 999999999999999999999 as long, not as string and SQL Method always fails, because /lib/python/Shared/DC/ZRDB/sqltest.py can understand only "float", "string", "int" and "not blank". If you pass type="int" this, for sure, runs int(value) and, sure, crashes. Should I use _float_??? No! Once I've changed sqltest.py for "int" type make as long (always). And it's work, but I would not like use my own patches for Zope...
So how to solve this in normal way? You file a "feature+solution" request in Zope's collector (<http://collector.zope.org>).
With some luck, your enhancement will be part of Zope 2.7 or 2.8. Dieter
participants (3)
-
Bo M. Maryniuck -
Dieter Maurer -
Jim Penny