2014-11-12 00:11:07 +01:00
|
|
|
#ifndef __CREATE_STATEMENT_H__
|
|
|
|
#define __CREATE_STATEMENT_H__
|
|
|
|
|
|
|
|
#include "Statement.h"
|
|
|
|
|
|
|
|
namespace hsql {
|
|
|
|
|
|
|
|
|
2014-11-26 14:43:22 +01:00
|
|
|
/**
|
|
|
|
* @struct ColumnDefinition
|
|
|
|
*/
|
|
|
|
struct ColumnDefinition {
|
|
|
|
enum DataType {
|
|
|
|
TEXT,
|
|
|
|
INT,
|
|
|
|
DOUBLE
|
|
|
|
};
|
|
|
|
|
|
|
|
char* name;
|
|
|
|
DataType type;
|
|
|
|
};
|
2014-11-12 00:11:07 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @struct CreateStatement
|
2014-11-26 14:43:22 +01:00
|
|
|
* CREATE TABLE students (name TEXT, student_number INTEGER, city TEXT, grade DOUBLE)
|
|
|
|
* CREATE TABLE students FROM TBL FILE 'test/students.tbl'
|
2014-11-12 00:11:07 +01:00
|
|
|
*/
|
|
|
|
struct CreateStatement : Statement {
|
2014-11-26 14:43:22 +01:00
|
|
|
enum CreateType {
|
|
|
|
kTable,
|
|
|
|
kTableFromTbl, // Hyrise file format
|
|
|
|
};
|
|
|
|
|
2014-11-13 01:27:47 +01:00
|
|
|
CreateStatement() :
|
|
|
|
Statement(kStmtCreate),
|
2014-11-17 02:18:31 +01:00
|
|
|
if_not_exists(false),
|
2014-11-13 01:27:47 +01:00
|
|
|
file_path(NULL),
|
|
|
|
table_name(NULL) {};
|
|
|
|
|
2014-11-12 00:11:07 +01:00
|
|
|
virtual ~CreateStatement(); // defined in destructors.cpp
|
|
|
|
|
|
|
|
CreateType create_type;
|
2014-11-17 02:18:31 +01:00
|
|
|
bool if_not_exists;
|
2014-11-12 00:11:07 +01:00
|
|
|
const char* file_path;
|
|
|
|
const char* table_name;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace hsql
|
|
|
|
#endif
|