MySQL engines MyISAM and InnoDB

来源:互联网 发布:公安情报大数据 编辑:程序博客网 时间:2024/05/02 01:34
The MySQL database has different types of storage engines. The most common are the MyISAM and the InnoDB engines. The MyISAM is the default one. There is a trade-off between data security and database speed. The MyISAM tables are faster to process and they do not support transactions. The commit() and rollback() methods are not implemented. They do nothing. On the other hand, the InnoDB tables are more safe against the data loss. They support transactions. They are slower to process.

try:    conn = mdb.connect('localhost', 'testuser',         'test623', 'testdb');    cursor = conn.cursor()        cursor.execute("DELETE FROM Writers WHERE Id = 5")      cursor.execute("DELETE FROM Writers WHERE Id = 4")     cursor.execute("DELETE FROM Writer WHERE Id = 3")         conn.commmit()except mdb.Error, e:      conn.rollback()    print "Error %d: %s" % (e.args[0],e.args[1])    sys.exit(1)cursor.close()conn.close()