another bit of refactoring
This commit is contained in:
30
row.h
30
row.h
@@ -7,28 +7,10 @@
|
||||
|
||||
namespace usql {
|
||||
|
||||
class ColumnValue {
|
||||
|
||||
|
||||
private:
|
||||
ColumnType m_type;
|
||||
union {
|
||||
int int_value;
|
||||
double float_value;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
struct ColValue {
|
||||
|
||||
virtual bool isNull() { return false; };
|
||||
|
||||
virtual bool isInteger() { return false; };
|
||||
|
||||
virtual bool isFloat() { return false; };
|
||||
|
||||
virtual bool isString() { return false; };
|
||||
virtual bool isNull() { return false; };;;;
|
||||
|
||||
virtual int integerValue() { throw Exception("Not supported"); };
|
||||
|
||||
@@ -50,9 +32,7 @@ namespace usql {
|
||||
|
||||
ColIntegerValue(int value) : m_integer(value) {};
|
||||
|
||||
ColIntegerValue(const ColIntegerValue &other) : m_integer(other.m_integer) {}
|
||||
|
||||
virtual bool isInteger() { return true; };
|
||||
ColIntegerValue(const ColIntegerValue &other) : m_integer(other.m_integer) {};
|
||||
|
||||
virtual int integerValue() { return m_integer; };
|
||||
|
||||
@@ -70,8 +50,6 @@ namespace usql {
|
||||
|
||||
ColFloatValue(const ColFloatValue &other) : m_float(other.m_float) {}
|
||||
|
||||
virtual bool isFloat() { return true; }
|
||||
|
||||
virtual int integerValue() { return (int) m_float; };
|
||||
|
||||
virtual double floatValue() { return m_float; };
|
||||
@@ -88,8 +66,6 @@ namespace usql {
|
||||
|
||||
ColStringValue(const ColStringValue &other) : m_string(other.m_string) {};
|
||||
|
||||
virtual bool isString() { return true; }
|
||||
|
||||
virtual int integerValue() { return std::stoi(m_string); };
|
||||
|
||||
virtual double floatValue() { return std::stod(m_string); };
|
||||
@@ -113,7 +89,7 @@ namespace usql {
|
||||
|
||||
void setColumnValue(int col_index, double value);
|
||||
|
||||
void setColumnValue(int col_index, std::string value);
|
||||
void setColumnValue(int col_index, const std::string &value);
|
||||
|
||||
ColValue &operator[](int i) {
|
||||
return *m_columns[i];
|
||||
|
||||
Reference in New Issue
Block a user