Skip to content

Commit

Permalink
Merge pull request #528 from jarrodb/db_sqlite_datetime
Browse files Browse the repository at this point in the history
update sqlite convert DB_DATETIME types to proper time values
  • Loading branch information
Ionut Ionita committed Jun 3, 2015
2 parents e45cc1f + 65e3a6c commit 4d3ab1f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions modules/db_sqlite/row.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,12 @@ int db_sqlite_convert_row(const db_con_t* _h, db_res_t* _res, db_row_t* _r)

break;
case DB_DATETIME:
VAL_INT(_v) = sqlite3_column_int(CON_SQLITE_PS(_h), col);
db_value = (char *)sqlite3_column_text(CON_SQLITE_PS(_h), col);
if (db_str2time(db_value, &VAL_TIME(_v)) < 0) {
LM_ERR("error while converting datetime value from string\n");
return -1;
}
VAL_TYPE(_v) = DB_DATETIME;

break;
case DB_DOUBLE:
VAL_DOUBLE(_v) = sqlite3_column_double(CON_SQLITE_PS(_h), col);
Expand Down

0 comments on commit 4d3ab1f

Please sign in to comment.