Skip to content

Commit

Permalink
Merge pull request #137 from pec1985/timob-12941
Browse files Browse the repository at this point in the history
[TIMOB-12941] Fixed Database returning _undefined_ if results were 0
  • Loading branch information
pec1985 committed Jul 26, 2013
2 parents 9c78ee1 + 11843c1 commit 17e0176
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/tibb/NativeDBObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ int NativeDBObject::execute(NativeResultSetObject* resultSet, string command, ve
}

stepResult = sqlite3_step(statement);
int effectedRows = 0;

if (stepResult == SQLITE_DONE) {
sqlite3_finalize(statement);
resultSet->effectedRows = effectedRows;
resultSet->statement = statement;
return NATIVE_ERROR_OK;
}

int effectedRows = 0;
while (true) {
if (stepResult == SQLITE_ROW) {
effectedRows++;
Expand Down
2 changes: 1 addition & 1 deletion src/tibb/TiDBObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Handle<Value> TiDBObject::_execute(void* userContext, TiObject*, const Arguments
}


if (nativeResultSet->effectedRows > 0) {
if (nativeResultSet->effectedRows >= 0) {
setTiObjectToJsObject(result, newResultSet);
return handleScope.Close(result);
}
Expand Down

0 comments on commit 17e0176

Please sign in to comment.