Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sqb

Package Overview
Dependencies
Maintainers
1
Versions
174
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sqb - npm Package Compare versions

Comparing version 0.12.1 to 0.13.0

lib/error/SqlError.js

22

lib/connect/Connection.js

@@ -20,4 +20,5 @@ /* SQB

const MetaData = require('./MetaData');
const normalizeRows = require('../normalizeRows');
const SqlError = require('../errors').SqlError;
const normalizeRows = require('../helper/normalizeRows');
const SqlError = require('../error/SqlError');
const sqlObjects = require('../helper/sqbexport');

@@ -31,3 +32,3 @@ /**

*
* @param {DbPool} pool
* @param {Pool} pool
* @param {Object} nested

@@ -79,2 +80,3 @@ * @constructor

Object.setPrototypeOf(Connection.prototype, EventEmitter.prototype);
Object.assign(Connection.prototype, sqlObjects);
Connection.prototype.constructor = Connection;

@@ -237,6 +239,6 @@

normalizeRows(response.rows, prepared);
/* Call onFetchRow events if exists */
if (prepared.onFetchRow && prepared.onFetchRow.length)
/* Call fetchEvents events if exists */
if (prepared.fetchEvents && prepared.fetchEvents.length)
response.rows.forEach(function(row) {
prepared.onFetchRow.forEach(function(cb) {
prepared.fetchEvents.forEach(function(cb) {
cb(row);

@@ -307,3 +309,3 @@ });

objectRows: options.objectRows || self.pool.defaults.objectRows,
onFetchRow: options.onFetchRow
fetchEvents: options.onFetchRow
};

@@ -321,5 +323,5 @@

out.module = query._module || self._module;
if (query._onFetchRow && query._onFetchRow.length) {
out.onFetchRow = out.onFetchRow || [];
out.onFetchRow.push.apply(out.onFetchRow, query._onFetchRow);
if (query.listeners && query.listenerCount('fetch')) {
out.fetchEvents = out.fetchEvents || [];
out.fetchEvents.push.apply(out.fetchEvents, query.listeners('fetch'));
}

@@ -326,0 +328,0 @@ } else {

@@ -21,3 +21,3 @@ /* SQB

const CursorStream = require('./CursorStream');
const normalizeRows = require('../normalizeRows');
const normalizeRows = require('../helper/normalizeRows');

@@ -58,4 +58,4 @@ const MAX_SAFE_INTEGER = Math.pow(2, 53) - 1;

if (options.onFetchRow && options.onFetchRow.length)
options.onFetchRow.forEach(function(fn) {
if (options.fetchEvents && options.fetchEvents.length)
options.fetchEvents.forEach(function(fn) {
self.on('fetch', fn);

@@ -185,5 +185,7 @@ });

return callback(err);
callback(undefined, row, function() {
setImmediate(more);
});
if (row)
callback(undefined, row, function() {
setImmediate(more);
});
else callback();
});

@@ -205,5 +207,7 @@ };

return callback(err);
callback(undefined, row, function() {
setImmediate(more);
});
if (row)
callback(undefined, row, function() {
setImmediate(more);
});
else callback();
});

@@ -210,0 +214,0 @@ };

@@ -22,3 +22,3 @@ /* SQB

/**
* @param {DbPool|Connection} dbobj
* @param {Pool|Connection} dbobj
* @param {Object} metaOperator

@@ -25,0 +25,0 @@ * @constructor

@@ -15,13 +15,13 @@ /* SQB

const ArgumentError = require('errorex').ArgumentError;
const debug = require('debug')('sqb:DbPool');
const debug = require('debug')('sqb:Pool');
const promisify = require('putil-promisify');
const plugins = require('../plugins');
const Serializer = require('../serializer');
const Serializer = require('../Serializer');
const Connection = require('./Connection');
const MetaData = require('./MetaData');
const SelectQuery = require('../query/selectquery');
const InsertQuery = require('../query/insertquery');
const UpdateQuery = require('../query/updatequery');
const DeleteQuery = require('../query/deletequery');
const sqlObjects = require('../sqbexport');
const SelectQuery = require('../query/SelectQuery');
const InsertQuery = require('../query/InsertQuery');
const UpdateQuery = require('../query/UpdateQuery');
const DeleteQuery = require('../query/DeleteQuery');
const sqlObjects = require('../helper/sqbexport');
const waterfall = require('putil-waterfall');

@@ -31,6 +31,6 @@ const lightningPool = require('lightning-pool');

/**
* Expose `DbPool`.
* Expose `Pool`.
*/
module.exports = DbPool;
module.exports = Pool;

@@ -52,12 +52,15 @@ /**

* @param {int} [config.pool.max = 10]
* @param {int} [config.pool.maxQueue = 1000]
* @param {int} [config.pool.min = 0]
* @param {int} [config.pool.minIdle = 0]
* @param {int} [config.pool.maxQueue = 0]
* @param {int} [config.pool.validation = true]
* @param {int} [config.pool.validation = false]
* @param {Object} [config.defaults]
* @param {Boolean} [config.defaults.autoCommit]
* @param {Boolean} [config.defaults.cursor]
* @param {Boolean} [config.defaults.objectRows]
* @param {String} [config.defaults.naming]
*
* @constructor
*/
function DbPool(config) {
function Pool(config) {
EventEmitter.call(this);

@@ -75,7 +78,6 @@ this._dialect = config.dialect;

this._npool = makePool(this, config && config.pool);
Object.assign(this, sqlObjects);
this.defaults = config.defaults || {};
}
DbPool.prototype = {
Pool.prototype = {
get dialect() {

@@ -86,3 +88,3 @@ return this._dialect;

get isClosed() {
return this.state === lightningPool.PoolState.STOPPED;
return this.state === Pool.PoolState.STOPPED;
},

@@ -126,21 +128,18 @@

new MetaData(this, this._driver.metaOperator));
},
get PoolState() {
return lightningPool.Pool.PoolState;
}
};
Object.setPrototypeOf(DbPool.prototype, EventEmitter.prototype);
DbPool.prototype.constructor = DbPool;
Object.setPrototypeOf(Pool.prototype, EventEmitter.prototype);
Object.assign(Pool.prototype, sqlObjects);
Pool.prototype.constructor = Pool;
DbPool.prototype.close = function(force, callback) {
Pool.prototype.close = function(force, callback) {
this._npool.stop.apply(this._npool, arguments);
};
DbPool.prototype.start = function() {
Pool.prototype.start = function() {
this._npool.start();
};
DbPool.prototype.connect = function(callback) {
Pool.prototype.connect = function(callback) {

@@ -174,3 +173,3 @@ const self = this;

DbPool.prototype.execute = function(query, params, options, callback) {
Pool.prototype.execute = function(query, params, options, callback) {
const self = this;

@@ -212,3 +211,3 @@ if (typeof options === 'function') {

DbPool.prototype.test = function(callback) {
Pool.prototype.test = function(callback) {
const self = this;

@@ -227,3 +226,3 @@ if (!callback)

DbPool.prototype.select = function(column) {
Pool.prototype.select = function(column) {
const query = Object.create(SelectQuery.prototype);

@@ -235,3 +234,3 @@ SelectQuery.apply(query, arguments);

DbPool.prototype.insert = function(column) {
Pool.prototype.insert = function(column) {
const query = Object.create(InsertQuery.prototype);

@@ -243,3 +242,3 @@ InsertQuery.apply(query, arguments);

DbPool.prototype.update = function(table, values) {
Pool.prototype.update = function(table, values) {
const query = Object.create(UpdateQuery.prototype);

@@ -251,3 +250,3 @@ UpdateQuery.apply(query, arguments);

DbPool.prototype.delete = function(table) {
Pool.prototype.delete = function(table) {
const query = Object.create(DeleteQuery.prototype);

@@ -259,5 +258,7 @@ DeleteQuery.apply(query, arguments);

Pool.PoolState = lightningPool.PoolState;
/**
* Factory to create new pools for a given DbPool
* @param {DbPool} self
* Factory to create new pools for a given Pool
* @param {Pool} self
* @param {Object} options

@@ -269,2 +270,3 @@ * @return {Object}

options = options || {};
options.validation = options.validation == null ? false : options.validation;
options.resetOnReturn = true;

@@ -271,0 +273,0 @@

@@ -13,17 +13,17 @@ /* SQB

*/
const SqlObject = require('./sqlobjects/sqlobject');
const SelectQuery = require('./query/selectquery');
const InsertQuery = require('./query/insertquery');
const UpdateQuery = require('./query/updatequery');
const DeleteQuery = require('./query/deletequery');
const Raw = require('./sqlobjects/raw');
const Column = require('./sqlobjects/column');
const Join = require('./sqlobjects/join');
const Condition = require('./sqlobjects/condition');
const ConditionGroup = require('./sqlobjects/conditiongroup');
const Case = require('./sqlobjects/case');
const Serializer = require('./serializer');
const SqlObject = require('./sqlobject/SqlObject');
const SelectQuery = require('./query/SelectQuery');
const InsertQuery = require('./query/InsertQuery');
const UpdateQuery = require('./query/UpdateQuery');
const DeleteQuery = require('./query/DeleteQuery');
const Raw = require('./sqlobject/Raw');
const Column = require('./sqlobject/Column');
const Join = require('./sqlobject/Join');
const Condition = require('./sqlobject/Condition');
const ConditionGroup = require('./sqlobject/ConditionGroup');
const Case = require('./sqlobject/Case');
const Serializer = require('./Serializer');
const Pool = require('./connect/Pool');
const types = require('./types');
const sqbexport = require('./sqbexport');
const sqbexport = require('./helper/sqbexport');
const plugins = require('./plugins');

@@ -38,2 +38,3 @@

Pool: Pool,
PoolState: Pool.PoolState,

@@ -92,3 +93,3 @@ SqlObject: SqlObject,

*/
createPool: function(config) {
pool: function(config) {
return new Pool(config);

@@ -95,0 +96,0 @@ },

@@ -9,11 +9,42 @@ /* SQB

const ParamType = {
COLON: 1,
QUESTION_MARK: 2,
DOLLAR: 3
};
/** @export @enum {number} */
const ParamType = {};
/** @export */
ParamType.COLON = /** @type {!ParamType} */ (0);
/** @export */
ParamType.QUESTION_MARK = /** @type {!ParamType} */ (1);
/** @export */
ParamType.DOLLAR = /** @type {!ParamType} */ (2);
/** @export @enum {number} */
const JoinType = {};
/** @export */
JoinType.INNER = /** @type {!JoinType} */ (0);
/** @export */
JoinType.LEFT = /** @type {!JoinType} */ (1);
/** @export */
JoinType.LEFT_OUTER = /** @type {!JoinType} */ (2);
/** @export */
JoinType.RIGHT = /** @type {!JoinType} */ (3);
/** @export */
JoinType.RIGHT_OUTER = /** @type {!JoinType} */ (4);
/** @export */
JoinType.OUTER = /** @type {!JoinType} */ (5);
/** @export */
JoinType.FULL_OUTER = /** @type {!JoinType} */ (6);
module.exports = {
JoinType: JoinType,
ParamType: ParamType
};
{
"name": "sqb",
"description": "Plugin-driven, multi-dialect SQL query builder and Database connection framework for JavaScript",
"version": "0.12.1",
"version": "0.13.0",
"author": "Panates Ltd.",

@@ -6,0 +6,0 @@ "contributors": [

@@ -1,3 +0,8 @@

# SQB
<p align="center">
<img src="https://user-images.githubusercontent.com/3836517/32965280-1a2b63ce-cbe7-11e7-8ee1-ba47313503c5.png" width="500px" alt="SQB Logo"/>
</p>
<br>
[![NPM Version][npm-image]][npm-url]

@@ -15,3 +20,3 @@ [![NPM Downloads][downloads-image]][downloads-url]

SQB (Sequential Query Builder) is a Plugin-driven, multi-dialect SQL query builder and Database connection wrapper for NodeJS. SQB can be used as a pure sql query builder or database connection wrapper.
SQB is a Plugin-driven, multi-dialect SQL query builder and Database connection wrapper for NodeJS. SQB can be used as a pure sql query builder or database connection wrapper.

@@ -18,0 +23,0 @@ Take a look at [documentation](https://panates.gitbooks.io/sqb/content/) for details

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc