Args as params #3

merged 2 commits into from Aug 19, 2011


None yet

2 participants


Attached is a diff to make db.execute take bind_vars as a list of params instead of an array.
For example:

  db.execute("INSERT INTO users (id, email) VALUES (?, ?)", ['kway', ''])


db.execute("INSERT INTO users (id, email) VALUES (?, ?)", 'kway', '')
psanford added some commits Aug 19, 2011
@psanford psanford Update Database.execute to take bind_vars as params.
Instead passing execute an array (Database.execute('statement', [arg1, arg2]))
you just pass it the bind args as parameters
(Database.execute('statement', arg1, arg2)).

Removed unnecessary &block from execute; block_given? and yield work
on the implicit block.
@psanford psanford Update readme with execute param syntax. 734825a
@kreynolds kreynolds merged commit 502c2e0 into kreynolds:master Aug 19, 2011

I know there is an implicit block but I like to explicitly state it as it makes the function clear when scanning generated documentation .. I'm old fashioned that way. Thanks.


You should be aware that there is a performance penalty in explicitly naming that block even if you never use it. See


So there is, I had not seen that before. I will remove them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment