@@ -841,17 +841,17 @@ func lastError(db *C.sqlite3) error {
841
841
842
842
// Exec implements Execer.
843
843
func (c * SQLiteConn ) Exec (query string , args []driver.Value ) (driver.Result , error ) {
844
- list := make ([]namedValue , len (args ))
844
+ list := make ([]driver. NamedValue , len (args ))
845
845
for i , v := range args {
846
- list [i ] = namedValue {
846
+ list [i ] = driver. NamedValue {
847
847
Ordinal : i + 1 ,
848
848
Value : v ,
849
849
}
850
850
}
851
851
return c .exec (context .Background (), query , list )
852
852
}
853
853
854
- func (c * SQLiteConn ) exec (ctx context.Context , query string , args []namedValue ) (driver.Result , error ) {
854
+ func (c * SQLiteConn ) exec (ctx context.Context , query string , args []driver. NamedValue ) (driver.Result , error ) {
855
855
start := 0
856
856
for {
857
857
s , err := c .prepare (ctx , query )
@@ -860,7 +860,7 @@ func (c *SQLiteConn) exec(ctx context.Context, query string, args []namedValue)
860
860
}
861
861
var res driver.Result
862
862
if s .(* SQLiteStmt ).s != nil {
863
- stmtArgs := make ([]namedValue , 0 , len (args ))
863
+ stmtArgs := make ([]driver. NamedValue , 0 , len (args ))
864
864
na := s .NumInput ()
865
865
if len (args )- start < na {
866
866
s .Close ()
@@ -898,28 +898,22 @@ func (c *SQLiteConn) exec(ctx context.Context, query string, args []namedValue)
898
898
}
899
899
}
900
900
901
- type namedValue struct {
902
- Name string
903
- Ordinal int
904
- Value driver.Value
905
- }
906
-
907
901
// Query implements Queryer.
908
902
func (c * SQLiteConn ) Query (query string , args []driver.Value ) (driver.Rows , error ) {
909
- list := make ([]namedValue , len (args ))
903
+ list := make ([]driver. NamedValue , len (args ))
910
904
for i , v := range args {
911
- list [i ] = namedValue {
905
+ list [i ] = driver. NamedValue {
912
906
Ordinal : i + 1 ,
913
907
Value : v ,
914
908
}
915
909
}
916
910
return c .query (context .Background (), query , list )
917
911
}
918
912
919
- func (c * SQLiteConn ) query (ctx context.Context , query string , args []namedValue ) (driver.Rows , error ) {
913
+ func (c * SQLiteConn ) query (ctx context.Context , query string , args []driver. NamedValue ) (driver.Rows , error ) {
920
914
start := 0
921
915
for {
922
- stmtArgs := make ([]namedValue , 0 , len (args ))
916
+ stmtArgs := make ([]driver. NamedValue , 0 , len (args ))
923
917
s , err := c .prepare (ctx , query )
924
918
if err != nil {
925
919
return nil , err
@@ -1916,7 +1910,7 @@ func (s *SQLiteStmt) NumInput() int {
1916
1910
1917
1911
var placeHolder = []byte {0 }
1918
1912
1919
- func (s * SQLiteStmt ) bind (args []namedValue ) error {
1913
+ func (s * SQLiteStmt ) bind (args []driver. NamedValue ) error {
1920
1914
rv := C .sqlite3_reset (s .s )
1921
1915
if rv != C .SQLITE_ROW && rv != C .SQLITE_OK && rv != C .SQLITE_DONE {
1922
1916
return s .c .lastError ()
@@ -1986,17 +1980,17 @@ func (s *SQLiteStmt) bind(args []namedValue) error {
1986
1980
1987
1981
// Query the statement with arguments. Return records.
1988
1982
func (s * SQLiteStmt ) Query (args []driver.Value ) (driver.Rows , error ) {
1989
- list := make ([]namedValue , len (args ))
1983
+ list := make ([]driver. NamedValue , len (args ))
1990
1984
for i , v := range args {
1991
- list [i ] = namedValue {
1985
+ list [i ] = driver. NamedValue {
1992
1986
Ordinal : i + 1 ,
1993
1987
Value : v ,
1994
1988
}
1995
1989
}
1996
1990
return s .query (context .Background (), list )
1997
1991
}
1998
1992
1999
- func (s * SQLiteStmt ) query (ctx context.Context , args []namedValue ) (driver.Rows , error ) {
1993
+ func (s * SQLiteStmt ) query (ctx context.Context , args []driver. NamedValue ) (driver.Rows , error ) {
2000
1994
if err := s .bind (args ); err != nil {
2001
1995
return nil , err
2002
1996
}
@@ -2026,9 +2020,9 @@ func (r *SQLiteResult) RowsAffected() (int64, error) {
2026
2020
2027
2021
// Exec execute the statement with arguments. Return result object.
2028
2022
func (s * SQLiteStmt ) Exec (args []driver.Value ) (driver.Result , error ) {
2029
- list := make ([]namedValue , len (args ))
2023
+ list := make ([]driver. NamedValue , len (args ))
2030
2024
for i , v := range args {
2031
- list [i ] = namedValue {
2025
+ list [i ] = driver. NamedValue {
2032
2026
Ordinal : i + 1 ,
2033
2027
Value : v ,
2034
2028
}
@@ -2045,7 +2039,7 @@ func isInterruptErr(err error) bool {
2045
2039
}
2046
2040
2047
2041
// exec executes a query that doesn't return rows. Attempts to honor context timeout.
2048
- func (s * SQLiteStmt ) exec (ctx context.Context , args []namedValue ) (driver.Result , error ) {
2042
+ func (s * SQLiteStmt ) exec (ctx context.Context , args []driver. NamedValue ) (driver.Result , error ) {
2049
2043
if ctx .Done () == nil {
2050
2044
return s .execSync (args )
2051
2045
}
@@ -2077,7 +2071,7 @@ func (s *SQLiteStmt) exec(ctx context.Context, args []namedValue) (driver.Result
2077
2071
return rv .r , rv .err
2078
2072
}
2079
2073
2080
- func (s * SQLiteStmt ) execSync (args []namedValue ) (driver.Result , error ) {
2074
+ func (s * SQLiteStmt ) execSync (args []driver. NamedValue ) (driver.Result , error ) {
2081
2075
if err := s .bind (args ); err != nil {
2082
2076
C .sqlite3_reset (s .s )
2083
2077
C .sqlite3_clear_bindings (s .s )
0 commit comments