Skip to content

Commit

Permalink
Added small change to simplify logic of createConnection
Browse files Browse the repository at this point in the history
  • Loading branch information
danbeam committed Jul 12, 2010
1 parent 22c2812 commit 97040c3
Showing 1 changed file with 4 additions and 34 deletions.
38 changes: 4 additions & 34 deletions mysql-libmysqlclient.js
Expand Up @@ -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.