ndo4h
v0.5.1
Published
NDO4H - Node Data Objects for HANA
Downloads
32
Readme
NDO4H - Node Data Objects for Hana
Promisify & Objectify as camelCase hana queries
Initialization
Make sure you imported and initialized @sap/hdbext library as described in https://www.npmjs.com/package/@sap/hdbext
Import the library
const {ndo4h} = require('ndo4h');
- Initialize it, passing the @sap/hdbext library
const db = ndo4h(req.db);
Executing queries
db.execute(query, parameters);
where
- query is a string
- parameters is an array
and it returns an array of objects with all field names as properties in camelCase, if they were in snake_case in the database
Examples
- Queries without parameters
const users = await db.execute("SELECT * FROM USERS");
Example return:
[
{
"id": 1,
"firstName": "Rafael",
"lastName": "Zanetti",
"email": "[email protected]"
}
]
- Query With parameters
const user = await db.execute("SELECT * FROM USERS WHERE EMAIL = ?", [req.params.email]);