UNPKG

ibm_db

Version:

IBM DB2 and IBM Informix bindings for node

30 lines (22 loc) 753 B
// To run this test.ts file, follow below steps // npm install -g typescript // npm install --save-dev @types/node // update database connection info in ../test/config.json file // tsc test.ts --lib es2015,dom // node test.js // OR, run: tsc test.ts && node test.js && rm test.js import * as ibmdb from '../' import * as common from '../test/common.js' let cn = common.connectionString , pool = new ibmdb.Pool(); async function main(){ const query = `SELECT * FROM employee WHERE phoneno = ?;` await pool.initAsync(1, cn) const conn = await pool.open(cn) const stmt = await conn.prepare(query) const result = await stmt.execute([3978]) const fetched = await result.fetchAll() console.log(fetched); await conn.close() } main();