{"analyzedAt":"2022-08-08T15:39:57.204Z","collected":{"metadata":{"name":"hdb","scope":"unscoped","version":"0.19.5","description":"SAP HANA Database Client for Node","keywords":["sap","hana","database","in-memory"],"date":"2022-08-08T15:26:21.634Z","author":{"name":"Koser, Holger","email":"holger.koser@sap.com","username":"holgerkoser"},"publisher":{"username":"jeffalbion","email":"jeff.albion@sap.com"},"maintainers":[{"username":"holgerkoser","email":"holger.koser@sap.com"},{"username":"alexpenev-s","email":"alexander.penev@sap.com"},{"username":"jeffalbion","email":"jeff.albion@sap.com"},{"username":"dancummins","email":"dan.cummins@sap.com"}],"contributors":[{"name":"Vachkov, Georgi","email":"georgi.vachkov@sap.com"},{"name":"Penev, Alexander","email":"alexander.penev@sap.com"}],"repository":{"type":"git","url":"git://github.com/SAP/node-hdb.git"},"links":{"npm":"https://www.npmjs.com/package/hdb","homepage":"https://github.com/SAP/node-hdb#readme","repository":"https://github.com/SAP/node-hdb","bugs":"https://github.com/SAP/node-hdb/issues"},"license":"Apache-2.0","dependencies":{"iconv-lite":"^0.4.18"},"devDependencies":{"async":"^2.4.1","chrome-net":"^3.3.0","concat-stream":"^1.5.1","coveralls":"^2.13.1","fstream":"^1.0.11","generic-pool":"^2.4.2","istanbul":"^0.4.4","mocha":"^3.4.2","should":"^10.0.0"},"releases":[{"from":"2022-07-09T00:00:00.000Z","to":"2022-08-08T00:00:00.000Z","count":1},{"from":"2022-05-10T00:00:00.000Z","to":"2022-08-08T00:00:00.000Z","count":2},{"from":"2022-02-09T00:00:00.000Z","to":"2022-08-08T00:00:00.000Z","count":3},{"from":"2021-08-08T00:00:00.000Z","to":"2022-08-08T00:00:00.000Z","count":5},{"from":"2020-08-08T00:00:00.000Z","to":"2022-08-08T00:00:00.000Z","count":7}],"hasTestScript":true,"readme":"hdb - Pure JavaScript SAP HANA Database Client\n==============================================\n\n[![Version](https://img.shields.io/npm/v/hdb.svg?style=flat-square)](https://npmjs.org/package/hdb)\n[![Build](https://img.shields.io/travis/SAP/node-hdb.svg?style=flat-square)](http://travis-ci.org/SAP/node-hdb)\n[![Coverage](https://img.shields.io/coveralls/SAP/node-hdb/master.svg?style=flat-square)](https://coveralls.io/r/SAP/node-hdb?branch=master)\n[![License](https://img.shields.io/npm/l/hdb.svg?style=flat-square)](http://www.apache.org/licenses/LICENSE-2.0.html)\n[![Downloads](https://img.shields.io/npm/dm/hdb.svg?style=flat-square)](http://npm-stat.com/charts.html?package=hdb)\n[![REUSE status](https://api.reuse.software/badge/github.com/SAP/node-hdb)](https://api.reuse.software/info/github.com/SAP/node-hdb)\n\nTable of contents\n-------------\n\n* [Install](#install)\n* [SAP Support for hdb and @sap/hana-client](#sap-support-for-hdb-and-saphana-client)\n* [Getting started](#getting-started)\n* [Establish a database connection](#establish-a-database-connection)\n* [Direct Statement Execution](#direct-statement-execution)\n* [Prepared Statement Execution](#prepared-statement-execution)\n* [Bulk Insert](#bulk-insert)\n* [Streaming results](#streaming-results)\n* [Transaction handling](#transaction-handling)\n* [Streaming Large Objects](#streaming-large-objects)\n* [CESU-8 encoding support](#cesu-8-encoding-support)\n* [TCP Keepalive](#tcp-keepalive)\n* [Setting Session-Specific Client Information](#setting-session-specific-client-information)\n* [Running tests](#running-tests)\n* [Running examples](#running-examples)\n\nInstall\n-------\n\nInstall from npm:\n\n```bash\nnpm install hdb\n```\n\nor clone from the [GitHub repository](https://github.com/SAP/node-hdb) to run tests and examples locally:\n\n```bash\ngit clone https://github.com/SAP/node-hdb.git\ncd node-hdb\nnpm install\n```\nSAP Support for hdb and @sap/hana-client\n------------\n\n__The hdb and [@sap/hana-client](https://www.npmjs.com/package/@sap/hana-client) Node.js SAP HANA client drivers are supported by SAP for connecting to [SAP HANA Cloud](https://www.sap.com/products/hana/cloud.html) and [SAP HANA Platform](https://www.sap.com/products/hana.html) servers. When starting a new project, it is encouraged to use the fully featured @sap/hana-client driver ([documentation](https://help.sap.com/viewer/f1b440ded6144a54ada97ff95dac7adf/latest/en-US/a5c332936d9f47d8b820a4ecc427352c.html)).__\n\n```shell\nnpm install @sap/hana-client\n```\n\nBelow is a major feature comparison chart between the two drivers:\n\n| Feature\t                                        | @sap/hana-client |hdb|\n|-------------------------------------------------------|:----------------:|:----------------:|\n| Connectivity to SAP HANA Cloud\t                |:heavy_check_mark:|:heavy_check_mark:|\n| Connectivity to SAP HANA as a Service\t                |:heavy_check_mark:|:heavy_check_mark:|\n| Connectivity to SAP HANA Platform\t                |:heavy_check_mark:|:heavy_check_mark:|\n| Transport Layer Security (TLS)\t                |:heavy_check_mark:|:heavy_check_mark:|\n| Active-Active Read Enabled\t                        |:heavy_check_mark:|:x:|\n| Client-Side Data Encryption\t                        |:heavy_check_mark:|:x:|\n| Statement Distribution\t                        |:heavy_check_mark:|:x:|\n| Password/PBKDF2 Authentication\t                |:heavy_check_mark:|:heavy_check_mark:|\n| SAML Authentication\t                            |:heavy_check_mark:|:heavy_check_mark:|\n| JWT Authentication\t                            |:heavy_check_mark:|:heavy_check_mark:|\n| LDAP Authentication\t                            |:heavy_check_mark:|:x:|\n| Kerberos Authentication\t                        |:heavy_check_mark:|:x:|\n| X.509 Authentication\t                          |:heavy_check_mark:|:x:|\n| Secure User Store Integration (hdbuserstore)\t        |:heavy_check_mark:|:x:|\n| Connections through HTTP proxy\t                |:heavy_check_mark:|:x:|\n| Connections through SOCKS proxy (SAP Cloud Connector)\t|:heavy_check_mark:|:x:|\n| Tracing via hdbsqldbc_cons\t                        |:heavy_check_mark:|:x:|\n| Tracing via environment variable to a file\t        |:heavy_check_mark:|:heavy_check_mark:|\n| Pure JavaScript package\t                        |:x:               |:heavy_check_mark:|\n| Node.js major version support                         |8+|All Supported Versions|\n| License (without alternate SAP license agreement)     |[SAP Developer Agreement](https://tools.hana.ondemand.com/developer-license.txt)|[Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)|\n| SAP Support (with SAP Support agreement)              |Component [HAN-DB-CLI](https://launchpad.support.sap.com/#incident/create)|Component [HAN-DB-CLI](https://launchpad.support.sap.com/#incident/create)|\n| Community Support                                     |[answers.sap.com](https://answers.sap.com/tags/73554900100700000996) HANA tag|[node-hdb/issues](https://github.com/SAP/node-hdb/issues)\n\nThe hdb driver may also have different APIs or lack support for SAP HANA server features where the @sap/hana-client is fully supported. APIs that are the same in both drivers may have different behaviour.\n\nGetting started\n------------\n\nIf you do not have access to an SAP HANA server, go to the [SAP HANA Developer Center](https://developers.sap.com/topics/hana.html) and choose one of the options to use SAP HANA Express or deploy a new SAP HANA Cloud server.\n\nThis is a very simple example showing how to use this module:\n\n```js\nvar hdb    = require('hdb');\nvar client = hdb.createClient({\n  host     : 'hostname',\n  port     : 30015,\n  user     : 'user',\n  password : 'secret'\n});\nclient.on('error', function (err) {\n  console.error('Network connection error', err);\n});\nclient.connect(function (err) {\n  if (err) {\n  \treturn console.error('Connect error', err);\n  }\n  client.exec('select * from DUMMY', function (err, rows) {\n\tclient.end();\n    if (err) {\n      return console.error('Execute error:', err);\n    }\n    console.log('Results:', rows);\n  });\n});\n```\n\nEstablish a database connection\n-------------------------------\n\nThe first step to establish a database connection is to create a client object. It is recommended to pass all required `connect` options like `host`, `port`, `user` and `password` to the `createClient` function. They will be used as defaults for any following connect calls on the created client instance. Options beginning with the prefix \"SESSIONVARIABLE:\" are used to set session-specific client information at connect time (see example of setting EXAMPLEKEY=EXAMPLEVALUE below). In case of network connection errors like a connection timeout or a database restart, you should register an error event handler in order to be able to handle these kinds of problems. If there are no error event handlers, errors will not be emitted.\n\n```js\nvar hdb    = require('hdb');\nvar client = hdb.createClient({\n  host     : 'hostname',\n  port     : 30015,\n  user     : 'user',\n  password : 'secret',\n  'SESSIONVARIABLE:EXAMPLEKEY' : 'EXAMPLEVALUE'\n});\nclient.on('error', function (err) {\n  console.error('Network connection error', err);\n});\nconsole.log(client.readyState); // new\n```\n\nWhen a client instance is created it does not immediately open a network connection to the database host. Initially, the client is in a 'new' state. When you call `connect` for the first time, two things are done internally:\n\n1. A network connection is established and the communication is initialized (Protocol - and Product Version exchange). Now the connection is ready for exchanging messages but no user session is established as the client is in a `disconnected` state. This step is skipped if the client is already in a `disconnected` state.\n\n2. The authentication process is initiated. After a successful user authentication a database session is established and the client is in a `connected` state. If authentication fails the client remains in a `'disconnect'` state.\n\n```js\nclient.connect(function (err) {\n  if (err) {\n    return console.error('Error:', err);\n  }\n  console.log(client.readyState); // connected\n});\n```\nIf user and password are specified they will override the defaults of the client. It is possible to disconnect and reconnect with a different user on the same client instance and the same network connection.\n\nThe client also supports SAP HANA systems installed in multiple-container (MDC) mode. In this case a single SAP HANA system may contain several isolated tenant databases.\nA database is identified by its name. One of the databases in an MDC setup is the system database which is used for central system administration.\nOne can connect to a specific tenant database directly via its host and SQL port (as shown in the example above) or via the system database which may lookup the exact host and port of a particular database by a given name.\n\n```js\nvar hdb    = require('hdb');\nvar client = hdb.createClient({\n  host         : 'hostname', // system database host\n  port         : 30013,      // system database port\n  databaseName : 'DB1',      // name of a particular tenant database\n  user         : 'user',     // user for the tenant database\n  password     : 'secret'    // password for the user specified\n});\n```\n\nThe client also accepts an instance number instead of the port of the system database:\n\n```js\nvar hdb    = require('hdb');\nvar client = hdb.createClient({\n  host           : 'hostname', // system database host\n  instanceNumber : '00',       // instance number of the HANA system\n  databaseName   : 'DB1',      // name of a particular tenant database\n  user           : 'user',     // user for the tenant database\n  password       : 'secret'    // password for the user specified\n});\n```\n\nMultiple hosts can be provided to the client as well:\n\n```js\nvar hdb    = require('hdb');\nvar client = hdb.createClient({\n  hosts : [ { host: 'host1', port: 30015 }, { host: 'host2', port: 30015 } ],\n  user     : 'user',\n  password : 'secret'\n});\n```\n\nThis is suitable for multiple-host SAP HANA systems which are distributed over several hosts. The client establishes a connection to the first available host from the list.\n\n### Authentication mechanisms\nDetails about the different authentication methods can be found in the [SAP HANA Security Guide](https://help.sap.com/viewer/6b94445c94ae495c83a19646e7c3fd56/latest/en-US/440f6efe693d4b82ade2d8b182eb1efb.html).\n\n#### User / Password\nUsers authenticate themselves with their database `user` and `password`.\n\n#### SAML assertion\nSAML bearer assertions as well as unsolicited SAML responses that include an\nunencrypted SAML assertion can be used to authenticate users. SAML assertions and responses must be signed using XML signatures. XML Digital signatures can be created with [xml-crypto](https://www.npmjs.org/package/xml-crypto) or [xml-dsig](https://www.npmjs.org/package/xml-dsig).\n\nInstead of `user` and `password` you have to provide a SAML `assertion`:\n\n```js\nclient.connect({\n  assertion: '<Assertion xmlns=\"urn:oasis:names:tc:SAML:2.0:assertion\" ...>...</Assertion>'\n},function (err) {\n  if (err) {\n    return console.error('Error:', err);\n  }\n  console.log('User:', client.get('user'));\n  console.log('SessionCookie:', client.get('SessionCookie'));\n});\n```\n\nAfter a successful SAML authentication, the server returns the database `user` and a `SessionCookie` which can be used for reconnecting.\n\n#### JWT token\nJWT tokens can also be used to authenticate users.\n\nInstead of `user` and `password` you have to provide a JWT `token`:\n\n```js\nclient.connect({\n  token: 'eyJhbGciOiJSUzI1NiJ9....'\n},function (err) {\n  if (err) {\n    return console.error('Error:', err);\n  }\n  console.log('User:', client.get('user'));\n  console.log('SessionCookie:', client.get('SessionCookie'));\n});\n```\n\nAfter a successful JWT authentication, the server returns the database `user` and a `SessionCookie` which can be used for reconnecting.\n\n### Encrypted network communication\nTo establish an encrypted database connection just pass either `key`, `cert` and `ca` or a `pfx` to createClient.\n\n```js\nvar client = hdb.createClient({\n  host : 'hostname',\n  port : 30015,\n  key  : fs.readFileSync('client-key.pem'),\n  cert : fs.readFileSync('client-cert.pem'),\n  ca   : [fs.readFileSync('trusted-cert.pem')],\n  ...\n});\n```\n\nUse the `useTLS` option if you would like to connect to SAP HANA using Node.js's trusted certificates.\n\n```js\nvar client = hdb.createClient({\n  host : 'hostname',\n  port : 30015,\n  useTLS: true,\n  ...\n});\n```\n\n**Note** for MDC use cases: The system database and the target tenant database may be configured to work with different certificates.\nIf so, make sure to include all the necessary TLS-related properties for both the databases in the client's options.\n\nIn case you need custom logic to validate the server's hostname against the certificate, you can assign a callback function to the `checkServerIdentity` property, alongside the other connection options. The callback is\nsupplied to the `tls.connect` funciton of the [TLS](https://nodejs.org/api/tls.html#connect) API and should conform to the signature described there.\n\nDirect Statement Execution\n--------------------------\n\nDirect statement execution is the simplest way to execute SQL statements.\nThe only input parameter is the SQL command to be executed.\nGenerally, statement execution results are returned using callbacks.\nThe type of returned result depends on the kind of statement.\n\n### DDL Statement\n\nIn the case of a DDL statement nothing is returned:\n\n```js\nclient.exec('create table TEST.NUMBERS (a int, b varchar(16))', function (err) {\n  if (err) {\n    return console.error('Error:', err);\n  }\n  console.log('Table TEST.NUMBERS has been created');\n});\n```\n\n### DML Statement\n\nIn the case of a DML Statement the number of `affectedRows` is returned:\n\n```js\nclient.exec('insert into TEST.NUMBERS values (1, \\'one\\')', function (err, affectedRows) {\n  if (err) {\n    return console.error('Error:', err);\n  }\n  console.log('Number of affected rows:', affectedRows);\n});\n```\n\n### Query\n\nThe `exec` function is a convenient way to completely retrieve the result of a query. In this case all selected `rows` are fetched and returned in the callback. The `resultSet` is automatically closed and all `Lobs` are completely read and returned as buffer objects. If streaming of the results is required you will have to use the `execute` function. This is described in section [Streaming results](#streaming-results):\n\n```js\nclient.exec('select A, B from TEST.NUMBERS order by A', function(err, rows) {\n  if (err) {\n    return console.error('Error:', err);\n  }\n  console.log('Rows:', rows);\n});\n```\n\nDifferent Representations of Query Results\n-----------------------------------\nThe default representation of a single row is an object where the property names are the columnDisplayNames of the resultSetMetadata:\n\n```js\nvar command = 'select top 1 * from t1';\nclient.exec(command, function(err, rows) {\n  /* rows will be an array like this:\n  [{\n    ID: 1,\n    A: 't1.1.a',\n    B: 't1.1.b'\n  }]\n  */\n});\n```\n\nIf your SQL statement is a join with overlapping column names, you may want to get separate objects for each table per row. This is possible if you set option `nestTables` to TRUE:\n\n```js\nvar command = 'select top 1 * from t1 join t2 on t1.id = t2.id';\nvar options = {\n  nestTables: true\n};\nclient.exec(command, options, function(err, rows) {\n  /* rows will be an array like this now:\n  [{\n    T1: {\n      ID: 1,\n      A: 't1.1.a',\n      B: 't1.1.b',\n    },\n    T2: {\n      ID: 1\n      A: 't2.1.a',\n      B: 't2.1.b',\n    },\n  }]\n  */\n});\n```\n\nIt is also possible to return all rows as an array where the order of the column values is exactly the same as in the resultSetMetadata. In this case you have to set the option `rowsAsArray` to TRUE:\n\n```js\nvar command = 'select top 1 * from t1 join t2 on t1.id = t2.id';\nvar options = {\n  rowsAsArray: true\n};\nclient.exec(command, options, function(err, rows) {\n  /* rows will be an array like this now:\n  [[\n    1,\n    't1.1.a',\n    't1.1.b',\n    1\n    't2.1.a',\n    't2.1.b'\n  ]]\n  */\n});\n```\n\nPrepared Statement Execution\n----------------------------\n\n###  Prepare a Statement\n\nThe client returns a `statement` object which can be executed multiple times:\n\n```js\nclient.prepare('select * from DUMMY where DUMMY = ?', function (err, statement){\n  if (err) {\n    return console.error('Error:', err);\n  }\n  // do something with the statement\n  console.log('StatementId', statement.id);\n});\n```\n\n### Execute a Statement\n\nThe execution of a prepared statement is similar to the direct statement execution on the client. The difference is that the first parameter of the `exec` function is an array with positional `parameters`. In case of named parameters it can also be an `parameters` object:\n\n```js\nstatement.exec(['X'], function (err, rows) {\n  if (err) {\n    return console.error('Error:', err);\n  }\n  console.log('Rows:', rows);\n});\n```\n\nIf you use the `execute` function instead of the `exec` function the `resultSet` is returned in the callback like in the direct query execution above.\n\n### Calling Stored Procedures\n\nIf you have a stored procedure similar to the following example:\n\n```sql\ncreate procedure PROC_DUMMY (in a int, in b int, out c int, out d DUMMY, out e TABLES)\n  language sqlscript\n  reads sql data as\n  begin\n    c := :a + :b;\n    d = select * from DUMMY;\n    e = select * from TABLES;\n  end\n```\nYou can call it via a prepared statement.\nThe second argument is always an object with the scalar parameters.\nIf there are no scalar parameters, an empty object ``{}`` is returned.\nThe following arguments are the `resultSets`:\n\n```js\nclient.prepare('call PROC_DUMMY (?, ?, ?, ?, ?)', function(err, statement){\n  if (err) {\n    return console.error('Prepare error:', err);\n  }\n  statement.exec({\n    A: 3,\n    B: 4\n  }, function(err, parameters, dummyRows, tableRows) {\n    if (err) {\n      return console.error('Exec error:', err);\n    }\n    console.log('Parameters:', parameters);\n    console.log('Dummies:', dummyRows);\n    console.log('Tables:', tableRows);\n  });\n});\n```\n**Note:** Default values for stored procedures are not supported.\n\n### Drop Statement\n\nTo drop the statement simply call:\n\n```js\nstatement.drop(function(err){\n  if (err) {\n    return console.error('Drop error:', err);\n  }\n  console.log('Statement dropped');\n});\n```\nThe callback is optional in this case.\n\n### Using Datetime types\n\nIf you want to use DATETIME types in a prepared statement,\nbe aware that strings like `'14.04.2016 12:41:11.215'` are not\nprocessed by the SAP HANA Database but by the node-hdb module.\nTherefore, you must use the exact required format that would be returned\nby a selection made with this module.\nThe formats are:\n```js\nTIME: '13:32:20'\nDATE: '2016-04-14'\nTIMESTAMP: '2016-04-14T13:32:20.737'\nSECONDDATE: '2016-04-14T13:32:20'\n```\n\nAnother possibility is to use the functions\n`TO_DATE`, `TO_DATS`, `TO_TIME` and `TO_TIMESTAMP` in your\nSQL statement to convert your string to a valid DATETIME type.\n\nBulk Insert\n---------------\n\nIf you want to insert multiple rows with a single execution you just\nhave to provide the all parameters as array, for example:\n\n```js\nclient.prepare('insert into TEST.NUMBERS values (?, ?)', function(err, statement){\n  if (err) {\n    return console.error('Prepare error:', err);\n  }\n  statement.exec([[1, 'one'], ['2', 'two'], [3, 'three']], function(err, affectedRows) {\n    if (err) {\n      return console.error('Exec error:', err);\n    }\n    console.log('Array of affected rows:', affectedRows);\n  });\n});\n```\nFor further details, see: [app9](https://github.com/SAP/node-hdb/blob/master/examples/app9.js).\n\n\nStreaming results\n---------------\n\nIf you use the `execute` function of the client or statement instead of the `exec` function, a `resultSet` object is returned in the callback instead of an array of all rows. The `resultSet` object allows you to create an object based `row` stream or an array based stream of `rows` which can be piped to an writer object. Don't forget to close the `resultSet` if you use the `execute` function:\n\n```js\nclient.execute('select A, B from TEST.NUMBERS order by A', function(err, rs) {\n  if (err) {\n    return console.error('Error:', err);\n  }\n  rs.setFetchSize(2048);\n  rs.createObjectStream()\n    .pipe(new MyWriteStream())\n    .on('finish', function (){\n      if (!rs.closed) {\n       rs.close();\n      }\n    });\n});\n```\nFor further details, see [app4](https://github.com/SAP/node-hdb/blob/master/examples/app4.js).\n\nTransaction handling\n---------------\n\nThe default behavior is that each statement is automatically committed. If you want to manually control `commit ` and `rollback` of a transaction, you can do this by calling `setAutoCommit(false)` on the client object:\n\n```js\nfunction execTransaction(cb) {\n  client.setAutoCommit(false);\n  async.series([\n    client.exec.bind(client, \"insert into NUMBERS values (1, 'one')\"),\n    client.exec.bind(client, \"insert into NUMBERS values (2, 'two')\")\n  ], function (err) {\n    if (err) {\n      client.rollback(function(err){\n        if (err) {\n          err.code = 'EROLLBACK';\n          return cb(err);\n        }\n        cb(null, false);\n      });\n    } else {\n      client.commit(function(commitError){\n        if (err) {\n          err.code = 'ECOMMIT';\n          return cb(err);\n        }\n        cb(null, true);\n      });\n    }\n    client.setAutoCommit(true);\n  });\n}\n\nexecTransaction(function(err, ok){\n  if (err) {\n    return console.error('Commit or Rollback error', err);\n  }\n  if (ok) {\n    console.log('Commited');\n  } else {\n    console.log('Rolled back');\n  }\n})\n\n```\n\nFor further details, see: [tx1](https://github.com/SAP/node-hdb/blob/master/examples/tx1.js).\n\nStreaming Large Objects\n-------------\n\n### Read Streams\n\nReading large object as stream can be done if you use the `execute` method of client or statement. In this case for all LOB columns a [Lob](https://github.com/SAP/node-hdb/blob/master/lib/protocol/Lob.js) object is returned. You can call `createReadStream` or `read` in order create a readable stream or to read the LOB completely.\n\n### Write Streams\n\nWriting large objects is automatically done. You just have to pass a [`Readable`](http://nodejs.org/api/stream.html#stream_class_stream_readable_1) instance or a buffer object as parameter.\n\nFor further details, see: [app7](https://github.com/SAP/node-hdb/blob/master/examples/app7.js).\n\nCESU-8 encoding support\n-------------\n\nThe SAP HANA server connectivity protocol uses [CESU-8](https://en.wikipedia.org/wiki/CESU-8) encoding. Node.js does not suport CESU-8 natively and the driver by default converts all text to CESU-8 format in the javascript layer including SQL statements.\n\nDue to the fact that Node.js has built-in support for UTF-8, using UTF-8 in the HDB drivers can lead to performance gains especially for large text data.\nIf you are sure that your data contains only [BMP](https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_Multilingual_Plane) characters, you can disable CESU-8 conversion by setting a flag in the client configuration.\n\n`createClient` accepts the parameter `useCesu8` to disable CESU-8 support. Here is how to provide the configuration:\n\n```js\nvar hdb    = require('hdb');\nvar client = hdb.createClient({\n  host     : 'hostname',\n  port     : 30015,\n  user     : 'user',\n  password : 'secret',\n  useCesu8 : false\n});\n\n```\n\nThis setting is per client and cannot be changed later.\n\n__Note:__ Using CESU-8 brings performance penalties proportionate to the text size that has to be converted.\n\nTCP Keepalive\n-------------\n\nTo configure TCP keepalive behaviour, include the tcpKeepAliveIdle connect option. The value provided for this option is the number of seconds before an idle connection will begin sending keepalive packets. By default, TCP keepalive will be turned on with a value of 200 seconds. If a value of 0 is specified, keepalive behaviour is determined by the operating system.\nThe following example creates a client whose connections will begin sending keepalive packets after 300 seconds.\n\n```js\nvar hdb    = require('hdb');\nvar client = hdb.createClient({\n  host             : 'hostname',\n  port             : 30015,\n  user             : 'user',\n  password         : 'secret',\n  tcpKeepAliveIdle : 300\n});\n\n```\n\nTCP keepalive can be explicity disabled by specifying tcpKeepAliveIdle=false as in the example below.\n\n```js\nvar hdb    = require('hdb');\nvar client = hdb.createClient({\n  host             : 'hostname',\n  port             : 30015,\n  user             : 'user',\n  password         : 'secret',\n  tcpKeepAliveIdle : false\n});\n\n```\nSetting Session-Specific Client Information\n-------------\n\nThe client information is a list of session variables (defined in property-value pairs that are case sensitive) that an application can set on a client object. These variables can be set at connection time via \"SESSIONVARIABLE:\" prefixed options, or by using the setClientInfo method to specify a single property-value pair.\n\n```js\nvar hdb    = require('hdb');\nvar client = hdb.createClient({\n  host             : 'hostname',\n  port             : 30015,\n  user             : 'user',\n  password         : 'secret',\n  \"SESSIONVARIABLE:EXAMPLEKEY1\" : \"EXAMPLEVALUE1\"\n});\nclient.setClientInfo(\"EXAMPLEKEY2\", \"EXAMPLEVALUE2\");\n\n```\nSession variables set via the setClientInfo method will be sent to the server during the next execute, prepare, or fetch operation.\n\n\nRunning tests\n-------------\n\nTo run the unit tests for _hdb_ simply run:\n\n```bash\nmake test-unit\n```\n\nTo run the unit tests as well as acceptance tests for _hdb_ you have to run:\n\n```bash\nmake test\n```\n\nFor the acceptance tests a database connection has to be established. Therefore, you need to copy the configuration template [config.tpl.json](https://github.com/SAP/node-hdb/blob/master/test/db/config.tpl.json) in the ```test/db``` folder to ```config.json``` and change the connection data to yours. If the ```config.json``` file does not exist a local mock server is started.\n\n\n\n\n\nRunning examples\n----------------\n\nFor any examples you need a valid ```config.json``` in the ```test/db``` folder.\n\n\n- [app1](https://github.com/SAP/node-hdb/blob/master/examples/app1.js): Simple query.\n- [app2](https://github.com/SAP/node-hdb/blob/master/examples/app2.js): Fetch rows from `ResultSet`.\n- [app3](https://github.com/SAP/node-hdb/blob/master/examples/app3.js): Streaming rows `createObjectStream()`.\n- [app4](https://github.com/SAP/node-hdb/blob/master/examples/app4.js): Pipe row into JSON-Transform and to `stdout`.\n- [app5](https://github.com/SAP/node-hdb/blob/master/examples/app6.js): Stream from the filesystem into a db table.\n- [app6](https://github.com/SAP/node-hdb/blob/master/examples/app5.js): Stream from a db table into the filesystem.\n- [app7](https://github.com/SAP/node-hdb/blob/master/examples/app7.js): Insert a row with a large image into a db table (uses WriteLobRequest and Transaction internally).\n- [app8](https://github.com/SAP/node-hdb/blob/master/examples/app8.js): Automatic reconnect when network connection is lost.\n- [app9](https://github.com/SAP/node-hdb/blob/master/examples/app9.js): Insert multiple rows with large images into a db table as one batch.\n- [app10](https://github.com/SAP/node-hdb/blob/master/examples/app10.js): Usage example of query option `nestTables`.\n- [call1](https://github.com/SAP/node-hdb/blob/master/examples/call1.js): Call stored procedure.\n- [call2](https://github.com/SAP/node-hdb/blob/master/examples/call2.js): Call stored procedure with lob input and output parameter.\n- [call3](https://github.com/SAP/node-hdb/blob/master/examples/call3.js): Call stored procedure with table as input parameter.\n- [tx1](https://github.com/SAP/node-hdb/blob/master/examples/tx1.js): Transaction handling (shows how to use commit and rollback).\n- [csv](https://github.com/SAP/node-hdb/blob/master/examples/csv.js): Stream a db table into csv file.\n- [server](https://github.com/SAP/node-hdb/blob/master/examples/server.js): Stream rows into http response `http://localhost:1337/{schema}/{tablename}?top={top}`\n\nTo run the first example:\n\n```bash\nnode examples/app1\n```\n\n## Licensing\n\nCopyright 2013-2021 SAP SE or an SAP affiliate company and node-hdb contributors. Please see our [LICENSE](LICENSE) for copyright and license information. Detailed information including third-party components and their licensing/copyright information is available [via the REUSE tool](https://api.reuse.software/info/github.com/SAP/node-hdb)."},"npm":{"downloads":[{"from":"2022-08-07T00:00:00.000Z","to":"2022-08-08T00:00:00.000Z","count":957},{"from":"2022-08-01T00:00:00.000Z","to":"2022-08-08T00:00:00.000Z","count":30273},{"from":"2022-07-09T00:00:00.000Z","to":"2022-08-08T00:00:00.000Z","count":99969},{"from":"2022-05-10T00:00:00.000Z","to":"2022-08-08T00:00:00.000Z","count":231654},{"from":"2022-02-09T00:00:00.000Z","to":"2022-08-08T00:00:00.000Z","count":417221},{"from":"2021-08-08T00:00:00.000Z","to":"2022-08-08T00:00:00.000Z","count":733917}],"starsCount":3},"github":{"starsCount":305,"forksCount":94,"subscribersCount":43,"issues":{"count":205,"openCount":23,"distribution":{"3600":15,"10800":10,"32400":8,"97200":22,"291600":17,"874800":31,"2624400":27,"7873200":31,"23619600":16,"70858800":10,"212576400":18},"isDisabled":false},"contributors":[{"username":"jeffalbion","commitsCount":6},{"username":"Simsso","commitsCount":1},{"username":"holgerkoser","commitsCount":87},{"username":"petar-iv","commitsCount":5},{"username":"dotchev","commitsCount":5},{"username":"cplussharp","commitsCount":3},{"username":"IanMcCurdy","commitsCount":25},{"username":"larshp","commitsCount":3},{"username":"BridgeAR","commitsCount":1},{"username":"rjayasinghe","commitsCount":1},{"username":"clncln1","commitsCount":1},{"username":"PSeitz","commitsCount":1},{"username":"gvachkov","commitsCount":5},{"username":"johannes-vogel","commitsCount":1},{"username":"SebastianWolf-SAP","commitsCount":1},{"username":"abap-weasel","commitsCount":1},{"username":"alexpenev-s","commitsCount":35},{"username":"mikelr","commitsCount":2},{"username":"MichaelSp","commitsCount":1}],"commits":[{"from":"2022-08-01T00:00:00.000Z","to":"2022-08-08T00:00:00.000Z","count":1},{"from":"2022-07-09T00:00:00.000Z","to":"2022-08-08T00:00:00.000Z","count":4},{"from":"2022-05-10T00:00:00.000Z","to":"2022-08-08T00:00:00.000Z","count":8},{"from":"2022-02-09T00:00:00.000Z","to":"2022-08-08T00:00:00.000Z","count":11},{"from":"2021-08-08T00:00:00.000Z","to":"2022-08-08T00:00:00.000Z","count":23}]},"source":{"files":{"readmeSize":28557,"testsSize":1312781,"hasNpmIgnore":true},"badges":[{"urls":{"original":"https://img.shields.io/npm/v/hdb.svg?style=flat-square","shields":"https://img.shields.io/npm/v/hdb.svg","content":"https://img.shields.io/npm/v/hdb.json"},"info":{"service":"npm","type":"version","modifiers":{"type":"v"}}},{"urls":{"original":"https://img.shields.io/travis/SAP/node-hdb.svg?style=flat-square","service":"https://api.travis-ci.org/SAP/node-hdb.svg","shields":"https://img.shields.io/travis/SAP/node-hdb.svg","content":"https://img.shields.io/travis/SAP/node-hdb.json"},"info":{"service":"travis","type":"build"}},{"urls":{"original":"https://img.shields.io/coveralls/SAP/node-hdb/master.svg?style=flat-square","service":"https://coveralls.io/repos/SAP/node-hdb/badge.svg?branch=master","shields":"https://img.shields.io/coveralls/SAP/node-hdb/master.svg","content":"https://img.shields.io/coveralls/SAP/node-hdb/master.json"},"info":{"service":"coveralls","type":"coverage","modifiers":{"branch":"master"}}},{"urls":{"original":"https://img.shields.io/npm/l/hdb.svg?style=flat-square","shields":"https://img.shields.io/npm/l/hdb.svg","content":"https://img.shields.io/npm/l/hdb.json"},"info":{"service":"npm","type":"license","modifiers":{"type":"l"}}},{"urls":{"original":"https://img.shields.io/npm/dm/hdb.svg?style=flat-square","shields":"https://img.shields.io/npm/dm/hdb.svg","content":"https://img.shields.io/npm/dm/hdb.json"},"info":{"service":"npm","type":"downloads","modifiers":{"type":"dm"}}}],"linters":["jshint"],"coverage":1,"outdatedDependencies":{"iconv-lite":{"required":"^0.4.18","stable":"0.6.3","latest":"0.6.3"}}}},"evaluation":{"quality":{"carefulness":0.45999999999999996,"tests":0.75,"health":0.75,"branding":0.6},"popularity":{"communityInterest":464,"downloadsCount":77218,"downloadsAcceleration":407.18285768645364,"dependentsCount":0},"maintenance":{"releasesFrequency":0.9394691780821918,"commitsFrequency":0.7801541095890411,"openIssues":1,"issuesDistribution":0}},"score":{"final":0.5655302879171407,"detail":{"quality":0.8649604926181321,"popularity":0.20848618114522238,"maintenance":0.6659199335167805}}}