Socket
Socket
Sign inDemoInstall

mysql

Package Overview
Dependencies
Maintainers
1
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 0.9.1 to 0.9.2

.mysql-error.js.un~

31

package.json

@@ -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

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