Sounds like you need to commit() the initial cursor.execute()
Kent
[EMAIL PROTECTED] wrote:
hi all, while recently trying to insert some data into the following table:
# stores unique course definitions CREATE TABLE adminCourses ( ID TINYINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, Code CHAR(6), Title VARCHAR(55), Units TINYINT UNSIGNED ) TYPE = InnoDB;
I got a 1L value when I ran the following:
cursor.execute("INSERT INTO adminCourses(ID, Code, Title, Units) VALUES (NULL, 'EAT100', 'Josue', 30);")
indicating no errors. Then when I cursor.execute("Select * from adminCourses") I can see the datum, but when I go to MySQL shell and "Select * from adminCourses;" there are 0 records ! If I then execute the aforementioned INSERT statement while still in MySQL shell, and then the SELECT statement, I will see the lone datum but the ID number will be offset by how many times I executed the INSERT statement via MySQLdb (e.g., if I cursor.execute the INSERT statement 5 times, then go to MySQL shell to run the INSERT statement, when I do a "SELECT * from adminCourses" the solo datum will appear prefixed by an ID number of 6). Am I doing something wrong ?
_______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
_______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
