Luc*_*man 0 python mysql mysql-python
我使用mysqldb插入一行:
def insertNewLog(self,uid,beginDate,endDate,logs):
qry1 = """INSERT INTO logs (owner,createDate,endDate,log) VALUES (%s,%s,%s,%s); """
cursor = self.db.cursor()
beginDate = int(time.mktime( beginDate.timetuple() ))
endDate = int(time.mktime( endDate.timetuple()))
print beginDate
print endDate
cursor.execute(qry1,(uid,beginDate,endDate,logs),)
print "inserted normally"
print "Number of rows inserted: %d" % cursor.rowcount
Run Code Online (Sandbox Code Playgroud)
我得到这个输出:
1337720045
1337740625
inserted normally
Number of rows inserted: 1
Run Code Online (Sandbox Code Playgroud)
但是当我在mysql shell中选择我的数据库时,我得到'空集'.我检查我的mysql日志,那里没有任何报告.我有点困惑.