backquote.sim 8.1 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 40 41
    print notes: after nchar show ok, modify binary to nchar
    sql create table `stable` (`timestamp` timestamp, `int` int, `binary` binary(16), `nchar` binary(16)) tags (`float` float, `Binary` binary(16), `Nchar` nchar(16))
    sql create table `Stable` (`timestamp` timestamp, `int` int, `Binary` binary(32), `Nchar` binary(32)) tags (`float` float, `binary` binary(16), `nchar` nchar(16))
P
plum-lihui 已提交
42 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 
P
plum-lihui 已提交
51 52 53
        if $data00 != stable then 
          return -1
        endi
P
plum-lihui 已提交
54
    endi
P
plum-lihui 已提交
55 56 57 58
    if $data10 != Stable then 
        if $data10 != stable then 
          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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 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
    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')
    
    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 已提交
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
    #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 
    #  return -1
    #endi     
    #sql select * from `stable`
P
plum-lihui 已提交
173 174 175 176 177 178 179 180 181 182 183 184 185
    #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 已提交
186
	sleep 200
P
plum-lihui 已提交
187 188 189 190 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
	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 
P
plum-lihui 已提交
236 237 238
        if $data00 != stable then 
          return -1
        endi
P
plum-lihui 已提交
239
    endi
P
plum-lihui 已提交
240 241 242 243
    if $data10 != Stable then 
        if $data10 != stable then 
          return -1
        endi
P
plum-lihui 已提交
244 245 246 247 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
    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 已提交
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344
    #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 
    #  return -1
    #endi     
    #sql select * from `stable`
P
plum-lihui 已提交
345 346 347 348 349 350 351 352
    #if $rows != 4 then 
    #  return -1
    #endi

endw


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