How to use the sql-client.MSSQLClient function in sql-client

To help you get started, we’ve selected a few sql-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ioBroker / ioBroker.sql / main.js View on Github external
server:     msg.message.config.host,
        host:       msg.message.config.host,
        user:       msg.message.config.user,
        password:   msg.message.config.password
    };
    if (msg.message.config.port) {
        params.port = msg.message.config.port;
    }

    if (msg.message.config.dbtype === 'postgresql' && !SQL.PostgreSQLClient) {
        const postgres = require(__dirname + '/lib/postgresql-client');
        for (const attr in postgres) {
            if (!SQL[attr]) SQL[attr] = postgres[attr];
        }
    } else
    if (msg.message.config.dbtype === 'mssql' && !SQL.MSSQLClient) {
        const mssql = require(__dirname + '/lib/mssql-client');
        for (const _attr in mssql) {
            if (!SQL[_attr]) SQL[_attr] = mssql[_attr];
        }
    }

    if (msg.message.config.dbtype === 'postgresql') {
        params.database = 'postgres';
    } else if (msg.message.config.dbtype === 'sqlite') {
        params = getSqlLiteDir(msg.message.config.fileName);
    }
    let timeout;
    try {
        const client = new SQL[clients[msg.message.config.dbtype].name](params);
        timeout = setTimeout(() => {
            timeout = null;

sql-client

A dirt-simple SQL client abstraction (currently) supporting PostgreSQL, MySQL and SQLite.

MIT
Latest version published 3 years ago

Package Health Score

42 / 100
Full package analysis