#W2K MSSQL 2000
#CREATE TABLE [dbo].[Table1] (
# [Id] [int] NULL ,
# [Data] [int] NULL
#)
import dbi, odbc
import time
myconn = odbc.odbc('DSN=ctbase2; UID=sa; PWD=')
mycursor = myconn.cursor()
updatelst = []
start = time.time()
for i in range(10000):
updatelst.append("update table1 set id = %d, data =
%d " % (i, i))
stri = " ".join(updatelst)
rc = mycursor.execute(stri)
myconn.commit()
#time.sleep(100)
mycursor.close()
myconn.close()
# When running this script, a very long string is passed
to execute.
# Only a few first update commands are executed.
# (I checked it by reading the data back).
# Somehow this is timing dependant.
# If sleep is commented out - 480 commands are
executed.
# If sleep is for 10 sec. - 1600 - 1800 commands are
executed.
# If sleep is for 100 sec. - 3800 commands are executed.
# In all cases no exception is thrown and rc = 1
|