Merge pull request #17 from ahalam/master
Use C++ standard int types to allow compilation with clang++ also
This commit is contained in:
commit
ffefb7a2e5
|
@ -102,7 +102,7 @@ int yyerror(YYLTYPE* llocp, SQLParserResult** result, yyscan_t scanner, const ch
|
||||||
double fval;
|
double fval;
|
||||||
int64_t ival;
|
int64_t ival;
|
||||||
char* sval;
|
char* sval;
|
||||||
uint uval;
|
uintmax_t uval;
|
||||||
bool bval;
|
bool bval;
|
||||||
|
|
||||||
hsql::SQLStatement* statement;
|
hsql::SQLStatement* statement;
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace hsql {
|
||||||
std::sort(placeholders.begin(), placeholders.end(), [](Expr* i, Expr* j) -> bool { return (i->ival < j->ival); });
|
std::sort(placeholders.begin(), placeholders.end(), [](Expr* i, Expr* j) -> bool { return (i->ival < j->ival); });
|
||||||
|
|
||||||
// Set the placeholder id on the Expr. This replaces the previously stored column id
|
// Set the placeholder id on the Expr. This replaces the previously stored column id
|
||||||
for (uint i = 0; i < placeholders.size(); ++i) placeholders[i]->ival = i;
|
for (uintmax_t i = 0; i < placeholders.size(); ++i) placeholders[i]->ival = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* name;
|
const char* name;
|
||||||
|
|
|
@ -5,31 +5,31 @@
|
||||||
|
|
||||||
namespace hsql {
|
namespace hsql {
|
||||||
|
|
||||||
void printOperatorExpression(Expr* expr, uint numIndent);
|
void printOperatorExpression(Expr* expr, uintmax_t numIndent);
|
||||||
|
|
||||||
std::string indent(uint numIndent) {
|
std::string indent(uintmax_t numIndent) {
|
||||||
return std::string(numIndent, '\t');
|
return std::string(numIndent, '\t');
|
||||||
}
|
}
|
||||||
void inprint(int64_t val, uint numIndent) {
|
void inprint(int64_t val, uintmax_t numIndent) {
|
||||||
printf("%s%ld \n", indent(numIndent).c_str(), val);
|
printf("%s%lld \n", indent(numIndent).c_str(), val);
|
||||||
}
|
}
|
||||||
void inprint(float val, uint numIndent) {
|
void inprint(float val, uintmax_t numIndent) {
|
||||||
printf("%s%f\n", indent(numIndent).c_str(), val);
|
printf("%s%f\n", indent(numIndent).c_str(), val);
|
||||||
}
|
}
|
||||||
void inprint(const char* val, uint numIndent) {
|
void inprint(const char* val, uintmax_t numIndent) {
|
||||||
printf("%s%s\n", indent(numIndent).c_str(), val);
|
printf("%s%s\n", indent(numIndent).c_str(), val);
|
||||||
}
|
}
|
||||||
void inprint(const char* val, const char* val2, uint numIndent) {
|
void inprint(const char* val, const char* val2, uintmax_t numIndent) {
|
||||||
printf("%s%s->%s\n", indent(numIndent).c_str(), val, val2);
|
printf("%s%s->%s\n", indent(numIndent).c_str(), val, val2);
|
||||||
}
|
}
|
||||||
void inprintC(char val, uint numIndent) {
|
void inprintC(char val, uintmax_t numIndent) {
|
||||||
printf("%s%c\n", indent(numIndent).c_str(), val);
|
printf("%s%c\n", indent(numIndent).c_str(), val);
|
||||||
}
|
}
|
||||||
void inprintU(uint64_t val, uint numIndent) {
|
void inprintU(uint64_t val, uintmax_t numIndent) {
|
||||||
printf("%s%lu\n", indent(numIndent).c_str(), val);
|
printf("%s%llu\n", indent(numIndent).c_str(), val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void printTableRefInfo(TableRef* table, uint numIndent) {
|
void printTableRefInfo(TableRef* table, uintmax_t numIndent) {
|
||||||
switch (table->type) {
|
switch (table->type) {
|
||||||
case kTableName:
|
case kTableName:
|
||||||
inprint(table->name, numIndent);
|
inprint(table->name, numIndent);
|
||||||
|
@ -56,7 +56,7 @@ namespace hsql {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void printOperatorExpression(Expr* expr, uint numIndent) {
|
void printOperatorExpression(Expr* expr, uintmax_t numIndent) {
|
||||||
if (expr == NULL) {
|
if (expr == NULL) {
|
||||||
inprint("null", numIndent);
|
inprint("null", numIndent);
|
||||||
return;
|
return;
|
||||||
|
@ -83,7 +83,7 @@ namespace hsql {
|
||||||
if (expr->expr2 != NULL) printExpression(expr->expr2, numIndent+1);
|
if (expr->expr2 != NULL) printExpression(expr->expr2, numIndent+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void printExpression(Expr* expr, uint numIndent) {
|
void printExpression(Expr* expr, uintmax_t numIndent) {
|
||||||
switch (expr->type) {
|
switch (expr->type) {
|
||||||
case kExprStar:
|
case kExprStar:
|
||||||
inprint("*", numIndent);
|
inprint("*", numIndent);
|
||||||
|
@ -118,7 +118,7 @@ namespace hsql {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void printSelectStatementInfo(SelectStatement* stmt, uint numIndent) {
|
void printSelectStatementInfo(SelectStatement* stmt, uintmax_t numIndent) {
|
||||||
inprint("SelectStatement", numIndent);
|
inprint("SelectStatement", numIndent);
|
||||||
inprint("Fields:", numIndent+1);
|
inprint("Fields:", numIndent+1);
|
||||||
for (Expr* expr : *stmt->selectList) printExpression(expr, numIndent+2);
|
for (Expr* expr : *stmt->selectList) printExpression(expr, numIndent+2);
|
||||||
|
@ -152,19 +152,19 @@ namespace hsql {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void printImportStatementInfo(ImportStatement* stmt, uint numIndent) {
|
void printImportStatementInfo(ImportStatement* stmt, uintmax_t numIndent) {
|
||||||
inprint("ImportStatment", numIndent);
|
inprint("ImportStatment", numIndent);
|
||||||
inprint(stmt->filePath, numIndent+1);
|
inprint(stmt->filePath, numIndent+1);
|
||||||
inprint(stmt->tableName, numIndent+1);
|
inprint(stmt->tableName, numIndent+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void printCreateStatementInfo(CreateStatement* stmt, uint numIndent) {
|
void printCreateStatementInfo(CreateStatement* stmt, uintmax_t numIndent) {
|
||||||
inprint("CreateStatment", numIndent);
|
inprint("CreateStatment", numIndent);
|
||||||
inprint(stmt->tableName, numIndent+1);
|
inprint(stmt->tableName, numIndent+1);
|
||||||
inprint(stmt->filePath, numIndent+1);
|
inprint(stmt->filePath, numIndent+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void printInsertStatementInfo(InsertStatement* stmt, uint numIndent) {
|
void printInsertStatementInfo(InsertStatement* stmt, uintmax_t numIndent) {
|
||||||
inprint("InsertStatment", numIndent);
|
inprint("InsertStatment", numIndent);
|
||||||
inprint(stmt->tableName, numIndent+1);
|
inprint(stmt->tableName, numIndent+1);
|
||||||
if (stmt->columns != NULL) {
|
if (stmt->columns != NULL) {
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
namespace hsql {
|
namespace hsql {
|
||||||
|
|
||||||
void printStatementInfo(SQLStatement* stmt);
|
void printStatementInfo(SQLStatement* stmt);
|
||||||
void printSelectStatementInfo(SelectStatement* stmt, uint num_indent);
|
void printSelectStatementInfo(SelectStatement* stmt, uintmax_t num_indent);
|
||||||
void printImportStatementInfo(ImportStatement* stmt, uint num_indent);
|
void printImportStatementInfo(ImportStatement* stmt, uintmax_t num_indent);
|
||||||
void printInsertStatementInfo(InsertStatement* stmt, uint num_indent);
|
void printInsertStatementInfo(InsertStatement* stmt, uintmax_t num_indent);
|
||||||
void printCreateStatementInfo(CreateStatement* stmt, uint num_indent);
|
void printCreateStatementInfo(CreateStatement* stmt, uintmax_t num_indent);
|
||||||
void printExpression(Expr* expr, uint num_indent);
|
void printExpression(Expr* expr, uintmax_t num_indent);
|
||||||
|
|
||||||
} // namespace hsql
|
} // namespace hsql
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue