•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Python section within the Software Development category of DaniWeb, a massive community of 427,377 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,038 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Python advertiser: Programming Forums
Views: 352 | Replies: 0
![]() |
•
•
Join Date: Aug 2007
Posts: 128
Reputation:
Rep Power: 2
Solved Threads: 13
I'm using MySQLdb.
Alright, I'm doing
Well, what happens is, it gets executed and prints "rows affected: 1" BUT when I check in my MySQL console no rows are there.
What's the problem? My SQL query is fine, and it works when I do it on the MySQL command line.
EDIT: okay, it works if I add a . -.-
How can I make it auto-commit? I don't feel like doing that after every query, and my app is always using the same cursor for a long period of time
Alright, I'm doing
python Syntax (Toggle Plain Text)
import MySQLdb as mysql db = mysql.connect("localhost", "root", "password", "database") cu = db.cursor() rows = cu.execute("INSERT INTO users (user, pass) VALUES ('test', 'test')") print "rows affected:", rows cu.close();db.close()
Well, what happens is, it gets executed and prints "rows affected: 1" BUT when I check in my MySQL console no rows are there.
What's the problem? My SQL query is fine, and it works when I do it on the MySQL command line.
EDIT: okay, it works if I add a
python Syntax (Toggle Plain Text)
db.commit()
How can I make it auto-commit? I don't feel like doing that after every query, and my app is always using the same cursor for a long period of time
Last edited by hacker9801 : Feb 16th, 2008 at 1:08 am.
![]() |
•
•
•
•
•
•
•
•
DaniWeb Python Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Other Threads in the Python Forum
- Previous Thread: wx.media.MediaCtrl
- Next Thread: Anyone good with Tkinter??


Linear Mode