Brian C fe88e825e5
Add pg-native to monorepo (#3225)
I didn't do much to "modernize" the pg-native codebase other than running it through the standard eslint --fix that is applied to the rest of the code. There's some easy opportunities there to update it to es6 and so on...it still uses some pretty antiquated coding styles in places.  This PR re-introduces the native tests on node v20, and updates test matrix to drop unsupported versions of node & add in node v22.
2024-06-04 10:26:11 -05:00

26 lines
860 B
JavaScript

var Client = require('../')
var assert = require('assert')
describe('client with arrayMode', function () {
it('returns result as array', function (done) {
var client = new Client({ arrayMode: true })
client.connectSync()
client.querySync('CREATE TEMP TABLE blah(name TEXT)')
client.querySync('INSERT INTO blah (name) VALUES ($1)', ['brian'])
client.querySync('INSERT INTO blah (name) VALUES ($1)', ['aaron'])
var rows = client.querySync('SELECT * FROM blah')
assert.equal(rows.length, 2)
var row = rows[0]
assert.equal(row.length, 1)
assert.equal(row[0], 'brian')
assert.equal(rows[1][0], 'aaron')
client.query("SELECT 'brian', null", function (err, res) {
assert.ifError(err)
assert.strictEqual(res[0][0], 'brian')
assert.strictEqual(res[0][1], null)
client.end(done)
})
})
})