fixes and improvements

exceptions related code needs work
This commit is contained in:
2021-07-22 23:57:42 +02:00
parent 977a9cd198
commit 6d4fe43a3b
15 changed files with 174 additions and 102 deletions

View File

@@ -1,7 +1,7 @@
#pragma once
#include "lexer.h"
#include <stdexcept>
#include "exception.h"
#include <string>
#include <vector>
@@ -16,6 +16,7 @@ namespace usql {
enum class NodeType {
true_node,
null_value,
int_value,
float_value,
string_value,
@@ -65,7 +66,7 @@ namespace usql {
int length;
bool null;
ColDefNode(const std::string col_name, const ColumnType col_type, int col_order, int col_len, bool nullable) :
ColDefNode(const std::string col_name, ColumnType col_type, int col_order, int col_len, bool nullable) :
Node(NodeType::column_def), name(col_name), type(col_type), order(col_order), length(col_len),
null(nullable) {}
};
@@ -93,6 +94,17 @@ namespace usql {
virtual ~ValueNode() {};
};
struct NullValueNode : ValueNode {
NullValueNode() : ValueNode(NodeType::null_value) {}
bool isNull() override { return true; }
long getIntValue() override { throw Exception("not supported on null value"); };
double getDoubleValue() override { throw Exception("not supported on null value"); };
std::string getStringValue() override { throw Exception("not supported on null value"); };
};
struct IntValueNode : ValueNode {
long value;