client3.sim 1.7 KB
Newer Older
H
Hui Li 已提交
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
$tblStart = 0
$tblEnd = 10000
$tsStart = 1325347200000  # 2012-01-01 00:00:00.000
###############################################################

sql connect

$db = db1
$stb = stb1

sql use $db

loop_lable:
print ====================== client3 start loop: dynamic create table and insert data, select, drop table ............

$totalRows = 0

#sql create table $stb ( ts timestamp, c1 int) tags ( t1 int, t2 binary(16) )
$tagBinary = ' . client3
$tagBinary = $tagBinary . '

$rowsPerLoop = 100
$ts = $tsStart

$i = $tblStart
while $i < $tblEnd
  $tb = dtb . $i
  $x = 0
  while $x < $rowsPerLoop
    sql insert into $tb using $stb tags ( $i , $tagBinary ) values ( $ts + 0a , $x ) ( $ts + 2a , $x ) ( $ts + 4a , $x ) ( $ts + 6a , $x ) ( $ts + 8a , $x ) ( $ts + 10a , $x ) ( $ts + 12a , $x ) ( $ts + 14a , $x ) ( $ts + 16a , $x ) ( $ts + 18a , $x ) ( $ts + 20a , $x ) ( $ts + 22a , $x ) ( $ts + 24a , $x ) ( $ts + 26a , $x ) ( $ts + 28a , $x ) ( $ts + 30a , $x ) ( $ts + 32a , $x ) ( $ts + 34a , $x ) ( $ts + 36a , $x ) ( $ts + 38a , $x )
    $x = $x + 20
    $ts = $ts + 40a
  endw 

  $totalRows = $totalRows + $x  
#  print ====== app insert totalRows: $totalRows  
  $i = $i + 1
endw 
   
sql select count(*) from $stb where t2 == $tagBinary
if $data00 != $totalRows then
  print data00 $data00 totalRows $totalRows
  print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  print ************ client3   insert loss: $deltaRows *****
  print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
endi

print ====================== client3 drop table
$i = $tblStart
while $i < $tblEnd
  $tb = dtb . $i
  sql drop table if exists $tb 
  $i = $i + 1
endw 
goto loop_lable