DBI cursor behaviour with multiple statements?
Steve Holden
sholden at holdenweb.com
Tue Oct 1 12:27:13 EDT 2002
More information about the Python-list mailing list
Tue Oct 1 12:27:13 EDT 2002
- Previous message (by thread): DBI cursor behaviour with multiple statements?
- Next message (by thread): DBI cursor behaviour with multiple statements?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Paul Boddie" <paul at boddie.net> wrote in message news:23891c90.0210010756.7ec21b94 at posting.google.com... > mark.charsley at REMOVE_THIS.radioscape.com (Mark Charsley) wrote in message news:<memo.20021001113236.1724B at a.a>... > > In article <23891c90.0209300554.5b37c195 at posting.google.com>, > > paul at boddie.net (Paul Boddie) wrote: > > > > > "SELECT * FROM table WHERE column IN %s" > > > > Does that work? I've never been able to pass in a list of things like that > > in either ODBC or ADO from C++. Which means: > > a) the python library isn't cacheing the execution plan, and is just > > building a new building a new SQL statement with each call (which is going > > to have serious consequences), or > > The only DB-API module that I've tried with "IN" that seemed to > support it was psycopg (out of that one and pyPgSQL). I don't know how > the psycopg people have implemented it, though, and from certain > conversations I've had, I don't think PostgreSQL supports/-ed proper > parameter binding anyway. > > > b) it's possible to make DB calls from python that can't be made from C++, > > or > > c) I've been an idiot > > Ruling out the last one, ;-) I would suspect that everything depends > on the database library or DB-API module concerned, given that > database vendors won't have overlooked this one. Have you tried using > mxODBC to see if this kind of thing is supported there? > Unless Herr Lemburg has put it in the latest release, I'd say mxODBC doesn't support it. Python 2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import mx.ODBC.Windows as db >>> c = db.Connect("Holdenwebsql") >>> cc = c.cursor() >>> cc.execute("SELECT Name FROM StdPage WHERE Num IN ?", ((10,20,30,40),)) Traceback (most recent call last): File "<stdin>", line 1, in ? mx.ODBC.Windows.ProgrammingError: ('42000', 1064, "[TCX][MyODBC]You have an erro r in your SQL syntax near ''(10, 20, 30, 40)'' at line 1", 5696) >>> regards ----------------------------------------------------------------------- Steve Holden http://www.holdenweb.com/ Python Web Programming http://pydish.holdenweb.com/pwp/ Previous .sig file retired to www.homeforoldsigs.com -----------------------------------------------------------------------
- Previous message (by thread): DBI cursor behaviour with multiple statements?
- Next message (by thread): DBI cursor behaviour with multiple statements?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list