From d3b5357d5ff1a2f1d6e4a212e768412da4fde2d2 Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Sat, 13 Jan 2007 19:12:41 +0000 Subject: Allow bind parameters to be specified without a leading colon. Also allow them to be specified as a symbol. --- lib/sqlite3/statement.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/sqlite3') 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 -- cgit