add.py 73.3 KB
Newer Older
1 2 3 4 5 6 7 8 9
# -*- coding: utf-8 -*-

import sys
from util.log import *
from util.cases import *
from util.sql import *


class TDTestCase:
S
Shuduo Sang 已提交
10
    def init(self, conn, logSql):
11
        tdLog.debug("start to execute %s" % __file__)
S
Shuduo Sang 已提交
12
        tdSql.init(conn.cursor(), logSql)
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 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 71 72 73 74 75 76 77 78 79

    def run(self):
        tdSql.prepare()

        # TSIM: system sh/stop_dnodes.sh
        # TSIM:
        # TSIM:
        # TSIM: system sh/deploy.sh -n dnode1 -i 1
        # TSIM: system sh/cfg.sh -n dnode1 -c walLevel -v 0
        # TSIM: system sh/exec.sh -n dnode1 -s start
        # TSIM:
        # TSIM: sleep 3000
        # TSIM: sql connect
        # TSIM:
        # TSIM: print ======================== dnode1 start
        tdLog.info('======================== dnode1 start')
        # TSIM:
        # TSIM: $dbPrefix = ta_ad_db
        # TSIM: $tbPrefix = ta_ad_tb
        tbPrefix = "ta_ad_tb"
        # TSIM: $mtPrefix = ta_ad_mt
        mtPrefix = "ta_ad_mt"
        # TSIM: $tbNum = 10
        tbNum = 10
        # TSIM: $rowNum = 20
        rowNum = 20
        # TSIM: $totalNum = 200
        totalNum = 200
        # TSIM:
        # TSIM: print =============== step1
        tdLog.info('=============== step1')
        # TSIM: $i = 0
        i = 0
        # TSIM: $db = $dbPrefix . $i
        # TSIM:
        # TSIM: sql create database $db
        # TSIM: sql use $db
        # TSIM:
        # TSIM: print =============== step2
        tdLog.info('=============== step2')
        # TSIM: $i = 2
        i = 2
        # TSIM: $mt = $mtPrefix . $i
        mt = "%s%d" % (mtPrefix, i)
        # TSIM: $tb = $tbPrefix . $i
        tb = "%s%d" % (tbPrefix, i)
        # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
        # bool, tgcol2 int)
        tdLog.info(
            'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int)' %
            (mt))
        tdSql.execute(
            'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int)' %
            (mt))
        # TSIM: sql create table $tb using $mt tags( 1, 2 )
        tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt))
        tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt))
        # TSIM: sql insert into $tb values(now, 1)
        tdLog.info('insert into %s values(now, 1)' % (tb))
        tdSql.execute('insert into %s values(now, 1)' % (tb))
        # TSIM: sql select * from $mt where tgcol2 = 2
        tdLog.info('select * from %s where tgcol2 = 2' % (mt))
        tdSql.query('select * from %s where tgcol2 = 2' % (mt))
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
80
        # TSIM: endi
81 82 83 84
        # TSIM: if $data01 != 1 then
        tdLog.info('tdSql.checkData(0, 1, 1)')
        tdSql.checkData(0, 1, 1)
        # TSIM: return -1
85
        # TSIM: endi
86 87 88 89
        # TSIM: if $data02 != 1 then
        tdLog.info('tdSql.checkData(0, 2, 1)')
        tdSql.checkData(0, 2, 1)
        # TSIM: return -1
90
        # TSIM: endi
91 92 93 94
        # TSIM: if $data03 != 2 then
        tdLog.info('tdSql.checkData(0, 3, 2)')
        tdSql.checkData(0, 3, 2)
        # TSIM: return -1
95
        # TSIM: endi
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
        # TSIM:
        # TSIM: sql alter table $mt drop tag tgcol2
        tdLog.info('alter table %s drop tag tgcol2' % (mt))
        tdSql.execute('alter table %s drop tag tgcol2' % (mt))
        # TSIM: sql alter table $mt add tag tgcol4 int
        tdLog.info('alter table %s add tag tgcol4 int' % (mt))
        tdSql.execute('alter table %s add tag tgcol4 int' % (mt))
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM: sql alter table $tb set tag tgcol4 =4
        tdLog.info('alter table %s set tag tgcol4 =4' % (tb))
        tdSql.execute('alter table %s set tag tgcol4 =4' % (tb))
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM:
        # TSIM: sql select * from $mt where tgcol4 = 4
        tdLog.info('select * from %s where tgcol4 = 4' % (mt))
        tdSql.query('select * from %s where tgcol4 = 4' % (mt))
        # TSIM: print $data01 $data02 $data03
        tdLog.info('$data01 $data02 $data03')
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
122
        # TSIM: endi
123 124 125 126
        # TSIM: if $data01 != 1 then
        tdLog.info('tdSql.checkData(0, 1, 1)')
        tdSql.checkData(0, 1, 1)
        # TSIM: return -1
127
        # TSIM: endi
128 129 130 131
        # TSIM: if $data02 != 1 then
        tdLog.info('tdSql.checkData(0, 2, 1)')
        tdSql.checkData(0, 2, 1)
        # TSIM: return -1
132
        # TSIM: endi
133 134 135 136
        # TSIM: if $data03 != 4 then
        tdLog.info('tdSql.checkData(0, 3, 4)')
        tdSql.checkData(0, 3, 4)
        # TSIM: return -1
137
        # TSIM: endi
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
        # TSIM:
        # TSIM: sql select * from $mt where tgcol2 = 1 -x step2
        tdLog.info('select * from %s where tgcol2 = 1 -x step2' % (mt))
        tdSql.error('select * from %s where tgcol2 = 1' % (mt))
        # TSIM: return -1
        # TSIM: step2:
        # TSIM:
        # TSIM: print =============== step3
        tdLog.info('=============== step3')
        # TSIM: $i = 3
        i = 3
        # TSIM: $mt = $mtPrefix . $i
        mt = "%s%d" % (mtPrefix, i)
        # TSIM: $tb = $tbPrefix . $i
        tb = "%s%d" % (tbPrefix, i)
        # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
        # smallint, tgcol2 tinyint)
        tdLog.info(
            'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint)' %
            (mt))
        tdSql.execute(
            'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint)' %
            (mt))
        # TSIM: sql create table $tb using $mt tags( 1, 2 )
        tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt))
        tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt))
        # TSIM: sql insert into $tb values(now, 1)
        tdLog.info('insert into %s values(now, 1)' % (tb))
        tdSql.execute('insert into %s values(now, 1)' % (tb))
        # TSIM: sql select * from $mt where tgcol2 = 2
        tdLog.info('select * from %s where tgcol2 = 2' % (mt))
        tdSql.query('select * from %s where tgcol2 = 2' % (mt))
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
174
        # TSIM: endi
175 176 177 178
        # TSIM: if $data01 != 1 then
        tdLog.info('tdSql.checkData(0, 1, 1)')
        tdSql.checkData(0, 1, 1)
        # TSIM: return -1
179
        # TSIM: endi
180 181 182 183
        # TSIM: if $data02 != 1 then
        tdLog.info('tdSql.checkData(0, 2, 1)')
        tdSql.checkData(0, 2, 1)
        # TSIM: return -1
184
        # TSIM: endi
185 186 187 188
        # TSIM: if $data03 != 2 then
        tdLog.info('tdSql.checkData(0, 3, 2)')
        tdSql.checkData(0, 3, 2)
        # TSIM: return -1
189
        # TSIM: endi
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
        # TSIM:
        # TSIM: sql alter table $mt drop tag tgcol2
        tdLog.info('alter table %s drop tag tgcol2' % (mt))
        tdSql.execute('alter table %s drop tag tgcol2' % (mt))
        # TSIM: sql alter table $mt add tag tgcol4 tinyint
        tdLog.info('alter table %s add tag tgcol4 tinyint' % (mt))
        tdSql.execute('alter table %s add tag tgcol4 tinyint' % (mt))
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM: sql alter table $tb set tag tgcol4=4
        tdLog.info('alter table %s set tag tgcol4=4' % (tb))
        tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM:
        # TSIM: sql select * from $mt where tgcol4 = 4
        tdLog.info('select * from %s where tgcol4 = 4' % (mt))
        tdSql.query('select * from %s where tgcol4 = 4' % (mt))
        # TSIM: print $data01 $data02 $data03
        tdLog.info('$data01 $data02 $data03')
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
216
        # TSIM: endi
217 218 219 220
        # TSIM: if $data01 != 1 then
        tdLog.info('tdSql.checkData(0, 1, 1)')
        tdSql.checkData(0, 1, 1)
        # TSIM: return -1
221
        # TSIM: endi
222 223 224 225
        # TSIM: if $data02 != 1 then
        tdLog.info('tdSql.checkData(0, 2, 1)')
        tdSql.checkData(0, 2, 1)
        # TSIM: return -1
226
        # TSIM: endi
227 228 229 230
        # TSIM: if $data03 != 4 then
        tdLog.info('tdSql.checkData(0, 3, 4)')
        tdSql.checkData(0, 3, 4)
        # TSIM: return -1
231
        # TSIM: endi
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267
        # TSIM:
        # TSIM: sql select * from $mt where tgcol2 = 1 -x step3
        tdLog.info('select * from %s where tgcol2 = 1 -x step3' % (mt))
        tdSql.error('select * from %s where tgcol2 = 1' % (mt))
        # TSIM: return -1
        # TSIM: step3:
        # TSIM:
        # TSIM: print =============== step4
        tdLog.info('=============== step4')
        # TSIM: $i = 4
        i = 4
        # TSIM: $mt = $mtPrefix . $i
        mt = "%s%d" % (mtPrefix, i)
        # TSIM: $tb = $tbPrefix . $i
        tb = "%s%d" % (tbPrefix, i)
        # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
        # bigint, tgcol2 float)
        tdLog.info(
            'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float)' %
            (mt))
        tdSql.execute(
            'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float)' %
            (mt))
        # TSIM: sql create table $tb using $mt tags( 1, 2 )
        tdLog.info('create table %s using %s tags( 1, 2 )' % (tb, mt))
        tdSql.execute('create table %s using %s tags( 1, 2 )' % (tb, mt))
        # TSIM: sql insert into $tb values(now, 1)
        tdLog.info('insert into %s values(now, 1)' % (tb))
        tdSql.execute('insert into %s values(now, 1)' % (tb))
        # TSIM: sql select * from $mt where tgcol2 = 2
        tdLog.info('select * from %s where tgcol2 = 2' % (mt))
        tdSql.query('select * from %s where tgcol2 = 2' % (mt))
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
268
        # TSIM: endi
269 270 271 272
        # TSIM: if $data01 != 1 then
        tdLog.info('tdSql.checkData(0, 1, 1)')
        tdSql.checkData(0, 1, 1)
        # TSIM: return -1
273
        # TSIM: endi
274 275 276 277
        # TSIM: if $data02 != 1 then
        tdLog.info('tdSql.checkData(0, 2, 1)')
        tdSql.checkData(0, 2, 1)
        # TSIM: return -1
278
        # TSIM: endi
279 280 281 282
        # TSIM: if $data03 != 2.00000 then
        tdLog.info('tdSql.checkData(0, 3, 2.00000)')
        tdSql.checkData(0, 3, 2.00000)
        # TSIM: return -1
283
        # TSIM: endi
284 285 286 287 288 289 290 291
        # TSIM:
        # TSIM: sql describe $tb
        tdLog.info('describe %s' % (tb))
        tdSql.query('describe %s' % (tb))
        # TSIM: if $data21 != BIGINT then
        tdLog.info('tdSql.checkDataType(2, 1, "BIGINT")')
        tdSql.checkDataType(2, 1, "BIGINT")
        # TSIM: return -1
292
        # TSIM: endi
293 294 295 296
        # TSIM: if $data31 != FLOAT then
        tdLog.info('tdSql.checkDataType(3, 1, "FLOAT")')
        tdSql.checkDataType(3, 1, "FLOAT")
        # TSIM: return -1
297
        # TSIM: endi
298
        # TSIM: if $data23 != 1 then
299 300
        tdLog.info('tdSql.checkData(2, 3, TAG)')
        tdSql.checkData(2, 3, "TAG")
301
        # TSIM: return -1
302
        # TSIM: endi
303 304
        # TSIM: if $data33 != 2.000000 then
        tdLog.info('tdSql.checkData(3, 3, 2.000000)')
305
        tdSql.checkData(3, 3, "TAG")
306
        # TSIM: return -1
307
        # TSIM: endi
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333
        # TSIM:
        # TSIM: sql alter table $mt drop tag tgcol2
        tdLog.info('alter table %s drop tag tgcol2' % (mt))
        tdSql.execute('alter table %s drop tag tgcol2' % (mt))
        # TSIM: sql alter table $mt add tag tgcol4 float
        tdLog.info('alter table %s add tag tgcol4 float' % (mt))
        tdSql.execute('alter table %s add tag tgcol4 float' % (mt))
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM: sql alter table $tb set tag tgcol4=4
        tdLog.info('alter table %s set tag tgcol4=4' % (tb))
        tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM:
        # TSIM: sql select * from $mt where tgcol4 = 4
        tdLog.info('select * from %s where tgcol4 = 4' % (mt))
        tdSql.query('select * from %s where tgcol4 = 4' % (mt))
        # TSIM: print $data01 $data02 $data03
        tdLog.info('$data01 $data02 $data03')
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
334
        # TSIM: endi
335 336 337 338
        # TSIM: if $data01 != 1 then
        tdLog.info('tdSql.checkData(0, 1, 1)')
        tdSql.checkData(0, 1, 1)
        # TSIM: return -1
339
        # TSIM: endi
340 341 342 343
        # TSIM: if $data02 != 1 then
        tdLog.info('tdSql.checkData(0, 2, 1)')
        tdSql.checkData(0, 2, 1)
        # TSIM: return -1
344
        # TSIM: endi
345 346 347 348
        # TSIM: if $data03 != 4.00000 then
        tdLog.info('tdSql.checkData(0, 3, 4.00000)')
        tdSql.checkData(0, 3, 4.00000)
        # TSIM: return -1
349
        # TSIM: endi
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385
        # TSIM:
        # TSIM: sql select * from $mt where tgcol2 = 1 -x step4
        tdLog.info('select * from %s where tgcol2 = 1 -x step4' % (mt))
        tdSql.error('select * from %s where tgcol2 = 1' % (mt))
        # TSIM: return -1
        # TSIM: step4:
        # TSIM:
        # TSIM: print =============== step5
        tdLog.info('=============== step5')
        # TSIM: $i = 5
        i = 5
        # TSIM: $mt = $mtPrefix . $i
        mt = "%s%d" % (mtPrefix, i)
        # TSIM: $tb = $tbPrefix . $i
        tb = "%s%d" % (tbPrefix, i)
        # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
        # double, tgcol2 binary(10))
        tdLog.info(
            'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10))' %
            (mt))
        tdSql.execute(
            'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10))' %
            (mt))
        # TSIM: sql create table $tb using $mt tags( 1, '2' )
        tdLog.info('create table %s using %s tags( 1, "2" )' % (tb, mt))
        tdSql.execute('create table %s using %s tags( 1, "2" )' % (tb, mt))
        # TSIM: sql insert into $tb values(now, 1)
        tdLog.info('insert into %s values(now, 1)' % (tb))
        tdSql.execute('insert into %s values(now, 1)' % (tb))
        # TSIM: sql select * from $mt where tgcol2 = '2'
        tdLog.info('select * from %s where tgcol2 = "2"' % (mt))
        tdSql.query('select * from %s where tgcol2 = "2"' % (mt))
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
386
        # TSIM: endi
387 388 389 390
        # TSIM: if $data01 != 1 then
        tdLog.info('tdSql.checkData(0, 1, 1)')
        tdSql.checkData(0, 1, 1)
        # TSIM: return -1
391
        # TSIM: endi
392 393 394 395
        # TSIM: if $data02 != 1.000000000 then
        tdLog.info('tdSql.checkData(0, 2, 1.000000000)')
        tdSql.checkData(0, 2, 1.000000000)
        # TSIM: return -1
396
        # TSIM: endi
397 398
        # TSIM: if $data03 != 2 then
        tdLog.info('tdSql.checkData(0, 3, 2)')
399
        tdSql.checkData(0, 3, "2")
400
        # TSIM: return -1
401
        # TSIM: endi
402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427
        # TSIM:
        # TSIM: sql alter table $mt drop tag tgcol2
        tdLog.info('alter table %s drop tag tgcol2' % (mt))
        tdSql.execute('alter table %s drop tag tgcol2' % (mt))
        # TSIM: sql alter table $mt add tag tgcol4 smallint
        tdLog.info('alter table %s add tag tgcol4 smallint' % (mt))
        tdSql.execute('alter table %s add tag tgcol4 smallint' % (mt))
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM: sql alter table $tb set tag tgcol4=4
        tdLog.info('alter table %s set tag tgcol4=4' % (tb))
        tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM:
        # TSIM: sql select * from $mt where tgcol4 = 4
        tdLog.info('select * from %s where tgcol4 = 4' % (mt))
        tdSql.query('select * from %s where tgcol4 = 4' % (mt))
        # TSIM: print $data01 $data02 $data03
        tdLog.info('$data01 $data02 $data03')
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
428
        # TSIM: endi
429 430 431 432
        # TSIM: if $data01 != 1 then
        tdLog.info('tdSql.checkData(0, 1, 1)')
        tdSql.checkData(0, 1, 1)
        # TSIM: return -1
433
        # TSIM: endi
434 435 436 437
        # TSIM: if $data02 != 1.000000000 then
        tdLog.info('tdSql.checkData(0, 2, 1.000000000)')
        tdSql.checkData(0, 2, 1.000000000)
        # TSIM: return -1
438
        # TSIM: endi
439 440 441 442
        # TSIM: if $data03 != 4 then
        tdLog.info('tdSql.checkData(0, 3, 4)')
        tdSql.checkData(0, 3, 4)
        # TSIM: return -1
443
        # TSIM: endi
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479
        # TSIM:
        # TSIM: sql select * from $mt where tgcol3 = '1' -x step5
        tdLog.info('select * from %s where tgcol3 = "1" -x step5' % (mt))
        tdSql.error('select * from %s where tgcol3 = "1"' % (mt))
        # TSIM: return -1
        # TSIM: step5:
        # TSIM:
        # TSIM: print =============== step6
        tdLog.info('=============== step6')
        # TSIM: $i = 6
        i = 6
        # TSIM: $mt = $mtPrefix . $i
        mt = "%s%d" % (mtPrefix, i)
        # TSIM: $tb = $tbPrefix . $i
        tb = "%s%d" % (tbPrefix, i)
        # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
        # bool, tgcol2 int, tgcol3 tinyint)
        tdLog.info(
            'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 tinyint)' %
            (mt))
        tdSql.execute(
            'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 tinyint)' %
            (mt))
        # TSIM: sql create table $tb using $mt tags( 1, 2, 3 )
        tdLog.info('create table %s using %s tags( 1, 2, 3 )' % (tb, mt))
        tdSql.execute('create table %s using %s tags( 1, 2, 3 )' % (tb, mt))
        # TSIM: sql insert into $tb values(now, 1)
        tdLog.info('insert into %s values(now, 1)' % (tb))
        tdSql.execute('insert into %s values(now, 1)' % (tb))
        # TSIM: sql select * from $mt where tgcol2 = 2
        tdLog.info('select * from %s where tgcol2 = 2' % (mt))
        tdSql.query('select * from %s where tgcol2 = 2' % (mt))
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
480
        # TSIM: endi
481 482 483 484
        # TSIM: if $data01 != 1 then
        tdLog.info('tdSql.checkData(0, 1, 1)')
        tdSql.checkData(0, 1, 1)
        # TSIM: return -1
485
        # TSIM: endi
486 487 488 489
        # TSIM: if $data02 != 1 then
        tdLog.info('tdSql.checkData(0, 2, 1)')
        tdSql.checkData(0, 2, 1)
        # TSIM: return -1
490
        # TSIM: endi
491 492 493 494
        # TSIM: if $data03 != 2 then
        tdLog.info('tdSql.checkData(0, 3, 2)')
        tdSql.checkData(0, 3, 2)
        # TSIM: return -1
495
        # TSIM: endi
