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!
Sounds like you have to rename your function. so that it does not include spaces. and include () <dtml-in "sqlmethod()"> wait till you get to parameters, that's a mind bender. Have Fun! Luis. On Thu, 18 May 2000, you wrote:
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 ) -- ======================================================
Luis Cortes Pollak EPD (915) 621-6113 ======================================================
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 ) //
I suppose this is related to a "bug" that has been "fixed" in Python 1.6a1: http://www.python.org/1.6
... Expected Code Breakage ...
The "nice" string representation of long integers no longer has an 'L' suffix. For example, print 10L**10 now prints 10000000000 where it used to print 10000000000L. This affects str(long) too; code breakage is expected for code that tries to strip off the 'L' without looking, like this: print str(x)[:-1]. You >can use repr(), which returns the 'L' suffix as before.
Just when you thought you understood the world, it changes.
Oops, I forgot to mention that the CONV function is used in your ZSQL method. Here's the ZSQL Method I use (returns upcoming birthdays falling within this, and the next, month): SELECT FirstName, LastName, MONTH(Birthday) AS Month, DAYOFMONTH(Birthday)AS Day, DATE_FORMAT(Birthday, '%M %D, %Y') AS BDay, CONV(ROUND((TO_DAYS(NOW())-TO_DAYS(Birthday))/365.25), 10, 10) as WillBeAge FROM users WHERE MONTH(Birthday) = MOD(MONTH(NOW()), 12) + 1 OR (MONTH(Birthday) = MONTH(NOW()) AND DAYOFMONTH(Birthday) >= DAYOFMONTH(NOW())) ORDER BY Month, Day // -----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 ) //
Jonathan Park wrote:
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'???
Is this with Sybase by any chance? Search the archives, look for Sybase & long & integers Here is one result (WARNING: long line, mayu be broken up by reader): http://zope.nipltd.com/public/lists/zope-archive.nsf/47ba74c812dbc5dd8025687...
participants (5)
-
Bill Anderson -
Eric L. Walstad -
Jonathan Park -
Luis Cortes -
Terrel Shumway