You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
stmt = DBInterface.prepare(conn, "INSERT INTO test_table VALUES(?, ?)") # prepare a statement with positional parameters
32
32
33
-
DBInterface.execute!(stmt, [1, 3.14]) # execute the prepared INSERT statement, passing 1 and 3.14 as positional parameters
33
+
DBInterface.execute(stmt, [1, 3.14]) # execute the prepared INSERT statement, passing 1 and 3.14 as positional parameters
34
34
35
35
stmt = DBInterface.prepare(conn, "INSERT INTO test_table VALUES(:col1, :col2)") # prepare a statement with named parameters
36
36
37
-
DBInterface.execute!(stmt, (col1=1, col2=3.14)) # execute the prepared INSERT statement, with 1 and 3.14 as named parameters
37
+
DBInterface.execute(stmt, (col1=1, col2=3.14)) # execute the prepared INSERT statement, with 1 and 3.14 as named parameters
38
38
39
-
DBInterface.executemany!(stmt, (col1=[1,2,3,4,5], col2=[3.14, 1.23, 2.343.45, 4.56])) # execute the prepared statement multiple times for each set of named parameters; each named parameter must be an indexable collection
39
+
DBInterface.executemany(stmt, (col1=[1,2,3,4,5], col2=[3.14, 1.23, 2.343.45, 4.56])) # execute the prepared statement multiple times for each set of named parameters; each named parameter must be an indexable collection
40
40
41
41
DBInterface.close!(stmt) # close the prepared statement
Copy file name to clipboardExpand all lines: src/DBInterface.jl
+18-18Lines changed: 18 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -58,27 +58,27 @@ macro prepare(getDB, sql)
58
58
end
59
59
end
60
60
61
-
"Any object that iterates \"rows\", which are objects that are property-accessible and indexable. See `DBInterface.execute!` for more details on fetching query results."
61
+
"Any object that iterates \"rows\", which are objects that are property-accessible and indexable. See `DBInterface.execute` for more details on fetching query results."
Similar in usage to `DBInterface.execute!`, but allows passing multiple sets of parameters to be executed in sequence.
98
-
`params`, like for `DBInterface.execute!`, should be an indexable collection (`Vector` or `Tuple`) or `NamedTuple`, but instead
97
+
Similar in usage to `DBInterface.execute`, but allows passing multiple sets of parameters to be executed in sequence.
98
+
`params`, like for `DBInterface.execute`, should be an indexable collection (`Vector` or `Tuple`) or `NamedTuple`, but instead
99
99
of a single scalar value per parameter, an indexable collection should be passed for each parameter. By default, each set of
100
-
parameters will be looped over and `DBInterface.execute!` will be called for each. Note that no result sets or cursors are returned
100
+
parameters will be looped over and `DBInterface.execute` will be called for each. Note that no result sets or cursors are returned
101
101
for any execution, so the usage is mainly intended for bulk INSERT statements.
102
102
"""
103
-
functionexecutemany!(stmt::Statement, params=())
103
+
functionexecutemany(stmt::Statement, params=())
104
104
if!isempty(params)
105
105
param = params[1]
106
106
len =length(param)
107
107
all(x ->length(x) == len, params) ||throw(ParameterError("parameters provided to `DBInterface.executemany!` do not all have the same number of parameters"))
0 commit comments