connect.js 431 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
const { options, connect } = require("td2.0-rest-connector");

async function test() {
  options.path = "/rest/sqlt";
  options.host = "localhost";
  let conn = connect(options);
  let cursor = conn.cursor();
  try {
    let res = await cursor.query("SELECT server_version()");
    res.toString();
  } catch (err) {
    console.log(err);
  }
}
test();

// output:
// server_version() |
// ===================
// 2.4.0.12         |