Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > DB API specification of .rowcount and/or execute

Reply
Thread Tools

DB API specification of .rowcount and/or execute

 
 
andychambers2002@yahoo.co.uk
Guest
Posts: n/a
 
      11-14-2005
Hi,

Should execute() be allowed to execute multiple operations?

e.g.

from dbi import *

conn = connect(database="test")
curs = conn.cursor()
curs.execute("""
INSERT INTO test_table VALUES (1, 'one');
INSERT INTO test_table VALUES(2, 'two');
""")

If so, then given this execution should rowcount contain the value 2?

What if both a select statement and an insert/update statement exist in
a single call to execute?

Perhaps only the rows affected/returned by the last operation in a
given execute() should be given by rowcount?

 
Reply With Quote
 
 
 
 
=?ISO-8859-1?Q?Gerhard_H=E4ring?=
Guest
Posts: n/a
 
      11-14-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Hi,
>
> Should execute() be allowed to execute multiple operations? [...]


You best ask such questions on the DB-SIG. I say "no" and I think most
people there will agree.

Most DB-API modules will accept multiple statements, but that's an
implementation artifact, and not intended by the DB-API.

FWIW I specifically implemented a check in pysqlite that will raise a
Warning if you use multiple statements in execute(many) and provided a
nonstandard executescript() method for those who really want to execute
multiple statements.

-- Gerhard

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to generate execute file that include enthought.traits.api ,enthought.traits.ui.api ? ray Python 1 06-04-2010 03:49 PM
Re: DB-API execute params, am I missing something? Dennis Lee Bieber Python 12 05-31-2009 02:15 AM
DB-API execute params, am I missing something? Gabriel Rossetti Python 4 05-29-2009 06:48 AM
What is the counterpart of Java API Specification in C++ xz C++ 14 07-30-2007 08:19 PM
Can i execute aspx file in my asp pag with server.execute method(sorry) Savas Ates ASP General 1 08-17-2004 04:52 PM



Advertisments