Permalink
Browse files

Added small change to simplify logic of createConnection

  • Loading branch information...
danbeam committed Jul 12, 2010
1 parent 22c2812 commit 97040c3e7a5d4673ca6f340d8a9bc69da8e398d8
Showing with 4 additions and 34 deletions.
  1. +4 −34 mysql-libmysqlclient.js
@@ -4,40 +4,10 @@ Copyright (C) 2010, Oleg Efimov <efimovov@gmail.com>
See license text in LICENSE file
*/
var
binding = require("./mysql_bindings"),
sys = require("sys");
var binding = require("./mysql_bindings");
function createConnection(servername, user, password, dbname, port, socket)
{
exports.createConnection = function () {
var db = new binding.MysqlConn();
if (typeof socket !== "undefined") {
db.connect(servername, user, password, dbname, port, socket);
} else {
if (typeof port !== "undefined") {
db.connect(servername, user, password, dbname, port);
} else {
if (typeof dbname !== "undefined") {
db.connect(servername, user, password, dbname);
} else {
if (typeof password !== "undefined") {
db.connect(servername, user, password);
} else {
if (typeof user !== "undefined") {
db.connect(servername, user);
} else {
if (typeof servername !== "undefined") {
db.connect(servername);
}
}
}
}
}
}
db.connect.apply(this, Array.prototype.slice.call(arguments, 0, 5));
return db;
}
exports.createConnection = createConnection;
};

0 comments on commit 97040c3

Please sign in to comment.