Skip to content

Commit d2c22fe

Browse files
committed
Doing early result release only when result is not buffered
1 parent 7f783d0 commit d2c22fe

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

lib/node-db

Submodule node-db updated 1 file

src/result.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,20 @@ node_db_mysql::Result::~Result() {
117117
}
118118

119119
void node_db_mysql::Result::free() throw() {
120+
this->release();
121+
120122
if (this->columns != NULL) {
121123
for (uint16_t i = 0; i < this->totalColumns; i++) {
122124
delete this->columns[i];
123125
}
124126
delete [] this->columns;
125127
}
128+
}
129+
130+
void node_db_mysql::Result::release() throw() {
126131
if (this->result != NULL) {
127132
mysql_free_result(this->result);
133+
this->result = NULL;
128134
}
129135
}
130136

src/result.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class Result : public node_db::Result {
2727

2828
explicit Result(MYSQL* connection) throw(node_db::Exception&);
2929
~Result();
30+
void release() throw();
3031
bool hasNext() const throw();
3132
char** next() throw(node_db::Exception&);
3233
unsigned long* columnLengths() throw(node_db::Exception&);

0 commit comments

Comments
 (0)