backquote.sim 8.2 KB
Newer Older
P
plum-lihui 已提交
1 2 3 4 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 31 32 33 34 35 36 37 38
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sleep 50
sql connect

print =============== create database
sql create database `database`
sql create database `DataBase`
sql show databases
print rows: $rows 
print $data00  $data01
print $data10  $data11 
print $data20  $data21
if $rows != 3 then 
  return -1
endi
if $data00 != database then 
  return -1
endi
if $data10 != DataBase then 
  return -1
endi
if $data20 != information_schema then 
  return -1
endi

$dbCnt = 0
while $dbCnt < 2
    if $dbCnt == 0 then 
        sql use `database`
    else 
        sql use `DataBase`
    endi
    
    $dbCnt = $dbCnt + 1

    print =============== create super table, include all type
P
plum-lihui 已提交
39
    print notes: after nchar show ok, modify binary to nchar
P
plum-lihui 已提交
40 41
    sql create table `stable` (`timestamp` timestamp, `int` int, `binary` binary(16), `nchar` nchar(16)) tags (`float` float, `Binary` binary(16), `Nchar` nchar(16))
    sql create table `Stable` (`timestamp` timestamp, `int` int, `Binary` binary(32), `Nchar` nchar(32)) tags (`float` float, `binary` binary(16), `nchar` nchar(16))
42

P
plum-lihui 已提交
43 44 45 46 47 48 49 50
    sql show stables
    print rows: $rows 
    print $data00  $data01
    print $data10  $data11
    if $rows != 2 then 
      return -1
    endi
    if $data00 != Stable then 
H
Haojun Liao 已提交
51
        if $data00 != stable then
P
plum-lihui 已提交
52 53
          return -1
        endi
P
plum-lihui 已提交
54
    endi
H
Haojun Liao 已提交
55 56
    if $data10 != Stable then
        if $data10 != stable then
P
plum-lihui 已提交
57 58
          return -1
        endi
P
plum-lihui 已提交
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
    endi
    
    print =============== create child table
    sql create table `table` using `stable` tags(100.0, 'stable+table', 'stable+table')
    sql create table `Table` using `stable` tags(100.1, 'stable+Table', 'stable+Table')
    
    sql create table `TAble` using `Stable` tags(100.0, 'Stable+TAble', 'Stable+TAble')
    sql create table `TABle` using `Stable` tags(100.1, 'Stable+TABle', 'Stable+TABle')    
   
    sql show tables
    print rows: $rows 
    print $data00  $data01
    print $data10  $data11
    print $data20  $data21
    print $data30  $data31
    if $rows != 4 then 
      return -1
    endi
    
    print =============== insert data
    sql insert into `table` values(now+0s, 10, 'table', 'table')(now+1s, 11, 'table', 'table')
    sql insert into `Table` values(now+0s, 20, 'Table', 'Table')(now+1s, 21, 'Table', 'Table')
    sql insert into `TAble` values(now+0s, 30, 'TAble', 'TAble')(now+1s, 31, 'TAble', 'TAble')
    sql insert into `TABle` values(now+0s, 40, 'TABle', 'TABle')(now+4s, 41, 'TABle', 'TABle')
83

P
plum-lihui 已提交
84 85
    print =============== query data
    sql select * from `table`
86
    print rows: $rows
P
plum-lihui 已提交
87 88 89 90 91 92 93 94 95 96 97
    print $data00 $data01 $data02 $data03
    print $data10 $data11 $data12 $data13
    if $rows != 2 then 
      return -1
    endi    
    if $data01 != 10 then 
      return -1
    endi    
    if $data02 != table then 
      return -1
    endi    
98 99
    if $data03 != table then
      print expect table, actual $data03
P
plum-lihui 已提交
100 101
      return -1
    endi
102 103 104


    print =================> 1
P
plum-lihui 已提交
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
    sql select * from `Table`
    print rows: $rows 
    print $data00 $data01 $data02 $data03
    print $data10 $data11 $data12 $data13
    if $rows != 2 then 
      return -1
    endi    
    if $data01 != 20 then 
      return -1
    endi    
    if $data02 != Table then 
      return -1
    endi    
    if $data03 != Table then 
      return -1
    endi
121 122

    print ================>2
P
plum-lihui 已提交
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
    sql select * from `TAble`
    print rows: $rows 
    print $data00 $data01 $data02 $data03
    print $data10 $data11 $data12 $data13
    if $rows != 2 then 
      return -1
    endi    
    if $data01 != 30 then 
      return -1
    endi    
    if $data02 != TAble then 
      return -1
    endi    
    if $data03 != TAble then 
      return -1
    endi
    
    sql select * from `TABle`
    print rows: $rows 
    print $data00 $data01 $data02 $data03
    print $data10 $data11 $data12 $data13
    if $rows != 2 then 
      return -1
    endi    
    if $data01 != 40 then 
      return -1
    endi    
    if $data02 != TABle then 
      return -1
    endi    
    if $data03 != TABle then 
      return -1
    endi
    
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
    #print =============== query data from st, but not support select * from super table, waiting fix
    #sql select count(*) from `stable`
    #print rows: $rows
    #print $data00 $data01 $data02 $data03
    #if $rows != 1 then
    #  return -1
    #endi
    #if $data00 != 4 then
    #  return -1
    #endi
    #sql select count(*) from `Stable`
    #print rows: $rows
    #print $data00 $data01 $data02 $data03
    #if $rows != 1 then
    #  return -1
    #endi
    #if $data00 != 4 then
