[Zope] Problem Inserting zsql query result

Ivan Stout aibanhamano at gmail.com
Fri Nov 11 11:49:07 EST 2005


Peter,

Thank you, but unfortunately I still get the same error due to the newline
character being there and still cannot remove it with variable.replace. Can
a "long object" be converted to a string or integer some way?


On 11/12/05, Peter Bengtsson <peter at fry-it.com> wrote:
>
> On 11/11/05, Ivan Stout <aibanhamano at gmail.com> wrote:
> > Greetings,
> >
> > I would like to insert the results of a query into another table and am
> > doing this from a python script. I am setting the results of a
> queryequal to
> > a variable with the following:
> >
> > variable = container.zsql_method(paramater=value)[0][0]
>
> Try getting the field out by name, not number.
> Eg:
> variable = container.zsql_method(paramater=value)[0]['count']
> or
> variable = container.zsql_method(paramater=value)[0]['age']
>
> >
> > This gives the results I want (in this case "0"), but when I try to
> insert
> > this variable using another zsql method, I get the following error:
> >
> > "MySQL server version for the right syntax to use near '0\n)'"
> >
> > The value I want is there, but it has a newline character also. I try
> > removing using .replace but then I get the following error:
> >
> > 'long' object has no attribute 'replace'
> >
> > I would greatly appreciate it if someone could point me in the right
> > direction.
> >
> > Than you very much,
> >
> > Ivan
> >
> > _______________________________________________
> > Zope maillist - Zope at zope.org
> > http://mail.zope.org/mailman/listinfo/zope
> > ** No cross posts or HTML encoding! **
> > (Related lists -
> > http://mail.zope.org/mailman/listinfo/zope-announce
> > http://mail.zope.org/mailman/listinfo/zope-dev )
> >
> >
> >
>
>
> --
> Peter Bengtsson,
> work www.fry-it.com <http://www.fry-it.com>
> home www.peterbe.com <http://www.peterbe.com>
> hobby www.issuetrackerproduct.com <http://www.issuetrackerproduct.com>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20051112/5a9fa9c1/attachment.htm


More information about the Zope mailing list