@@ -837,17 +837,17 @@ func lastError(db *C.sqlite3) error {
837
837
838
838
// Exec implements Execer.
839
839
func (c * SQLiteConn ) Exec (query string , args []driver.Value ) (driver.Result , error ) {
840
- list := make ([]namedValue , len (args ))
840
+ list := make ([]driver. NamedValue , len (args ))
841
841
for i , v := range args {
842
- list [i ] = namedValue {
842
+ list [i ] = driver. NamedValue {
843
843
Ordinal : i + 1 ,
844
844
Value : v ,
845
845
}
846
846
}
847
847
return c .exec (context .Background (), query , list )
848
848
}
849
849
850
- func (c * SQLiteConn ) exec (ctx context.Context , query string , args []namedValue ) (driver.Result , error ) {
850
+ func (c * SQLiteConn ) exec (ctx context.Context , query string , args []driver. NamedValue ) (driver.Result , error ) {
851
851
start := 0
852
852
for {
853
853
s , err := c .prepare (ctx , query )
@@ -856,7 +856,7 @@ func (c *SQLiteConn) exec(ctx context.Context, query string, args []namedValue)
856
856
}
857
857
var res driver.Result
858
858
if s .(* SQLiteStmt ).s != nil {
859
- stmtArgs := make ([]namedValue , 0 , len (args ))
859
+ stmtArgs := make ([]driver. NamedValue , 0 , len (args ))
860
860
na := s .NumInput ()
861
861
if len (args )- start < na {
862
862
s .Close ()
@@ -894,28 +894,22 @@ func (c *SQLiteConn) exec(ctx context.Context, query string, args []namedValue)
894
894
}
895
895
}
896
896
897
- type namedValue struct {
898
- Name string
899
- Ordinal int
900
- Value driver.Value
901
- }
902
-
903
897
// Query implements Queryer.
904
898
func (c * SQLiteConn ) Query (query string , args []driver.Value ) (driver.Rows , error ) {
905
- list := make ([]namedValue , len (args ))
899
+ list := make ([]driver. NamedValue , len (args ))
906
900
for i , v := range args {
907
- list [i ] = namedValue {
901
+ list [i ] = driver. NamedValue {
908
902
Ordinal : i + 1 ,
909
903
Value : v ,
910
904
}
911
905
}
912
906
return c .query (context .Background (), query , list )
913
907
}
914
908
915
- func (c * SQLiteConn ) query (ctx context.Context , query string , args []namedValue ) (driver.Rows , error ) {
909
+ func (c * SQLiteConn ) query (ctx context.Context , query string , args []driver. NamedValue ) (driver.Rows , error ) {
916
910
start := 0
917
911
for {
918
- stmtArgs := make ([]namedValue , 0 , len (args ))
912
+ stmtArgs := make ([]driver. NamedValue , 0 , len (args ))
919
913
s , err := c .prepare (ctx , query )
920
914
if err != nil {
921
915
return nil , err
@@ -1912,7 +1906,7 @@ func (s *SQLiteStmt) NumInput() int {
1912
1906
1913
1907
var placeHolder = []byte {0 }
1914
1908
1915
- func (s * SQLiteStmt ) bind (args []namedValue ) error {
1909
+ func (s * SQLiteStmt ) bind (args []driver. NamedValue ) error {
1916
1910
rv := C .sqlite3_reset (s .s )
1917
1911
if rv != C .SQLITE_ROW && rv != C .SQLITE_OK && rv != C .SQLITE_DONE {
1918
1912
return s .c .lastError ()
@@ -1982,17 +1976,17 @@ func (s *SQLiteStmt) bind(args []namedValue) error {
1982
1976
1983
1977
// Query the statement with arguments. Return records.
1984
1978
func (s * SQLiteStmt ) Query (args []driver.Value ) (driver.Rows , error ) {
1985
- list := make ([]namedValue , len (args ))
1979
+ list := make ([]driver. NamedValue , len (args ))
1986
1980
for i , v := range args {
1987
- list [i ] = namedValue {
1981
+ list [i ] = driver. NamedValue {
1988
1982
Ordinal : i + 1 ,
1989
1983
Value : v ,
1990
1984
}
1991
1985
}
1992
1986
return s .query (context .Background (), list )
1993
1987
}
1994
1988
1995
- func (s * SQLiteStmt ) query (ctx context.Context , args []namedValue ) (driver.Rows , error ) {
1989
+ func (s * SQLiteStmt ) query (ctx context.Context , args []driver. NamedValue ) (driver.Rows , error ) {
1996
1990
if err := s .bind (args ); err != nil {
1997
1991
return nil , err
1998
1992
}
@@ -2022,9 +2016,9 @@ func (r *SQLiteResult) RowsAffected() (int64, error) {
2022
2016
2023
2017
// Exec execute the statement with arguments. Return result object.
2024
2018
func (s * SQLiteStmt ) Exec (args []driver.Value ) (driver.Result , error ) {
2025
- list := make ([]namedValue , len (args ))
2019
+ list := make ([]driver. NamedValue , len (args ))
2026
2020
for i , v := range args {
2027
- list [i ] = namedValue {
2021
+ list [i ] = driver. NamedValue {
2028
2022
Ordinal : i + 1 ,
2029
2023
Value : v ,
2030
2024
}
@@ -2041,7 +2035,7 @@ func isInterruptErr(err error) bool {
2041
2035
}
2042
2036
2043
2037
// exec executes a query that doesn't return rows. Attempts to honor context timeout.
2044
- func (s * SQLiteStmt ) exec (ctx context.Context , args []namedValue ) (driver.Result , error ) {
2038
+ func (s * SQLiteStmt ) exec (ctx context.Context , args []driver. NamedValue ) (driver.Result , error ) {
2045
2039
if ctx .Done () == nil {
2046
2040
return s .execSync (args )
2047
2041
}
@@ -2073,7 +2067,7 @@ func (s *SQLiteStmt) exec(ctx context.Context, args []namedValue) (driver.Result
2073
2067
return rv .r , rv .err
2074
2068
}
2075
2069
2076
- func (s * SQLiteStmt ) execSync (args []namedValue ) (driver.Result , error ) {
2070
+ func (s * SQLiteStmt ) execSync (args []driver. NamedValue ) (driver.Result , error ) {
2077
2071
if err := s .bind (args ); err != nil {
2078
2072
C .sqlite3_reset (s .s )
2079
2073
C .sqlite3_clear_bindings (s .s )
0 commit comments