mysql
Advanced tools
Comparing version 0.9.5 to 0.9.6
// Last v8 profile when running this test for 500k rows: | ||
// https://gist.github.com/f85c38010c038e5efe2e | ||
require('../../test/common'); | ||
var Client = require('mysql/client'), | ||
client = Client(TEST_CONFIG), | ||
var common = require('../../test/common'); | ||
var Client = require('../../lib/client'), | ||
client = common.createClient(), | ||
rows = 0; | ||
@@ -10,10 +10,9 @@ | ||
client.connect(); | ||
client.query('CREATE DATABASE '+TEST_DB, function(err) { | ||
if (err && err.number != Client.ERROR_DB_CREATE_EXISTS) { | ||
throw err; | ||
} | ||
client.query('CREATE DATABASE '+common.TEST_DB, function(err) { | ||
//if (err && err.number != Client.ERROR_DB_CREATE_EXISTS) { | ||
//throw err; | ||
//} | ||
}); | ||
client.query('USE '+TEST_DB); | ||
client.query('USE '+common.TEST_DB); | ||
var selectStart = +new Date; | ||
@@ -23,3 +22,3 @@ | ||
client | ||
.query('SELECT * FROM '+TEST_TABLE) | ||
.query('SELECT * FROM '+common.TEST_TABLE) | ||
.on('row', function(row) { | ||
@@ -26,0 +25,0 @@ rows++; |
@@ -165,2 +165,4 @@ var util = require('util'); | ||
Client.prototype.escape = function(val) { | ||
var escape = this.escape; | ||
if (val === undefined || val === null) { | ||
@@ -175,2 +177,7 @@ return 'NULL'; | ||
if (Array.isArray(val)) { | ||
var sanitized = val.map( function( v ) { return escape( v ); } ); | ||
return "'" + sanitized.join( "','" ) + "'"; | ||
} | ||
if (typeof val === 'object') { | ||
@@ -177,0 +184,0 @@ val = (typeof val.toISOString === 'function') |
{ | ||
"name": "mysql", | ||
"version": "0.9.5", | ||
"version": "0.9.6", | ||
"author": "Felix Geisendörfer <felix@debuggable.com> (http://debuggable.com/)", | ||
@@ -25,3 +25,4 @@ "description": "A pure node.js JavaScript Client implementing the MySQL protocol.", | ||
"node": "*" | ||
} | ||
}, | ||
"optionalDependencies": {} | ||
} |
# node-mysql | ||
[![Build Status](https://secure.travis-ci.org/felixge/node-mysql.png)](http://travis-ci.org/felixge/node-mysql) | ||
[![Build Status](https://secure.travis-ci.org/felixge/node-mysql.png?branch=master)](http://travis-ci.org/felixge/node-mysql) | ||
@@ -205,2 +205,8 @@ ## Purpose | ||
### How can I find out the number of rows affected by the last query? | ||
client.query('UPDATE my_table SET title = ?', function(err, info) { | ||
console.log(info.affectedRows); | ||
}); | ||
## Todo | ||
@@ -217,3 +223,7 @@ | ||
* Decide how to handle queries with multiple statements | ||
* Transactions | ||
A stop-gap solution to support multiple statements and transactions is | ||
available. Check it out here: http://github.com/bminer/node-mysql-queues | ||
## Contributors | ||
@@ -246,2 +256,8 @@ | ||
### v0.9.6 | ||
* Escape array values so they produce sql arrays (Roger Castells, Colin Smith) | ||
* docs: mention mysql transaction stop gap solution (Blake Miner) | ||
* docs: Mention affectedRows in FAQ (Michael Baldwin) | ||
### v0.9.5 | ||
@@ -248,0 +264,0 @@ |
@@ -44,3 +44,3 @@ var common = require('./common'); | ||
assert.equal(client.escape({foo:'bar'}), "'[object Object]'"); | ||
assert.equal(client.escape([1,2,3]), "'1,2,3'"); | ||
assert.equal(client.escape([1,2,3]), "'1','2','3'"); | ||
assert.equal(client.escape(new Date(Date.UTC(2011,6,6,6,6,6,6))), "'2011-07-06T06:06:06.006Z'"); | ||
@@ -47,0 +47,0 @@ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
2105168
307
1
51
3129