### Vladimir Dzhuvinov, 22.11.2007 ### ### Populate employees/accounts tables for SP make_payment test ### 10'000 records with $5000 each import MySQLdb import sys connection = MySQLdb.connect (host='192.168.0.1', user='ttc', passwd='secret', db='ttc') cursor = connection.cursor() cursor.execute("SELECT VERSION()") ((r,),) = cursor.fetchall() print "MySQL version:", r for i in range (0,10000): cursor.callproc("create_employee", ['John Cool '+str(i), 'john'+str(i), 'secret']) ((r,),) = cursor.fetchall() cursor.nextset() eid = int(r) if (eid < 0): print 'Error create_employee:', eid sys.exit(-1) cursor.callproc("create_account", [eid, 5000]) ((r,),) = cursor.fetchall() cursor.nextset() aid = int(r) if (aid < 0): print 'Error creating account:', aid cursor.close() connection.close()