MySQLdb 中 autocommit 默认是关闭的,下面是例子。

 

import MySQLdb


conn = MySQLdb.connect(host='127.0.0.1',user='root',passwd='131417',db='studio');
cursor = conn.cursor();
cursor.execute('select @@autocommit');

data = cursor.fetchone();
print data;

cursor.close();
conn.close();

 

MySQLdb autocommit

 

 

返回值为 0 ;这个也一定成度上左证了,为什么一定要调用conn.commit()方法。

相关文章:

  • 2022-01-18
  • 2021-10-07
  • 2022-12-23
  • 2022-01-15
  • 2021-05-24
  • 2021-09-19
  • 2022-01-05
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-27
  • 2022-12-23
  • 2022-01-02
  • 2022-12-23
  • 2022-12-23
  • 2021-12-18
相关资源
相似解决方案