Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add integration test for duplicate column names in results.

  • Loading branch information...
commit 9e6941a39d3049f24db5087df4637772aa84c242 1 parent 60c24d1
@pekim authored
Showing with 46 additions and 0 deletions.
  1. +46 −0 test/integration/connection-test.coffee
View
46 test/integration/connection-test.coffee
@@ -273,6 +273,52 @@ exports.numericColumnName = (test) ->
#console.log(text)
)
+exports.duplicateColumnNames = (test) ->
+ test.expect(10)
+
+ config = getConfig()
+
+ request = new Request('select 1 as abc, 2 as xyz, 3 as abc', (err, rowCount) ->
+ test.ok(!err)
+ test.strictEqual(rowCount, 1)
+
+ connection.close()
+ )
+
+ request.on('columnMetadata', (columnsMetadata) ->
+ test.strictEqual(columnsMetadata.length, 3)
+ )
+
+ request.on('row', (columns) ->
+ test.strictEqual(columns.length, 3)
+
+ test.strictEqual(columns[0].value, 1)
+ test.strictEqual(columns[1].value, 2)
+ test.strictEqual(columns[2].value, 3)
+
+ test.strictEqual(columns.abc[0].value, 1)
+ test.strictEqual(columns.abc[1].value, 3)
+ test.strictEqual(columns.xyz.value, 2)
+ )
+
+ connection = new Connection(config)
+
+ connection.on('connect', (err) ->
+ connection.execSql(request)
+ )
+
+ connection.on('end', (info) ->
+ test.done()
+ )
+
+ connection.on('infoMessage', (info) ->
+ #console.log("#{info.number} : #{info.message}")
+ )
+
+ connection.on('debug', (text) ->
+ #console.log(text)
+ )
+
exports.execSqlMultipleTimes = (test) ->
timesToExec = 5
sqlExecCount = 0
Please sign in to comment.
Something went wrong with that request. Please try again.