Bruza wrote:
> By using "%s", does that mean MySQL does not support "binding" of
> parameter
> and will have to pass the entire SQL statement as one text string?
> 
>   c.execute("select * from t_test where c1=%s" % '1234567')

That should be a comma separating the bind values, not a % format operator:

   c.execute("select * from t_test where c1=%s", '1234567')

This db-api uses '%s' notation as its placeholder marker.  It's 
equivalent to '?' or ':foo'.  There's a whole mess of different possible 
styles in db-api for specifying binds.  If you use sqlalchemy's text(), 
you can use ':foo' notation cross platform and not have to care about 
the db-api's bind implementation or typos like the % above.

> works, but this means the parameter was first substituted into the
> query string
> (by Python) before sending it to MySQL. I think that is why people
> uses ":c1"
> notation in query so that parameters are sent as binary format
> separated from
> the original query string itself...


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to