autocreate.sim 2.6 KB
Newer Older
S
slguan 已提交
1
system sh/stop_dnodes.sh
S
slguan 已提交
2
system sh/deploy.sh -n dnode1 -i 1
S
slguan 已提交
3
system sh/exec.sh -n dnode1 -s start
H
Haojun Liao 已提交
4
sleep 2000
S
slguan 已提交
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
sql connect

print =============== create database
sql create database db
sql show databases
if $rows != 1 then 
  return -1
endi

print $data00 $data01 $data02

print =============== create super table
sql create table db.st1 (ts timestamp, i int) tags (j int)
sql create table db.st2 (ts timestamp, i int, j int) tags (t1 int, t2 int, t3 int)
sql show db.stables
if $rows != 2 then 
  return -1
endi

print $data00 $data01 $data02

print =============== create child table
sql insert into db.c1 using db.st1 tags(1) values(now, 1);
sql insert into db.c2 using db.st1 tags(2) values(now, 2);
sql insert into db.c3 using db.st1 tags(3) values(now, 3);
sql insert into db.c4 using db.st1 tags(4) values(now, 4);
S
script  
Shengliang Guan 已提交
31 32 33 34
sql insert into db.c1 using db.st1 tags(1) values(now+1s, 1);
sql insert into db.c2 using db.st1 tags(2) values(now+1s, 2);
sql insert into db.c3 using db.st1 tags(3) values(now+1s, 3);
sql insert into db.c4 using db.st1 tags(4) values(now+1s, 4);
S
slguan 已提交
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70

sql show db.tables
if $rows != 4 then 
  return -1
endi

sql select * from db.c1
if $rows != 2 then 
  return -1
endi

sql select * from db.c2
if $rows != 2 then 
  return -1
endi

sql select * from db.c3
if $rows != 2 then 
  return -1
endi

sql select * from db.c4
if $rows != 2 then 
  return -1
endi

sql select * from db.st1
if $rows != 8 then 
  return -1
endi

print =============== insert data
sql insert into db.s1 using db.st2 tags(1, 1, 1) values(now, 1, 2);
sql insert into db.s2 using db.st2 tags(2, 2, 2) values(now, 2, 3);
sql insert into db.s3 using db.st2 tags(3, 3, 3) values(now, 3, 4);
sql insert into db.s4 using db.st2 tags(4, 4, 4) values(now, 4, 5);
S
script  
Shengliang Guan 已提交
71 72 73 74 75 76 77 78
sql insert into db.s1 using db.st2 tags(1, 1, 1) values(now+1s, 1, 2);
sql insert into db.s2 using db.st2 tags(2, 2, 2) values(now+1s, 2, 3);
sql insert into db.s3 using db.st2 tags(3, 3, 3) values(now+1s, 3, 4);
sql insert into db.s4 using db.st2 tags(4, 4, 4) values(now+1s, 4, 5);
sql insert into db.s1 using db.st2 tags(1, 1, 1) values(now+2s, 1, 2);
sql insert into db.s2 using db.st2 tags(2, 2, 2) values(now+2s, 2, 3);
sql insert into db.s3 using db.st2 tags(3, 3, 3) values(now+2s, 3, 4);
sql insert into db.s4 using db.st2 tags(4, 4, 4) values(now+2s, 4, 5);
S
slguan 已提交
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103

sql show db.tables
if $rows != 8 then 
  return -1
endi

sql select * from db.s1
if $rows != 3 then 
  return -1
endi

sql select * from db.s2
if $rows != 3 then 
  return -1
endi

sql select * from db.s3
if $rows != 3 then 
  return -1
endi

sql select * from db.s4
if $rows != 3 then 
  return -1
endi
S
scripts  
slguan 已提交
104 105

system sh/exec.sh -n dnode1 -s stop -x SIGINT