|
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)]
|
|