Hi all,

Not to hijack the thread but I think Django indeed supports prepared
statements if the underlying db-binding supports it.
This is from cx_Oracle's doc (http://www.cxtools.net/default.aspx?
nav=cxorlb):

execute(        statement, [parameters], **keywordParameters)
    Execute a statement against the database. Parameters may be passed
as a dictionary or sequence or as keyword arguments. If the arguments
are a dictionary, the values will be bound by name and if the
arguments are a sequence the values will be bound by position.

    A reference to the statement will be retained by the cursor. If
None or the same string object is passed in again, the cursor will
execute that statement again without performing a prepare or rebinding
and redefining. This is most effective for algorithms where the same
statement is used, but different parameters are bound to it (many
times).

and this:
http://osdir.com/ml/python.db.cx-oracle/2007-01/msg00014.html

Peter



On Jul 12, 8:27 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Wed, 2007-07-11 at 16:10 -0500, Carl Karsten wrote:
>
> [...]
>
>
>
> > It is pretty much this simple:
>
> > import settings
> > import MySQLdb
>
> > con = MySQLdb.connect(user=settings.DATABASE_USER,
> >      passwd=settings.DATABASE_PASSWORD,
> >      db=settings.DATABASE_NAME )
> > cur=con.cursor()
>
> > cur.execute("select * from auth_user where id=1" )
> > print cur.fetchall()
> > cur.execute("select * from auth_user where id=%s" % (1,) )
> > print cur.fetchall()
>
> > cur.execute("select * from auth_user where id=%s", (1,) )
> > print cur.fetchall()
>
> > All 3 return the same thing, but only the last one has a chance of the value
> > making it to the server separate from the command, which is a good thing.
>
> Finally the concrete question. Django uses the third form. It's all a
> bit academic as to how much a of a good or better thing this is, but if
> you grep through the code for execute(), you'll be able to see how the
> queries are constructed and passed to the DB-API.
>
> Regards,
> Malcolm
>
> --
> The early bird may get the worm, but the second mouse gets the 
> cheese.http://www.pointy-stick.com/blog/


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

Reply via email to