496 497 498 499
        # TSIM: if $data04 != 3 then
        tdLog.info('tdSql.checkData(0, 4, 3)')
        tdSql.checkData(0, 4, 3)
        # TSIM: return -1
500
        # TSIM: endi
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542
        # TSIM:
        # TSIM: sql alter table $mt change tag tgcol1 tgcol4
        tdLog.info('alter table %s change tag tgcol1 tgcol4' % (mt))
        tdSql.execute('alter table %s change tag tgcol1 tgcol4' % (mt))
        # TSIM: sql alter table $mt drop tag tgcol2
        tdLog.info('alter table %s drop tag tgcol2' % (mt))
        tdSql.execute('alter table %s drop tag tgcol2' % (mt))
        # TSIM: sql alter table $mt drop tag tgcol3
        tdLog.info('alter table %s drop tag tgcol3' % (mt))
        tdSql.execute('alter table %s drop tag tgcol3' % (mt))
        # TSIM: sql alter table $mt add tag tgcol5 binary(10)
        tdLog.info('alter table %s add tag tgcol5 binary(10)' % (mt))
        tdSql.execute('alter table %s add tag tgcol5 binary(10)' % (mt))
        # TSIM: sql alter table $mt add tag tgcol6 binary(10)
        tdLog.info('alter table %s add tag tgcol6 binary(10)' % (mt))
        tdSql.execute('alter table %s add tag tgcol6 binary(10)' % (mt))
        # TSIM:
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM: sql alter table $tb set tag tgcol4=false
        tdLog.info('alter table %s set tag tgcol4=false' % (tb))
        tdSql.execute('alter table %s set tag tgcol4=false' % (tb))
        # TSIM: sql alter table $tb set tag tgcol5=5
        tdLog.info('alter table %s set tag tgcol5=5' % (tb))
        tdSql.execute('alter table %s set tag tgcol5=5' % (tb))
        # TSIM: sql alter table $tb set tag tgcol6=6
        tdLog.info('alter table %s set tag tgcol6=6' % (tb))
        tdSql.execute('alter table %s set tag tgcol6=6' % (tb))
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM:
        # TSIM: sql select * from $mt where tgcol5 = '5'
        tdLog.info('select * from %s where tgcol5 = "5"' % (mt))
        tdSql.query('select * from %s where tgcol5 = "5"' % (mt))
        # TSIM: print $data01 $data02 $data03
        tdLog.info('$data01 $data02 $data03')
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
543
        # TSIM: endi
544 545 546 547
        # TSIM: if $data01 != 1 then
        tdLog.info('tdSql.checkData(0, 1, 1)')
        tdSql.checkData(0, 1, 1)
        # TSIM: return -1
548
        # TSIM: endi
549 550 551 552
        # TSIM: if $data02 != 0 then
        tdLog.info('tdSql.checkData(0, 2, 0)')
        tdSql.checkData(0, 2, 0)
        # TSIM: return -1
553
        # TSIM: endi
554 555
        # TSIM: if $data03 != 5 then
        tdLog.info('tdSql.checkData(0, 3, 5)')
556
        tdSql.checkData(0, 3, "5")
557
        # TSIM: return -1
558
        # TSIM: endi
559 560
        # TSIM: if $data04 != 6 then
        tdLog.info('tdSql.checkData(0, 4, 6)')
561
        tdSql.checkData(0, 4, "6")
562
        # TSIM: return -1
563
        # TSIM: endi
564 565 566 567 568 569 570 571 572 573
        # TSIM:
        # TSIM: sql select * from $mt where tgcol6 = '6'
        tdLog.info('select * from %s where tgcol6 = "6"' % (mt))
        tdSql.query('select * from %s where tgcol6 = "6"' % (mt))
        # TSIM: print $data01 $data02 $data03
        tdLog.info('$data01 $data02 $data03')
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
574
        # TSIM: endi
575 576 577 578
        # TSIM: if $data01 != 1 then
        tdLog.info('tdSql.checkData(0, 1, 1)')
        tdSql.checkData(0, 1, 1)
        # TSIM: return -1
579
        # TSIM: endi
580 581 582 583
        # TSIM: if $data02 != 0 then
        tdLog.info('tdSql.checkData(0, 2, 0)')
        tdSql.checkData(0, 2, 0)
        # TSIM: return -1
584
        # TSIM: endi
585 586
        # TSIM: if $data03 != 5 then
        tdLog.info('tdSql.checkData(0, 3, 5)')
587
        tdSql.checkData(0, 3, "5")
588
        # TSIM: return -1
589
        # TSIM: endi
590 591
        # TSIM: if $data04 != 6 then
        tdLog.info('tdSql.checkData(0, 4, 6)')
592
        tdSql.checkData(0, 4, "6")
593
        # TSIM: return -1
594
        # TSIM: endi
595 596 597 598 599 600 601 602
        # TSIM:
        # TSIM: sql select * from $mt where tgcol4 = 1
        tdLog.info('select * from %s where tgcol4 = 1' % (mt))
        tdSql.query('select * from %s where tgcol4 = 1' % (mt))
        # TSIM: if $rows != 0 then
        tdLog.info('tdSql.checkRow(0)')
        tdSql.checkRows(0)
        # TSIM: return -1
603
        # TSIM: endi
604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638
        # TSIM: sql select * from $mt where tgcol3 = 1 -x step52
        tdLog.info('select * from %s where tgcol3 = 1 -x step52' % (mt))
        tdSql.error('select * from %s where tgcol3 = 12' % (mt))
        # TSIM: return -1
        # TSIM: step52:
        # TSIM:
        # TSIM: print =============== step7
        tdLog.info('=============== step7')
        # TSIM: $i = 7
        i = 7
        # TSIM: $mt = $mtPrefix . $i
        mt = "%s%d" % (mtPrefix, i)
        # TSIM: $tb = $tbPrefix . $i
        tb = "%s%d" % (tbPrefix, i)
        # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
        # smallint, tgcol2 tinyint, tgcol3 binary(10))
        tdLog.info(
            'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint, tgcol3 binary(10))' %
            (mt))
        tdSql.execute(
            'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint, tgcol3 binary(10))' %
            (mt))
        # TSIM: sql create table $tb using $mt tags( 1, 2, '3' )
        tdLog.info('create table %s using %s tags( 1, 2, "3" )' % (tb, mt))
        tdSql.execute('create table %s using %s tags( 1, 2, "3" )' % (tb, mt))
        # TSIM: sql insert into $tb values(now, 1)
        tdLog.info('insert into %s values(now, 1)' % (tb))
        tdSql.execute('insert into %s values(now, 1)' % (tb))
        # TSIM: sql select * from $mt where tgcol3 = '3'
        tdLog.info('select * from %s where tgcol3 = "3"' % (mt))
        tdSql.query('select * from %s where tgcol3 = "3"' % (mt))
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
639
        # TSIM: endi
640 641 642 643
        # TSIM: if $data01 != 1 then
        tdLog.info('tdSql.checkData(0, 1, 1)')
        tdSql.checkData(0, 1, 1)
        # TSIM: return -1
644
        # TSIM: endi
645 646 647 648
        # TSIM: if $data02 != 1 then
        tdLog.info('tdSql.checkData(0, 2, 1)')
        tdSql.checkData(0, 2, 1)
        # TSIM: return -1
649
        # TSIM: endi
650 651 652 653
        # TSIM: if $data03 != 2 then
        tdLog.info('tdSql.checkData(0, 3, 2)')
        tdSql.checkData(0, 3, 2)
        # TSIM: return -1
654
        # TSIM: endi
655 656
        # TSIM: if $data04 != 3 then
        tdLog.info('tdSql.checkData(0, 4, 3)')
657
        tdSql.checkData(0, 4, "3")
658
        # TSIM: return -1
659
        # TSIM: endi
660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701
        # TSIM:
        # TSIM: sql alter table $mt change tag tgcol1 tgcol4
        tdLog.info('alter table %s change tag tgcol1 tgcol4' % (mt))
        tdSql.execute('alter table %s change tag tgcol1 tgcol4' % (mt))
        # TSIM: sql alter table $mt drop tag tgcol2
        tdLog.info('alter table %s drop tag tgcol2' % (mt))
        tdSql.execute('alter table %s drop tag tgcol2' % (mt))
        # TSIM: sql alter table $mt drop tag tgcol3
        tdLog.info('alter table %s drop tag tgcol3' % (mt))
        tdSql.execute('alter table %s drop tag tgcol3' % (mt))
        # TSIM: sql alter table $mt add tag tgcol5 bigint
        tdLog.info('alter table %s add tag tgcol5 bigint' % (mt))
        tdSql.execute('alter table %s add tag tgcol5 bigint' % (mt))
        # TSIM: sql alter table $mt add tag tgcol6 tinyint
        tdLog.info('alter table %s add tag tgcol6 tinyint' % (mt))
        tdSql.execute('alter table %s add tag tgcol6 tinyint' % (mt))
        # TSIM:
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM: sql alter table $tb set tag tgcol4=4
        tdLog.info('alter table %s set tag tgcol4=4' % (tb))
        tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
        # TSIM: sql alter table $tb set tag tgcol5=5
        tdLog.info('alter table %s set tag tgcol5=5' % (tb))
        tdSql.execute('alter table %s set tag tgcol5=5' % (tb))
        # TSIM: sql alter table $tb set tag tgcol6=6
        tdLog.info('alter table %s set tag tgcol6=6' % (tb))
        tdSql.execute('alter table %s set tag tgcol6=6' % (tb))
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM:
        # TSIM: sql select * from $mt where tgcol6 = 6
        tdLog.info('select * from %s where tgcol6 = 6' % (mt))
        tdSql.query('select * from %s where tgcol6 = 6' % (mt))
        # TSIM: print $data01 $data02 $data03
        tdLog.info('$data01 $data02 $data03')
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
702
        # TSIM: endi
703 704 705 706
        # TSIM: if $data01 != 1 then
        tdLog.info('tdSql.checkData(0, 1, 1)')
        tdSql.checkData(0, 1, 1)
        # TSIM: return -1
707
        # TSIM: endi
708 709 710 711
        # TSIM: if $data02 != 4 then
        tdLog.info('tdSql.checkData(0, 2, 4)')
        tdSql.checkData(0, 2, 4)
        # TSIM: return -1
