Socket
Socket
Sign inDemoInstall

mysql

Package Overview
Dependencies
Maintainers
9
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mysql - npm Package Compare versions

Comparing version 2.6.1 to 2.6.2

5

Changes.md

@@ -7,2 +7,7 @@ # Changes

## v2.6.2 (2015-04-14)
* Fix `Connection.createQuery` for no SQL #1058
* Update `bignumber.js` to 2.0.7
## v2.6.1 (2015-03-26)

@@ -9,0 +14,0 @@

42

lib/Connection.js

@@ -35,3 +35,3 @@ var Crypto = require('crypto');

Connection.createQuery = function(sql, values, cb) {
Connection.createQuery = function createQuery(sql, values, callback) {
if (sql instanceof Query) {

@@ -41,23 +41,33 @@ return sql;

var cb = bindToCurrentDomain(callback);
var options = {};
if (typeof sql === 'function') {
cb = bindToCurrentDomain(sql);
return new Query(options, cb);
}
if (typeof sql === 'object') {
// query(options, cb)
options = sql;
for (var prop in sql) {
options[prop] = sql[prop];
}
if (typeof values === 'function') {
cb = values;
} else if (typeof values !== 'undefined') {
cb = bindToCurrentDomain(values);
} else if (values !== undefined) {
options.values = values;
}
} else if (typeof values === 'function') {
// query(sql, cb)
cb = values;
options.sql = sql;
return new Query(options, cb);
}
options.sql = sql;
options.values = values;
if (typeof values === 'function') {
cb = bindToCurrentDomain(values);
options.values = undefined;
} else {
// query(sql, values, cb)
options.sql = sql;
options.values = values;
}
return new Query(options, bindToCurrentDomain(cb));
return new Query(options, cb);
};

@@ -185,3 +195,5 @@

query.sql = this.format(query.sql, query.values);
if (query.sql) {
query.sql = this.format(query.sql, query.values);
}

@@ -188,0 +200,0 @@ return this._protocol._enqueue(query);

{
"name": "mysql",
"description": "A node.js driver for mysql. It is written in JavaScript, does not require compiling, and is 100% MIT licensed.",
"version": "2.6.1",
"version": "2.6.2",
"license": "MIT",

@@ -15,3 +15,3 @@ "author": "Felix Geisendörfer <felix@debuggable.com> (http://debuggable.com/)",

"dependencies": {
"bignumber.js": "2.0.5",
"bignumber.js": "2.0.7",
"readable-stream": "~1.1.13",

@@ -18,0 +18,0 @@ "require-all": "~1.0.0"

@@ -540,8 +540,7 @@ # mysql

In the MySQL library library, the most basic way to perform a query is to call
the `.query()` method on an object (like on a `Connection`, `Pool`, `PoolNamespace`
or other similar objects).
The most basic way to perform a query is to call the `.query()` method on an object
(like on a `Connection`, `Pool`, `PoolNamespace` or other similar objects).
The simplest form on query comes as `.query(sqlString, callback)`, where a string
of a MySQL query is the first argument and the second is a callback:
The simplest form of .`query()` is `.query(sqlString, callback)`, where a SQL string
is the first argument and the second is a callback:

@@ -556,4 +555,4 @@ ```js

The second form `.query(sqlString, parameters, callback)` comes when using
placeholders (see [escaping query values](#escaping-query-values)):
The second form `.query(sqlString, values, callback)` comes when using
placeholder values (see [escaping query values](#escaping-query-values)):

@@ -585,2 +584,20 @@ ```js

Note that a combination of the second and third forms can be used where the
placeholder values are passes as an argument and not in the options object.
The `values` argument will override the `values` in the option object.
```js
connection.query({
sql: 'SELECT * FROM `books` WHERE `author` = ?',
timeout: 40000, // 40s
},
['David'],
function (error, results, fields) {
// error will be an Error if one occurred during the query
// results will contain the results of the query
// fields will contain information about the returned results fields (if any)
}
);
```
## Escaping query values

@@ -998,3 +1015,3 @@

A ping packet can be sent over a connection using the `connection.ping` method. This
mehtod will send a ping packet to the server and when the server responds, the callback
method will send a ping packet to the server and when the server responds, the callback
will fire. If an error occurred, the callback will fire with an error argument.

@@ -1097,3 +1114,3 @@

Note: `'error'` are special in node. If they occur without an attached
Note: `'error'` events are special in node. If they occur without an attached
listener, a stack trace is printed and your process is killed.

@@ -1100,0 +1117,0 @@

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