File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -734,6 +734,8 @@ type bindArg struct {
734
734
v driver.Value
735
735
}
736
736
737
+ var placeHolder byte = 0
738
+
737
739
func (s * SQLiteStmt ) bind (args []namedValue ) error {
738
740
rv := C .sqlite3_reset (s .s )
739
741
if rv != C .SQLITE_ROW && rv != C .SQLITE_OK && rv != C .SQLITE_DONE {
@@ -755,8 +757,7 @@ func (s *SQLiteStmt) bind(args []namedValue) error {
755
757
rv = C .sqlite3_bind_null (s .s , n )
756
758
case string :
757
759
if len (v ) == 0 {
758
- b := []byte {0 }
759
- rv = C ._sqlite3_bind_text (s .s , n , (* C .char )(unsafe .Pointer (& b [0 ])), C .int (0 ))
760
+ rv = C ._sqlite3_bind_text (s .s , n , (* C .char )(unsafe .Pointer (& placeHolder )), C .int (0 ))
760
761
} else {
761
762
b := []byte (v )
762
763
rv = C ._sqlite3_bind_text (s .s , n , (* C .char )(unsafe .Pointer (& b [0 ])), C .int (len (b )))
@@ -774,7 +775,7 @@ func (s *SQLiteStmt) bind(args []namedValue) error {
774
775
case []byte :
775
776
var ptr * byte
776
777
if len (v ) == 0 {
777
- ptr = & ( make ([] byte , 1 )[ 0 ])
778
+ ptr = & placeHolder
778
779
} else {
779
780
ptr = & v [0 ]
780
781
}
You can’t perform that action at this time.
0 commit comments