712
        # TSIM: endi
713 714 715 716
        # TSIM: if $data03 != 5 then
        tdLog.info('tdSql.checkData(0, 3, 5)')
        tdSql.checkData(0, 3, 5)
        # TSIM: return -1
717
        # TSIM: endi
718 719 720 721
        # TSIM: if $data04 != 6 then
        tdLog.info('tdSql.checkData(0, 4, 6)')
        tdSql.checkData(0, 4, 6)
        # TSIM: return -1
722
        # TSIM: endi
723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763
        # TSIM:
        # TSIM: sql select * from $mt where tgcol2 = 1 -x step71
        tdLog.info('select * from %s where tgcol2 = 1 -x step71' % (mt))
        tdSql.error('select * from %s where tgcol2 = 11' % (mt))
        # TSIM: return -1
        # TSIM: step71:
        # TSIM: sql select * from $mt where tgcol3 = 1 -x step72
        tdLog.info('select * from %s where tgcol3 = 1 -x step72' % (mt))
        tdSql.error('select * from %s where tgcol3 = 12' % (mt))
        # TSIM: return -1
        # TSIM: step72:
        # TSIM:
        # TSIM: print =============== step8
        tdLog.info('=============== step8')
        # TSIM: $i = 8
        i = 8
        # TSIM: $mt = $mtPrefix . $i
        mt = "%s%d" % (mtPrefix, i)
        # TSIM: $tb = $tbPrefix . $i
        tb = "%s%d" % (tbPrefix, i)
        # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
        # bigint, tgcol2 float, tgcol3 binary(10))
        tdLog.info(
            'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float, tgcol3 binary(10))' %
            (mt))
        tdSql.execute(
            'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float, tgcol3 binary(10))' %
            (mt))
        # TSIM: sql create table $tb using $mt tags( 1, 2, '3' )
        tdLog.info('create table %s using %s tags( 1, 2, "3" )' % (tb, mt))
        tdSql.execute('create table %s using %s tags( 1, 2, "3" )' % (tb, mt))
        # TSIM: sql insert into $tb values(now, 1)
        tdLog.info('insert into %s values(now, 1)' % (tb))
        tdSql.execute('insert into %s values(now, 1)' % (tb))
        # TSIM: sql select * from $mt where tgcol3 = '3'
        tdLog.info('select * from %s where tgcol3 = "3"' % (mt))
        tdSql.query('select * from %s where tgcol3 = "3"' % (mt))
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
764
        # TSIM: endi
765 766 767 768
        # TSIM: if $data01 != 1 then
        tdLog.info('tdSql.checkData(0, 1, 1)')
        tdSql.checkData(0, 1, 1)
        # TSIM: return -1
769
        # TSIM: endi
770 771 772 773
        # TSIM: if $data02 != 1 then
        tdLog.info('tdSql.checkData(0, 2, 1)')
        tdSql.checkData(0, 2, 1)
        # TSIM: return -1
774
        # TSIM: endi
775 776 777 778
        # TSIM: if $data03 != 2.00000 then
        tdLog.info('tdSql.checkData(0, 3, 2.00000)')
        tdSql.checkData(0, 3, 2.00000)
        # TSIM: return -1
779
        # TSIM: endi
780 781
        # TSIM: if $data04 != 3 then
        tdLog.info('tdSql.checkData(0, 4, 3)')
782
        tdSql.checkData(0, 4, "3")
783
        # TSIM: return -1
784
        # TSIM: endi
785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827
        # TSIM:
        # TSIM: sql alter table $mt change tag tgcol1 tgcol4
        tdLog.info('alter table %s change tag tgcol1 tgcol4' % (mt))
        tdSql.execute('alter table %s change tag tgcol1 tgcol4' % (mt))
        # TSIM: sql alter table $mt drop tag tgcol2
        tdLog.info('alter table %s drop tag tgcol2' % (mt))
        tdSql.execute('alter table %s drop tag tgcol2' % (mt))
        # TSIM: sql alter table $mt drop tag tgcol3
        tdLog.info('alter table %s drop tag tgcol3' % (mt))
        tdSql.execute('alter table %s drop tag tgcol3' % (mt))
        # TSIM: sql alter table $mt add tag tgcol5 binary(17)
        tdLog.info('alter table %s add tag tgcol5 binary(17)' % (mt))
        tdSql.execute('alter table %s add tag tgcol5 binary(17)' % (mt))
        # TSIM: sql alter table $mt add tag tgcol6 bool
        tdLog.info('alter table %s add tag tgcol6 bool' % (mt))
        tdSql.execute('alter table %s add tag tgcol6 bool' % (mt))
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM: sql alter table $tb set tag tgcol4=4
        tdLog.info('alter table %s set tag tgcol4=4' % (tb))
        tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
        # TSIM: sql alter table $tb set tag tgcol5=5
        tdLog.info('alter table %s set tag tgcol5=5' % (tb))
        tdSql.execute('alter table %s set tag tgcol5=5' % (tb))
        # TSIM: sql alter table $tb set tag tgcol6=1
        tdLog.info('alter table %s set tag tgcol6=1' % (tb))
        tdSql.execute('alter table %s set tag tgcol6=1' % (tb))
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM:
        # TSIM: sql select * from $mt where tgcol5 = '5'
        tdLog.info('select * from %s where tgcol5 = "5"' % (mt))
        tdSql.query('select * from %s where tgcol5 = "5"' % (mt))
        # TSIM: print select * from $mt where tgcol5 = 5
        tdLog.info('select * from $mt where tgcol5 = 5')
        # TSIM: print $data01 $data02 $data03 $data04
        tdLog.info('$data01 $data02 $data03 $data04')
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
828
        # TSIM: endi
829 830 831 832
        # TSIM: if $data01 != 1 then
        tdLog.info('tdSql.checkData(0, 1, 1)')
        tdSql.checkData(0, 1, 1)
        # TSIM: return -1
833
        # TSIM: endi
834 835 836 837
        # TSIM: if $data02 != 4 then
        tdLog.info('tdSql.checkData(0, 2, 4)')
        tdSql.checkData(0, 2, 4)
        # TSIM: return -1
838
        # TSIM: endi
839 840
        # TSIM: if $data03 != 5 then
        tdLog.info('tdSql.checkData(0, 3, 5)')
841
        tdSql.checkData(0, 3, "5")
842
        # TSIM: return -1
843
        # TSIM: endi
844 845 846 847
        # TSIM: if $data04 != 1 then
        tdLog.info('tdSql.checkData(0, 4, 1)')
        tdSql.checkData(0, 4, 1)
        # TSIM: return -1
848
        # TSIM: endi
849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889
        # TSIM:
        # TSIM: sql select * from $mt where tgcol2 = 1 -x step81
        tdLog.info('select * from %s where tgcol2 = 1 -x step81' % (mt))
        tdSql.error('select * from %s where tgcol2 = 11' % (mt))
        # TSIM: return -1
        # TSIM: step81:
        # TSIM: sql select * from $mt where tgcol3 = 1 -x step82
        tdLog.info('select * from %s where tgcol3 = 1 -x step82' % (mt))
        tdSql.error('select * from %s where tgcol3 = 12' % (mt))
        # TSIM: return -1
        # TSIM: step82:
        # TSIM:
        # TSIM: print =============== step9
        tdLog.info('=============== step9')
        # TSIM: $i = 9
        i = 9
        # TSIM: $mt = $mtPrefix . $i
        mt = "%s%d" % (mtPrefix, i)
        # TSIM: $tb = $tbPrefix . $i
        tb = "%s%d" % (tbPrefix, i)
        # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
        # double, tgcol2 binary(10), tgcol3 binary(10))
        tdLog.info(
            'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10), tgcol3 binary(10))' %
            (mt))
        tdSql.execute(
            'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10), tgcol3 binary(10))' %
            (mt))
        # TSIM: sql create table $tb using $mt tags( 1, 2, '3' )
        tdLog.info('create table %s using %s tags( 1, 2, "3" )' % (tb, mt))
        tdSql.execute('create table %s using %s tags( 1, 2, "3" )' % (tb, mt))
        # TSIM: sql insert into $tb values(now, 1)
        tdLog.info('insert into %s values(now, 1)' % (tb))
        tdSql.execute('insert into %s values(now, 1)' % (tb))
        # TSIM: sql select * from $mt where tgcol2 = '2'
        tdLog.info('select * from %s where tgcol2 = "2"' % (mt))
        tdSql.query('select * from %s where tgcol2 = "2"' % (mt))
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
890
        # TSIM: endi
891 892 893 894
        # TSIM: if $data01 != 1 then
        tdLog.info('tdSql.checkData(0, 1, 1)')
        tdSql.checkData(0, 1, 1)
        # TSIM: return -1
895
        # TSIM: endi
896 897 898 899
        # TSIM: if $data02 != 1.000000000 then
        tdLog.info('tdSql.checkData(0, 2, 1.000000000)')
        tdSql.checkData(0, 2, 1.000000000)
        # TSIM: return -1
900
        # TSIM: endi
901 902
        # TSIM: if $data03 != 2 then
        tdLog.info('tdSql.checkData(0, 3, 2)')
903
        tdSql.checkData(0, 3, "2")
904
        # TSIM: return -1
905
        # TSIM: endi
906 907
        # TSIM: if $data04 != 3 then
        tdLog.info('tdSql.checkData(0, 4, 3)')
908
        tdSql.checkData(0, 4, "3")
909
        # TSIM: return -1
910
        # TSIM: endi