P
plum-lihui 已提交
174 175
    #  return -1
    #endi
P
plum-lihui 已提交
176
    #sql select * from `stable`
P
plum-lihui 已提交
177 178 179 180 181 182 183 184 185 186 187 188 189
    #if $rows != 4 then 
    #  return -1
    #endi

endw

print =============== stop and restart taosd
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start

$loop_cnt = 0
check_dnode_ready:
	$loop_cnt = $loop_cnt + 1
P
plum-lihui 已提交
190
	sleep 200
P
plum-lihui 已提交
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
	if $loop_cnt == 10 then
	  print ====> dnode not ready!
		return -1
	endi
sql show dnodes
print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05
if $data00 != 1 then
  return -1
endi
if $data04 != ready then
  goto check_dnode_ready
endi

sql show databases
print rows: $rows 
print $data00  $data01
print $data10  $data11 
print $data20  $data21
if $rows != 3 then 
  return -1
endi
if $data00 != database then 
  return -1
endi
if $data10 != DataBase then 
  return -1
endi
if $data20 != information_schema then 
  return -1
endi

$dbCnt = 0
while $dbCnt < 2
    if $dbCnt == 0 then 
        sql use `database`
    else 
        sql use `DataBase`
    endi
    
    $dbCnt = $dbCnt + 1

    sql show stables
    print rows: $rows 
    print $data00  $data01
    print $data10  $data11
    if $rows != 2 then 
      return -1
    endi
    if $data00 != Stable then 
H
Haojun Liao 已提交
240
        if $data00 != stable then
P
plum-lihui 已提交
241 242
          return -1
        endi
P
plum-lihui 已提交
243
    endi
H
Haojun Liao 已提交
244 245
    if $data10 != Stable then
        if $data10 != stable then
P
plum-lihui 已提交
246 247
          return -1
        endi
P
plum-lihui 已提交
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328
    endi
  
    sql show tables
    print rows: $rows 
    print $data00  $data01
    print $data10  $data11
    print $data20  $data21
    print $data30  $data31
    if $rows != 4 then 
      return -1
    endi
    
    print =============== query data
    sql select * from `table`
    print rows: $rows 
    print $data00 $data01 $data02 $data03
    print $data10 $data11 $data12 $data13
    if $rows != 2 then 
      return -1
    endi    
    if $data01 != 10 then 
      return -1
    endi    
    if $data02 != table then 
      return -1
    endi    
    if $data03 != table then 
      return -1
    endi
    
    sql select * from `Table`
    print rows: $rows 
    print $data00 $data01 $data02 $data03
    print $data10 $data11 $data12 $data13
    if $rows != 2 then 
      return -1
    endi    
    if $data01 != 20 then 
      return -1
    endi    
    if $data02 != Table then 
      return -1
    endi    
    if $data03 != Table then 
      return -1
    endi
    
    sql select * from `TAble`
    print rows: $rows 
    print $data00 $data01 $data02 $data03
    print $data10 $data11 $data12 $data13
    if $rows != 2 then 
      return -1
    endi    
    if $data01 != 30 then 
      return -1
    endi    
    if $data02 != TAble then 
      return -1
    endi    
    if $data03 != TAble then 
      return -1
    endi
    
    sql select * from `TABle`
    print rows: $rows 
    print $data00 $data01 $data02 $data03
    print $data10 $data11 $data12 $data13
    if $rows != 2 then 
      return -1
    endi    
    if $data01 != 40 then 
      return -1
    endi    
    if $data02 != TABle then 
      return -1
    endi    
    if $data03 != TABle then 
      return -1
    endi
    
P
plum-lihui 已提交
329 330
    #print =============== query data from st, but not support select * from super table, waiting fix
    #sql select count(*) from `stable`
H
Haojun Liao 已提交
331
    #print rows: $rows
P
plum-lihui 已提交
332
    #print $data00 $data01 $data02 $data03
H
Haojun Liao 已提交
333
    #if $rows != 1 then
P
plum-lihui 已提交
334
    #  return -1
H
Haojun Liao 已提交
335 336
    #endi
    #if $data00 != 4 then
P
plum-lihui 已提交
337
    #  return -1
H
Haojun Liao 已提交
338
    #endi
P
plum-lihui 已提交
339
    #sql select count(*) from `Stable`
H
Haojun Liao 已提交
340
    #print rows: $rows
P
plum-lihui 已提交
341
    #print $data00 $data01 $data02 $data03
H
Haojun Liao 已提交
342
    #if $rows != 1 then
P
plum-lihui 已提交
343
    #  return -1
H
Haojun Liao 已提交
344 345
    #endi
    #if $data00 != 4 then
P
plum-lihui 已提交
346
    #  return -1
H
Haojun Liao 已提交
347
    #endi
P
plum-lihui 已提交
348
    #sql select * from `stable`
P
plum-lihui 已提交
349 350 351 352 353 354 355 356
    #if $rows != 4 then 
    #  return -1
    #endi

endw


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