Permalink
Browse files

Fixing a bug where previous values were set instead of empty #2

  • Loading branch information...
Sannis committed Aug 16, 2010
1 parent 75d0617 commit 1e779019b5db91ca7804fc3f0b784abcac1698f0
Showing with 11 additions and 2 deletions.
  1. +11 −2 src/mysql_bindings_result.cc
@@ -86,6 +86,8 @@ void MysqlConn::MysqlResult::SetFieldValue(
case MYSQL_TYPE_YEAR: // YEAR field
if (field_value) {
js_field = String::New(field_value)->ToInteger();
+ } else {
+ js_field = String::New("");
}
break;
case MYSQL_TYPE_DECIMAL: // DECIMAL or NUMERIC field
@@ -95,26 +97,34 @@ void MysqlConn::MysqlResult::SetFieldValue(
// TODO(Sannis): Read about MySQL datatypes and javascript data
if (field_value) {
js_field = String::New(field_value)->ToNumber();
+ } else {
+ js_field = String::New("");
}
break;
case MYSQL_TYPE_TIME: // TIME field
// TODO(Sannis): Read about MySQL datatypes and javascript data
if (field_value) {
js_field = String::New(field_value);
+ } else {
+ js_field = String::New("");
}
break;
case MYSQL_TYPE_TIMESTAMP: // TIMESTAMP field
case MYSQL_TYPE_DATETIME: // DATETIME field
// TODO(Sannis): Read about MySQL datatypes and javascript data
if (field_value) {
js_field = String::New(field_value);
+ } else {
+ js_field = String::New("");
}
break;
case MYSQL_TYPE_DATE: // DATE field
case MYSQL_TYPE_NEWDATE: // Newer const used > 5.0
// TODO(Sannis): Read about MySQL datatypes and javascript data
if (field_value) {
js_field = String::New(field_value);
+ } else {
+ js_field = String::New("");
}
break;
case MYSQL_TYPE_TINY_BLOB:
@@ -129,8 +139,7 @@ void MysqlConn::MysqlResult::SetFieldValue(
default:
if (field_value) {
js_field = String::New(field_value);
- }
- else {
+ } else {
js_field = String::New("");
}
}

0 comments on commit 1e77901

Please sign in to comment.