failed to create table in taosdemo
This commit is contained in:
parent
4cf862dcba
commit
6d13cf37ef
|
@ -499,7 +499,7 @@ int main(int argc, char *argv[]) {
|
||||||
/* Create all the tables; */
|
/* Create all the tables; */
|
||||||
printf("Creating %d table(s)......\n", ntables);
|
printf("Creating %d table(s)......\n", ntables);
|
||||||
for (int i = 0; i < ntables; i++) {
|
for (int i = 0; i < ntables; i++) {
|
||||||
snprintf(command, BUFFER_SIZE, "create table %s.%s%d (ts timestamp%s;", db_name, tb_prefix, i, cols);
|
snprintf(command, BUFFER_SIZE, "create table if not exists %s.%s%d (ts timestamp%s;", db_name, tb_prefix, i, cols);
|
||||||
queryDB(taos, command);
|
queryDB(taos, command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -509,7 +509,7 @@ int main(int argc, char *argv[]) {
|
||||||
} else {
|
} else {
|
||||||
/* Create metric table */
|
/* Create metric table */
|
||||||
printf("Creating meters super table...\n");
|
printf("Creating meters super table...\n");
|
||||||
snprintf(command, BUFFER_SIZE, "create table %s.meters (ts timestamp%s tags (areaid int, loc binary(10))", db_name, cols);
|
snprintf(command, BUFFER_SIZE, "create table if not exists %s.meters (ts timestamp%s tags (areaid int, loc binary(10))", db_name, cols);
|
||||||
queryDB(taos, command);
|
queryDB(taos, command);
|
||||||
printf("meters created!\n");
|
printf("meters created!\n");
|
||||||
|
|
||||||
|
@ -523,9 +523,9 @@ int main(int argc, char *argv[]) {
|
||||||
j = i % 10;
|
j = i % 10;
|
||||||
}
|
}
|
||||||
if (j % 2 == 0) {
|
if (j % 2 == 0) {
|
||||||
snprintf(command, BUFFER_SIZE, "create table %s.%s%d using %s.meters tags (%d,\"%s\");", db_name, tb_prefix, i, db_name, j, "shanghai");
|
snprintf(command, BUFFER_SIZE, "create table if not exists %s.%s%d using %s.meters tags (%d,\"%s\");", db_name, tb_prefix, i, db_name, j, "shanghai");
|
||||||
} else {
|
} else {
|
||||||
snprintf(command, BUFFER_SIZE, "create table %s.%s%d using %s.meters tags (%d,\"%s\");", db_name, tb_prefix, i, db_name, j, "beijing");
|
snprintf(command, BUFFER_SIZE, "create table if not exists %s.%s%d using %s.meters tags (%d,\"%s\");", db_name, tb_prefix, i, db_name, j, "beijing");
|
||||||
}
|
}
|
||||||
queryDB(taos, command);
|
queryDB(taos, command);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue