Skip to content

Commit 85f111a

Browse files
committed
Fixing issue where connect would throw SEGFAULT on some OSs
1 parent 76553a0 commit 85f111a

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ For more in depth changelog, check the Github Commits:
22

33
https://github.com/mariano/node-db-mysql/commits/master
44

5+
0.6.6
6+
-----
7+
* Fixed issue where new connections would throw SEGFAULT on some OSs
8+
59
0.6.5
610
-----
711
* Fixed issue where conversion of result fields to JS Date object could be truncated on some systems

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
, "description" : "MySQL database bindings for Node.JS"
33
, "keywords": ["database","db","native","binding","library","plugin","client","mysql","libmysql"]
44
, "homepage" : "http://nodejsdb.org/db-mysql"
5-
, "version" : "0.6.5"
5+
, "version" : "0.6.6"
66
, "engines" : { "node" : ">=0.4.1" }
77
, "maintainers" :
88
[ { "name": "Mariano Iglesias"

src/connection.cc

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,10 @@ node_db_mysql::Connection::Connection()
99
timeout(0),
1010
writeTimeout(0),
1111
connection(NULL) {
12-
this->connection = new MYSQL();
13-
if (this->connection == NULL) {
14-
throw node_db::Exception("Cannot create MYSQL handle");
15-
}
16-
mysql_init(this->connection);
1712
}
1813

1914
node_db_mysql::Connection::~Connection() {
2015
this->close();
21-
if (this->connection != NULL) {
22-
delete this->connection;
23-
}
2416
}
2517

2618
void node_db_mysql::Connection::setCharset(const std::string& charset) throw() {
@@ -69,6 +61,11 @@ bool node_db_mysql::Connection::isAlive(bool ping) throw() {
6961
void node_db_mysql::Connection::open() throw(node_db::Exception&) {
7062
this->close();
7163

64+
this->connection = mysql_init(NULL);
65+
if (this->connection == NULL) {
66+
throw node_db::Exception("Cannot create MYSQL handle");
67+
}
68+
7269
if (!this->charset.empty()) {
7370
mysql_options(this->connection, MYSQL_SET_CHARSET_NAME, this->charset.c_str());
7471
}

wscript

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ from os.path import exists
1111

1212
srcdir = "."
1313
blddir = "build"
14-
VERSION = "0.6.5"
14+
VERSION = "0.6.6"
1515

1616
def set_options(opt):
1717
opt.tool_options("compiler_cxx")

0 commit comments

Comments
 (0)