diff --git a/src/sql/ColumnType.h b/src/sql/ColumnType.h index ff8fd540..f5049316 100644 --- a/src/sql/ColumnType.h +++ b/src/sql/ColumnType.h @@ -2,6 +2,7 @@ #define SQLPARSER_COLUMN_TYPE_H #include +#include namespace hsql { enum class DataType { @@ -26,11 +27,11 @@ enum class DataType { // Represents the type of a column, e.g., FLOAT or VARCHAR(10) struct ColumnType { ColumnType() = default; - ColumnType(DataType data_type, int64_t length = 0, int64_t precision = 0, int64_t scale = 0); + ColumnType(DataType data_type, std::int64_t length = 0, std::int64_t precision = 0, std::int64_t scale = 0); DataType data_type; - int64_t length; // Used for, e.g., VARCHAR(10) - int64_t precision; // Used for, e.g., DECIMAL (6, 4) or TIME (5) - int64_t scale; // Used for DECIMAL (6, 4) + std::int64_t length; // Used for, e.g., VARCHAR(10) + std::int64_t precision; // Used for, e.g., DECIMAL (6, 4) or TIME (5) + std::int64_t scale; // Used for DECIMAL (6, 4) }; bool operator==(const ColumnType& lhs, const ColumnType& rhs); diff --git a/src/sql/Expr.cpp b/src/sql/Expr.cpp index 7b788f99..b7cdeaf6 100644 --- a/src/sql/Expr.cpp +++ b/src/sql/Expr.cpp @@ -2,10 +2,11 @@ #include #include #include "SelectStatement.h" +#include namespace hsql { -FrameBound::FrameBound(int64_t offset, FrameBoundType type, bool unbounded) +FrameBound::FrameBound(std::int64_t offset, FrameBoundType type, bool unbounded) : offset{offset}, type{type}, unbounded{unbounded} {} FrameDescription::FrameDescription(FrameType type, FrameBound* start, FrameBound* end) @@ -140,7 +141,7 @@ Expr* Expr::makeCase(Expr* expr, Expr* caseList, Expr* elseExpr) { return e; } -Expr* Expr::makeLiteral(int64_t val) { +Expr* Expr::makeLiteral(std::int64_t val) { Expr* e = new Expr(kExprLiteralInt); e->ival = val; return e; @@ -176,7 +177,7 @@ Expr* Expr::makeDateLiteral(char* string) { return e; } -Expr* Expr::makeIntervalLiteral(int64_t duration, DatetimeField unit) { +Expr* Expr::makeIntervalLiteral(std::int64_t duration, DatetimeField unit) { Expr* e = new Expr(kExprLiteralInterval); e->ival = duration; e->datetimeField = unit; @@ -222,7 +223,7 @@ Expr* Expr::makeArray(std::vector* exprList) { return e; } -Expr* Expr::makeArrayIndex(Expr* expr, int64_t index) { +Expr* Expr::makeArrayIndex(Expr* expr, std::int64_t index) { Expr* e = new Expr(kExprArrayIndex); e->expr = expr; e->ival = index; diff --git a/src/sql/Expr.h b/src/sql/Expr.h index e44c42ca..e2343aa1 100644 --- a/src/sql/Expr.h +++ b/src/sql/Expr.h @@ -87,9 +87,9 @@ enum DatetimeField { // Description of the frame clause within a window expression. enum FrameBoundType { kFollowing, kPreceding, kCurrentRow }; struct FrameBound { - FrameBound(int64_t offset, FrameBoundType type, bool unbounded); + FrameBound(std::int64_t offset, FrameBoundType type, bool unbounded); - int64_t offset; + std::int64_t offset; FrameBoundType type; bool unbounded; }; @@ -135,8 +135,8 @@ struct Expr { char* table; char* alias; double fval; - int64_t ival; - int64_t ival2; + std::int64_t ival; + std::int64_t ival2; DatetimeField datetimeField; ColumnType columnType; bool isBoolLiteral; @@ -176,7 +176,7 @@ struct Expr { static Expr* makeCase(Expr* expr, Expr* when, Expr* elseExpr); - static Expr* makeLiteral(int64_t val); + static Expr* makeLiteral(std::int64_t val); static Expr* makeLiteral(double val); @@ -188,7 +188,7 @@ struct Expr { static Expr* makeDateLiteral(char* val); - static Expr* makeIntervalLiteral(int64_t duration, DatetimeField unit); + static Expr* makeIntervalLiteral(std::int64_t duration, DatetimeField unit); static Expr* makeColumnRef(char* name); @@ -202,7 +202,7 @@ struct Expr { static Expr* makeArray(std::vector* exprList); - static Expr* makeArrayIndex(Expr* expr, int64_t index); + static Expr* makeArrayIndex(Expr* expr, std::int64_t index); static Expr* makeParameter(int id); diff --git a/src/sql/statements.cpp b/src/sql/statements.cpp index 45a6bb5f..c67dc8f6 100644 --- a/src/sql/statements.cpp +++ b/src/sql/statements.cpp @@ -1,5 +1,6 @@ #include "statements.h" #include "AlterStatement.h" +#include namespace hsql { @@ -23,7 +24,7 @@ ColumnDefinition::~ColumnDefinition() { delete column_constraints; } -ColumnType::ColumnType(DataType data_type, int64_t length, int64_t precision, int64_t scale) +ColumnType::ColumnType(DataType data_type, std::int64_t length, std::int64_t precision, std::int64_t scale) : data_type(data_type), length(length), precision(precision), scale(scale) {} bool operator==(const ColumnType& lhs, const ColumnType& rhs) { diff --git a/src/util/sqlhelper.cpp b/src/util/sqlhelper.cpp index 7c2f16d9..330d253e 100644 --- a/src/util/sqlhelper.cpp +++ b/src/util/sqlhelper.cpp @@ -4,6 +4,7 @@ #include #include #include +#include namespace hsql { @@ -15,7 +16,7 @@ std::ostream& operator<<(std::ostream& os, const DatetimeField& datetime); std::ostream& operator<<(std::ostream& os, const FrameBound& frame_bound); std::string indent(uintmax_t num_indent) { return std::string(num_indent, '\t'); } -void inprint(int64_t val, uintmax_t num_indent) { std::cout << indent(num_indent).c_str() << val << " " << std::endl; } +void inprint(std::int64_t val, uintmax_t num_indent) { std::cout << indent(num_indent).c_str() << val << " " << std::endl; } void inprint(double val, uintmax_t num_indent) { std::cout << indent(num_indent).c_str() << val << std::endl; } void inprint(const char* val, uintmax_t num_indent) { std::cout << indent(num_indent).c_str() << val << std::endl; } void inprint(const char* val, const char* val2, uintmax_t num_indent) { @@ -452,7 +453,7 @@ std::ostream& operator<<(std::ostream& os, const OperatorType& op) { const auto found = operatorToToken.find(op); if (found == operatorToToken.cend()) { - return os << static_cast(op); + return os << static_cast(op); } else { return os << (*found).second; } @@ -465,7 +466,7 @@ std::ostream& operator<<(std::ostream& os, const DatetimeField& datetime) { const auto found = operatorToToken.find(datetime); if (found == operatorToToken.cend()) { - return os << static_cast(datetime); + return os << static_cast(datetime); } else { return os << (*found).second; }