Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

preparing for npm

  • Loading branch information...
commit 57c6522ce0b30c9f021d1d6b7a1c6a5627f6dba7 1 parent 34773cc
@sidorares sidorares authored
View
4 README
@@ -2,7 +2,7 @@ Mysql client module for node.js, written in JavaScript. No other mysql runtime r
simple example:
-var db = require("mysql/client").createTCPClient(); // localhost:3306 by default
+var db = require("mysql-native").createTCPClient(); // localhost:3306 by default
db.auto_prepare = true;
function dump_rows(cmd)
{
@@ -28,8 +28,6 @@ highlights:
== API:
-mysql/client:
-
createClient(socket) - create client from duplex stream (TODO: add default path to local server socket)
createTCPClient(host, port) - create tcp client, default host 127.0.0.1, port 3306
createUNIXClient(path) - connect to unix domain socket, default is /var/run/mysqld/mysqld.sock
View
7 examples/myhttp.js
@@ -3,20 +3,19 @@
var sys = require("sys");
var http = require("http");
var url = require("url");
-var client = require("mysql/client");
-var pool = require("mysql/pool").pool;
+var mysql = require("mysql-native");
process.addListener('uncaughtException', function(err) { sys.p(err); });
function test_datasource()
{
- var db = client.createTCPClient();
+ var db = mysql.createTCPClient();
db.auto_prepare = true;
db.auth("test", "testuser", "testpass");
return db;
}
-var dbpool = new pool(test_datasource, 16);
+var dbpool = new mysql.pool(test_datasource, 16);
dbpool.max_connections = 32;
function dump_row(row, res)
View
0  lib/client.js → lib/mysql-native/client.js
File renamed without changes
View
0  lib/commands.js → lib/mysql-native/commands.js
File renamed without changes
View
0  lib/constants.js → lib/mysql-native/constants.js
File renamed without changes
View
0  lib/containers.js → lib/mysql-native/containers.js
File renamed without changes
View
7 lib/mysql-native/index.js
@@ -0,0 +1,7 @@
+var client = require('./client');
+var pool = require('./pool');
+
+exports.createClient = client.createClient;
+exports.createTCPClient = client.createTCPClient;
+exports.createUNIXClient = client.createUNIXClient;
+exports.pool = pool.pool;
View
0  lib/pool.js → lib/mysql-native/pool.js
File renamed without changes
View
0  lib/serializers.js → lib/mysql-native/serializers.js
File renamed without changes
View
0  lib/websql.js → lib/mysql-native/websql.js
File renamed without changes
View
4 package.json
@@ -0,0 +1,4 @@
+{ "name" : "mysql-native"
+, "version": "0.4.0"
+, "main" : "./lib/mysql-native"
+}
View
2  tests/test_autoprepare.js
@@ -1,7 +1,7 @@
#!/usr/local/bin/node
var sys = require("sys");
-var db = require("mysql/client").createTCPClient();
+var db = require("mysql-native").createTCPClient();
db.auth("test", "testuser", "testpass");
View
3  tests/test_execute.js
@@ -1,8 +1,9 @@
#!/usr/local/bin/node
var sys = require("sys");
-var db = require("mysql/client").createTCPClient();
+var mysql = require("mysql-native");
+var db = mysql.createTCPClient();
db.auth("test", "testuser", "testpass");
db.prepare(process.argv[2]);
var examplecmd = db.execute(process.argv[2], );
View
2  tests/test_null_param.js
@@ -1,7 +1,7 @@
#!/usr/local/bin/node
var sys = require("sys");
-var db = require("mysql/client").createTCPClient(); // localhost:3306 by default
+var db = require("mysql-native").createTCPClient(); // localhost:3306 by default
db.auto_prepare = true;
function dump_rows(cmd)
{
View
7 tests/test_pool.js
@@ -1,8 +1,7 @@
#!/usr/local/bin/node
var sys = require("sys");
-var client = require("mysql/client");
-var pool = require("mysql/pool").pool;
+var mysql = require("mysql-native");
function dump_rows(cmd)
{
@@ -11,13 +10,13 @@ function dump_rows(cmd)
function createConnection()
{
- var db = client.createTCPClient();
+ var db = mysql.createTCPClient();
db.auto_prepare = true;
db.auth("test", "testuser", "testpass");
return db;
}
-var dbpool = new pool(createConnection, 3);
+var dbpool = new mysql.pool(createConnection, 3);
function test_pool(p)
{
View
2  tests/test_query.js
@@ -1,7 +1,7 @@
#!/usr/local/bin/node
var sys = require("sys");
-var db = require("mysql/client").createTCPClient();
+var db = require("mysql-native").createTCPClient();
db.auth("test", "testuser", "testpass").addListener('authorized', function(s) { sys.puts("authorized as " + sys.inspect(s)); });
db.query(process.argv[2]).addListener('row', function(r) { sys.puts("row: " + sys.inspect(r)); } );
View
2  tests/test_simple.js
@@ -1,7 +1,7 @@
#!/usr/local/bin/node
var sys = require("sys");
-var db = require("mysql/client").createTCPClient(); // localhost:3306 by default
+var db = require("mysql-native").createTCPClient(); // localhost:3306 by default
db.auto_prepare = true;
function dump_rows(cmd)
{
View
2  tests/test_stmt_parameters.js
@@ -1,7 +1,7 @@
#!/usr/local/bin/node
var sys = require("sys");
-var db = require("mysql/client").createTCPClient();
+var db = require("mysql-native").createTCPClient();
db.auth("test", "testuser", "testpass");
//var sql = "select null,null,2,null,1,null,null";
View
2  tests/test_stress.js
@@ -2,7 +2,7 @@
var sys = require("sys");
-var createTCPClient = require("mysql/client").createTCPClient;
+var createTCPClient = require("mysql-native").createTCPClient;
var numclients = process.argv[2];
var clients = []
Please sign in to comment.
Something went wrong with that request. Please try again.