@@ -582,23 +582,23 @@ func (stmt *mysqlStmt) writeExecutePacket(args []driver.Value) error {
582
582
}
583
583
584
584
// cache types and values
585
- switch args [i ].(type ) {
585
+ switch v := args [i ].(type ) {
586
586
case int64 :
587
587
paramTypes [i << 1 ] = fieldTypeLongLong
588
- paramValues [i ] = uint64ToBytes (uint64 (args [ i ].( int64 ) ))
588
+ paramValues [i ] = uint64ToBytes (uint64 (v ))
589
589
pktLen += 8
590
590
continue
591
591
592
592
case float64 :
593
593
paramTypes [i << 1 ] = fieldTypeDouble
594
- paramValues [i ] = uint64ToBytes (math .Float64bits (args [ i ].( float64 ) ))
594
+ paramValues [i ] = uint64ToBytes (math .Float64bits (v ))
595
595
pktLen += 8
596
596
continue
597
597
598
598
case bool :
599
599
paramTypes [i << 1 ] = fieldTypeTiny
600
600
pktLen ++
601
- if args [ i ].( bool ) {
601
+ if v {
602
602
paramValues [i ] = []byte {0x01 }
603
603
} else {
604
604
paramValues [i ] = []byte {0x00 }
@@ -607,27 +607,25 @@ func (stmt *mysqlStmt) writeExecutePacket(args []driver.Value) error {
607
607
608
608
case []byte :
609
609
paramTypes [i << 1 ] = fieldTypeString
610
- val := args [i ].([]byte )
611
610
paramValues [i ] = append (
612
- lengthEncodedIntegerToBytes (uint64 (len (val ))),
613
- val ... ,
611
+ lengthEncodedIntegerToBytes (uint64 (len (v ))),
612
+ v ... ,
614
613
)
615
614
pktLen += len (paramValues [i ])
616
615
continue
617
616
618
617
case string :
619
618
paramTypes [i << 1 ] = fieldTypeString
620
- val := []byte (args [i ].(string ))
621
619
paramValues [i ] = append (
622
- lengthEncodedIntegerToBytes (uint64 (len (val ))),
623
- val ... ,
620
+ lengthEncodedIntegerToBytes (uint64 (len (v ))),
621
+ [] byte ( v ) ... ,
624
622
)
625
623
pktLen += len (paramValues [i ])
626
624
continue
627
625
628
626
case time.Time :
629
627
paramTypes [i << 1 ] = fieldTypeString
630
- val := []byte (args [ i ].(time. Time ) .Format (timeFormat ))
628
+ val := []byte (v .Format (timeFormat ))
631
629
paramValues [i ] = append (
632
630
lengthEncodedIntegerToBytes (uint64 (len (val ))),
633
631
val ... ,
0 commit comments