Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add integration test for executing a request multiple tiimes on a sta…

…tement.
  • Loading branch information...
commit 625d8fce9465eeca323b8eb60554af48abad8845 1 parent 2a498fb
@pekim authored
Showing with 56 additions and 0 deletions.
  1. +56 −0 test/integration/connection-test.coffee
View
56 test/integration/connection-test.coffee
@@ -234,6 +234,62 @@ exports.execSql = (test) ->
#console.log(text)
)
+exports.execSqlMultipleTime = (test) ->
+ timesToExec = 5
+ sqlExecCount = 0
+
+ test.expect(timesToExec * 8)
+
+ config = getConfig()
+
+ execSql = ->
+ if sqlExecCount == timesToExec
+ connection.close()
+ return
+
+ request = new Request('select 8 as C1', (err, rowCount) ->
+ test.ok(!err)
+ test.strictEqual(rowCount, 1)
+
+ sqlExecCount++
+ execSql()
+ )
+
+ request.on('doneInProc', (rowCount, more) ->
+ test.ok(more)
+ test.strictEqual(rowCount, 1)
+ )
+
+ request.on('columnMetadata', (columnsMetadata) ->
+ test.strictEqual(columnsMetadata.length, 1)
+ )
+
+ request.on('row', (columns) ->
+ test.strictEqual(columns.length, 1)
+ test.strictEqual(columns[0].value, 8)
+ test.strictEqual(columns.C1.value, 8)
+ )
+
+ connection.execSql(request)
+
+ connection = new Connection(config)
+
+ connection.on('connect', (err) ->
+ execSql()
+ )
+
+ connection.on('end', (info) ->
+ test.done()
+ )
+
+ connection.on('infoMessage', (info) ->
+ #console.log("#{info.number} : #{info.message}")
+ )
+
+ connection.on('debug', (text) ->
+ #console.log(text)
+ )
+
exports.execSqlWithOrder = (test) ->
test.expect(10)
Please sign in to comment.
Something went wrong with that request. Please try again.