Skip to content

Commit

Permalink
Update some sqlite types (#6392)
Browse files Browse the repository at this point in the history
Correct SQL data types.
  • Loading branch information
directionless committed Apr 28, 2020
1 parent a07140a commit f54d904
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion osquery/sql/virtual_sqlite_table.cpp
Expand Up @@ -42,6 +42,7 @@ Status genSqliteTableRow(sqlite3_stmt* stmt,
auto column_name = std::string(sqlite3_column_name(stmt, i));
auto column_type = sqlite3_column_type(stmt, i);
switch (column_type) {
case SQLITE_BLOB:
case SQLITE_TEXT: {
auto text_value = sqlite3_column_text(stmt, i);
if (text_value != nullptr) {
Expand All @@ -55,7 +56,7 @@ Status genSqliteTableRow(sqlite3_stmt* stmt,
break;
}
case SQLITE_INTEGER: {
auto int_value = sqlite3_column_int(stmt, i);
auto int_value = sqlite3_column_int64(stmt, i);
r[column_name] = INTEGER(int_value);
break;
}
Expand Down
2 changes: 1 addition & 1 deletion osquery/tables/system/darwin/quicklook_cache.cpp
Expand Up @@ -44,7 +44,7 @@ void genQuicklookRow(sqlite3_stmt* stmt, Row& r) {
}
} else if (column_type == SQLITE_INTEGER) {
// Handle INTEGER columns explicitly to handle the date-value offset.
auto value = sqlite3_column_int(stmt, i);
auto value = sqlite3_column_int64(stmt, i);
if (column_name == "last_hit_date") {
value += kReferenceDateOffset;
}
Expand Down
2 changes: 1 addition & 1 deletion osquery/tables/system/freebsd/pkg_packages.cpp
Expand Up @@ -33,7 +33,7 @@ void genPkgRow(sqlite3_stmt* stmt, Row& r) {
r[column_name] = std::string((const char*)value);
}
} else if (column_type == SQLITE_INTEGER) {
auto value = sqlite3_column_int(stmt, i);
auto value = sqlite3_column_int64(stmt, i);
r[column_name] = INTEGER(value);
}
}
Expand Down

0 comments on commit f54d904

Please sign in to comment.