File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,3 +47,32 @@ def selectCodes(table='app_mccatcivitas.showmethecode'):
4747 for row in rows :
4848 result .append (str (row [0 ]))
4949 return result
50+
51+
52+ def cleanUp (table = 'app_mccatcivitas.showmethecode' ):
53+ connection = MySQLdb .connect (
54+ host = sae .const .MYSQL_HOST ,
55+ user = sae .const .MYSQL_USER ,
56+ passwd = sae .const .MYSQL_PASS ,
57+ port = int (sae .const .MYSQL_PORT ),
58+ init_command = 'set names utf8' )
59+ cur = connection .cursor ()
60+ try :
61+ cur .execute ("""drop table %s""" % (table ))
62+ except Exception , e :
63+ print e
64+ connection .commit ()
65+ cur .execute (
66+ """create table %s (code char(32) not null primary key)""" % (table ))
67+ connection .commit ()
68+ cur .close ()
69+ connection .close ()
70+
71+
72+ def Process ():
73+ cleanUp ()
74+ code = create_code ()
75+ for c in code :
76+ insertCode (c )
77+ result = selectCodes ()
78+ return result
You can’t perform that action at this time.
0 commit comments