Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: John Conery
Parentheses in SQLite3 Queries [ reply ]  
2007-11-15 21:46
Is there a problem with queries that contain parentheses? A query starting out "select max(n) from...." returns the expected result set when I enter it with the sqlite3 command line client, but generates an error when I try it in Ruby using the sqlite3 module. Changing the query to "select n from..." works OK.

Here is the error message:

/opt/local/lib/ruby/vendor_ruby/1.8/sqlite3/translator.rb:85:in `type_name': undefined method `upcase' for nil:NilClass (NoMethodError)
from /opt/local/lib/ruby/vendor_ruby/1.8/sqlite3/translator.rb:77:in `translate'
from /opt/local/lib/ruby/vendor_ruby/1.8/sqlite3/resultset.rb:135:in `next'
from /opt/local/lib/ruby/vendor_ruby/1.8/sqlite3/resultset.rb:134:in `map'
from /opt/local/lib/ruby/vendor_ruby/1.8/sqlite3/resultset.rb:134:in `next'
from /opt/local/lib/ruby/vendor_ruby/1.8/sqlite3/resultset.rb:160:in `each'
from /opt/local/lib/ruby/vendor_ruby/1.8/sqlite3/database.rb:215:in `inject'
from /opt/local/lib/ruby/vendor_ruby/1.8/sqlite3/database.rb:215:in `execute'
from /opt/local/lib/ruby/vendor_ruby/1.8/sqlite3/database.rb:186:in `prepare'
from /opt/local/lib/ruby/vendor_ruby/1.8/sqlite3/database.rb:210:in `execute'

I'm using Ruby 1.8.6, sqlite3-ruby 1.2.1, and OS/X 10.4.11.