提交 c1c15967 编写于 作者: A Alex Duan

support create table as...

上级 33b1bb13
...@@ -78,6 +78,7 @@ SWords shellCommands[] = { ...@@ -78,6 +78,7 @@ SWords shellCommands[] = {
{"alter user <user_name> privilege read", 0, 0, NULL}, {"alter user <user_name> privilege read", 0, 0, NULL},
{"alter user <user_name> privilege write", 0, 0, NULL}, {"alter user <user_name> privilege write", 0, 0, NULL},
{"create table <anyword> using <stb_name> tags(", 0, 0, NULL}, {"create table <anyword> using <stb_name> tags(", 0, 0, NULL},
{"create table <anyword> as select ", 0, 0, NULL},
{"create database ", 0, 0, NULL}, {"create database ", 0, 0, NULL},
{"create table <anyword> as ", 0, 0, NULL}, {"create table <anyword> as ", 0, 0, NULL},
{"create dnode ", 0, 0, NULL}, {"create dnode ", 0, 0, NULL},
...@@ -126,6 +127,7 @@ SWords shellCommands[] = { ...@@ -126,6 +127,7 @@ SWords shellCommands[] = {
{"show vgroups;", 0, 0, NULL}, {"show vgroups;", 0, 0, NULL},
{"insert into <tb_name> values(", 0, 0, NULL}, {"insert into <tb_name> values(", 0, 0, NULL},
{"insert into <tb_name> using <stb_name> tags( <anyword> ) values(", 0, 0, NULL}, {"insert into <tb_name> using <stb_name> tags( <anyword> ) values(", 0, 0, NULL},
{"insert into <tb_name> using <stb_name> <anyword> values(", 0, 0, NULL},
{"use <db_name>", 0, 0, NULL}, {"use <db_name>", 0, 0, NULL},
{"quit", 0, 0, NULL} {"quit", 0, 0, NULL}
}; };
...@@ -1398,26 +1400,16 @@ int32_t searchAfterSelect(char* p, int32_t len) { ...@@ -1398,26 +1400,16 @@ int32_t searchAfterSelect(char* p, int32_t len) {
return p1 - p; return p1 - p;
} }
// explain as select * from st;
if(strncasecmp(p, "explain select ", 15) == 0) {
return 15;
}
char* as_pos_end = strstr(p, " as select "); char* as_pos_end = strstr(p, " as select ");
if (as_pos_end == NULL) if (as_pos_end == NULL)
return -1; return -1;
as_pos_end += 11; as_pos_end += 11;
// create stream <stream_name> as select // create table <stream_name> as select
if(strncasecmp(p, "create stream ", 14) == 0) { if(strncasecmp(p, "create table ", 13) == 0) {
return as_pos_end - p;; return as_pos_end - p;;
} }
// create topic <topic_name> as select
if(strncasecmp(p, "create topic ", 13) == 0) {
return as_pos_end - p;
}
return -1; return -1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册