Skip to content

Commit

Permalink
Convert the stress-test to get rid of call-with-context and call-with…
Browse files Browse the repository at this point in the history
…-connection too
  • Loading branch information
Peter Bex committed Apr 30, 2011
1 parent e3bc5c8 commit 0e8350e
Showing 1 changed file with 30 additions and 32 deletions.
62 changes: 30 additions & 32 deletions tests/stress-test.scm
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
(use freetds sql-null)
(define debug print)
(include "test-freetds-secret.scm")
(call-with-context
(lambda (context)
(call-with-connection
context
server
username
password
(lambda (connection)
(call-with-result-set
connection
"CREATE TABLE #harro (a VARCHAR(30), b VARCHAR(30), c VARCHAR(30), d VARCHAR(30), e VARCHAR(30), f VARCHAR(30))"
(lambda (command) (debug (result-values context connection command))))
(for-each
(lambda (i)
(call-with-result-set
connection
"INSERT INTO #harro VALUES(?, ?, ?, ?, ?, ?)"
i (+ i 1) (exact->inexact (+ i 2)) (->string (+ i 3)) (+ i 4) (sql-null)
(lambda (command) (result-values context connection command))))
(iota (expt 2 10)))
(call-with-result-set
connection
"SELECT a, b, c, d, e, f FROM #harro"
(lambda (command) (debug (result-values context connection command))))
(call-with-result-set
connection
"SELECT a, b, c, d, e, f FROM #harro"
(lambda (command) (debug (result-values context connection command))))
(call-with-result-set
connection
"SELECT a, b, c, d, e, f FROM #harro"
(lambda (command) (debug (result-values context connection command))))))))
(define connection (make-connection server username password))

(call-with-result-set
connection
"CREATE TABLE #harro (a VARCHAR(30), b VARCHAR(30), c VARCHAR(30), d VARCHAR(30), e VARCHAR(30), f VARCHAR(30))"
(lambda (command) (debug (result-values connection command))))

(for-each
(lambda (i)
(call-with-result-set
connection
"INSERT INTO #harro VALUES(?, ?, ?, ?, ?, ?)"
i (+ i 1) (exact->inexact (+ i 2)) (->string (+ i 3)) (+ i 4) (sql-null)
(lambda (command) (result-values connection command))))
(iota (expt 2 10)))

(call-with-result-set
connection
"SELECT a, b, c, d, e, f FROM #harro"
(lambda (command) (debug (result-values connection command))))

(call-with-result-set
connection
"SELECT a, b, c, d, e, f FROM #harro"
(lambda (command) (debug (result-values connection command))))

(call-with-result-set
connection
"SELECT a, b, c, d, e, f FROM #harro"
(lambda (command) (debug (result-values connection command))))

0 comments on commit 0e8350e

Please sign in to comment.