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

Negative time value not handled

    XMLWordPrintable

Details

    Description

      While MariaDB allows negative time values, they can't be stored in Python's datetime.time object and will be returned as a positive time value.

      >>> import mariadb
      >>> conn=mariadb.connect(db="testp")
      >>> cur=conn.cursor()
      >>> cur.execute("create temporary table t1 (a time)")
      >>> cur.execute("insert into t1 values ('-23:00')")
      >>> cur.execute("select a from t1")
      >>> cur.fetchone()
      (datetime.time(23, 0),)
      >>> cur.execute("select cast(a as char) from t1")
      >>> cur.fetchone()
      ('-23:00:00',)
      

      Instead of storing time values in datetime.time, they should be stored in datetime.timedelta.

      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.