81 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			81 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| $tblStart = 3000
 | |
| $tblEnd = 4000
 | |
| $tsStart = 1325347200000  # 2012-01-01 00:00:00.000
 | |
| ###############################################################
 | |
| 
 | |
| sql connect
 | |
| 
 | |
| $db = db1
 | |
| $stb = stb1
 | |
| 
 | |
| sql use $db
 | |
| 
 | |
| ######sql create table $stb (ts timestamp, c1 int) tags(t1 int, t2 binary(8))
 | |
| $tagBinary = ' . client1_3
 | |
| $tagBinary = $tagBinary . '
 | |
| #print ======= tag: $tagBinary
 | |
| 
 | |
| $i = $tblStart
 | |
| while $i < $tblEnd
 | |
|   $tb = tb . $i
 | |
| #  print create table if not exists $tb using $stb tags ( $i , $tagBinary )
 | |
|   sql create table if not exists $tb using $stb tags ( $i , $tagBinary )
 | |
|   $i = $i + 1
 | |
| endw 
 | |
| 
 | |
| print ====================== client1_3 create table end, start insert data ............
 | |
| sql select count(tbname) from $stb
 | |
| print select count(tbname) from $stb
 | |
| print data00 $data00
 | |
| 
 | |
| $rowsPerLoop = 100
 | |
| $ts = $tsStart
 | |
| 
 | |
| $lastLossRows = 0
 | |
| 
 | |
| $i = $tblStart
 | |
| while $i < $tblEnd
 | |
|   $tb = tb . $i
 | |
|   $x = 0
 | |
|   while $x < $rowsPerLoop
 | |
|     sql insert into $tb 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 insert_error_loop
 | |
|     $x = $x + 20
 | |
|     $ts = $ts + 40a
 | |
|     goto continue_next_0
 | |
|     insert_error_loop:
 | |
|     print ============== main1_client1_3 run error: sql insert into $tb values ( $ts + 0a , $x ) ... ...
 | |
|     continue_next_0:
 | |
|   endw 
 | |
| 
 | |
|   $totalRows = $totalRows + $x
 | |
|   $i = $i + 1
 | |
|   
 | |
|   if $i == $tblEnd then
 | |
|     $i = $tblStart
 | |
|     
 | |
|     sql select count(*) from $stb where t2 == $tagBinary -x query_error_loop
 | |
|     if $data00 != $totalRows then
 | |
|       print data00 $data00 totalRows $totalRows
 | |
|       $deltaRows = $totalRows - $data00
 | |
|       if $lastLossRows == 0 then 
 | |
|         $lastLossRows = $deltaRows
 | |
|         print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 | |
|         print ************ client1_3 insert loss: $deltaRows *****
 | |
|         print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 | |
|       elif $deltaRows != $lastLossRows
 | |
|         $tmp = $deltaRows - $lastLossRows
 | |
|         print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 | |
|         print ************ client1_3 insert loss: $tmp ***********
 | |
|         print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 | |
|         $lastLossRows = $deltaRows
 | |
|       endi
 | |
| #	    return -1
 | |
|     endi
 | |
|     goto continue_next_1
 | |
|     query_error_loop:
 | |
|     print ============== main1_client1_3 run error: sql select count(*) from $stb where t2 == $tagBinary -x query_error_loop
 | |
|     continue_next_1:
 | |
|     print ====================== client1_3  insert data complete once ............
 | |
|   endi
 | |
| endw 
 | |
| print ====================== client1_3  success and auto end ===================== |