Notifications
Clear all
[Closed] .net SQL Result Read Algorithm?
Jul 24, 2008 7:13 pm
Here is my current “Query” script. I have a dataset it’s returning with 4,000+ results. The SQL Squery takes 15ms well within tolerable limitations. However getting that data into an array takes 890ms. MUCH slower. This also starts to compound when relational data comes into the mix and I have to act on that data.
Anybody know how to skip the while loop and just push the data in one giant block. I’m sure it’s that while/append/append/etc that is slowing it to a ‘crawl’.
function Query input SQLRequest =
(
starttime = timestamp()
cmdObject = input.CreateCommand()
cmdObject.commandText = (SQLRequest as string)
readerObject = cmdObject.ExecuteReader()
print "SQL Request Time:"
print (timestamp() - starttime)
starttime = timestamp()
SQLDataSet = #()
while readerObject.read() do
(
record =ReaderObject.item
SQLRow = #()
for j = 0 to (ReaderObject.FieldCount - 1) do
(
append SQLRow record[j]
)
Append SQLDataSet SQLRow
)
readerobject.close()
print "SQL DataBlock Read Time:"
print (timestamp() - starttime)
return SQLDataSet
),
1 Reply