911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952
        # TSIM:
        # TSIM: sql alter table $mt change tag tgcol1 tgcol4
        tdLog.info('alter table %s change tag tgcol1 tgcol4' % (mt))
        tdSql.execute('alter table %s change tag tgcol1 tgcol4' % (mt))
        # TSIM: sql alter table $mt drop tag tgcol2
        tdLog.info('alter table %s drop tag tgcol2' % (mt))
        tdSql.execute('alter table %s drop tag tgcol2' % (mt))
        # TSIM: sql alter table $mt drop tag tgcol3
        tdLog.info('alter table %s drop tag tgcol3' % (mt))
        tdSql.execute('alter table %s drop tag tgcol3' % (mt))
        # TSIM: sql alter table $mt add tag tgcol5 bool
        tdLog.info('alter table %s add tag tgcol5 bool' % (mt))
        tdSql.execute('alter table %s add tag tgcol5 bool' % (mt))
        # TSIM: sql alter table $mt add tag tgcol6 float
        tdLog.info('alter table %s add tag tgcol6 float' % (mt))
        tdSql.execute('alter table %s add tag tgcol6 float' % (mt))
        # TSIM:
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM: sql alter table $tb set tag tgcol4=4
        tdLog.info('alter table %s set tag tgcol4=4' % (tb))
        tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
        # TSIM: sql alter table $tb set tag tgcol5=1
        tdLog.info('alter table %s set tag tgcol5=1' % (tb))
        tdSql.execute('alter table %s set tag tgcol5=1' % (tb))
        # TSIM: sql alter table $tb set tag tgcol6=6
        tdLog.info('alter table %s set tag tgcol6=6' % (tb))
        tdSql.execute('alter table %s set tag tgcol6=6' % (tb))
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM:
        # TSIM: sql select * from $mt where tgcol5 = 1
        tdLog.info('select * from %s where tgcol5 = 1' % (mt))
        tdSql.query('select * from %s where tgcol5 = 1' % (mt))
        # TSIM: print $data01 $data02 $data03
        tdLog.info('$data01 $data02 $data03')
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
953
        # TSIM: endi
954 955 956 957
        # TSIM: if $data01 != 1 then
        tdLog.info('tdSql.checkData(0, 1, 1)')
        tdSql.checkData(0, 1, 1)
        # TSIM: return -1
958
        # TSIM: endi
959 960 961 962
        # TSIM: if $data02 != 4.000000000 then
        tdLog.info('tdSql.checkData(0, 2, 4.000000000)')
        tdSql.checkData(0, 2, 4.000000000)
        # TSIM: return -1
963
        # TSIM: endi
964 965 966 967
        # TSIM: if $data03 != 1 then
        tdLog.info('tdSql.checkData(0, 3, 1)')
        tdSql.checkData(0, 3, 1)
        # TSIM: return -1
968
        # TSIM: endi
969 970 971 972
        # TSIM: if $data04 != 6.00000 then
        tdLog.info('tdSql.checkData(0, 4, 6.00000)')
        tdSql.checkData(0, 4, 6.00000)
        # TSIM: return -1
973
        # TSIM: endi
974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018
        # TSIM:
        # TSIM: sql select * from $mt where tgcol3 = 1 -x step91
        tdLog.info('select * from %s where tgcol3 = 1 -x step91' % (mt))
        tdSql.error('select * from %s where tgcol3 = 11' % (mt))
        # TSIM: return -1
        # TSIM: step91:
        # TSIM: sql select * from $mt where tgcol2 = 1 -x step92
        tdLog.info('select * from %s where tgcol2 = 1 -x step92' % (mt))
        tdSql.error('select * from %s where tgcol2 = 12' % (mt))
        # TSIM: return -1
        # TSIM: step92:
        # TSIM:
        # TSIM: print =============== step10
        tdLog.info('=============== step10')
        # TSIM: $i = 10
        i = 10
        # TSIM: $mt = $mtPrefix . $i
        mt = "%s%d" % (mtPrefix, i)
        # TSIM: $tb = $tbPrefix . $i
        tb = "%s%d" % (tbPrefix, i)
        # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
        # binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10))
        tdLog.info(
            'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10))' %
            (mt))
        tdSql.execute(
            'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10))' %
            (mt))
        # TSIM: sql create table $tb using $mt tags( '1', '2', '3', '4' )
        tdLog.info(
            'create table %s using %s tags( "1", "2", "3", "4" )' %
            (tb, mt))
        tdSql.execute(
            'create table %s using %s tags( "1", "2", "3", "4" )' %
            (tb, mt))
        # TSIM: sql insert into $tb values(now, 1)
        tdLog.info('insert into %s values(now, 1)' % (tb))
        tdSql.execute('insert into %s values(now, 1)' % (tb))
        # TSIM: sql select * from $mt where tgcol4 = '4'
        tdLog.info('select * from %s where tgcol4 = "4"' % (mt))
        tdSql.query('select * from %s where tgcol4 = "4"' % (mt))
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
1019
        # TSIM: endi
1020 1021 1022 1023
        # TSIM: if $data01 != 1 then
        tdLog.info('tdSql.checkData(0, 1, 1)')
        tdSql.checkData(0, 1, 1)
        # TSIM: return -1
1024
        # TSIM: endi
1025 1026
        # TSIM: if $data02 != 1 then
        tdLog.info('tdSql.checkData(0, 2, 1)')
1027
        tdSql.checkData(0, 2, "1")
1028
        # TSIM: return -1
1029
        # TSIM: endi
1030 1031
        # TSIM: if $data03 != 2 then
        tdLog.info('tdSql.checkData(0, 3, 2)')
1032
        tdSql.checkData(0, 3, "2")
1033
        # TSIM: return -1
1034
        # TSIM: endi
1035 1036
        # TSIM: if $data04 != 3 then
        tdLog.info('tdSql.checkData(0, 4, 3)')
1037
        tdSql.checkData(0, 4, "3")
1038
        # TSIM: return -1
1039
        # TSIM: endi
1040 1041
        # TSIM: if $data05 != 4 then
        tdLog.info('tdSql.checkData(0, 5, 4)')
1042
        tdSql.checkData(0, 5, "4")
1043
        # TSIM: return -1
1044
        # TSIM: endi
1045 1046 1047
        # TSIM:
        # TSIM: sql alter table $mt change tag tgcol1 tgcol4 -x step103
        tdLog.info('alter table %s change tag tgcol1 tgcol4 -x step103' % (mt))
1048
        tdSql.error('alter table %s change tag tgcol1 tgcol4' % (mt))
1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092
        # TSIM: return -1
        # TSIM: step103:
        # TSIM:
        # TSIM: sql alter table $mt drop tag tgcol2
        tdLog.info('alter table %s drop tag tgcol2' % (mt))
        tdSql.execute('alter table %s drop tag tgcol2' % (mt))
        # TSIM: sql alter table $mt drop tag tgcol3
        tdLog.info('alter table %s drop tag tgcol3' % (mt))
        tdSql.execute('alter table %s drop tag tgcol3' % (mt))
        # TSIM: sql alter table $mt drop tag tgcol4
        tdLog.info('alter table %s drop tag tgcol4' % (mt))
        tdSql.execute('alter table %s drop tag tgcol4' % (mt))
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM: sql alter table $mt add tag tgcol4 binary(10)
        tdLog.info('alter table %s add tag tgcol4 binary(10)' % (mt))
        tdSql.execute('alter table %s add tag tgcol4 binary(10)' % (mt))
        # TSIM: sql alter table $mt add tag tgcol5 bool
        tdLog.info('alter table %s add tag tgcol5 bool' % (mt))
        tdSql.execute('alter table %s add tag tgcol5 bool' % (mt))
        # TSIM:
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM: sql alter table $tb set tag tgcol4=4
        tdLog.info('alter table %s set tag tgcol4=4' % (tb))
        tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
        # TSIM: sql alter table $tb set tag tgcol5=false
        tdLog.info('alter table %s set tag tgcol5=false' % (tb))
        tdSql.execute('alter table %s set tag tgcol5=false' % (tb))
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM:
        # TSIM: sql select * from $mt where tgcol4 = '4'
        tdLog.info('select * from %s where tgcol4 = "4"' % (mt))
        tdSql.query('select * from %s where tgcol4 = "4"' % (mt))
        # TSIM: print $data01 $data02 $data03
        tdLog.info('$data01 $data02 $data03')
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
1093
        # TSIM: endi
1094 1095 1096 1097
        # TSIM: if $data01 != 1 then
        tdLog.info('tdSql.checkData(0, 1, 1)')
        tdSql.checkData(0, 1, 1)
        # TSIM: return -1
1098
        # TSIM: endi
1099 1100
        # TSIM: if $data02 != 1 then
        tdLog.info('tdSql.checkData(0, 2, 1)')
1101
        tdSql.checkData(0, 2, "1")
1102
        # TSIM: return -1
1103
        # TSIM: endi
1104 1105
        # TSIM: if $data03 != 4 then
        tdLog.info('tdSql.checkData(0, 3, 4)')
1106
        tdSql.checkData(0, 3, "4")
1107
        # TSIM: return -1
1108
        # TSIM: endi
1109 1110 1111 1112
        # TSIM: if $data04 != 0 then
        tdLog.info('tdSql.checkData(0, 4, 0)')
        tdSql.checkData(0, 4, 0)
        # TSIM: return -1
1113
        # TSIM: endi
1114
        # TSIM: if $data05 != NULL then
1115 1116
       #tdLog.info('tdSql.checkData(0, 5, NULL)')
       # tdSql.checkData(0, 5, None)
1117
        # TSIM: return -1
1118
        # TSIM: endi
1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163
        # TSIM:
        # TSIM: sql select * from $mt where tgcol2 = 1 -x step101
        tdLog.info('select * from %s where tgcol2 = 1 -x step101' % (mt))
        tdSql.error('select * from %s where tgcol2 = 101' % (mt))
        # TSIM: return -1
        # TSIM: step101:
        # TSIM: sql select * from $mt where tgcol3 = 1 -x step102
        tdLog.info('select * from %s where tgcol3 = 1 -x step102' % (mt))
        tdSql.error('select * from %s where tgcol3 = 102' % (mt))
        # TSIM: return -1
        # TSIM: step102:
        # TSIM:
        # TSIM: print =============== step11
        tdLog.info('=============== step11')
        # TSIM: $i = 11
        i = 11
        # TSIM: $mt = $mtPrefix . $i
        mt = "%s%d" % (mtPrefix, i)
        # TSIM: $tb = $tbPrefix . $i
        tb = "%s%d" % (tbPrefix, i)
        # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
        # bool, tgcol2 int, tgcol3 smallint, tgcol4 float, tgcol5 binary(10))
        tdLog.info(
            'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 smallint, tgcol4 float, tgcol5 binary(10))' %
            (mt))
        tdSql.execute(
            'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 smallint, tgcol4 float, tgcol5 binary(10))' %
            (mt))
        # TSIM: sql create table $tb using $mt tags( 1, 2, 3, 4, '5' )
        tdLog.info(
            'create table %s using %s tags( 1, 2, 3, 4, "5" )' %
            (tb, mt))
        tdSql.execute(
            'create table %s using %s tags( 1, 2, 3, 4, "5" )' %
            (tb, mt))
        # TSIM: sql insert into $tb values(now, 1)
        tdLog.info('insert into %s values(now, 1)' % (tb))
        tdSql.execute('insert into %s values(now, 1)' % (tb))
        # TSIM: sql select * from $mt where tgcol1 = 1
        tdLog.info('select * from %s where tgcol1 = 1' % (mt))
        tdSql.query('select * from %s where tgcol1 = 1' % (mt))
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
1164
        # TSIM: endi
1165 1166 1167 1168
        # TSIM: if $data01 != 1 then
        tdLog.info('tdSql.checkData(0, 1, 1)')
        tdSql.checkData(0, 1, 1)
        # TSIM: return -1
1169
        # TSIM: endi
1170 1171 1172 1173
        # TSIM: if $data02 != 1 then
        tdLog.info('tdSql.checkData(0, 2, 1)')
        tdSql.checkData(0, 2, 1)
        # TSIM: return -1
1174
        # TSIM: endi
1175 1176 1177 1178
        # TSIM: if $data03 != 2 then
        tdLog.info('tdSql.checkData(0, 3, 2)')
        tdSql.checkData(0, 3, 2)
        # TSIM: return -1
1179
        # TSIM: endi
1180 1181 1182 1183
        # TSIM: if $data04 != 3 then
        tdLog.info('tdSql.checkData(0, 4, 3)')
        tdSql.checkData(0, 4, 3)
        # TSIM: return -1
1184
        # TSIM: endi
1185 1186 1187 1188
        # TSIM: if $data05 != 4.00000 then
        tdLog.info('tdSql.checkData(0, 5, 4.00000)')
        tdSql.checkData(0, 5, 4.00000)
        # TSIM: return -1
1189
        # TSIM: endi
1190 1191
        # TSIM: if $data06 != 5 then
        tdLog.info('tdSql.checkData(0, 6, 5)')
1192
        tdSql.checkData(0, 6, "5")
1193
        # TSIM: return -1
1194
        # TSIM: endi
1195 1196 1197
        # TSIM:
        # TSIM: sql alter table $mt change tag tgcol1 tgcol4 -x step114
        tdLog.info('alter table %s change tag tgcol1 tgcol4 -x step114' % (mt))
1198
        tdSql.error('alter table %s change tag tgcol1 tgcol4' % (mt))
1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263
        # TSIM: return -1
        # TSIM: step114:
        # TSIM:
        # TSIM: sql alter table $mt drop tag tgcol2
        tdLog.info('alter table %s drop tag tgcol2' % (mt))
        tdSql.execute('alter table %s drop tag tgcol2' % (mt))
        # TSIM: sql alter table $mt drop tag tgcol3
        tdLog.info('alter table %s drop tag tgcol3' % (mt))
        tdSql.execute('alter table %s drop tag tgcol3' % (mt))
        # TSIM: sql alter table $mt drop tag tgcol4
        tdLog.info('alter table %s drop tag tgcol4' % (mt))
        tdSql.execute('alter table %s drop tag tgcol4' % (mt))
        # TSIM: sql alter table $mt drop tag tgcol5
        tdLog.info('alter table %s drop tag tgcol5' % (mt))
        tdSql.execute('alter table %s drop tag tgcol5' % (mt))
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM: sql alter table $mt add tag tgcol4 binary(10)
        tdLog.info('alter table %s add tag tgcol4 binary(10)' % (mt))
        tdSql.execute('alter table %s add tag tgcol4 binary(10)' % (mt))
        # TSIM: sql alter table $mt add tag tgcol5 int
        tdLog.info('alter table %s add tag tgcol5 int' % (mt))
        tdSql.execute('alter table %s add tag tgcol5 int' % (mt))
        # TSIM: sql alter table $mt add tag tgcol6 binary(10)
        tdLog.info('alter table %s add tag tgcol6 binary(10)' % (mt))
        tdSql.execute('alter table %s add tag tgcol6 binary(10)' % (mt))
        # TSIM: sql alter table $mt add tag tgcol7 bigint
        tdLog.info('alter table %s add tag tgcol7 bigint' % (mt))
        tdSql.execute('alter table %s add tag tgcol7 bigint' % (mt))
        # TSIM: sql alter table $mt add tag tgcol8 smallint
        tdLog.info('alter table %s add tag tgcol8 smallint' % (mt))
        tdSql.execute('alter table %s add tag tgcol8 smallint' % (mt))
        # TSIM:
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM: sql alter table $tb set tag tgcol4=4
        tdLog.info('alter table %s set tag tgcol4=4' % (tb))
        tdSql.execute('alter table %s set tag tgcol4=4' % (tb))
        # TSIM: sql alter table $tb set tag tgcol5=5
        tdLog.info('alter table %s set tag tgcol5=5' % (tb))
        tdSql.execute('alter table %s set tag tgcol5=5' % (tb))
        # TSIM: sql alter table $tb set tag tgcol6=6
        tdLog.info('alter table %s set tag tgcol6=6' % (tb))
        tdSql.execute('alter table %s set tag tgcol6=6' % (tb))
        # TSIM: sql alter table $tb set tag tgcol7=7
        tdLog.info('alter table %s set tag tgcol7=7' % (tb))
        tdSql.execute('alter table %s set tag tgcol7=7' % (tb))
        # TSIM: sql alter table $tb set tag tgcol8=8
        tdLog.info('alter table %s set tag tgcol8=8' % (tb))
        tdSql.execute('alter table %s set tag tgcol8=8' % (tb))
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM:
        # TSIM: sql select * from $mt where tgcol5 =5
        tdLog.info('select * from %s where tgcol5 =5' % (mt))
        tdSql.query('select * from %s where tgcol5 =5' % (mt))
        # TSIM: print $data01 $data02 $data03
        tdLog.info('$data01 $data02 $data03')
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
1264
        # TSIM: endi
1265 1266 1267 1268
        # TSIM: if $data01 != 1 then
        tdLog.info('tdSql.checkData(0, 1, 1)')
        tdSql.checkData(0, 1, 1)
        # TSIM: return -1
1269
        # TSIM: endi
1270 1271 1272 1273
        # TSIM: if $data02 != 1 then
        tdLog.info('tdSql.checkData(0, 2, 1)')
        tdSql.checkData(0, 2, 1)
        # TSIM: return -1
1274
        # TSIM: endi
1275 1276
        # TSIM: if $data03 != 4 then
        tdLog.info('tdSql.checkData(0, 3, 4)')
1277
        tdSql.checkData(0, 3, "4")
1278
        # TSIM: return -1
1279
        # TSIM: endi
1280 1281 1282 1283
        # TSIM: if $data04 != 5 then
        tdLog.info('tdSql.checkData(0, 4, 5)')
        tdSql.checkData(0, 4, 5)
        # TSIM: return -1
1284
        # TSIM: endi
1285 1286
        # TSIM: if $data05 != 6 then
        tdLog.info('tdSql.checkData(0, 5, 6)')
1287
        tdSql.checkData(0, 5, "6")
1288
        # TSIM: return -1
1289
        # TSIM: endi
1290 1291 1292 1293
        # TSIM: if $data06 != 7 then
        tdLog.info('tdSql.checkData(0, 6, 7)')
        tdSql.checkData(0, 6, 7)
        # TSIM: return -1
1294
        # TSIM: endi
1295 1296 1297 1298
        # TSIM: if $data07 != 8 then
        tdLog.info('tdSql.checkData(0, 7, 8)')
        tdSql.checkData(0, 7, 8)
        # TSIM: return -1
1299
        # TSIM: endi
1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350
        # TSIM:
        # TSIM: sql select * from $mt where tgcol2 = 1 -x step111
        tdLog.info('select * from %s where tgcol2 = 1 -x step111' % (mt))
        tdSql.error('select * from %s where tgcol2 = 111' % (mt))
        # TSIM: return -1
        # TSIM: step111:
        # TSIM: sql select * from $mt where tgcol3 = 1 -x step112
        tdLog.info('select * from %s where tgcol3 = 1 -x step112' % (mt))
        tdSql.error('select * from %s where tgcol3 = 112' % (mt))
        # TSIM: return -1
        # TSIM: step112:
        # TSIM: sql select * from $mt where tgcol9 = 1 -x step113
        tdLog.info('select * from %s where tgcol9 = 1 -x step113' % (mt))
        tdSql.error('select * from %s where tgcol9 = 113' % (mt))
        # TSIM: return -1
        # TSIM: step113:
        # TSIM:
        # TSIM: print =============== step12
        tdLog.info('=============== step12')
        # TSIM: $i = 12
        i = 12
        # TSIM: $mt = $mtPrefix . $i
        mt = "%s%d" % (mtPrefix, i)
        # TSIM: $tb = $tbPrefix . $i
        tb = "%s%d" % (tbPrefix, i)
        # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
        # bool, tgcol2 smallint, tgcol3 float, tgcol4 double, tgcol5
        # binary(10), tgcol6 binary(20))
        tdLog.info(
            'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 smallint, tgcol3 float, tgcol4 double, tgcol5 binary(10), tgcol6 binary(20))' %
            (mt))
        tdSql.execute(
            'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 smallint, tgcol3 float, tgcol4 double, tgcol5 binary(10), tgcol6 binary(20))' %
            (mt))
        # TSIM: sql create table $tb using $mt tags( 1, 2, 3, 4, '5', '6' )
        tdLog.info(
            'create table %s using %s tags( 1, 2, 3, 4, "5", "6" )' %
            (tb, mt))
        tdSql.execute(
            'create table %s using %s tags( 1, 2, 3, 4, "5", "6" )' %
            (tb, mt))
        # TSIM: sql insert into $tb values(now, 1)
        tdLog.info('insert into %s values(now, 1)' % (tb))
        tdSql.execute('insert into %s values(now, 1)' % (tb))
        # TSIM: sql select * from $mt where tgcol1 = 1
        tdLog.info('select * from %s where tgcol1 = 1' % (mt))
        tdSql.query('select * from %s where tgcol1 = 1' % (mt))
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
1351
        # TSIM: endi
1352 1353 1354 1355
        # TSIM: if $data01 != 1 then
        tdLog.info('tdSql.checkData(0, 1, 1)')
        tdSql.checkData(0, 1, 1)
        # TSIM: return -1
1356
        # TSIM: endi
1357 1358 1359 1360
        # TSIM: if $data02 != 1 then
        tdLog.info('tdSql.checkData(0, 2, 1)')
        tdSql.checkData(0, 2, 1)
        # TSIM: return -1
1361
        # TSIM: endi
1362 1363 1364 1365
        # TSIM: if $data03 != 2 then
        tdLog.info('tdSql.checkData(0, 3, 2)')
        tdSql.checkData(0, 3, 2)
        # TSIM: return -1
1366
        # TSIM: endi
1367 1368 1369 1370
        # TSIM: if $data04 != 3.00000 then
        tdLog.info('tdSql.checkData(0, 4, 3.00000)')
        tdSql.checkData(0, 4, 3.00000)
        # TSIM: return -1
1371
        # TSIM: endi
1372 1373 1374 1375
        # TSIM: if $data05 != 4.000000000 then
        tdLog.info('tdSql.checkData(0, 5, 4.000000000)')
        tdSql.checkData(0, 5, 4.000000000)
        # TSIM: return -1
1376
        # TSIM: endi
1377 1378
        # TSIM: if $data06 != 5 then
        tdLog.info('tdSql.checkData(0, 6, 5)')
1379
        tdSql.checkData(0, 6, "5")
1380
        # TSIM: return -1
1381
        # TSIM: endi
1382 1383
        # TSIM: if $data07 != 6 then
        tdLog.info('tdSql.checkData(0, 7, 6)')
1384
        tdSql.checkData(0, 7, "6")
1385
        # TSIM: return -1
1386
        # TSIM: endi
1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449
        # TSIM:
        # TSIM: sql alter table $mt drop tag tgcol2
        tdLog.info('alter table %s drop tag tgcol2' % (mt))
        tdSql.execute('alter table %s drop tag tgcol2' % (mt))
        # TSIM: sql alter table $mt drop tag tgcol3
        tdLog.info('alter table %s drop tag tgcol3' % (mt))
        tdSql.execute('alter table %s drop tag tgcol3' % (mt))
        # TSIM: sql alter table $mt drop tag tgcol4
        tdLog.info('alter table %s drop tag tgcol4' % (mt))
        tdSql.execute('alter table %s drop tag tgcol4' % (mt))
        # TSIM: sql alter table $mt drop tag tgcol5
        tdLog.info('alter table %s drop tag tgcol5' % (mt))
        tdSql.execute('alter table %s drop tag tgcol5' % (mt))
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM: sql alter table $mt add tag tgcol2 binary(10)
        tdLog.info('alter table %s add tag tgcol2 binary(10)' % (mt))
        tdSql.execute('alter table %s add tag tgcol2 binary(10)' % (mt))
        # TSIM: sql alter table $mt add tag tgcol3 int
        tdLog.info('alter table %s add tag tgcol3 int' % (mt))
        tdSql.execute('alter table %s add tag tgcol3 int' % (mt))
        # TSIM: sql alter table $mt add tag tgcol4 binary(10)
        tdLog.info('alter table %s add tag tgcol4 binary(10)' % (mt))
        tdSql.execute('alter table %s add tag tgcol4 binary(10)' % (mt))
        # TSIM: sql alter table $mt add tag tgcol5 bigint
        tdLog.info('alter table %s add tag tgcol5 bigint' % (mt))
        tdSql.execute('alter table %s add tag tgcol5 bigint' % (mt))
        # TSIM:
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM: sql alter table $tb set tag tgcol1=false
        tdLog.info('alter table %s set tag tgcol1=false' % (tb))
        tdSql.execute('alter table %s set tag tgcol1=false' % (tb))
        # TSIM: sql alter table $tb set tag tgcol2=5
        tdLog.info('alter table %s set tag tgcol2=5' % (tb))
        tdSql.execute('alter table %s set tag tgcol2=5' % (tb))
        # TSIM: sql alter table $tb set tag tgcol3=4
        tdLog.info('alter table %s set tag tgcol3=4' % (tb))
        tdSql.execute('alter table %s set tag tgcol3=4' % (tb))
        # TSIM: sql alter table $tb set tag tgcol4=3
        tdLog.info('alter table %s set tag tgcol4=3' % (tb))
        tdSql.execute('alter table %s set tag tgcol4=3' % (tb))
        # TSIM: sql alter table $tb set tag tgcol5=2
        tdLog.info('alter table %s set tag tgcol5=2' % (tb))
        tdSql.execute('alter table %s set tag tgcol5=2' % (tb))
        # TSIM: sql alter table $tb set tag tgcol6=1
        tdLog.info('alter table %s set tag tgcol6=1' % (tb))
        tdSql.execute('alter table %s set tag tgcol6=1' % (tb))
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM:
        # TSIM: sql select * from $mt where tgcol4 = '3'
        tdLog.info('select * from %s where tgcol4 = "3"' % (mt))
        tdSql.query('select * from %s where tgcol4 = "3"' % (mt))
        # TSIM: print $data01 $data02 $data03
        tdLog.info('$data01 $data02 $data03')
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
1450
        # TSIM: endi
1451 1452 1453 1454
        # TSIM: if $data01 != 1 then
        tdLog.info('tdSql.checkData(0, 1, 1)')
        tdSql.checkData(0, 1, 1)
        # TSIM: return -1
1455
        # TSIM: endi
1456 1457 1458 1459
        # TSIM: if $data02 != 0 then
        tdLog.info('tdSql.checkData(0, 2, 0)')
        tdSql.checkData(0, 2, 0)
        # TSIM: return -1
1460
        # TSIM: endi
1461 1462
        # TSIM: if $data03 != 1 then
        tdLog.info('tdSql.checkData(0, 3, 1)')
1463
        tdSql.checkData(0, 3, "1")
1464
        # TSIM: return -1
1465
        # TSIM: endi
1466 1467
        # TSIM: if $data04 != 5 then
        tdLog.info('tdSql.checkData(0, 4, 5)')
1468
        tdSql.checkData(0, 4, "5")
1469
        # TSIM: return -1
1470
        # TSIM: endi
1471 1472 1473 1474
        # TSIM: if $data05 != 4 then
        tdLog.info('tdSql.checkData(0, 5, 4)')
        tdSql.checkData(0, 5, 4)
        # TSIM: return -1
1475
        # TSIM: endi
1476 1477
        # TSIM: if $data06 != 3 then
        tdLog.info('tdSql.checkData(0, 6, 3)')
1478
        tdSql.checkData(0, 6, "3")
1479
        # TSIM: return -1
1480
        # TSIM: endi
1481 1482 1483 1484
        # TSIM: if $data07 != 2 then
        tdLog.info('tdSql.checkData(0, 7, 2)')
        tdSql.checkData(0, 7, 2)
        # TSIM: return -1
1485
        # TSIM: endi
1486 1487 1488 1489 1490 1491 1492 1493
        # TSIM:
        # TSIM: sql select * from $mt where tgcol2 = '5'
        tdLog.info('select * from %s where tgcol2 = "5"' % (mt))
        tdSql.query('select * from %s where tgcol2 = "5"' % (mt))
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
1494
        # TSIM: endi
1495 1496 1497 1498 1499 1500 1501 1502
        # TSIM:
        # TSIM: sql select * from $mt where tgcol3 = 4
        tdLog.info('select * from %s where tgcol3 = 4' % (mt))
        tdSql.query('select * from %s where tgcol3 = 4' % (mt))
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
1503
        # TSIM: endi
1504 1505 1506 1507 1508 1509 1510 1511
        # TSIM:
        # TSIM: sql select * from $mt where tgcol5 = 2
        tdLog.info('select * from %s where tgcol5 = 2' % (mt))
        tdSql.query('select * from %s where tgcol5 = 2' % (mt))
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
1512
        # TSIM: endi
1513 1514 1515 1516 1517 1518 1519 1520
        # TSIM:
        # TSIM: sql select * from $mt where tgcol6 = '1'
        tdLog.info('select * from %s where tgcol6 = "1"' % (mt))
        tdSql.query('select * from %s where tgcol6 = "1"' % (mt))
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
1521
        # TSIM: endi
1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556
        # TSIM:
        # TSIM: print =============== step13
        tdLog.info('=============== step13')
        # TSIM: $i = 13
        i = 13
        # TSIM: $mt = $mtPrefix . $i
        mt = "%s%d" % (mtPrefix, i)
        # TSIM: $tb = $tbPrefix . $i
        tb = "%s%d" % (tbPrefix, i)
        # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
        # binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5
        # double, tgcol6 binary(20))
        tdLog.info(
            'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20))' %
            (mt))
        tdSql.execute(
            'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20))' %
            (mt))
        # TSIM: sql create table $tb using $mt tags( '1', 2, 3, '4', 5, '6' )
        tdLog.info(
            'create table %s using %s tags( "1", 2, 3, "4", 5, "6" )' %
            (tb, mt))
        tdSql.execute(
            'create table %s using %s tags( "1", 2, 3, "4", 5, "6" )' %
            (tb, mt))
        # TSIM: sql insert into $tb values(now, 1)
        tdLog.info('insert into %s values(now, 1)' % (tb))
        tdSql.execute('insert into %s values(now, 1)' % (tb))
        # TSIM: sql select * from $mt where tgcol1 = '1'
        tdLog.info('select * from %s where tgcol1 = "1"' % (mt))
        tdSql.query('select * from %s where tgcol1 = "1"' % (mt))
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
1557
        # TSIM: endi
1558 1559 1560 1561
        # TSIM: if $data01 != 1 then
        tdLog.info('tdSql.checkData(0, 1, 1)')
        tdSql.checkData(0, 1, 1)
        # TSIM: return -1
1562
        # TSIM: endi
1563 1564
        # TSIM: if $data02 != 1 then
        tdLog.info('tdSql.checkData(0, 2, 1)')
1565
        tdSql.checkData(0, 2, "1")
1566
        # TSIM: return -1
1567
        # TSIM: endi
1568 1569 1570 1571
        # TSIM: if $data03 != 2 then
        tdLog.info('tdSql.checkData(0, 3, 2)')
        tdSql.checkData(0, 3, 2)
        # TSIM: return -1
1572
        # TSIM: endi
1573 1574 1575 1576
        # TSIM: if $data04 != 3 then
        tdLog.info('tdSql.checkData(0, 4, 3)')
        tdSql.checkData(0, 4, 3)
        # TSIM: return -1
1577
        # TSIM: endi
1578 1579
        # TSIM: if $data05 != 4 then
        tdLog.info('tdSql.checkData(0, 5, 4)')
1580
        tdSql.checkData(0, 5, "4")
1581
        # TSIM: return -1
1582
        # TSIM: endi
1583 1584 1585 1586
        # TSIM: if $data06 != 5.000000000 then
        tdLog.info('tdSql.checkData(0, 6, 5.000000000)')
        tdSql.checkData(0, 6, 5.000000000)
        # TSIM: return -1
1587
        # TSIM: endi
1588 1589
        # TSIM: if $data07 != 6 then
        tdLog.info('tdSql.checkData(0, 7, 6)')
1590
        tdSql.checkData(0, 7, "6")
1591
        # TSIM: return -1
1592
        # TSIM: endi
1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649
        # TSIM:
        # TSIM: sql alter table $mt drop tag tgcol2
        tdLog.info('alter table %s drop tag tgcol2' % (mt))
        tdSql.execute('alter table %s drop tag tgcol2' % (mt))
        # TSIM: sql alter table $mt drop tag tgcol4
        tdLog.info('alter table %s drop tag tgcol4' % (mt))
        tdSql.execute('alter table %s drop tag tgcol4' % (mt))
        # TSIM: sql alter table $mt drop tag tgcol6
        tdLog.info('alter table %s drop tag tgcol6' % (mt))
        tdSql.execute('alter table %s drop tag tgcol6' % (mt))
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM: sql alter table $mt add tag tgcol2 binary(10)
        tdLog.info('alter table %s add tag tgcol2 binary(10)' % (mt))
        tdSql.execute('alter table %s add tag tgcol2 binary(10)' % (mt))
        # TSIM: sql alter table $mt add tag tgcol4 int
        tdLog.info('alter table %s add tag tgcol4 int' % (mt))
        tdSql.execute('alter table %s add tag tgcol4 int' % (mt))
        # TSIM: sql alter table $mt add tag tgcol6 bigint
        tdLog.info('alter table %s add tag tgcol6 bigint' % (mt))
        tdSql.execute('alter table %s add tag tgcol6 bigint' % (mt))
        # TSIM:
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM: sql alter table $tb set tag tgcol1=7
        tdLog.info('alter table %s set tag tgcol1=7' % (tb))
        tdSql.execute('alter table %s set tag tgcol1=7' % (tb))
        # TSIM: sql alter table $tb set tag tgcol2=8
        tdLog.info('alter table %s set tag tgcol2=8' % (tb))
        tdSql.execute('alter table %s set tag tgcol2=8' % (tb))
        # TSIM: sql alter table $tb set tag tgcol3=9
        tdLog.info('alter table %s set tag tgcol3=9' % (tb))
        tdSql.execute('alter table %s set tag tgcol3=9' % (tb))
        # TSIM: sql alter table $tb set tag tgcol4=10
        tdLog.info('alter table %s set tag tgcol4=10' % (tb))
        tdSql.execute('alter table %s set tag tgcol4=10' % (tb))
        # TSIM: sql alter table $tb set tag tgcol5=11
        tdLog.info('alter table %s set tag tgcol5=11' % (tb))
        tdSql.execute('alter table %s set tag tgcol5=11' % (tb))
        # TSIM: sql alter table $tb set tag tgcol6=12
        tdLog.info('alter table %s set tag tgcol6=12' % (tb))
        tdSql.execute('alter table %s set tag tgcol6=12' % (tb))
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM:
        # TSIM: sql select * from $mt where tgcol2 = '8'
        tdLog.info('select * from %s where tgcol2 = "8"' % (mt))
        tdSql.query('select * from %s where tgcol2 = "8"' % (mt))
        # TSIM: print $data01 $data02 $data03
        tdLog.info('$data01 $data02 $data03')
        # TSIM: if $rows != 1 then
        tdLog.info('tdSql.checkRow(1)')
        tdSql.checkRows(1)
        # TSIM: return -1
1650
        # TSIM: endi
1651 1652 1653 1654
        # TSIM: if $data01 != 1 then
        tdLog.info('tdSql.checkData(0, 1, 1)')
        tdSql.checkData(0, 1, 1)
        # TSIM: return -1
1655
        # TSIM: endi
1656 1657
        # TSIM: if $data02 != 7 then
        tdLog.info('tdSql.checkData(0, 2, 7)')
1658
        tdSql.checkData(0, 2, "7")
1659
        # TSIM: return -1
1660
        # TSIM: endi
1661 1662 1663 1664
        # TSIM: if $data03 != 9 then
        tdLog.info('tdSql.checkData(0, 3, 9)')
        tdSql.checkData(0, 3, 9)
        # TSIM: return -1
1665
        # TSIM: endi
1666 1667 1668 1669
        # TSIM: if $data04 != 11.000000000 then
        tdLog.info('tdSql.checkData(0, 4, 11.000000000)')
        tdSql.checkData(0, 4, 11.000000000)
        # TSIM: return -1
1670
        # TSIM: endi
1671 1672
        # TSIM: if $data05 != 8 then
        tdLog.info('tdSql.checkData(0, 5, 8)')
1673
        tdSql.checkData(0, 5, "8")
1674
        # TSIM: return -1
1675
        # TSIM: endi
1676 1677 1678 1679
        # TSIM: if $data06 != 10 then
        tdLog.info('tdSql.checkData(0, 6, 10)')
        tdSql.checkData(0, 6, 10)
        # TSIM: return -1
1680
        # TSIM: endi
1681 1682 1683 1684
        # TSIM: if $data07 != 12 then
        tdLog.info('tdSql.checkData(0, 7, 12)')
        tdSql.checkData(0, 7, 12)
        # TSIM: return -1
1685
        # TSIM: endi
1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746
        # TSIM:
        # TSIM: print =============== step14
        tdLog.info('=============== step14')
        # TSIM: $i = 14
        i = 14
        # TSIM: $mt = $mtPrefix . $i
        mt = "%s%d" % (mtPrefix, i)
        # TSIM: $tb = $tbPrefix . $i
        tb = "%s%d" % (tbPrefix, i)
        # TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
        # bool, tgcol2 bigint)
        tdLog.info(
            'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 bigint)' %
            (mt))
        tdSql.execute(
            'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 bigint)' %
            (mt))
        # TSIM: sql create table $tb using $mt tags( 1, 1 )
        tdLog.info('create table %s using %s tags( 1, 1 )' % (tb, mt))
        tdSql.execute('create table %s using %s tags( 1, 1 )' % (tb, mt))
        # TSIM: sql insert into $tb values(now, 1)
        tdLog.info('insert into %s values(now, 1)' % (tb))
        tdSql.execute('insert into %s values(now, 1)' % (tb))
        # TSIM:
        # TSIM: sql alter table $mt add tag tgcol3 binary(10)
        tdLog.info('alter table %s add tag tgcol3 binary(10)' % (mt))
        tdSql.execute('alter table %s add tag tgcol3 binary(10)' % (mt))
        # TSIM: sql alter table $mt add tag tgcol4 int
        tdLog.info('alter table %s add tag tgcol4 int' % (mt))
        tdSql.execute('alter table %s add tag tgcol4 int' % (mt))
        # TSIM: sql alter table $mt add tag tgcol5 bigint
        tdLog.info('alter table %s add tag tgcol5 bigint' % (mt))
        tdSql.execute('alter table %s add tag tgcol5 bigint' % (mt))
        # TSIM: sql alter table $mt add tag tgcol6 bigint
        tdLog.info('alter table %s add tag tgcol6 bigint' % (mt))
        tdSql.execute('alter table %s add tag tgcol6 bigint' % (mt))
        # TSIM:
        # TSIM: return
        # TSIM: sql alter table $mt add tag tgcol7 bigint -x step141
        tdLog.info('alter table %s add tag tgcol7 bigint -x step141' % (mt))
        tdSql.error('alter table %s add tag tgcol7 bigint41' % (mt))
        # TSIM: return -1
        # TSIM: step141:
        # TSIM: sql reset query cache
        tdLog.info('reset query cache')
        tdSql.execute('reset query cache')
        # TSIM: sql alter table $mt drop tag tgcol6
        tdLog.info('alter table %s drop tag tgcol6' % (mt))
        tdSql.execute('alter table %s drop tag tgcol6' % (mt))
        # TSIM: sql alter table $mt add tag tgcol7 bigint
        tdLog.info('alter table %s add tag tgcol7 bigint' % (mt))
        tdSql.execute('alter table %s add tag tgcol7 bigint' % (mt))
        # TSIM: sql alter table $mt add tag tgcol8 bigint -x step142
        tdLog.info('alter table %s add tag tgcol8 bigint -x step142' % (mt))
        tdSql.error('alter table %s add tag tgcol8 bigint42' % (mt))
        # TSIM: return -1
        # TSIM: step142:
        # TSIM:
        # TSIM: print =============== clear
        tdLog.info('=============== clear')
        # TSIM: sql drop database $db
1747 1748
        tdLog.info('sql drop database db')
        tdSql.execute('drop database db')
1749 1750 1751 1752 1753 1754 1755
        # TSIM: sql show databases
        tdLog.info('show databases')
        tdSql.query('show databases')
        # TSIM: if $rows != 0 then
        tdLog.info('tdSql.checkRow(0)')
        tdSql.checkRows(0)
        # TSIM: return -1
1756
        # TSIM: endi
1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767
        # TSIM:
        # TSIM: system sh/exec.sh -n dnode1 -s stop -x SIGINT
# convert end

    def stop(self):
        tdSql.close()
        tdLog.success("%s successfully executed" % __file__)


tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())