Document string and decimal meta
This commit is contained in:
		
							parent
							
								
									aa2b3ad7b1
								
							
						
					
					
						commit
						ec8e2e9a9c
					
				| @ -55,17 +55,21 @@ func decodeColumnMeta(data []byte, cols []byte) []uint16 { | |||||||
| 	meta := make([]uint16, len(cols)) | 	meta := make([]uint16, len(cols)) | ||||||
| 	for i, typ := range cols { | 	for i, typ := range cols { | ||||||
| 		switch mysql.ColumnType(typ) { | 		switch mysql.ColumnType(typ) { | ||||||
| 		case mysql.ColumnTypeString, | 		case mysql.ColumnTypeString: | ||||||
| 			mysql.ColumnTypeNewDecimal: | 			// 1st: Type | ||||||
| 
 | 			// 2nd: Length | ||||||
| 			// TODO: Is that correct? | 			meta[i] = uint16(data[pos])<<8 | uint16(data[pos+1]) | ||||||
|  | 			pos += 2 | ||||||
|  | 		case mysql.ColumnTypeNewDecimal: | ||||||
|  | 			// 1st: Precision | ||||||
|  | 			// 2nd: Decimal places | ||||||
| 			meta[i] = uint16(data[pos])<<8 | uint16(data[pos+1]) | 			meta[i] = uint16(data[pos])<<8 | uint16(data[pos+1]) | ||||||
| 			pos += 2 | 			pos += 2 | ||||||
| 		case mysql.ColumnTypeVarchar, | 		case mysql.ColumnTypeVarchar, | ||||||
| 			mysql.ColumnTypeVarstring, | 			mysql.ColumnTypeVarstring, | ||||||
| 			mysql.ColumnTypeBit: | 			mysql.ColumnTypeBit: | ||||||
| 
 | 
 | ||||||
| 			// TODO: Is that correct? | 			// Likely it's length | ||||||
| 			meta[i] = mysql.DecodeUint16(data[pos:]) | 			meta[i] = mysql.DecodeUint16(data[pos:]) | ||||||
| 			pos += 2 | 			pos += 2 | ||||||
| 		case mysql.ColumnTypeFloat, | 		case mysql.ColumnTypeFloat, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user