WIP on indexes cat
This commit is contained in:
parent
17445d0bd6
commit
4faaf38986
3
debug.h
3
debug.h
|
|
@ -57,6 +57,7 @@ std::vector<std::string> k_debug_sql_commands {
|
|||
// "select max(to_int(to_float(to_char(datetime, '%Y%m%d')))) from d",
|
||||
|
||||
// "select * from usql_tables",
|
||||
// "select * from usql_columns"
|
||||
// "select * from usql_columns",
|
||||
// "select * from usql_indexes",
|
||||
};
|
||||
|
||||
|
|
|
|||
3
usql.cpp
3
usql.cpp
|
|
@ -11,7 +11,8 @@ USql::USql() {
|
|||
|
||||
std::vector<std::string> k_debug_sql_commands {
|
||||
"create table usql_tables(name varchar(32) not null, modified boolean not null)",
|
||||
"create table usql_columns(table_name varchar(32) not null, column_name varchar(32) not null, column_type varchar(16) not null, column_length integer not null, nullable boolean not null, column_order integer not null)"
|
||||
"create table usql_columns(table_name varchar(32) not null, column_name varchar(32) not null, column_type varchar(16) not null, column_length integer not null, nullable boolean not null, column_order integer not null)",
|
||||
"create table usql_indexes(index_name varchar(32) not null, table_name varchar(32), column_name varchar(32) not null)"
|
||||
};
|
||||
|
||||
// create cataloque tables
|
||||
|
|
|
|||
1
usql.h
1
usql.h
|
|
@ -22,6 +22,7 @@ private:
|
|||
std::unique_ptr<Table> execute_create_table(const CreateTableNode &node);
|
||||
bool execute_create_table_sys_catalogue(const CreateTableNode &node);
|
||||
std::unique_ptr<Table> execute_create_index(const CreateIndexNode &node);
|
||||
bool execute_create_index_sys_catalogue(const CreateIndexNode &node);
|
||||
std::unique_ptr<Table> execute_create_table_as_table(const CreateTableAsSelectNode &node);
|
||||
std::unique_ptr<Table> execute_load(const LoadIntoTableNode &node);
|
||||
std::unique_ptr<Table> execute_save(const SaveTableNode &node);
|
||||
|
|
|
|||
16
usql_ddl.cpp
16
usql_ddl.cpp
|
|
@ -8,7 +8,6 @@
|
|||
namespace usql {
|
||||
|
||||
|
||||
|
||||
std::unique_ptr<Table> USql::execute_create_table(const CreateTableNode &node) {
|
||||
check_table_not_exists(node.table_name);
|
||||
|
||||
|
|
@ -56,10 +55,25 @@ std::unique_ptr<Table> USql::execute_create_index(const CreateIndexNode &node) {
|
|||
|
||||
table_def->index_rows(node.index_name);
|
||||
|
||||
execute_create_index_sys_catalogue(node);
|
||||
|
||||
return create_stmt_result_table(0, "index created", 0);
|
||||
}
|
||||
|
||||
|
||||
bool USql::execute_create_index_sys_catalogue(const CreateIndexNode &node) {
|
||||
std::string i {"insert into usql_indexes(index_name, table_name, column_name) values("};
|
||||
i += "'" + node.index_name + "', ";
|
||||
i += "'" + node.table_name + "', ";
|
||||
i += "'" + node.column_name + "')";
|
||||
|
||||
auto r = execute(i);
|
||||
// r->print();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
std::unique_ptr<Table> USql::execute_create_table_as_table(const CreateTableAsSelectNode &node) {
|
||||
check_table_not_exists(node.table_name);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue