Skip to content

Instantly share code, notes, and snippets.

@giskarda
Created November 13, 2011 15:30
Show Gist options
  • Save giskarda/1362224 to your computer and use it in GitHub Desktop.
Save giskarda/1362224 to your computer and use it in GitHub Desktop.
>> DB.schema('prj')
=> [[:id, {:type=>:integer, :default=>nil, :ruby_default=>nil, :db_type=>"integer", :primary_key=>true, :allow_null=>true}], [:name, {:type=>:string, :default=>nil, :ruby_default=>nil, :db_type=>"varchar(255)", :primary_key=>false, :allow_null=>true}], [:owner, {:type=>:string, :default=>nil, :ruby_default=>nil, :db_type=>"varchar(255)", :primary_key=>false, :allow_null=>true}], [:owner_email, {:type=>:string, :default=>nil, :ruby_default=>nil, :db_type=>"varchar(255)", :primary_key=>false, :allow_null=>true}], [:tag, {:type=>:string, :default=>nil, :ruby_default=>nil, :db_type=>"varchar(255)", :primary_key=>false, :allow_null=>true}], [:description, {:type=>:string, :default=>nil, :ruby_default=>nil, :db_type=>"varchar(255)", :primary_key=>false, :allow_null=>true}], [:created_at, {:type=>:datetime, :default=>nil, :ruby_default=>nil, :db_type=>"timestamp", :primary_key=>false, :allow_null=>true}]]
>> DB['prj'].all()
Sequel::DatabaseError: SQLite3::SQLException: near "prj": syntax error
from /Library/Ruby/Gems/1.8/gems/sqlite3-1.3.4/lib/sqlite3/database.rb:91:in `initialize'
from /Library/Ruby/Gems/1.8/gems/sqlite3-1.3.4/lib/sqlite3/database.rb:91:in `new'
from /Library/Ruby/Gems/1.8/gems/sqlite3-1.3.4/lib/sqlite3/database.rb:91:in `prepare'
from /Library/Ruby/Gems/1.8/gems/sqlite3-1.3.4/lib/sqlite3/database.rb:263:in `query'
from /Library/Ruby/Gems/1.8/gems/sequel-3.29.0/lib/sequel/adapters/sqlite.rb:124:in `_execute'
from /Library/Ruby/Gems/1.8/gems/sequel-3.29.0/lib/sequel/database/logging.rb:28:in `log_yield'
from /Library/Ruby/Gems/1.8/gems/sequel-3.29.0/lib/sequel/adapters/sqlite.rb:124:in `_execute'
from /Library/Ruby/Gems/1.8/gems/sequel-3.29.0/lib/sequel/connection_pool/threaded.rb:84:in `hold'
from /Library/Ruby/Gems/1.8/gems/sequel-3.29.0/lib/sequel/database/connecting.rb:225:in `synchronize'
from /Library/Ruby/Gems/1.8/gems/sequel-3.29.0/lib/sequel/adapters/sqlite.rb:117:in `_execute'
from /Library/Ruby/Gems/1.8/gems/sequel-3.29.0/lib/sequel/adapters/sqlite.rb:82:in `execute'
from /Library/Ruby/Gems/1.8/gems/sequel-3.29.0/lib/sequel/dataset/actions.rb:646:in `execute'
from /Library/Ruby/Gems/1.8/gems/sequel-3.29.0/lib/sequel/adapters/sqlite.rb:296:in `fetch_rows'
from /Library/Ruby/Gems/1.8/gems/sequel-3.29.0/lib/sequel/dataset/actions.rb:133:in `each'
from /Library/Ruby/Gems/1.8/gems/sequel-3.29.0/lib/sequel/dataset/actions.rb:55:in `all'
from (irb):2
>>
@giskarda
Copy link
Author

dataset = DB['prj']
=> #<Sequel::SQLite::Dataset: "prj">
dataset.all
Sequel::DatabaseError: SQLite3::SQLException: near "prj": syntax error
from /Library/Ruby/Gems/1.8/gems/sqlite3-1.3.4/lib/sqlite3/database.rb:91:in initialize' from /Library/Ruby/Gems/1.8/gems/sqlite3-1.3.4/lib/sqlite3/database.rb:91:innew'
from /Library/Ruby/Gems/1.8/gems/sqlite3-1.3.4/lib/sqlite3/database.rb:91:in prepare' from /Library/Ruby/Gems/1.8/gems/sqlite3-1.3.4/lib/sqlite3/database.rb:263:inquery'
from /Library/Ruby/Gems/1.8/gems/sequel-3.29.0/lib/sequel/adapters/sqlite.rb:124:in _execute' from /Library/Ruby/Gems/1.8/gems/sequel-3.29.0/lib/sequel/database/logging.rb:28:inlog_yield'
from /Library/Ruby/Gems/1.8/gems/sequel-3.29.0/lib/sequel/adapters/sqlite.rb:124:in _execute' from /Library/Ruby/Gems/1.8/gems/sequel-3.29.0/lib/sequel/connection_pool/threaded.rb:84:inhold'
from /Library/Ruby/Gems/1.8/gems/sequel-3.29.0/lib/sequel/database/connecting.rb:225:in synchronize' from /Library/Ruby/Gems/1.8/gems/sequel-3.29.0/lib/sequel/adapters/sqlite.rb:117:in_execute'
from /Library/Ruby/Gems/1.8/gems/sequel-3.29.0/lib/sequel/adapters/sqlite.rb:82:in execute' from /Library/Ruby/Gems/1.8/gems/sequel-3.29.0/lib/sequel/dataset/actions.rb:646:inexecute'
from /Library/Ruby/Gems/1.8/gems/sequel-3.29.0/lib/sequel/adapters/sqlite.rb:296:in fetch_rows' from /Library/Ruby/Gems/1.8/gems/sequel-3.29.0/lib/sequel/dataset/actions.rb:133:ineach'
from /Library/Ruby/Gems/1.8/gems/sequel-3.29.0/lib/sequel/dataset/actions.rb:55:in `all'
from (irb):4

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