basic1.sim 2.0 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 4 5 6
system sh/exec.sh -n dnode1 -s start
sql connect

print =============== create database
S
slguan 已提交
7
sql create database d1
S
slguan 已提交
8 9 10 11 12 13 14
sql show databases
if $rows != 1 then 
  return -1
endi

print $data00 $data01 $data02

S
Shengliang Guan 已提交
15
sql use d1
S
slguan 已提交
16 17

print =============== create super table
S
Shengliang Guan 已提交
18 19
sql create table st (ts timestamp, i int) tags (j int)
sql show stables
S
slguan 已提交
20 21 22 23 24 25
if $rows != 1 then 
  return -1
endi

print $data00 $data01 $data02

S
Shengliang Guan 已提交
26
sql create table st2 (ts timestamp, i float) tags (j int)
S
Shengliang Guan 已提交
27 28 29 30 31 32
sql show stables
if $rows != 2 then 
  return -1
endi

print $data00 $data01 $data02
S
Shengliang Guan 已提交
33 34 35 36 37 38 39 40 41 42 43
print $data10 $data11 $data12

sql drop table st2

sql show stables
if $rows != 1 then 
  return -1
endi

print $data00 $data01 $data02
print $data10 $data11 $data12
S
Shengliang Guan 已提交
44

S
slguan 已提交
45
print =============== create child table
S
Shengliang Guan 已提交
46
sql create table c1 using st tags(1)
S
Shengliang Guan 已提交
47
sql create table c2 using st tags(2) 
S
Shengliang Guan 已提交
48

S
Shengliang Guan 已提交
49 50
sql show tables
if $rows != 2 then 
S
slguan 已提交
51 52 53
  return -1
endi

S
Shengliang Guan 已提交
54 55 56 57 58 59 60
sql create table c3 using st tags(3) c4 using st tags(4) c5 using st tags(5) c6 using st tags(6) c7 using st tags(7)

sql show tables
if $rows != 7 then 
  return -1
endi

S
slguan 已提交
61 62 63 64 65
print $data00 $data01 $data02
print $data10 $data11 $data22
print $data20 $data11 $data22

print =============== insert data
S
Shengliang Guan 已提交
66 67 68
sql insert into c1 values(now+1s, 1)
sql insert into c1 values(now+2s, 2)
sql insert into c1 values(now+3s, 3)
S
slguan 已提交
69

S
Shengliang Guan 已提交
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
print =============== query data
sql select * from c1
if $rows != 3 then 
  return -1
endi

print $data00 $data01
print $data10 $data11
print $data20 $data11

if $data01 != 1 then 
  return -1
endi

if $data11 != 2 then 
  return -1
endi

if $data21 != 3 then 
  return -1
endi

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

S
slguan 已提交
95
print =============== query data
S
Shengliang Guan 已提交
96
sql select * from c1
S
slguan 已提交
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
if $rows != 3 then 
  return -1
endi

print $data00 $data01
print $data10 $data11
print $data20 $data11

if $data01 != 1 then 
  return -1
endi

if $data11 != 2 then 
  return -1
endi

if $data21 != 3 then 
  return -1
endi

S
scripts  
slguan 已提交
117
system sh/exec.sh -n dnode1 -s stop -x SIGINT