[Zope] Incrementing an Integer

Anthony Baxter Anthony Baxter <anthony@interlink.com.au>
Thu, 18 Nov 1999 09:28:36 +1100


>>> James Punteney wrote
> I have a SQL Query that returns a column called "CTN" in the database 
> (MySQL) this is defined as an integer, and currently has the value of 
> "20000" (the table only contains one entry right now).  I want to set the 
> variable "ctn" to the CTN returned from the query plus 1.
> 
> This is the error I get:
> Error Type: TypeError
> Error Value: illegal argument type for built-in operation

There was some discussion recently that at least one of the MySQL DAs
would return everything (including numbers) as strings. In python, attempting
to add a string to a number is not valid - convert it to an int, first.


Anthony

> When I view the source of the page I just see CTN: 20000, which I had 
> printing out at one point but have since removed, but no error information 
> or anything.
> 
> Any thoughts would be appreciated.
> 
> Thanks,
> --James
> 
> _______________________________________________
> 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 )

-- 
Anthony Baxter     <anthony@interlink.com.au>   
It's never too late to have a happy childhood.