Hi all!

I am running 
PyICQt Version: 0.8.1.5-5
with
python-mysqldb Version: 1.2.3-1
using
mysql-server Version: 5.5.28+dfsg-1
and encountered the following bug:
Nothing was ever written into the database. After some debugging I found 
out that apparently autocommit is disabled by default. 
Here a snipped from the mysql.log:
           83 Connect    pyicqt@localhost on pyicqt
           83 Query    SET NAMES utf8
           83 Query    set autocommit=0

Hence an explicit commit is needed in order to actually write changes to 
the db (and release locks).
I have added those at the relevant places. See attached diff (note that the 
filenames in the header should probably be changed before patching. ;)

I hope this might be helpful and find its way into the next version.


Apart from this little problem, thx for implementing this nice transport!

Best 
Sebastian

-- 
You received this message because you are subscribed to the Google Groups 
"py-transports" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/py-transports/-/5LL91NpblqEJ.
To post to this group, send email to py-transports@googlegroups.com.
To unsubscribe from this group, send email to 
py-transports+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/py-transports?hl=en.

--- mysql.py.ori	2013-01-10 08:24:31.207152315 +0000
+++ /usr/share/pyicqt/src/xdb/mysql.py	2013-01-10 08:27:54.955800543 +0000
@@ -83,6 +83,7 @@
 			c.execute("INSERT INTO register(owner,username,encryptedpassword) VALUES('%s','%s',HEX('%s'))" % (jabberID, username, password))
 		else:
 			c.execute("INSERT INTO register(owner,username,password) VALUES('%s','%s','%s')" % (jabberID, username, password))
+		self.db.commit()
 
 	def removeRegistration(self, jabberID):
 		""" Removes a registration from the XDB. """
@@ -92,6 +93,7 @@
 		c.execute("DELETE FROM settings WHERE owner = '%s'" % jabberID)
 		c.execute("DELETE FROM lists WHERE owner = '%s'" % jabberID)
 		c.execute("DELETE FROM list_attributes WHERE owner = '%s'" % jabberID)
+		self.db.commit()
 
 	def getSettingList(self, jabberID):
 		""" Gets a list of all settings for a user from the XDB. """
@@ -125,6 +127,7 @@
 		c=self.db.cursor()
 		c.execute("DELETE FROM settings WHERE owner = '%s' AND variable = '%s'" % (jabberID, variable))
 		c.execute("INSERT INTO settings(owner,variable,value) VALUES('%s','%s','%s')" % (jabberID, variable, value))
+		self.db.commit()
 		
 	def getCSetting(self, jabberID, variable):
 		""" Gets a custom user setting from the XDB. """
@@ -144,6 +147,7 @@
 		c=self.db.cursor()
 		c.execute("DELETE FROM csettings WHERE owner = '%s' AND variable = '%s'" % (jabberID, variable))
 		c.execute("INSERT INTO csettings(owner,variable,value) VALUES('%s','%s','%s')" % (jabberID, variable, value))
+		self.db.commit()
 		
 	def getXstatusText(self, jabberID, number):
 		""" Get a latest title and desc for x-status """
@@ -164,6 +168,7 @@
 		c=self.db.cursor()
 		c.execute("DELETE FROM xstatuses WHERE owner = '%s' AND number = '%s'" % (jabberID, number))
 		c.execute("INSERT INTO xstatuses(owner,number,title,value) VALUES('%s','%s','%s','%s')" % (jabberID, number, title, desc))
+		self.db.commit()
 		
 	def getCSettingList(self, jabberID):
 		""" Gets a list of all custom settings for a user from the XDB. """
@@ -243,6 +248,7 @@
 		c.execute("INSERT INTO lists(owner,type,jid) VALUES('%s','%s','%s')" % (jabberID, type, legacyID))
 		for p in payload.keys():
 			c.execute("INSERT INTO list_attributes(owner,type,jid,attribute,value) VALUES('%s','%s','%s','%s','%s')" % (jabberID, type, legacyID, p, re.escape(payload[p].replace("'", "\\'"))))
+		self.db.commit()
 
 	def removeListEntry(self, type, jabberID, legacyID):
 		""" Removes a legacy ID entry from a list in
@@ -251,6 +257,7 @@
 		c=self.db.cursor()
 		c.execute("DELETE FROM lists WHERE owner = '%s' AND type = '%s' AND jid = '%s'" % (jabberID, type, legacyID))
 		c.execute("DELETE FROM list_attributes WHERE owner = '%s' AND type = '%s' AND jid = '%s'" % (jabberID, type, legacyID))
+		self.db.commit()
 
 
 def housekeep():

Reply via email to