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

executemany() with NULL values fails in fallback mode

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.9
    • Fix Version/s: 1.0.10
    • Component/s: DBAPI 2.0
    • Labels:
      None
    • Python Version:
      3.10

      Description

      When connected to a server which doesn't support bulk operations (binary protocol) the fallback routine doesn't handle NULL values correctly.

      import mariadb
       
      conn = mariadb.connect(db="test")
      cur=conn.cursor()
      cur.execute("create table t1(x int, y int, z int)")
       
      sql = "insert into t1 values(?,?,?)"
       
      d=[(None,1,1),(2,None,2),(3,3,None)]
      print(f'input: {d}')
      cur.executemany(sql, d)
       
      cur.execute("select * from t1")
      y=cur.fetchall()
       
      print(f'result: {y}')
      

      Output:

      input : [(None, 1, 1), (2, None, 2), (3, 3, None)]
      result: [(None, 1, 1), (None, None, 2), (None, None, None)]
      

        Attachments

          Activity

            People

            Assignee:
            georg Georg Richter
            Reporter:
            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.