basic.sim 3.3 KB
Newer Older
S
slguan 已提交
1
sleep 3000
S
scripts  
slguan 已提交
2 3
sql connect

S
TD-1057  
Shengliang Guan 已提交
4 5 6 7 8 9 10
sql show databases
sql drop database $data00 -x e1
e1:
sql show databases
sql drop database $data00 -x e2
e2:

S
slguan 已提交
11 12 13 14 15 16 17 18 19
print ============================ dnode1 start

$i = 0
$dbPrefix = ob_db_db
$tbPrefix = ob_db_tb
$db = $dbPrefix . $i
$tb = $tbPrefix . $i

print =============== step1
S
scripts  
slguan 已提交
20
sql create database $db replica 1 days 20 keep 2000 cache 16
S
slguan 已提交
21 22 23 24 25 26 27 28 29 30 31 32 33 34
sql show databases
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07
if $data00 != $db then 
  return -1
endi
if $data02 != 0 then 
  return -1
endi
if $data03 != 0 then 
  return -1
endi
if $data04 != 1 then 
  return -1
endi
S
scripts  
slguan 已提交
35
if $data06 != 20 then 
S
slguan 已提交
36 37
  return -1
endi
S
scripts  
slguan 已提交
38
if $data08 != 16 then 
S
slguan 已提交
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
  return -1
endi
 
print =============== step2
sql create database $db
sql show databases
if $rows != 1 then 
  return -1
endi 

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

print =============== step4
S
scripts  
slguan 已提交
57
sql_error drop database $db
S
slguan 已提交
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74

print =============== step5
sql create database $db replica 1 days 15 keep 1500
sql show databases
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07
if $data00 != $db then 
  return -1
endi
if $data02 != 0 then 
  return -1
endi
if $data03 != 0 then 
  return -1
endi
if $data04 != 1 then 
  return -1
endi
S
scripts  
slguan 已提交
75
if $data06 != 15 then 
S
slguan 已提交
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
  return -1
endi

print =============== step6
sql use $db
sql create table $tb (ts timestamp, speed int)
$i = 1
while $i < 4
  $db = $dbPrefix . $i
  $tb = $tbPrefix . $i
  sql create database $db
  sql use $db
  sql create table $tb (ts timestamp, speed int)
  $i = $i + 1
endw

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

$i = 4
$db = $dbPrefix . $i
$tb = $tbPrefix . $i
sql create database $db
sql use $db
S
scripts  
slguan 已提交
102
sql create table $tb (ts timestamp, speed int)
S
slguan 已提交
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193

print =============== step7
$i = 0
while $i < 5
  $db = $dbPrefix . $i  
  sql drop database $db 
  $i = $i + 1
endw

print =============== step8
$i = 0
$db = $dbPrefix . $i
$tb = $tbPrefix . $i
sql create database $db
sql use $db
sql create table $tb (ts timestamp, speed int)
sql show tables
if $rows != 1 then 
  return -1
endi

print =============== step9
sql drop database $db

print =============== step10
sql create database $db
sql use $db
sql show tables
if $rows != 0 then 
  return -1
endi

print =============== step11
sql create table $tb (ts timestamp, speed int)
sql show tables
if $rows != 1 then 
  return -1
endi

print =============== step12
sql drop database $db

print =============== step13
sql create database $db
sql use $db
sql show tables
if $rows != 0 then 
  return -1
endi
sql create table $tb (ts timestamp, speed int)
sql show tables
if $rows != 1 then 
  return -1
endi
sql insert into $tb values (now+1a, 0)
sql insert into $tb values (now+2a, 1)
sql insert into $tb values (now+3a, 2)
sql insert into $tb values (now+4a, 3)
sql insert into $tb values (now+5a, 4)
sql select * from $tb
if $rows != 5 then 
  return -1
endi

print =============== step14
sql drop database $db

print =============== step15
sql create database $db
sql use $db
sql show tables
if $rows != 0 then 
  return -1
endi

print =============== step16
sql create table $tb (ts timestamp, speed int)
sql show tables
if $rows != 1 then 
  return -1
endi
sql select * from $tb
if $rows != 0 then 
  return -1
endi

sql drop database $db
sql show databases
if $rows != 0 then 
  return -1
endi