[Zope] zsql method??/

Eric L. Walstad Eric@Walstads.net
Thu, 18 May 2000 14:21:41 -0700


Hi Jon,

I had the same trouble when returning values from a user db of mine.  I
believe the L indicates that the value returned is of type "Long Integer."
I am using MySQL, which has a function called CONV().  This is the function
I used to fix the problem.  Here is an explanation of the function from the
MySQL manual (found at http://www.mysql.com/php/manual.php3):

CONV(N,from_base,to_base)
Converts numbers between different number bases. Returns a string
representation of the number N, converted from base from_base to base
to_base. Returns NULL if any argument is NULL. The argument N is interpreted
as an integer, but may be specified as an integer or a string. The minimum
base is 2 and the maximum base is 36. If to_base is a negative number, N is
regarded as a signed number. Otherwise, N is treated as unsigned. CONV works
with 64-bit precision.
mysql> select CONV("a",16,2);
        -> '1010'
mysql> select CONV("6E",18,8);
        -> '172'
mysql> select CONV(-17,10,-18);
        -> '-H'
mysql> select CONV(10+"10"+'10'+0xa,10,10);
        -> '40'

In my case I just did something like:
CONV(TheNumber, 10, 10)

If you're not using MySQL, maybe there is a similar function in your db(?)

Hope this helps.

Eric.


// -----Original Message-----
// From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
// Jonathan Park
// Sent: Thursday, May 18, 2000 1:35 PM
// To: zope@zope.org
// Subject: [Zope] zsql method??/
//
//
// Hello everyone!
//
//   I have a dtml method that calls in the sql method like this
//        <dtml-in sql method>
//   the result I get is what I would expect except in the unique_#
// field  'L'
// is added at the end of the number
//   ex:
//
//   unique_#    blah    blah       blah
//     1L	   data   data       data
//     2L   	   data   data       data
//
//  any reason why it is adding the 'L'???
//
// thanks
// -jon
//
// Have a great afternoon!
//
//
// _______________________________________________
// 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 )
//