diff options
author | Jamis Buck <jamis@37signals.com> | 2007-01-13 19:12:41 +0000 |
---|---|---|
committer | Jamis Buck <jamis@37signals.com> | 2007-01-13 19:12:41 +0000 |
commit | d3b5357d5ff1a2f1d6e4a212e768412da4fde2d2 (patch) | |
tree | 806bad59220e70fdeb211d9cf07121af96ad568e /lib/sqlite3 | |
parent | 12953284d8a3e171c9a029ab11a47167df304b55 (diff) | |
download | third_party-sqlite3-ruby-d3b5357d5ff1a2f1d6e4a212e768412da4fde2d2.tar.gz third_party-sqlite3-ruby-d3b5357d5ff1a2f1d6e4a212e768412da4fde2d2.tar.xz third_party-sqlite3-ruby-d3b5357d5ff1a2f1d6e4a212e768412da4fde2d2.zip |
Allow bind parameters to be specified without a leading colon. Also allow them to be specified as a symbol.
Diffstat (limited to 'lib/sqlite3')
-rw-r--r-- | lib/sqlite3/statement.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/sqlite3/statement.rb b/lib/sqlite3/statement.rb index af26d42..0de27f1 100644 --- a/lib/sqlite3/statement.rb +++ b/lib/sqlite3/statement.rb @@ -129,8 +129,9 @@ module SQLite3 @driver.bind_text( @handle, param, value ) end else - index = @driver.bind_parameter_index( - @handle, param.to_s ) + param = param.to_s + param = ":#{param}" unless param[0] == ?: + index = @driver.bind_parameter_index( @handle, param ) raise Exception, "no such bind parameter '#{param}'" if index == 0 bind_param index, value end |