Skip to content
Browse files

version boost

  • Loading branch information...
1 parent f968859 commit f11e4e01d5245d57a976e59ec62ed5e706278efe @xdenser committed
View
3 .npmignore
@@ -1,3 +1,6 @@
test.js
.lock-wscript
build
+issues
+tests
+tools
View
2 README.md
@@ -24,7 +24,7 @@ As for now in plans are:
##Under Linux
You will need:
- NodeJS (tested with v0.6.0)
+ NodeJS (tested with v0.6.13)
Firebird (tested with v2.5)
All things below were tested on CentOS 5.5.
View
6 firebird.js
@@ -2,6 +2,7 @@ var binding = require("./build/Release/binding");
var stream = require("stream");
var util = require("util");
var events = require('events');
+
var SchunkSize = 4*1024;
@@ -120,11 +121,8 @@ exports.createConnection = function () {
return c;
};
-exports.createConnectionPool = function(settings){
-
-};
-// Allows further extention
+// Allows further extension
exports.binding = binding;
function Stream(blob){
View
2 package.json
@@ -1,5 +1,5 @@
{ "name" : "firebird"
-, "version" : "v0.0.8"
+, "version" : "v0.0.9"
, "description" : "Firebird binding to node, uses libfbclient."
, "author": "Denys Khanzhiyev"
, "main": "./firebird"
View
4 tests/config.js
@@ -6,8 +6,8 @@ See license text in LICENSE file
exports.cfg = {
// Database connection settings
-// db: "test.fdb",
- db: "192.168.80.143:test4.fdb",
+ db: "test.fdb",
+// db: "192.168.80.143:test4.fdb",
user: "sysdba",
password: "masterkey",
role: ""
View
2 tests/def/test-blob-stream.js
@@ -15,7 +15,7 @@ var
var
fs = require('fs');
var
- sys = require("sys");
+ sys = require("util");
var util = {
View
2 tests/def/test-concurrent-fetch.js
@@ -5,7 +5,7 @@ See license text in LICENSE file
// Load configuration
var cfg = require("../config").cfg;
-var sys = require("sys");
+var sys = require("util");
var zexports = {};
// Require modules
View
2 tests/def/test-datatypes.js
@@ -5,7 +5,7 @@ See license text in LICENSE file
// Load configuration
var cfg = require("../config").cfg;
-var sys = require("sys");
+var sys = require("util");
// Require modules
var
View
2 tests/def/test-prepared-stmt.js
@@ -6,7 +6,7 @@ See license text in LICENSE file
// Load configuration
var cfg = require("../config").cfg;
-var sys = require("sys");
+var sys = require("util");
// Require modules
var
View
3 tests/perf/select-full-async.js
@@ -14,7 +14,8 @@ http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
var con = fb.createConnection();
con.connect(cfg.db, cfg.user, cfg.password, cfg.role,function(){
- con.query('select * from rdb$relations',function(err,rs){
+ //con.query('select * from rdb$relations',function(err,rs){
+ con.query('select first 20 * from test_t where pid = 10',function(err,rs){
//var rows = [];
res.write('[');
rs.fetch("all",true,function(r){
View
9 tests/perf/select-full-sync.js
@@ -14,9 +14,14 @@ http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
var con = fb.createConnection();
con.connectSync(cfg.db, cfg.user, cfg.password, cfg.role);
- var rs = con.querySync('select * from rdb$relations');
+ // var rs = con.querySync('select * from rdb$relations');
+ var rs = con.querySync('select first 20 * from test_t where pid = 10');
var rows = rs.fetchSync("all",true);
con.disconnect();
- res.end(JSON.stringify(rows));
+ res.write('[');
+ rows.forEach(function(r){
+ res.write(JSON.stringify(r)+',');
+ });
+ res.end(']');
}).listen(1337, "127.0.0.1");
console.log('Server running at http://127.0.0.1:1337/');
View
27 tests/perf/select-one-async.js
@@ -13,36 +13,37 @@ var con = fb.createConnection();
con.connectSync(cfg.db, cfg.user, cfg.password, cfg.role),
busy = false,
next = [];
-
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
- function process(cn){
- busy = true;
- if(!con.inTransaction) con.startTransactionSync();
- con.query('select * from rdb$relations',function(err,rs){
- //var rows = [];
+ function doReq(){
+ //con.query('select * from rdb$relations',function(err,rs){
+ con.query('select first 20 * from test_t where pid = 10',function(err,rs){
res.write('[');
rs.fetch("all",true,function(r){
- // rows.push(r);
res.write(JSON.stringify(r)+',');
}, function(err){
res.end(']');
- //res.end(util.inspect(rows));
- con.commitSync();
- busy = false;
- var n = next.pop();
- if(n) n();
+ con.commit(function(){
+ busy = false;
+ var n = next.pop();
+ if(n) n();
+ });
});
});
+ }
+
+ function process(){
+ busy = true;
+ if(!con.inTransaction) con.startTransaction(doReq);
+ else doReq();
}
if(busy) next.push(function(){
process();
});
else process();
-
}).listen(1337, "127.0.0.1");
console.log('Server running at http://127.0.0.1:1337/');
View
9 tests/perf/select-one-sync.js
@@ -16,9 +16,14 @@ var con = fb.createConnection();
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
if(!con.inTransaction) con.startTransactionSync();
- var rs = con.querySync('select * from rdb$relations');
+ //var rs = con.querySync('select * from rdb$relations');
+ var rs = con.querySync('select * from test_t where pid = 10');
var rows = rs.fetchSync("all",true);
- res.end(util.inspect(rows));
+ res.write('[');
+ rows.forEach(function(r){
+ res.write(JSON.stringify(r)+',');
+ });
+ res.end(']');
con.commitSync();
}).listen(1337, "127.0.0.1");
console.log('Server running at http://127.0.0.1:1337/');
View
23 tests/perf/select-pool-async.js
@@ -17,10 +17,12 @@ function ConnectionPool()
this.conns = [];
this.busy = [];
this.MaxConns = 5;
- this.newConn = function(){
+ this.newConn = function(cb){
var c = fb.createConnection();
- c.connectSync(cfg.db, cfg.user, cfg.password, cfg.role);
- this.conns.push(c);
+ c.connect(cfg.db, cfg.user, cfg.password, cfg.role,function(){
+ this.conns.push(c);
+ cb();
+ });
};
this.get = function(cb)
{
@@ -37,8 +39,9 @@ function ConnectionPool()
});
}
else {
- this.newConn();
- this.get(cb);
+ this.newConn(function(){
+ this.get(cb);
+ });
}
};
@@ -64,11 +67,11 @@ var pool = new ConnectionPool();
pool.setMaxListeners(2000);
function exec(con,res){
- con.query('select * from rdb$relations',function(err,rs){
+ //con.query('select * from rdb$relations',function(err,rs){
+ con.query('select first 5 * from test_t where pid = 10',function(err,rs){
res.write('[');
rs.fetch("all",true,function(r){
res.write(JSON.stringify(r)+',');
-
},function(err){
res.end(']');
con.commit(function(){
@@ -76,15 +79,11 @@ function exec(con,res){
});
});
});
- };
+};
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
-// console.log(stmt);
-
pool.get(function(con){
- // if(!con.inTransaction) con.startTransactionSync();
-
if(!con.inTransaction) con.startTransaction(function(err){
if(!err) exec(con,res);
});
View
36 tests/perf/select-prep-async-pool.js
@@ -17,13 +17,17 @@ function StatementPool()
this.conns = [];
this.busy = [];
this.MaxConns = 5;
- this.newConn = function(){
+ this.newConn = function(cb){
var c ={
conn: fb.createConnection()
- };
- c.conn.connectSync(cfg.db, cfg.user, cfg.password, cfg.role);
- c.stmt = c.conn.prepareSync('select * from rdb$relations');
- this.conns.push(c);
+ }, self = this;
+
+ c.conn.connect(cfg.db, cfg.user, cfg.password, cfg.role, function(){
+ c.stmt = c.conn.prepareSync('select * from rdb$relations');
+ // c.stmt = c.conn.prepareSync('select first 5 * from test_t where pid = ?');
+ self.conns.push(c);
+ cb();
+ });
};
this.get = function(cb)
{
@@ -40,8 +44,9 @@ function StatementPool()
});
}
else {
- this.newConn();
- this.get(cb);
+ this.newConn(function(){
+ this.get(cb);
+ });
}
};
this.release = function(con){
@@ -68,15 +73,12 @@ pool.setMaxListeners(2000);
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
-// console.log(stmt);
pool.get(function(con){
var exec = function(){
- con.stmt.exec();
+ con.stmt.exec(10);
con.stmt.once('result',function(err){
- // var rows = [];
res.write('[');
con.stmt.fetch("all",true,function(r){
- //rows.push(r);
res.write(JSON.stringify(r)+',');
}, function(err){
res.end(']');
@@ -87,16 +89,10 @@ http.createServer(function (req, res) {
});
};
- var resp = function(){
- if(!con.conn.inTransaction) con.conn.startTransaction(function(err){
+ if(!con.conn.inTransaction) con.conn.startTransaction(function(err){
if(!err) exec();
- });
- else exec();
- };
-
-
- resp();
-
+ });
+ else exec();
});
}).listen(1337, "127.0.0.1");
View
2 wscript
@@ -4,7 +4,7 @@ from os.path import exists
srcdir = '.'
blddir = 'build'
-VERSION = '0.0.8'
+VERSION = '0.0.9'
def set_options(opt):
opt.tool_options('compiler_cxx')

0 comments on commit f11e4e0

Please sign in to comment.
Something went wrong with that request. Please try again.