summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md21
1 files changed, 21 insertions, 0 deletions
diff --git a/README.md b/README.md
index dea6990..7f12093 100644
--- a/README.md
+++ b/README.md
@@ -102,6 +102,27 @@ try stmt.exec({
102 102
103See the section "Bind parameters and resultset rows" for more information on the types mapping rules. 103See the section "Bind parameters and resultset rows" for more information on the types mapping rules.
104 104
105## Reuse a statement
106
107You can reuse a statement by resetting it like this:
108```zig
109const query =
110 \\UPDATE foo SET salary = ? WHERE id = ?
111;
112
113var stmt = try db.prepare(query);
114defer stmt.deinit();
115
116var id: usize = 0;
117while (id < 20) : (id += 1) {
118 stmt.reset();
119 try stmt.exec(.{
120 .salary = 2000,
121 .id = id,
122 });
123}
124```
125
105## Reading data 126## Reading data
106 127
107For queries which return data you have multiple options: 128For queries which return data you have multiple options: