# Collection of code snippets by Arne Vajhøj 
# (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) 
import pymysql

from DB import *

class Good(DB):
    def get_connection(self):
        return pymysql.connect(host='localhost',user='root',password='hemmeligt',db='Test')
    def test(self):
        for i in range(10):
            con = self.get_connection()
            c = con.cursor()
            c.execute("UPDATE tblsrc SET val = val - 1 WHERE id = 1")
            c.execute("UPDATE tbltrg SET val = val + 1 WHERE id = 1")
            c.close()
            con.commit()

demo(Good())
