-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Prepared Statements #24
Comments
Do you mean like this?
This would run the insert statement 3 times. I like this approach. I'm not sure if it's a good idea to reuse the same method or perhaps create new methods like:
I'm not sure what the best return type for queryMulti() would be, it's effectively a stream of streams. I could flatten this, and add some kind of sentinel to signal the end of a result set. The good thing about having separate methods is it makes the feature more discoverable in the api docs (Which don't exist yet :( ) |
I like your idea, but is not a http://www.postgresql.org/docs/current/static/sql-prepare.html something like this: db.query( "prepare emp_update( int, varchar ) as update emp set name=$2 db.query( 'emp_update', [ 15, 'John Doe' ] )
*I think I can prove that quoting/escaping parameters will not guarantee On Thu, Nov 21, 2013 at 11:35 AM, xxgreg [email protected] wrote:
|
Prepared statements can be used by these methods if the list size is large enough to warrant the extra overhead (>20?). I could also add an optional forcePreparedStatement argument. For small lists, prepared statements are significantly slower - as there are more round trips to the server. From a sql injection perspective, it doesn't matter if the parameter substitution is done on the client or the server, as long as it is done, and done correctly. The advantage of doing it on the client, is it means you don't have to use pay the overhead of using prepared statements even if you're only submitting the query once. |
I'm suggesting that the developer create a set of commonly used dml as that's why
On Thu, Nov 21, 2013 at 11:56 AM, xxgreg [email protected] wrote:
|
Thank your for your comments. I agree that support for prepared statements is a useful feature. When I initially wrote this driver, I have looked at the protocol to see how to implement this. I won't have time to do this with in the next couple of months. However, I do have time to answer questions if any one else is interested in implementing this. The protocol documentation can be found here: |
once I get up to snuff on Dart, will be happy to contribute. have written On Sun, Nov 24, 2013 at 4:15 AM, xxgreg [email protected] wrote:
|
Great. Contributions are very welcome ;) On Sun, Nov 24, 2013 at 3:42 PM, cc young [email protected] wrote:
|
my pleasure. will be start in about a week (unless I'm stupider in Dart On Mon, Nov 25, 2013 at 2:43 AM, xxgreg [email protected] wrote:
|
It's pretty easy to get started with. Make sure you've read up on Futures and Streams. |
I do not see support for prepared statements.
seems like
query( String query, List params )
would be appropriate, as versusquery( String query, Map params )
for regular query.The text was updated successfully, but these errors were encountered: