ikai - i take it you mean like this:
Regards Martin Webb The information contained in this email is confidential and may contain proprietary information. It is meant solely for the intended recipient. Access to this email by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted in reliance on this, is prohibited and may be unlawful. No liability or responsibility is accepted if information or data is, for whatever reason corrupted or does not reach its intended recipient. No warranty is given that this email is free of viruses. The views expressed in this email are, unless otherwise stated, those of the author ________________________________ From: Ikai Lan (Google) <ikai.l+gro...@google.com> To: google-appengine@googlegroups.com Sent: Fri, 17 September, 2010 15:49:47 Subject: Re: [google-appengine] Re: gqlquery passing in numeric parameters - help needed Just do a string substitution. GQL isn't SQL and you're not at risk of an injection attack. On Thu, Sep 16, 2010 at 11:26 PM, Martin Webb <spydre...@yahoo.co.uk> wrote: Tim. Yes that was my first guess - i thought max was coming in as None - but that isnt the case? The code below fails?? > >BadQueryError: Parse Error: Non-number limit in LIMIT clause at symbol :2 > > >def load_all(stream,max=10): > test=10 > indexes = db.GqlQuery("SELECT __key__ FROM message_index WHERE receivers = >:1 ORDER BY created DESC LIMIT :2", stream,test) > > > > >Regards > > >Martin Webb >The information contained in this email is confidential and may contain >proprietary information. It is meant solely for the intended recipient. >Access >to this email by anyone else is unauthorised. If you are not the intended >recipient, any disclosure, copying, distribution or any action taken or >omitted >in reliance on this, is prohibited and may be unlawful. No liability or >responsibility is accepted if information or data is, for whatever reason >corrupted or does not reach its intended recipient. No warranty is given that >this email is free of viruses. The views expressed in this email are, unless >otherwise stated, those of the author > > > > > > > > ________________________________ From: Tim Hoffman <zutes...@gmail.com> >To: Google App Engine <google-appengine@googlegroups.com> >Sent: Fri, 17 September, 2010 4:36:14 >Subject: [google-appengine] Re: gqlquery passing in numeric parameters - help >needed > > >Hi > >Have you confirmed max is an int and not a string. My bet that is the >problem. > >Alternately use > >results = message_index.all(keys_only=True).filter('receivers = >',stream).order('-created').fetch(max) > >But max will still need to be an int ;-) > >T > > >On Sep 17, 10:03 am, Martin Webb <spydre...@yahoo.co.uk> wrote: >> Can someone tell me how i pass the max parameter into the query below. Ive >>tried >> : >> ("SELECT __key__ FROM message_index WHERE receivers = :1 ORDER BY created >DESC >> LIMIT :2", stream,max) >> but it throws an erorr: Non-number limit in LIMIT clause >> >> It works fine as below - but i need to pass the max param in >> >> def load_all(stream,max=10): >> indexes = db.GqlQuery("SELECT __key__ FROM message_index WHERE receivers = >> :1 ORDER BY created DESC LIMIT 10", stream) >> >> Regards >> >> Martin Webb >> >> The information contained in this email is confidential and may contain >> proprietary information. It is meant solely for the intended recipient. Access >> to this email by anyone else is unauthorised. If you are not the intended >> recipient, any disclosure, copying, distribution or any action taken or >omitted >> in reliance on this, is prohibited and may be unlawful. No liability or >> responsibility is accepted if information or data is, for whatever reason >> corrupted or does not reach its intended recipient. No warranty is given that >> this email is free of viruses. The views expressed in this email are, unless >> otherwise stated, those of the author > >-- >You received this message because you are subscribed to the Google Groups >"Google App Engine" group. >To post to this group, send email to google-appeng...@googlegroups.com. >To unsubscribe from this group, send email to >google-appengine+unsubscr...@googlegroups.com. >For more options, visit this group at >http://groups.google.com/group/google-appengine?hl=en. > > > > -- >You received this message because you are subscribed to the Google Groups >"Google App Engine" group. >To post to this group, send email to google-appeng...@googlegroups.com. >To unsubscribe from this group, send email to >google-appengine+unsubscr...@googlegroups.com. >For more options, visit this group at >http://groups.google.com/group/google-appengine?hl=en. > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appeng...@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en. -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appeng...@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.