generated from WebAssembly/wasi-proposal-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
I don't quite understand this part:
Lines 25 to 29 in d14174a
| /// allows parameterized queries | |
| /// e.g., prepare("SELECT * FROM users WHERE name = ? AND age = ?", vec!["John Doe", "32"]) | |
| resource statement { | |
| prepare: static func(query: string, params: list<string>) -> result<statement, error>; | |
| } |
As far as I know, many sql prepare protocols support binary, so it should not be converted to string here, as there will be too many extra allocations.
And the binary solution can also solve the problem of custom data types in pgsql.
I think prepare should be a (prepare-)statement constructor that accepts a sql string with slots.
At constructor time, a binary ArgumentBuffer will be constructed inside the statement.
Then a write method is provided to write the binary encoding of the parameter.
Maybe also provide an is-finish to determine if all slots have been filled. Because it is possible to have dynamic construction based on if else
Metadata
Metadata
Assignees
Labels
No labels