Fix: use correct format specifiers for int64 (#45)
* Fix: use correct format specifiers for int64 * Use iostream instead of stdio
This commit is contained in:
parent
0939a8d6cd
commit
8913f9213d
|
@ -25,7 +25,7 @@ int main(int argc, char* argv[]) {
|
||||||
printf("Parsed successfully!\n");
|
printf("Parsed successfully!\n");
|
||||||
printf("Number of statements: %lu\n", result.size());
|
printf("Number of statements: %lu\n", result.size());
|
||||||
|
|
||||||
for (uint i = 0; i < result.size(); ++i) {
|
for (auto i = 0u; i < result.size(); ++i) {
|
||||||
// Print a statement summary.
|
// Print a statement summary.
|
||||||
hsql::printStatementInfo(result.getStatement(i));
|
hsql::printStatementInfo(result.getStatement(i));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
#include "sqlhelper.h"
|
#include "sqlhelper.h"
|
||||||
#include <stdio.h>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace hsql {
|
namespace hsql {
|
||||||
|
@ -11,22 +11,22 @@ namespace hsql {
|
||||||
return std::string(numIndent, '\t');
|
return std::string(numIndent, '\t');
|
||||||
}
|
}
|
||||||
void inprint(int64_t val, uintmax_t numIndent) {
|
void inprint(int64_t val, uintmax_t numIndent) {
|
||||||
printf("%s%ld \n", indent(numIndent).c_str(), val);
|
std::cout << indent(numIndent).c_str() << val << " " << std::endl;
|
||||||
}
|
}
|
||||||
void inprint(float val, uintmax_t numIndent) {
|
void inprint(float val, uintmax_t numIndent) {
|
||||||
printf("%s%f\n", indent(numIndent).c_str(), val);
|
std::cout << indent(numIndent).c_str() << val << std::endl;
|
||||||
}
|
}
|
||||||
void inprint(const char* val, uintmax_t numIndent) {
|
void inprint(const char* val, uintmax_t numIndent) {
|
||||||
printf("%s%s\n", indent(numIndent).c_str(), val);
|
std::cout << indent(numIndent).c_str() << val << std::endl;
|
||||||
}
|
}
|
||||||
void inprint(const char* val, const char* val2, uintmax_t numIndent) {
|
void inprint(const char* val, const char* val2, uintmax_t numIndent) {
|
||||||
printf("%s%s->%s\n", indent(numIndent).c_str(), val, val2);
|
std::cout << indent(numIndent).c_str() << val << "->" << val2 << std::endl;
|
||||||
}
|
}
|
||||||
void inprintC(char val, uintmax_t numIndent) {
|
void inprintC(char val, uintmax_t numIndent) {
|
||||||
printf("%s%c\n", indent(numIndent).c_str(), val);
|
std::cout << indent(numIndent).c_str() << val << std::endl;
|
||||||
}
|
}
|
||||||
void inprintU(uint64_t val, uintmax_t numIndent) {
|
void inprintU(uint64_t val, uintmax_t numIndent) {
|
||||||
printf("%s%lu\n", indent(numIndent).c_str(), val);
|
std::cout << indent(numIndent).c_str() << val << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void printTableRefInfo(TableRef* table, uintmax_t numIndent) {
|
void printTableRefInfo(TableRef* table, uintmax_t numIndent) {
|
||||||
|
@ -109,7 +109,7 @@ namespace hsql {
|
||||||
printOperatorExpression(expr, numIndent);
|
printOperatorExpression(expr, numIndent);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Unrecognized expression type %d\n", expr->type);
|
std::cerr << "Unrecognized expression type " << expr->type << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (expr->alias != nullptr) {
|
if (expr->alias != nullptr) {
|
||||||
|
|
Loading…
Reference in New Issue