127 lines
		
	
	
		
			4.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			127 lines
		
	
	
		
			4.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| $tblStart = 0
 | |
| $tblEnd = 10000
 | |
| $tsStart = 1325347200000  # 2012-01-01 00:00:00.000
 | |
| ###############################################################
 | |
| 
 | |
| sql connect
 | |
| 
 | |
| $db = db2
 | |
| $stb = stb2
 | |
| 
 | |
| loop_lable:
 | |
| print ========= start loop create db, table, inset data, alter column/tag, select, drop db
 | |
| 
 | |
| sql create database if not exists $db
 | |
| sql use $db
 | |
| sql create table if not exists $stb ( ts timestamp, c1 int, c2 float ) tags ( t1 int , t2 binary(16) )
 | |
| $tagBinary = ' . client4
 | |
| $tagBinary = $tagBinary . '
 | |
| 
 | |
| $i = $tblStart
 | |
| while $i < $tblEnd
 | |
|   $tb = tb . $i
 | |
|   sql create table if not exists  $tb using $stb tags ( $i , $tagBinary )
 | |
|   $i = $i + 1
 | |
| endw 
 | |
| 
 | |
| $rowsPerLoop = 100
 | |
| $ts = $tsStart
 | |
| 
 | |
| $i = $tblStart
 | |
| while $i < $tblEnd
 | |
|   $tb = tb . $i
 | |
|   $x = 0
 | |
|   while $x < $rowsPerLoop
 | |
|     sql insert into $tb values ( $ts + 0a , $x , $x ) ( $ts + 2a , $x , $x ) ( $ts + 4a , $x , $x ) ( $ts + 6a , $x , $x ) ( $ts + 8a , $x , $x ) ( $ts + 10a , $x , $x ) ( $ts + 12a , $x , $x ) ( $ts + 14a , $x , $x ) ( $ts + 16a , $x , $x ) ( $ts + 18a , $x , $x ) ( $ts + 20a , $x , $x ) ( $ts + 22a , $x , $x ) ( $ts + 24a , $x , $x ) ( $ts + 26a , $x , $x ) ( $ts + 28a , $x , $x ) ( $ts + 30a , $x , $x ) ( $ts + 32a , $x , $x ) ( $ts + 34a , $x , $x ) ( $ts + 36a , $x , $x ) ( $ts + 38a , $x , $x )
 | |
|     $x = $x + 20
 | |
|     $ts = $ts + 40a
 | |
|   endw 
 | |
| 
 | |
|   $totalRows = $totalRows + $x
 | |
|   $i = $i + 1
 | |
|   
 | |
|   if $i == $tblEnd then
 | |
|     $i = $tblStart
 | |
|     
 | |
|     sql select count(*) from $stb -x continue_loop
 | |
|     print data00 $data00 totalRows $totalRows
 | |
|     if $data00 != $totalRows then
 | |
| 	    print **********************  select error **********************
 | |
|     endi
 | |
|     continue_loop:
 | |
|     print ====================== client4  insert data complete once ............
 | |
|   endi
 | |
| endw 
 | |
| 
 | |
| ##################### alter column
 | |
| sql alter table $stb add column c3 double
 | |
| sql alter table $stb drop column c2
 | |
| 
 | |
| $i = $tblStart
 | |
| while $i < $tblEnd
 | |
|   $tb = tb . $i
 | |
|   $x = 0
 | |
|   while $x < $rowsPerLoop
 | |
|     sql insert into $tb values ( $ts + 0a , $x , $x ) ( $ts + 2a , $x , $x ) ( $ts + 4a , $x , $x ) ( $ts + 6a , $x , $x ) ( $ts + 8a , $x , $x ) ( $ts + 10a , $x , $x ) ( $ts + 12a , $x , $x ) ( $ts + 14a , $x , $x ) ( $ts + 16a , $x , $x ) ( $ts + 18a , $x , $x ) ( $ts + 20a , $x , $x ) ( $ts + 22a , $x , $x ) ( $ts + 24a , $x , $x ) ( $ts + 26a , $x , $x ) ( $ts + 28a , $x , $x ) ( $ts + 30a , $x , $x ) ( $ts + 32a , $x , $x ) ( $ts + 34a , $x , $x ) ( $ts + 36a , $x , $x ) ( $ts + 38a , $x , $x )
 | |
|     $x = $x + 20
 | |
|     $ts = $ts + 40a
 | |
|   endw 
 | |
| 
 | |
|   $totalRows = $totalRows + $x
 | |
|   $i = $i + 1
 | |
|   
 | |
|   if $i == $tblEnd then
 | |
|     $i = $tblStart
 | |
|     
 | |
|     sql select count(*) from $stb -x continue_loop
 | |
|     print data00 $data00 totalRows $totalRows
 | |
|     if $data00 != $totalRows then
 | |
| 	    print **********************  select error **********************
 | |
|     endi
 | |
|     continue_loop:
 | |
|     print ====================== client4  insert data complete once ............
 | |
|   endi
 | |
| endw 
 | |
| 
 | |
| 
 | |
| ##################### alter tag
 | |
| sql alter table $stb add tag t3 int
 | |
| sql alter table $stb drop tag t2
 | |
| 
 | |
| $i = $tblStart
 | |
| while $i < $tblEnd
 | |
|   $tb = ttb . $i
 | |
|   sql create table if not exists  $tb using $stb tags ($i, $i)
 | |
|   $i = $i + 1
 | |
| endw 
 | |
| 
 | |
| $rowsPerLoop = 100
 | |
| $ts = $tsStart
 | |
| 
 | |
| $i = $tblStart
 | |
| while $i < $tblEnd
 | |
|   $tb = tb . $i
 | |
|   $x = 0
 | |
|   while $x < $rowsPerLoop
 | |
|     sql insert into $tb values ( $ts + 0a , $x , $x ) ( $ts + 2a , $x , $x ) ( $ts + 4a , $x , $x ) ( $ts + 6a , $x , $x ) ( $ts + 8a , $x , $x ) ( $ts + 10a , $x , $x ) ( $ts + 12a , $x , $x ) ( $ts + 14a , $x , $x ) ( $ts + 16a , $x , $x ) ( $ts + 18a , $x , $x ) ( $ts + 20a , $x , $x ) ( $ts + 22a , $x , $x ) ( $ts + 24a , $x , $x ) ( $ts + 26a , $x , $x ) ( $ts + 28a , $x , $x ) ( $ts + 30a , $x , $x ) ( $ts + 32a , $x , $x ) ( $ts + 34a , $x , $x ) ( $ts + 36a , $x , $x ) ( $ts + 38a , $x , $x )
 | |
|     $x = $x + 20
 | |
|     $ts = $ts + 40a
 | |
|   endw 
 | |
| 
 | |
|   $totalRows = $totalRows + $x
 | |
|   $i = $i + 1
 | |
|   
 | |
|   if $i == $tblEnd then
 | |
|     $i = $tblStart
 | |
|     
 | |
|     sql select count(*) from $stb -x continue_loop
 | |
|     print data00 $data00 totalRows $totalRows
 | |
|     if $data00 != $totalRows then
 | |
| 	    print **********************  select error **********************
 | |
|     endi
 | |
|     continue_loop:
 | |
|     print ====================== client4  insert data complete once ............
 | |
|   endi
 | |
| endw 
 | |
| 
 | |
| goto loop_lable |