sequel

Ruby Sequel: is there a last_insert_id method?

Hi after an insert I need to know the ID from this row, how can I do that? ...

How to disconnect an existing ruby sequel connection to a database?

I mean the one which was previously established as DB = Sequel.sqlite('my_blog.db') or DB = Sequel.connect('postgres://user:password@localhost/my_db') or DB = Sequel.postgres('my_db', :user => 'user', :password => 'password', :host => 'localhost') or etcetera. The Sequel::Database class has no public instance method called "dis...

Killing the mysqld process

I have a table with ~800k rows. I ran an update users set hash = SHA1(CONCAT({about eight fields})) where 1; Now I have a hung Sequel Pro process and I'm not sure about the mysqld process. This is two questions: What harm can possibly come from killing these programs? I'm working on a separate database, so no damage should come to o...

proper way to run raw sql queries with sequel

I am not clear yet on the proper way to run raw sql queries with sequel currently I am trying this but not sure if it is the correct way DB.fetch("SELECT * FROM zone WHERE dialcode = '#{@dialcode}' LIMIT 1") do |row| @zonename = row end What would be good is if I can run the queries as raw then access the results like normal e.g i...

[Ruby] Sequel example won't run

Hi, I've just installed "sequel" gem for Ruby. I wanted to try example from Sequel website and it won't work :( test.rb: require 'rubygems' require 'sequel' DB = Sequel.sqlite # memory database DB.create_table :items do primary_key :id String :name Float :price end items = DB[:items] # Create a dataset # Populate the tab...

More complicated Sequel selections

There is a simple database in Sequel: DB = Sequel.sqlite DB.create_table :items do primary_key :id DateTime :date String :name end items = DB[:items] items.insert(:name => 'abc', :date => DateTime.now) items.insert(:name => 'ghi', :date => DateTime.now) items.insert(:name => 'def', :date => DateTime.now) The question: is...

activerecord to sequel transition

I'm using rails3.rc and activerecord3 (with meta_where) and just started to switch to sequel, because it seems to be muuuuch faster and offers some really great features :-) I'm already using the active_model plugin (and some others). But here are some questions I found and which I didn't find any documentation for: As far as I know, ...

Ruby 1.9.2 under RVM and MySQL already initialized constant warnings

When running Rails 3 RC with Ruby 1.9.2.rc2 under RVM I keep getting a very large number of errors from the MySQL driver bundle that look like this: /opt/local/rvm/gems/ruby-1.9.2-rc2/gems/mysql-2.8.1/lib/mysql_api.bundle: warning: already initialized constant MysqlRes /opt/local/rvm/gems/ruby-1.9.2-rc2/gems/mysql-2.8.1/lib/mysql_api.bu...

Mysql / Ruby Sequel last insert ID value, what method?

I just want to get the last_insert_id() using Ruby's Sequel: insertret = @con.run("INSERT INTO `wv_persons` ( `id` ) VALUES ( NULL )") pp insertret.inspect # returns "nil", expected that.. last_insert_id = @con.run("SELECT LAST_INSERT_ID() AS last_id;") pp last_insert_id.inspect # returns "nil", should be an ID The SELECT query should ...

Are Sequel::Model validations only instance methods?

In modern versions of ActiveRecord you can define any number of before_validation handlers using a simple declaration: class MyModel < ActiveRecord::Base before_validation :do_something before_validation :do_something_else end Using Sequel it looks like the only way you can do this is similar to the older ActiveRecord method: cla...

noob confused regarding sequel ORM usage

Hi, I am currently doing small pet project web programming stuff using ruby. I am new to web programming, MVC, ORM and so on, so lots of hurdles here. Anyway, I have difficulties using sequel as ORM. I already have a postgres db running (created without using sequel whatsoever, just used plain postgresql command) but don't know wher...

Sequel::AdapterNotFound while trying to run Ruby On Rails application

Hello everyone. This is my first question asked here so I apologize in advance if I break any rules. I'm trying to get a project going on my system, I have imported the source code via GITHub, and are running it locally with WEBrick. When I do, the following error is printed: => Booting WEBrick => Rails 2.3.8 application starting on 0....

How do I set Ruby Sequel logging to the DEBUG level?

The default Ruby Sequel behaviour is to log all DB queries at the INFO level (unlike ActiveRecord which logs at the DEBUG level). How do I change this? ...

HSQL access from both Java and Ruby?

Is it possible to access a local HSQL database from Ruby as well as from Java? (separately of course, not concurrent) The Ruby SQL toolkit called Sequel, for example, claims to have "adapters" for JDBC, so I think the answer is yes, yes? =) If the answer is "kind of" or something, is there a better RDBMS that would allow straightforward...

Can the Sequel Gem connect to MySQL over SSL

Hi Does anyone have any information on how to connect from the sequel gem to a remote mysql database over ssl? I can connect without ssl but trying to connect as a user who requires ssl just fails with the error message: Sequel::DatabaseConnectionError: Mysql::Error Access denied for user 'ssl_user'@'<IP_ADDRESS>' (using password: YES...