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 {
|
2016-02-27 15:01:06 +01:00
|
|
|
/**
|
2016-02-27 15:22:22 +01:00
|
|
|
* Represents SQL Insert statements.
|
|
|
|
* Example: "INSERT INTO students VALUES ('Max', 1112233, 'Musterhausen', 2.3)"
|
2016-02-27 15:01:06 +01:00
|
|
|
*/
|
|
|
|
struct InsertStatement : SQLStatement {
|
|
|
|
enum InsertType {
|
|
|
|
kInsertValues,
|
|
|
|
kInsertSelect
|
|
|
|
};
|
|
|
|
|
|
|
|
InsertStatement(InsertType type) :
|
|
|
|
SQLStatement(kStmtInsert),
|
|
|
|
type(type),
|
2016-02-27 15:22:22 +01:00
|
|
|
tableName(NULL),
|
2016-02-27 15:01:06 +01:00
|
|
|
columns(NULL),
|
|
|
|
values(NULL),
|
|
|
|
select(NULL) {}
|
|
|
|
|
|
|
|
virtual ~InsertStatement() {
|
2016-02-27 15:22:22 +01:00
|
|
|
delete tableName;
|
2016-02-27 15:01:06 +01:00
|
|
|
delete columns;
|
|
|
|
delete values;
|
|
|
|
delete select;
|
|
|
|
}
|
|
|
|
|
|
|
|
InsertType type;
|
2016-02-27 15:22:22 +01:00
|
|
|
const char* tableName;
|
2016-02-27 15:01:06 +01:00
|
|
|
std::vector<char*>* columns;
|
|
|
|
std::vector<Expr*>* values;
|
|
|
|
SelectStatement* select;
|
|
|
|
};
|
2014-11-26 00:26:20 +01:00
|
|
|
|
|
|
|
} // namsepace hsql
|
|
|
|
#endif
|