Comparing version 0.9.1 to 0.9.2
@@ -1,6 +0,25 @@ | ||
{ "name" : "mysql" | ||
, "version": "0.9.1" | ||
, "devDependencies": {"gently": ">=0.8.0"} | ||
, "main" : "./lib/mysql" | ||
, "scripts" : { "test" : "make test" } | ||
} | ||
{ | ||
"name": "mysql", | ||
"version": "0.9.2", | ||
"author": "Felix Geisendörfer <felix@debuggable.com> (http://debuggable.com/)", | ||
"description": "A pure node.js JavaScript Client implementing the MySQL protocol.", | ||
"homepage": "https://github.com/felixge/node-mysql", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/felixge/node-mysql.git" | ||
}, | ||
"main": "./index", | ||
"scripts": { | ||
"test": "make test-all" | ||
}, | ||
"dependencies": { | ||
"hashish": "0.0.4" | ||
}, | ||
"devDependencies": { | ||
"gently": "0.8.0", | ||
"far": "0.0.6" | ||
}, | ||
"engines": { | ||
"node": "*" | ||
} | ||
} |
213
Readme.md
@@ -7,121 +7,81 @@ # node-mysql | ||
## Current status | ||
## Support this module | ||
This module was developed for [Transloadit](http://transloadit.com/), a service focused on uploading | ||
and encoding images and videos. It is currently used in production there, but since the service is not | ||
very heavy on database interaction your milage may vary. | ||
If you like this module, check out and spread the word about our service | ||
[transloadit.com][]. We provide file uploading and encoding functionality to | ||
other applications, and have performed billions of queries with this module so | ||
far. | ||
## Contributors | ||
[transloadit.com]: http://transloadit.com/ | ||
* Felix Geisendörfer ([felixge](http://github.com/felixge/node-mysql/commits/master?author=felixge)) - Author and maintainer | ||
* Bert Belder ([piscisaureus](http://github.com/felixge/node-mysql/commits/master?author=piscisaureus)) | ||
* Alan Gutierrez ([bigeasy](http://github.com/felixge/node-mysql/commits/master?author=bigeasy)) | ||
* Brian ([mscdex](http://github.com/felixge/node-mysql/commits/master?author=mscdex)) | ||
* Cal Henderson ([iamcal](http://github.com/felixge/node-mysql/commits/master?author=iamcal)) | ||
* Frank Grimm ([FrankGrimm](http://github.com/felixge/node-mysql/commits/master?author=FrankGrimm)) | ||
* Nick Payne ([makeusabrew](http://github.com/felixge/node-mysql/commits/master?author=makeusabrew)) | ||
## Sponsors | ||
* [Joyent](http://www.joyent.com/) - Main sponsor, you should check out their [node.js hosting](https://no.de/). | ||
* [pinkbike.com](http://pinkbike.com/) - The most awesome biking site there is | ||
This is a rather large project requiring a significant amount of my limited resources. | ||
If your company could benefit from a well-engineered non-blocking mysql driver, and | ||
wants to support this project, I would greatly appriciate any sponsorship you may be | ||
able to provide. All sponsors will get lifetime display in this readme, priority | ||
support on problems, and votes on roadmap decisions. If you are interested, contact | ||
me at [felix@debuggable.com](mailto:felix@debuggable.com) for details. | ||
Of course I'm also happy about code contributions. If you're interested in | ||
working on features, just get in touch so we can talk about API design and | ||
testing. | ||
[transloadit]: http://transloadit.com/ | ||
## Installation | ||
npm install mysql | ||
``` | ||
npm install mysql | ||
``` | ||
Or if you don't want to use npm / run the latest source: | ||
**Important**: If you are upgrading from 0.9.1 or below, there have been | ||
backwards incompatible changes in the API. Please read the [upgrading guide][]. | ||
cd ~/.node_libraries | ||
git clone git://github.com/felixge/node-mysql.git mysql | ||
[upgrading guide]: https://github.com/felixge/node-mysql/wiki/Upgrading-to-0.9.2+ | ||
## Compatibility | ||
## Usage | ||
This module is compatible with node v0.4.x. | ||
``` javascript | ||
var mysql = require('mysql'); | ||
var TEST_DATABASE = 'nodejs_mysql_test'; | ||
var TEST_TABLE = 'test'; | ||
var client = mysql.createClient({ | ||
user: 'root', | ||
password: 'root', | ||
}); | ||
If you need to work with an older node version, download v0.9.0. It supports | ||
node >= v0.1.102. | ||
client.query('CREATE DATABASE '+TEST_DATABASE, function(err) { | ||
if (err && err.number != mysql.ERROR_DB_CREATE_EXISTS) { | ||
throw err; | ||
} | ||
}); | ||
## Design Goals | ||
// If no callback is provided, any errors will be emitted as `'error'` | ||
// events by the client | ||
client.query('USE '+TEST_DATABASE); | ||
* TDD: All code is written using test driven development, code coverage should approach 100% | ||
* Simplicity: The MySQL protocol is easy, a good parser should reflect that | ||
* Efficiency: Use fast algorithms, buffers and as little memory as possible. | ||
* Portability: Should run anywhere node runs | ||
* Completeness: The goal is to support the full MySQL API. | ||
* Compatibility: MySql >= 4.1 | ||
client.query( | ||
'CREATE TEMPORARY TABLE '+TEST_TABLE+ | ||
'(id INT(11) AUTO_INCREMENT, '+ | ||
'title VARCHAR(255), '+ | ||
'text TEXT, '+ | ||
'created DATETIME, '+ | ||
'PRIMARY KEY (id))' | ||
); | ||
## Tutorial | ||
client.query( | ||
'INSERT INTO '+TEST_TABLE+' '+ | ||
'SET title = ?, text = ?, created = ?', | ||
['super cool', 'this is a nice text', '2010-08-16 10:00:23'] | ||
); | ||
var Client = require('mysql').Client, | ||
client = new Client(), | ||
TEST_DATABASE = 'nodejs_mysl_test', | ||
TEST_TABLE = 'test'; | ||
var query = client.query( | ||
'INSERT INTO '+TEST_TABLE+' '+ | ||
'SET title = ?, text = ?, created = ?', | ||
['another entry', 'because 2 entries make a better test', '2010-08-16 12:42:15'] | ||
); | ||
client.user = 'root'; | ||
client.password = 'root'; | ||
client.query( | ||
'SELECT * FROM '+TEST_TABLE, | ||
function selectCb(err, results, fields) { | ||
if (err) { | ||
throw err; | ||
} | ||
client.connect(); | ||
console.log(results); | ||
console.log(fields); | ||
client.end(); | ||
} | ||
); | ||
``` | ||
client.query('CREATE DATABASE '+TEST_DATABASE, function(err) { | ||
if (err && err.number != Client.ERROR_DB_CREATE_EXISTS) { | ||
throw err; | ||
} | ||
}); | ||
// If no callback is provided, any errors will be emitted as `'error'` | ||
// events by the client | ||
client.query('USE '+TEST_DATABASE); | ||
client.query( | ||
'CREATE TEMPORARY TABLE '+TEST_TABLE+ | ||
'(id INT(11) AUTO_INCREMENT, '+ | ||
'title VARCHAR(255), '+ | ||
'text TEXT, '+ | ||
'created DATETIME, '+ | ||
'PRIMARY KEY (id))' | ||
); | ||
client.query( | ||
'INSERT INTO '+TEST_TABLE+' '+ | ||
'SET title = ?, text = ?, created = ?', | ||
['super cool', 'this is a nice text', '2010-08-16 10:00:23'] | ||
); | ||
var query = client.query( | ||
'INSERT INTO '+TEST_TABLE+' '+ | ||
'SET title = ?, text = ?, created = ?', | ||
['another entry', 'because 2 entries make a better test', '2010-08-16 12:42:15'] | ||
); | ||
client.query( | ||
'SELECT * FROM '+TEST_TABLE, | ||
function selectCb(err, results, fields) { | ||
if (err) { | ||
throw err; | ||
} | ||
console.log(results); | ||
console.log(fields); | ||
client.end(); | ||
} | ||
); | ||
## API | ||
### new mysql.Client([options]) | ||
### mysql.createClient([options]) | ||
@@ -159,6 +119,2 @@ Creates a new client instance. Any client property can be set using the | ||
### client.connect([cb]) | ||
Initiates a connection to the specified host server. | ||
### client.query(sql, [params, cb]) | ||
@@ -254,2 +210,3 @@ | ||
* Implement retry | ||
* Pause / resume | ||
@@ -260,7 +217,29 @@ * Remaining mysql commands | ||
* Compression | ||
* Performance profiling | ||
* Handle re-connect after bad credential error (should query queue be kept?) | ||
* Deal with stale connections / other potential network issues | ||
* Decide how to handle queries with multiple statements | ||
## Contributors | ||
[Click here][contributors] for a full list of contributors. | ||
[contributors]: https://github.com/felixge/node-mysql/contributors | ||
## Sponsors | ||
* [Joyent](http://www.joyent.com/) - Main sponsor, you should check out their [node.js hosting](https://no.de/). | ||
* [pinkbike.com](http://pinkbike.com/) - The most awesome biking site there is | ||
This is a rather large project requiring a significant amount of my limited resources. | ||
If your company could benefit from a well-engineered non-blocking mysql driver, and | ||
wants to support this project, I would greatly appriciate any sponsorship you may be | ||
able to provide. All sponsors will get lifetime display in this readme, priority | ||
support on problems, and votes on roadmap decisions. If you are interested, contact | ||
me at [felix@debuggable.com](mailto:felix@debuggable.com) for details. | ||
Of course I'm also happy about code contributions. If you're interested in | ||
working on features, just get in touch so we can talk about API design and | ||
testing. | ||
[transloadit]: http://transloadit.com/ | ||
## Changelog | ||
@@ -273,3 +252,3 @@ | ||
[See Commits](https://github.com/felixge/node-formidable/compare/v0.9.0...v0.9.1) | ||
[See Commits](https://github.com/felixge/node-mysql/compare/v0.9.0...v0.9.1) | ||
@@ -280,11 +259,11 @@ ### Older releases | ||
* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) | ||
* [v0.8.0](https://github.com/felixge/node-formidable/compare/v0.7.0...v0.9.0) | ||
* [v0.7.0](https://github.com/felixge/node-formidable/compare/v0.6.0...v0.9.0) | ||
* [v0.6.0](https://github.com/felixge/node-formidable/compare/v0.5.0...v0.9.0) | ||
* [v0.5.0](https://github.com/felixge/node-formidable/compare/v0.4.0...v0.9.0) | ||
* [v0.4.0](https://github.com/felixge/node-formidable/compare/v0.3.0...v0.9.0) | ||
* [v0.3.0](https://github.com/felixge/node-formidable/compare/v0.2.0...v0.9.0) | ||
* [v0.2.0](https://github.com/felixge/node-formidable/compare/v0.1.0...v0.9.0) | ||
* [v0.1.0](https://github.com/felixge/node-formidable/commits/v0.1.0) | ||
* [v0.9.0](https://github.com/felixge/node-mysql/compare/v0.8.0...v0.9.0) | ||
* [v0.8.0](https://github.com/felixge/node-mysql/compare/v0.7.0...v0.8.0) | ||
* [v0.7.0](https://github.com/felixge/node-mysql/compare/v0.6.0...v0.7.0) | ||
* [v0.6.0](https://github.com/felixge/node-mysql/compare/v0.5.0...v0.6.0) | ||
* [v0.5.0](https://github.com/felixge/node-mysql/compare/v0.4.0...v0.5.0) | ||
* [v0.4.0](https://github.com/felixge/node-mysql/compare/v0.3.0...v0.4.0) | ||
* [v0.3.0](https://github.com/felixge/node-mysql/compare/v0.2.0...v0.3.0) | ||
* [v0.2.0](https://github.com/felixge/node-mysql/compare/v0.1.0...v0.2.0) | ||
* [v0.1.0](https://github.com/felixge/node-mysql/commits/v0.1.0) | ||
@@ -291,0 +270,0 @@ ## License |
@@ -0,9 +1,17 @@ | ||
var mysql = require('..'); | ||
var path = require('path'); | ||
require.paths.unshift(path.dirname(__dirname)+'/lib'); | ||
var util = require('util'); | ||
var parent = module.parent.filename; | ||
if (parent.match(/test\/system/) || parent.match(/benchmark/)) { | ||
var root = path.join(__dirname, '../'); | ||
exports.dir = { | ||
root: root, | ||
lib: root + '/lib', | ||
fixture: root + '/test/fixture', | ||
}; | ||
exports.TEST_DB = 'node_mysql_test'; | ||
exports.TEST_TABLE = 'posts'; | ||
exports.createClient = function() { | ||
try { | ||
global.TEST_CONFIG = require('./config'); | ||
var config = require('./config'); | ||
} catch (e) { | ||
@@ -13,22 +21,6 @@ console.log('Skipping. See test/config.template.js for more information.'); | ||
} | ||
} | ||
global.TEST_DB = 'node_mysql_test'; | ||
global.TEST_TABLE = 'posts'; | ||
global.TEST_FIXTURES = path.join(__dirname, 'fixture'); | ||
global.Gently = require('gently'); | ||
global.assert = require('assert'); | ||
global.p = function(val) { | ||
util.error(util.inspect(val)); | ||
return mysql.createClient(config); | ||
}; | ||
global.GENTLY = new Gently(); | ||
global.HIJACKED = GENTLY.hijacked; | ||
// Stupid new feature in node that complains about gently attaching too many | ||
// listeners to process 'exit'. This is a workaround until I can think of a | ||
// better way to deal with this. | ||
if (process.setMaxListeners) { | ||
process.setMaxListeners(Infinity); | ||
} | ||
exports.fastOrSlow = require('fast-or-slow'); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
1
1
2003461
1
2
75
3171
267
14
+ Addedhashish@0.0.4
+ Addedarray-buffer-byte-length@1.0.1(transitive)
+ Addedarraybuffer.prototype.slice@1.0.3(transitive)
+ Addedavailable-typed-arrays@1.0.7(transitive)
+ Addedcall-bind@1.0.7(transitive)
+ Addeddata-view-buffer@1.0.1(transitive)
+ Addeddata-view-byte-length@1.0.1(transitive)
+ Addeddata-view-byte-offset@1.0.0(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddefine-properties@1.2.1(transitive)
+ Addedes-abstract@1.23.3(transitive)
+ Addedes-define-property@1.0.0(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedes-object-atoms@1.0.0(transitive)
+ Addedes-set-tostringtag@2.0.3(transitive)
+ Addedes-to-primitive@1.2.1(transitive)
+ Addedfor-each@0.3.3(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedfunction.prototype.name@1.1.6(transitive)
+ Addedfunctions-have-names@1.2.3(transitive)
+ Addedget-intrinsic@1.2.4(transitive)
+ Addedget-symbol-description@1.0.2(transitive)
+ Addedglobalthis@1.0.4(transitive)
+ Addedgopd@1.0.1(transitive)
+ Addedhas-bigints@1.0.2(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.0.3(transitive)
+ Addedhas-symbols@1.0.3(transitive)
+ Addedhas-tostringtag@1.0.2(transitive)
+ Addedhashish@0.0.4(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedinternal-slot@1.0.7(transitive)
+ Addedis-array-buffer@3.0.4(transitive)
+ Addedis-bigint@1.0.4(transitive)
+ Addedis-boolean-object@1.1.2(transitive)
+ Addedis-callable@1.2.7(transitive)
+ Addedis-data-view@1.0.1(transitive)
+ Addedis-date-object@1.0.5(transitive)
+ Addedis-negative-zero@2.0.3(transitive)
+ Addedis-number-object@1.0.7(transitive)
+ Addedis-regex@1.1.4(transitive)
+ Addedis-shared-array-buffer@1.0.3(transitive)
+ Addedis-string@1.0.7(transitive)
+ Addedis-symbol@1.0.4(transitive)
+ Addedis-typed-array@1.1.13(transitive)
+ Addedis-weakref@1.0.2(transitive)
+ Addedisarray@2.0.5(transitive)
+ Addedobject-inspect@1.13.2(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedobject.assign@4.1.5(transitive)
+ Addedpossible-typed-array-names@1.0.0(transitive)
+ Addedregexp.prototype.flags@1.5.2(transitive)
+ Addedsafe-array-concat@1.1.2(transitive)
+ Addedsafe-regex-test@1.0.3(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedset-function-name@2.0.2(transitive)
+ Addedside-channel@1.0.6(transitive)
+ Addedstring.prototype.trim@1.2.9(transitive)
+ Addedstring.prototype.trimend@1.0.8(transitive)
+ Addedstring.prototype.trimstart@1.0.8(transitive)
+ Addedtraverse@0.6.10(transitive)
+ Addedtyped-array-buffer@1.0.2(transitive)
+ Addedtyped-array-byte-length@1.0.1(transitive)
+ Addedtyped-array-byte-offset@1.0.2(transitive)
+ Addedtyped-array-length@1.0.6(transitive)
+ Addedtypedarray.prototype.slice@1.0.3(transitive)
+ Addedunbox-primitive@1.0.2(transitive)
+ Addedwhich-boxed-primitive@1.0.2(transitive)
+ Addedwhich-typed-array@1.1.15(transitive)