Uploaded image for project: 'MariaDB Connector/Python'
  1. MariaDB Connector/Python
  2. CONPY-105

Change behavior of cursor->rowcount and cursor->lastrowid

    XMLWordPrintable

Details

    Description

      For compatibility with SQLAlchemy (close_with_result) values for lastrowid and rowcount should be retrieved immediately after execute/executemany, and stored in cursor->lastrowid and cursor->rowcount.

      When using unbuffered result sets, rowcount should be updated per fetch.

      Also the behaviour of rowcount and lastrowid should be changed:

      rowcount:
      In case of an error, or if statement wasn't executed rowcount should be -1 (see PEP-249)

      • For DML statements the number of affected rows returned in OK packet by server:
        • > 0 for DML statements which modify or insert, e.g. ALTER TABLE or CREATE TABLE .. SELECT FROM
        • otherwise 0
      • For DQL statement
        • if field_count > 0: number of rows returned
        • otherwise affected rows returned in OK packet by server.

      lastrowid:

      • if server returns no value (0) for last_insert_id, lastrowid should be None.
      • if last_insert_id is > 0, return it's value

      Attachments

        Issue Links

          Activity

            People

              georg Georg Richter
              georg Georg Richter
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.