mirror of
https://github.com/brianc/node-postgres.git
synced 2026-01-18 15:55:05 +00:00
* Work on converting lib to standard * Finish updating lib * Finish linting lib * Format test files * Add .eslintrc with standard format * Supply full path to eslint bin * Move lint command to package.json * Add eslint as dev dependency
31 lines
667 B
JavaScript
31 lines
667 B
JavaScript
'use strict'
|
|
var helper = require('../test-helper')
|
|
var assert = require('assert')
|
|
|
|
const pool = new helper.pg.Pool()
|
|
pool.connect(function (err, client, done) {
|
|
if (err) throw err
|
|
|
|
var c = 'CREATE TEMP TABLE posts (body TEXT)'
|
|
|
|
client.query(c, function (err) {
|
|
if (err) throw err
|
|
|
|
c = 'INSERT INTO posts (body) VALUES ($1) RETURNING *'
|
|
|
|
var body = Buffer.from('foo')
|
|
client.query(c, [body], function (err) {
|
|
if (err) throw err
|
|
|
|
body = Buffer.from([])
|
|
client.query(c, [body], function (err, res) {
|
|
done()
|
|
|
|
if (err) throw err
|
|
assert.equal(res.rows[0].body, '')
|
|
pool.end()
|
|
})
|
|
})
|
|
})
|
|
})
|