handle comparation on dates
This commit is contained in:
5
usql.cpp
5
usql.cpp
@@ -431,7 +431,7 @@ bool USql::eval_relational_operator(const RelationalOperatorNode &filter, Table
|
|||||||
bool bl = left_value->getBooleanValue();
|
bool bl = left_value->getBooleanValue();
|
||||||
bool br = right_value->getBooleanValue();
|
bool br = right_value->getBooleanValue();
|
||||||
comparator = bl == br ? 0 : 1;
|
comparator = bl == br ? 0 : 1;
|
||||||
// TODO handle dates
|
// date values are essentially int values so handled above
|
||||||
} else {
|
} else {
|
||||||
throw Exception("Undefined combination of types");
|
throw Exception("Undefined combination of types");
|
||||||
}
|
}
|
||||||
@@ -487,9 +487,8 @@ std::unique_ptr<ValueNode> USql::eval_database_value_node(Table *table, Row &row
|
|||||||
return std::make_unique<StringValueNode>(db_value->getStringValue());
|
return std::make_unique<StringValueNode>(db_value->getStringValue());
|
||||||
if (col_def.type == ColumnType::bool_type)
|
if (col_def.type == ColumnType::bool_type)
|
||||||
return std::make_unique<BooleanValueNode>(db_value->getBoolValue());
|
return std::make_unique<BooleanValueNode>(db_value->getBoolValue());
|
||||||
// Date has no it's own value node (it is passed around as string)
|
|
||||||
if (col_def.type == ColumnType::date_type)
|
if (col_def.type == ColumnType::date_type)
|
||||||
return std::make_unique<StringValueNode>(db_value->getStringValue());
|
return std::make_unique<IntValueNode>(db_value->getIntValue());
|
||||||
|
|
||||||
throw Exception("unknown database value type");
|
throw Exception("unknown database value type");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user