65 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			65 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| system sh/stop_dnodes.sh
 | |
| system sh/deploy.sh -n dnode1 -i 1
 | |
| system sh/exec.sh -n dnode1 -s start
 | |
| sql connect
 | |
| 
 | |
| print ======================== dnode1 start
 | |
| 
 | |
| sql create database mul_db
 | |
| sql use mul_db
 | |
| sql create table mul_st (ts timestamp, col1 int) tags (tag1 int)
 | |
| 
 | |
| # case: insert multiple recordes for multiple table in a query
 | |
| print =========== insert_multiTbl.sim case: insert multiple records for multiple table in a query
 | |
| $ts = 1600000000000
 | |
| sql insert into mul_t0 using mul_st tags(0) values ( $ts , 0) ( $ts + 1s, 1) ( $ts + 2s, 2) mul_t1 using mul_st tags(1) values ( $ts , 10) ( $ts + 1s, 11) ( $ts + 2s, 12) mul_t2 using mul_st tags(2) values ( $ts , 20) ( $ts + 1s, 21) ( $ts + 2s, 22) mul_t3 using mul_st tags(3) values ( $ts , 30) ( $ts + 1s, 31) ( $ts + 2s, 32)
 | |
| sql select * from mul_st order by ts, col1 ;
 | |
| print rows = $rows
 | |
| if $rows != 12 then
 | |
|   return -1
 | |
| endi
 | |
| if $data01 != 0 then
 | |
|   return -1
 | |
| endi
 | |
| 
 | |
| sql create table mul_b0 (ts timestamp, col1 int)
 | |
| sql create table mul_b1 (ts timestamp, col1 int)
 | |
| sql create table mul_b2 (ts timestamp, col1 int)
 | |
| sql create table mul_b3 (ts timestamp, col1 int)
 | |
| 
 | |
| sql insert into mul_b0 values ( $ts , 0) ( $ts + 1s, 1) ( $ts + 2s, 2) mul_b1 values ( $ts , 10) ( $ts + 1s, 11) ( $ts + 2s, 12) mul_b2 values ( $ts , 20) ( $ts + 1s, 21) ( $ts + 2s, 22) mul_b3 values ( $ts , 30) ( $ts + 1s, 31) ( $ts + 2s, 32)
 | |
| sql select * from mul_b3
 | |
| print rows = $rows
 | |
| if $rows != 3 then
 | |
|   return -1
 | |
| endi
 | |
| if $data01 != 30 then
 | |
|   return -1
 | |
| endi
 | |
| 
 | |
| # insert values for specified columns
 | |
| sql create table mul_st1 (ts timestamp, col1 int, col2 float, col3 binary(10)) tags (tag1 int, tag2 int, tag3 binary(8))
 | |
| print =========== insert values for specified columns for multiple table in a query
 | |
| $ts = 1600000000000
 | |
| sql insert into mul_t10 (ts, col1, col3) using mul_st1 (tag1, tag3) tags(0, 'tag3-0') values ( $ts , 00, 'binary00') ( $ts + 1s, 01, 'binary01') ( $ts + 2s, 02, 'binary02') mul_t11 (ts, col1, col3) using mul_st1 (tag1, tag3) tags(1, 'tag3-0') values ( $ts , 10, 'binary10') ( $ts + 1s, 11, 'binary11') ( $ts + 2s, 12, 'binary12') mul_t12 (ts, col1, col3) using mul_st1 (tag1, tag3) tags(2, 'tag3-0') values ( $ts , 20, 'binary20') ( $ts + 1s, 21, 'binary21') ( $ts + 2s, 22, 'binary22') mul_t13 (ts, col1, col3) using mul_st1 (tag1, tag3) tags(3, 'tag3-0') values ( $ts , 30, 'binary30') ( $ts + 1s, 31, 'binary31') ( $ts + 2s, 32, 'binary32')
 | |
| 
 | |
| sql select * from mul_st1 order by ts, col1 ;
 | |
| print rows = $rows
 | |
| if $rows != 12 then
 | |
|   return -1
 | |
| endi
 | |
| if $data02 != NULL then
 | |
|   print "expect: NULL, act: $data02"
 | |
|   return -1
 | |
| endi
 | |
| if $data03 != @binary00@ then
 | |
|   return -1
 | |
| endi
 | |
| if $data92 != NULL then
 | |
|   return -1
 | |
| endi
 | |
| if $data93 != @binary12@ then
 | |
|   return -1
 | |
| endi
 | |
| 
 |