HyriseSQLParser/src/sql/InsertStatement.h

46 lines
779 B
C
Raw Normal View History

2014-11-26 00:26:20 +01:00
#ifndef __INSERT_STATEMENT_H__
#define __INSERT_STATEMENT_H__
2014-12-03 17:43:02 +01:00
#include "SQLStatement.h"
2014-11-26 00:26:20 +01:00
#include "SelectStatement.h"
namespace hsql {
/**
* @struct InsertStatement
2014-12-15 18:32:46 +01:00
* @brief Represents "INSERT INTO students VALUES ('Max', 1112233, 'Musterhausen', 2.3)"
*/
2014-12-03 17:43:02 +01:00
struct InsertStatement : SQLStatement {
enum InsertType {
2014-11-26 00:26:20 +01:00
kInsertValues,
kInsertSelect
2014-12-03 17:43:02 +01:00
};
2014-11-26 00:26:20 +01:00
2014-12-03 17:43:02 +01:00
InsertStatement(InsertType type) :
SQLStatement(kStmtInsert),
type(type),
2014-11-26 00:26:20 +01:00
table_name(NULL),
columns(NULL),
values(NULL),
select(NULL) {}
2014-12-15 18:32:46 +01:00
virtual ~InsertStatement() {
delete table_name;
delete columns;
delete values;
delete select;
}
2014-11-26 00:26:20 +01:00
2014-12-03 17:43:02 +01:00
InsertType type;
2014-11-26 00:26:20 +01:00
const char* table_name;
std::vector<char*>* columns;
std::vector<Expr*>* values;
2014-11-26 00:26:20 +01:00
SelectStatement* select;
};
} // namsepace hsql
#endif