DB API specification of .rowcount and/or execute

Discussion in 'Python' started by andychambers2002@yahoo.co.uk, Nov 14, 2005.

  1. Guest

    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?
     
    , Nov 14, 2005
    #1
    1. Advertising

  2. 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
     
    =?ISO-8859-1?Q?Gerhard_H=E4ring?=, Nov 14, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. robert madrian

    ODS + TableAdapter + Rowcount

    robert madrian, Dec 19, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    399
    robert madrian
    Dec 19, 2005
  2. Jon Haakon Ariansen

    SqlDataReader - ReturnValue - rowcount

    Jon Haakon Ariansen, Nov 8, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    1,943
    bruce barker \(sqlwork.com\)
    Nov 8, 2006
  3. segue

    getting rowcount

    segue, Jan 23, 2008, in forum: ASP .Net
    Replies:
    4
    Views:
    772
    segue
    Jan 23, 2008
  4. Darrel
    Replies:
    2
    Views:
    2,457
    Darrel
    Dec 29, 2008
  5. et

    rowcount

    et, Sep 22, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    3
    Views:
    158
    Scott Mitchell [MVP]
    Sep 23, 2005
Loading...

Share This Page