Re: JSON support for the serialization plugin

2009-07-31 Thread Jeremy Evans
On Jul 31, 11:02 am, Xavier Lange wrote: > Ah, okay, I understand that. > > I have one question, though, how should JSON be initialized? What > should the plugin do if JSON is not already loaded when the > model.plugin(:serialize, :json, :field) call is made? Nothing. It's the user's responsibi

Re: it support stored procedures in SQL Server? How to get the return value?

2009-08-01 Thread Jeremy Evans
On Jul 31, 10:34 pm, zboage wrote: > it support stored procedures in ms SQL Server? How to get the return > value? The JDBC adapter supports stored procedures, and it might work on SQL Server. I haven't tried it, though. Jeremy --~--~-~--~~~---~--~~ You received

Sequel 3.3.0 Released

2009-08-03 Thread Jeremy Evans
Sequel 3.3.0 has been released and should be available on the gem mirrors. The 3.3.0 release adds numerous improvements: New Features * An association_proxies plugin has been added. This is not a full-blown proxy implementation, but it allows you to write code such as: ar

Re: MySQL Adapter Not Found

2009-08-03 Thread Jeremy Evans
On Aug 3, 10:16 am, Scott LaBounty wrote: > It looks like I'm doing something wrong so I'm not getting the mySQL > adapter. I have a problem when I try to do a migration: > > slabou...@slabounty-laptop:~/RamazeTutorial/Library2$ sequel -m dbMigration/ > mysql://libraryMySQL.db > Error: Sequel::Ad

Re: MySQL Adapter Not Found

2009-08-03 Thread Jeremy Evans
On Aug 3, 12:26 pm, Scott LaBounty wrote: > Jeremy, > > Here's what I get: > > slabou...@slabounty-laptop:~/RamazeTutorial/Library2$ irb -rubygems -rmysql > /usr/local/lib/ruby/1.9.1/irb/init.rb:262:in `require':LoadError: no such > file to load -- mysql I'm guessing the mysql gem installation e

Re: MySQL Adapter Not Found

2009-08-03 Thread Jeremy Evans
On Aug 3, 3:54 pm, Scott LaBounty wrote: > Yep, didn't complete. Any recommendations on where to install from? The first Google link for "mysql ruby" is http://www.tmtm.org/en/mysql/ruby/. Jeremy --~--~-~--~~~---~--~~ You received this message because you are sub

Re: Bug in mysql adapter

2009-08-04 Thread Jeremy Evans
On Aug 4, 1:26 am, Shawn Van Ittersum wrote: > Hmm, when I change the code to db.execute(), I get this error: > > /usr/local/lib/ruby/gems/1.8/gems/sequel-3.2.0/lib/sequel/adapters/ > mysql.rb:196:in `close': Mysql::Error: Commands out of sync; you can't > run this command now (Sequel::DatabaseEr

Re: How to connect to MS SQL using Sequel.odbc

2009-08-04 Thread Jeremy Evans
On Aug 4, 10:44 am, "Pablo Q." wrote: > Hi folks, > > I need help, I have been trying to connect to sql server using odbc > without success. > > This is the code that I'm using: > > db = Sequel.odbc(mydb, :user=> > my_user,password=>my_pass,:db_type=>'mssql',:driver=>'{SQL Server}') > db[:mytable

Re: How to connect to MS SQL using Sequel.odbc

2009-08-04 Thread Jeremy Evans
On Aug 4, 3:02 pm, "Pablo Q." wrote: > Hi Jeremy, > > I have solved the connection (using odbc) doing like this: > > db  = Sequel.connect(:adapter=>'odbc',:driver=>'SQL > Server',:server=>'localhost',:uid=>user,:pwd=>pass,:database=>mydb,:db_type=>'mssql') Well, I'm glad that is working for you.

UTC vs Local Time

2009-08-04 Thread Jeremy Evans
Currently, Sequel doesn't really pay much attention to time zones. When putting datetime values in the database, it generally omits the time zone information. When retrieving times, it just uses the parse method of the datetime_class, so if the string doesn't include time zone information, ruby w

Re: Merb+Sequel+MySQL handshake problem

2009-08-05 Thread Jeremy Evans
On Aug 4, 11:58 pm, "cristian.malinescu" wrote: > Hi, > > I try to launch a Merb app where I replaced the default datamapper orm > with Sequel, however, I'm stuck at this error: > ../gems/mysql-2.7/lib/mysql.so: warning: already initialized constant > MysqlError. Well, that's a warning, not an e

Re: newbie can't connect to local mysql db

2009-08-05 Thread Jeremy Evans
On Aug 5, 4:10 pm, dj wrote: > Something stupid no doubt, but I verified the settings, which work > fine via this api:http://www.tmtm.org/en/ruby/mysql/ > > here's the code: > > require 'rubygems' > require 'sequel' > > #DB = Sequel.connect > (:adapter=>'mysql', :host=>'localhost', :database=>'fi

Re: newbie can't connect to local mysql db

2009-08-05 Thread Jeremy Evans
On Aug 5, 4:27 pm, Jeremy Evans wrote: > This error is common enough that I should write have Sequel check for > it and report a better error. Done: http://github.com/jeremyevans/sequel/commit/051d8972b96b94caed9cd2b31afb9141af373f81

Re: Could not load interbase adapter: (Sequel::AdapterNotFound)

2009-08-05 Thread Jeremy Evans
On Aug 5, 5:29 pm, dj wrote: > Code: > > require 'rubygems' > require 'sequel' > DB = Sequel.connect('interbase://SYSDBA:master...@192.168.0.81:3050/ > finqueries') > dataset = DB["SELECT pricedate FROM pricedata"] > puts dataset.count > > full error log: > > /usr/lib/ruby/gems/1.8/gems/sequel-3.

Re: UTC vs Local Time

2009-08-06 Thread Jeremy Evans
On Aug 6, 7:00 am, byrnejb wrote: > Three questions: > >   How is :local determined?  If by the host local time then this would > have consistency implications for host transfers or multi-host > support.  I realise that using UTC is indicated in these situations, > but sometimes the utc approach

Re: How to connect to MS SQL using Sequel.odbc

2009-08-06 Thread Jeremy Evans
On Aug 6, 10:47 am, dj wrote: > Hi folks, > > I tried this: > > DB = Sequel.connect > (:adapter=>'odbc',:driver=>'Firebird',:server=>'192.168.0.81',:uid=>"xxx",:pwd=>"xxx",:database=>"finqueries") > > and I get this: > > /usr/lib/ruby/gems/1.8/gems/sequel-3.3.0/lib/sequel/database.rb:112:

Re: sql_string_join.like

2009-08-06 Thread Jeremy Evans
On Aug 6, 2:49 pm, Scott LaBounty wrote: > Here's what I have for a search I'm doing: > >         @search_response = Book.filter([:title, > :description].sql_string_join.like("%...@search_string}%")).all > > This works great for a simple search string like "sequel" or "ramaze" but if > I have two

Re: sql_string_join.like

2009-08-06 Thread Jeremy Evans
On Aug 6, 4:23 pm, Clive Crous wrote: > 2009/8/7 Jeremy Evans : > > > What you want is already exists in Dataset#grep > > Well look at that, and here I've been doing this manually. Thanks Jeremy. > > Jeremy: Do you plan any support for postgres's ` .similar ` &

Re: Bug in mysql adapter

2009-08-07 Thread Jeremy Evans
On Aug 6, 7:43 pm, Shawn Van Ittersum wrote: > Hi Jeremy, > > Will the db << string syntax raise an error if there is something > wrong with the SQL?  And can I execute the SQL inside a transaction, > to rollback everything in case something goes wrong? Yes, Sequel will raise an error if the dat

Re: underscore inflector

2009-08-07 Thread Jeremy Evans
On Aug 6, 8:28 pm, Shawn Van Ittersum wrote: > Actually, any substring of non-word characters, not just spaces and > tabs: > >     def underscore(s) >       s = s.to_s >       return s.underscore if s.respond_to?(:underscore) >       s.gsub(UNDERSCORE_MODULE_REGEXP, SLASH).gsub > (UNDERSCORE_CONV

Re: unions within model association datasets

2009-08-07 Thread Jeremy Evans
On Aug 7, 1:31 am, Clive Crous wrote: > Hi, > > Does anyone know how to get around the fact that a model association > automatically prepends a "select tablename.* from" to a dataset as set > within the model association definition? > > I'm using postgres and when the dataset as defined in my man

Re: Search Ramaze/Sequel Blog Post

2009-08-07 Thread Jeremy Evans
On Aug 7, 5:46 am, Scott LaBounty wrote: > Thanks to all the help I've received on the two lists, I've written up a > short post on search using Ramaze and Sequel. Take a look > at:http://steamcode.blogspot.com/2009/08/ramaze-sequel-and-search.htmland let > me know what you think. It looks pret

Re: Bug in mysql adapter

2009-08-07 Thread Jeremy Evans
On Aug 7, 3:11 pm, Shawn Van Ittersum wrote: > Is there a reason why db.execute is a public method, if it shouldn't > be called from outside Sequel?  I had thought it was safe to call > because it was public. Historical behavior/backwards compatibility. When I took over maintenance, all of Sequ

Re: convert_tinyint_to_bool

2009-08-08 Thread Jeremy Evans
On Aug 8, 1:28 am, Eleo wrote: > It seems Sequel converts tinyint fields of any size to true/false. > I'm not sure but looking at various parts of the code it seems the > intention is it only do this to tinyint(1) columns, although it's > affecting my tinyint(4) columns as well.  I was hunting th

Re: convert_tinyint_to_bool

2009-08-08 Thread Jeremy Evans
On Aug 8, 11:51 am, Eleo wrote: > I find the wording to be a bit confusing. > > >When parsing the schema, now only tinyint(1) columns are now considered as > >boolean, instead of all tinyint columns. > >Unfortunately, due to limitations in the native MySQL driver, all tinyint > >column values a

Re: convert_tinyint_to_bool

2009-08-08 Thread Jeremy Evans
On Aug 8, 11:29 am, Eleo wrote: > That really sucks. Agreed. But if you use MySQL, you should be used to suckiness. :) Jeremy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this gr

Re: convert_tinyint_to_bool

2009-08-08 Thread Jeremy Evans
On Aug 8, 6:30 pm, Eleo wrote: > > The native MySQL driver returns a type number for each column in the > > result set.  The same type number is used for both tinyint(1) columns > > and tinyint(4) columns.  If the setting is used, any column with that > > type number is converted to a boolean.  T

Re: convert_tinyint_to_bool

2009-08-10 Thread Jeremy Evans
On Aug 9, 8:57 pm, Shawn Van Ittersum wrote: > Hi Jeremy, > > I was just coming to post an idea for a better way to handle tinyint > bools, and found this thread at the top of the recent list. > > Because I don't like Sequel converting all my tinyints to bools, I > disabled that setting in my pro

Re: Bug in mysql adapter

2009-08-10 Thread Jeremy Evans
On Aug 9, 9:39 pm, Shawn Van Ittersum wrote: > How hard would it be to make 'execute' safe for public use, or to > rename it so that a new public method 'execute' could be added?  From > an end user perspective, I think db.execute('...') is a much more > readable syntax than db << '...'.  Readabi

Re: sequel error

2009-08-12 Thread Jeremy Evans
On Aug 12, 2:18 am, pure wrote: > I update gem > > gem update --system > sudo gem install sequel > > then > > require 'rubygems' > require 'sequel' > > DB = Sequel.sqlite # memory database > > DB.create_table :items do >   primary_key :id >   String :name >   Float :price > end > > items = DB[:it

Re: Case insensitive select

2009-08-12 Thread Jeremy Evans
On Aug 12, 8:54 am, Sam wrote: > Hey everyone, >    How do I perform a case insensitive select statement in sequel? > > For example, if I have a user with the username 'BobSmith', I would > like to be able to query the database with "User[:username => > 'bobsmith']" (also somehow specifying case

Re: Sequel and oracle default tablespace

2009-08-12 Thread Jeremy Evans
On Aug 12, 9:56 am, "Pablo Q." wrote: > Hi folks, > > Is there an way to change the tablespace to create tables and indexes > in oracle? > For example: > > db.add_index :servers, :name > > creates the index on the default tablespace setup on my oracle client. > I would like to use the add_index f

Re: Text / String Difference - sqlite

2009-08-12 Thread Jeremy Evans
On Aug 12, 10:40 am, Piotr Szotkowski wrote: > Jeremy Evans: > > > Yes. On MySQL, String is varchar(255), while String :text=>true is > > text. On PostgreSQL, String is text and String :text=>false is varchar > > (255). This is because MySQL's text type has li

Re: Bug in mysql adapter

2009-08-12 Thread Jeremy Evans
On Aug 12, 4:24 pm, Shawn Van Ittersum wrote: > How does Dataset#fetch_rows call Database#execute with adapters that > don't support Database#execute? On all adapters, Dataset#fetch_rows works with Database#execute. The Database#execute API is adapter-dependent and it's specifically designed to

Re: convert_tinyint_to_bool

2009-08-12 Thread Jeremy Evans
On Aug 12, 4:31 pm, Shawn Van Ittersum wrote: > I did not mean to suggest that [] would be supported on model > objects.  I was suggesting that Hash results returned by db > [:table_name].filter(...).all (Sequel core) would have both integer > and boolean values for each tinyint column, the integ

Re: Select Distinct with mysql

2009-08-13 Thread Jeremy Evans
On Aug 13, 10:54 am, Tal wrote: > Whenever I try to use the .distinct method on a dataset using mysql it > says it doesn't support mysql. > > It seems strange that I can't figure out how to get it working because > mysql definitely supports distinct in queries. Are you are sure you are using .di

Re: Select Distinct with mysql

2009-08-13 Thread Jeremy Evans
On Aug 13, 2:29 pm, Tal wrote: > On Aug 13, 2:54 pm, Jeremy Evans wrote: > > > On Aug 13, 10:54 am, Tal wrote: > > > > Whenever I try to use the .distinct method on a dataset using mysql it > > > says it doesn't support mysql. > > > > It s

Re: it support stored procedures in SQL Server? How to get the return value?

2009-08-13 Thread Jeremy Evans
On Aug 13, 7:21 pm, dj wrote: > I've got a stored procedure on a DB I'm accessing through ODBC (for > Sequel); when I use it natively, I use this syntax: > > Select * from getcrossdata('MSFT', '1986-03-13', '2009-08-12') > > (the store procedure, obviously, is 'getcrossdata', and it takes 3 > par

Re: acts_as_list alike plugin?

2009-08-17 Thread Jeremy Evans
On Aug 17, 11:48 am, Adrian Madrid wrote: > Active Record has a plugin [1] that provides with "list" functionality > (move_lower, move_higuer, etc) [2] based on a "position" field. I don't know of an existing plugin for Sequel that does that. You could give it a shot if you need it, it shouldn'

Re: acts_as_list alike plugin?

2009-08-17 Thread Jeremy Evans
On Aug 17, 1:48 pm, Adrian Madrid wrote: > Thanks! I knew there used to be something like it but I couldn't find it. > I'll check it out and see how that goes. There is sequel_orderable, which is actually hosted in the Sequel rubyforge page. I hadn't bothered to look at it till today, but a cur

Re: convert_tinyint_to_bool

2009-08-18 Thread Jeremy Evans
On Aug 18, 6:06 am, Shawn Van Ittersum wrote: > On Aug 12, 5:39 pm, Jeremy Evans wrote: > > > Why use method_missing?  The model knows which columns are booleans/ > > tinyints, you should be creating specific attribute? accessors for > > those columns.  method_missing

Re: UTC vs Local Time

2009-08-18 Thread Jeremy Evans
A preliminary patch for the UTC support is available at http://pastie.org/587930.txt. It's specced and has been tested on the adapters I usually test with. DataObjects appears to have problems with some of the integration tests, but most of the other tested adapters appear to work. I plan to ap

Re: UTC vs Local Time

2009-08-19 Thread Jeremy Evans
On Aug 18, 5:01 pm, Jeremy Evans wrote: > A preliminary patch for the UTC support is available > athttp://pastie.org/587930.txt. A modified version of this patch was just committed: http://github.com/jeremyevans/sequel/commit/8eb8cf642a21e870f57be6627282738eade47068

Re: Bug when chaining drop_column with SQLite

2009-08-20 Thread Jeremy Evans
On Aug 20, 6:18 am, Simon Arnaud wrote: > Hi > > I think I found a bug in the drop_column implementation of the SQLite > adapter. > > I have a migration which add a few columns to a table. So, the down > method chains the drop_columns like this : > > def down >   alter_table :foo do >     drop_co

Re: Money & Smallmoney Types from String

2009-08-20 Thread Jeremy Evans
On Aug 20, 7:16 am, Paul F Fraser wrote: > Hi , > > How are strings ("-173.66") converted to money type in Sequel? > Silly question, is money type the best type to use for money when large > amounts may be involved? > A search of all records in the mail list does not turn up any references > to m

Re: Bug when chaining drop_column with SQLite

2009-08-20 Thread Jeremy Evans
On Aug 20, 8:59 am, Jeremy Evans wrote: > On Aug 20, 6:18 am, Simon Arnaud wrote: > > It would be nice if the drop_column statements for the sqlite adapter > > could be aggregated until really needed, to drop all the columns at > > once. However, I understand it's not

Re: Bug when chaining drop_column with SQLite

2009-08-20 Thread Jeremy Evans
On Aug 20, 9:17 am, Jeremy Evans wrote: > Fixing would require significant refactoring.  The way it works > currently is that all alter_table SQL statements are produced by the > generator first, and afterward each of the SQL strings returned by the > generator is executed on the

Re: Mixins for models

2009-08-20 Thread Jeremy Evans
On Aug 20, 12:10 pm, Tal wrote: > I've got 3 models that are extremely similar except for a few small > differences. I was thinking the easiest way to get the methods i > wanted working would be to make them subclasses. I’m not sure how to > appropriately set the tables for the sub classes. > > W

Re: Money & Smallmoney Types from String

2009-08-20 Thread Jeremy Evans
On Aug 20, 4:31 pm, Paul F Fraser wrote: > Jeremy Evans wrote: > > On Aug 20, 7:16 am, Paul F Fraser wrote: > > >> Hi , > > >> How are strings ("-173.66") converted to money type in Sequel? > >> Silly question, is money type the best type to u

Re: Money & Smallmoney Types from String

2009-08-21 Thread Jeremy Evans
On Aug 20, 11:09 pm, Paul F Fraser wrote: > Works well, but how is numeric precision and scale specified in > create_table. :size=>[10,2] > DB.create_table :bank_statements do >   primary_key :id >   String :acct_code >   date :date >   numeric :amount :precision =>10, :scale =>2 ??

Re: Multiple Result Sets from Stored Procedures

2009-08-21 Thread Jeremy Evans
On Aug 21, 6:19 am, tooky wrote: > Hi > > Has anybody used sequel with stored procedures that return multiple > result sets (with mysql)? > > It seems to work to an extent, in that it returns all the data, but it > returns a single array with all the results sets concatenated. Is > there a way to

Re: convert_tinyint_to_bool

2009-08-21 Thread Jeremy Evans
On Aug 18, 8:43 am, Jeremy Evans wrote: > You'd probably want to make it a real plugin, though. Done: http://github.com/jeremyevans/sequel/commit/96f08b9ede25ee776b2f79c15600b79874d89918 Jeremy --~--~-~--~~~---~--~~ You received this message because

Re: dataset.update(params) isn't calling after_update hook

2009-08-25 Thread Jeremy Evans
On Aug 25, 5:05 pm, Aman Gupta wrote: > after_update hooks are only invoked when you use Model#update, not > Dataset#update. There's no way to know which model instances were affected > by a dataset update. Aman is correct. If you want the after_update hooks run, you need to do: Post.filter(

Re: How do I get the result rows from a stored procedure in Sql Server?

2009-08-26 Thread Jeremy Evans
On Aug 26, 9:10 am, Christer Nilsson wrote: > This is taken from the Ruby DBI documentation: > >   To create the stored procedure, run a query like the following. > >   create procedure testproc as select * from testtable > >   To exceute the stored procedure from an SQL Relay program, ue code >

Re: How do I get the result rows from a stored procedure in Sql Server?

2009-08-26 Thread Jeremy Evans
On Aug 26, 2:34 pm, Jeremy Evans wrote: > You'll have to be using the JDBC adapter (and therefore JRuby), since > that's the only adapter that supports both SQL Server and stored > procedures.  But it should be something like: > >   row1, row2, row3 = DB.dataset.call

Re: acts_as_list alike plugin?

2009-08-27 Thread Jeremy Evans
On Aug 26, 10:40 am, Adrian Madrid wrote: > So I finally finished it. Here it is in all its > glory:http://github.com/aemadrid/sequel_orderable > > It is not super pretty but it does its job. I updated Aman's original plugin > to the new plugin system and added a couple of exceptions for > movin

Re: Sequel object mocks

2009-08-27 Thread Jeremy Evans
On Aug 27, 12:43 am, Shawn wrote: > Hi Jeremy, > > Have you done any unit testing on Sequel models using mock objects > instead of real database objects?  Is there support for that in > Sequel?  Otherwise, have you created or seen any code to extend a > standard Sequel model to provide such suppo

Re: Typecast problem in SQLite timestamp column

2009-08-27 Thread Jeremy Evans
On Aug 27, 7:22 am, felixaa wrote: > Hello. > I have a problem with this code: > > DB = Sequel.sqlite("/Users/elusuario/Database.db") > . > . > #This code in a loop > items= DB[:items] > items_resul = items[:isbn => isbn] > . > . > One column in "items" has numbers from -500 to 50 but is

Re: Typecast problem in SQLite timestamp column

2009-08-27 Thread Jeremy Evans
On Aug 27, 9:14 am, felixaa wrote: > Thanks Jeremy > > I don´t want to create a new type, just disable casting in a query. > This method working for me: > > DB = Sequel.sqlite("/Users/elusuario/Database.db") > > DB[:item].select(:releasedate.cast(String)).map do |row| > > . > . > But here is the

Re: Is posible to set a field with primary key value from the same row?

2009-08-27 Thread Jeremy Evans
On Aug 27, 9:24 am, felixaa wrote: > Hi Again > I have this .. > > DB = Sequel.sqlite("/Users/elusuario/Database.db") > > items= DB[:items] > > ##And insert one row ... > > i_pk = items.insert(:ent => 3, :opt => 1,  :title => "Test") > > ##But I have to set field :uud to primary key (i_pk) with:

Re: Setting primary key when creating instance

2009-08-27 Thread Jeremy Evans
On Aug 27, 4:27 pm, Xavier Lange wrote: > Is there a way to set the primary key of a model's instance when using > new/create? > > I would like to do > Role.new(:user_id => 10, :survey_id => 100) > [:user_id,:survey_id] is a composite key. It raises "Sequel::Error: > method user_id= doesn't exist

Re: How to change case for querying

2009-08-28 Thread Jeremy Evans
On Aug 27, 4:11 pm, ChilliCoder wrote: > Hi list, > > I'm working with Sequel in Ruby 1.8.6 and MS SQL Server 2000 and now I > face a problem. > > The database I'm accesing has collation set to Latin1 with case > sensitive and the tables are named on lowercase so when Sequel > generates SQL state

Re: Force ISO8601 in literal_date and literal_datetime

2009-08-28 Thread Jeremy Evans
On Aug 28, 10:29 am, Simon Arnaud wrote: > Hi > > You might want to always format the date you record with strftime. I > don't think relying on Date_to_s is wise, as it might be redefined. > > I, for example, display dates in french in Gtk widgets. To avoid > calling a Date::to_s_fr on each date,

Re: Force ISO8601 in literal_date and literal_datetime

2009-08-28 Thread Jeremy Evans
On Aug 28, 5:32 pm, Clive Crous wrote: > 2009/8/29 Jeremy Evans : > > > However, in general, if you modify methods that Sequel uses that are > > defined by ruby, and you change their behavior, you should expect to > > have problems. > > I mostly agree with this ho

Lone Star Ruby Conference 2009 Sequel Presentation Slides

2009-08-29 Thread Jeremy Evans
Slides from my presentation at Lone Star Ruby Conference 2009 are now up at http://sequel.rubyforge.org/static/lsrc2009_presentation/sequel-lsrc2009.html. Jeremy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sequ

Re: Multiple Result Sets from Stored Procedures

2009-08-29 Thread Jeremy Evans
On Aug 29, 2:45 pm, Steve Tooke wrote: > Is there anyway we could pass an option to the dataset that would allow us > to return as an array of array instead of the default behaviour? I'm happy > to work up a patch or a plugin if something like that would be likely to be > accepted. Any pointers o

Sequel 3.4.0 Release Candidate

2009-08-31 Thread Jeremy Evans
The master branch is now the release candidate for 3.4.0. I plan on releasing 3.4.0 on Wednesday or Thursday (the 2nd or 3rd). Please test the master branch with your apps and notify me of any breakage. Thanks, Jeremy --~--~-~--~~~---~--~~ You received this messa

Re: mysql dump/load problems with enum columns

2009-08-31 Thread Jeremy Evans
On Aug 31, 12:20 pm, None wrote: > I have a db table that dumps to this: > > Class.new(Sequel::Migration) do >   def up >     create_table(:foo) do >       primary_key :someId >       column :fk, "int(11)", :null=>false >       column :other_fk, "int(11)", :null=>false >       column :type, "enum

Re: Classifying dataset methods according to multiple-call behavior

2009-08-31 Thread Jeremy Evans
On Aug 31, 3:21 pm, David Lee wrote: > This is mostly a documentation issue, but I'm hoping for consistent > terminology to differentiate between dataset methods that stack/merge/ > join options unto previous options, and those that replace previous > options. > > For example, multiple calls to D

Re: how to eager load association with compsite key

2009-08-31 Thread Jeremy Evans
On Aug 31, 8:34 pm, daniel_spaniel wrote: > Hi >  I am trying to eager load an association which is linked by composite > key.  Lets say I have a models like these. > > DB_DEMO.create_table! :dudes do >   Integer :'kid - date' >   Integer :'kid - time' >   Integer :'kid - user' >   String  :'name

Re: how to eager load association with compsite key

2009-08-31 Thread Jeremy Evans
On Aug 31, 11:00 pm, daniel_spaniel wrote: >  I tried your suggestions ( added graph_only_conditions, no dice .. > here is result sequel for the >   Horse.eager_graph(:dude).first ( same result as with > Horses.eager_graph(:dude).limit(1).all.first ) Horse.eager_graph(:dude).first won't do what

Re: how to eager load association with compsite key

2009-09-01 Thread Jeremy Evans
On Sep 1, 9:24 am, daniel_spaniel wrote: > Hi J >  Here is the pastie. >  http://pastie.org/601790 > >  I think if I only understood how to get the graph_conditions to be > applied .. ( the ones you suggested are the correct ones ) when I use > eager_graph, this would work, but I am not sure why

Re: wrapping exceptions

2009-09-01 Thread Jeremy Evans
On Sep 1, 8:49 am, Joel VanderWerf wrote: > This patch preserves more of the information carried by exceptions that > bubble up from particular database libraries and are handled by sequel, > so that you don't have to parse and match message strings. > > The basic idea, abstracted from Sequel, is

Re: MySQL Stored procedure

2009-09-02 Thread Jeremy Evans
On Sep 2, 5:09 am, Watchdog6241 wrote: > Hi > Can you help on a hello world sequel, I'm ok calling a stored > procedure and passing in a parameter(s), but how do I get  return > parameters e.g from the below example > > (MYSQL 5.1x) > > CREATE DEFINER = 'root'@'localhost' PROCEDURE `usp_get`( >  

Sequel 3.4.0 Released

2009-09-02 Thread Jeremy Evans
Sequel 3.4.0 has been released and should be available on the gem mirrors. The 3.4.0 release adds numerous improvements: New Plugins --- * A nested_attributes plugin was added allowing you to modify associated objects directly through a model object, similar to ActiveRecord's Nested

Re: Sequel 3.4.0 Released

2009-09-02 Thread Jeremy Evans
On Sep 2, 11:21 am, Joel VanderWerf wrote: > Jeremy Evans wrote: > > * Database#<< now always returns nil.  Before, the return value was > >   adapter dependent. > > I was going to ask why not return self, like other #<< in ruby, but then > I ran into this wi

Re: Sequel 3.4.0 Released

2009-09-02 Thread Jeremy Evans
On Sep 2, 11:36 am, Joel VanderWerf wrote: > Joel VanderWerf wrote: > > Jeremy Evans wrote: > >> * Database#<< now always returns nil.  Before, the return value was > >>   adapter dependent. > > > I was going to ask why not return self, like other #<

Re: Sequel 3.4.0 Released

2009-09-02 Thread Jeremy Evans
On Sep 2, 2:45 pm, Clive Crous wrote: > 2009/9/2 Jeremy Evans : > > >  DB << "create table t (a text, b text)" << "insert into t values > > ('a', 'b')" > > > I think that makes the code harder to read.  If you

Re: Sequel 3.4.0 Released

2009-09-03 Thread Jeremy Evans
On Sep 2, 11:43 pm, Clive Crous wrote: > 2009/9/3 Jeremy Evans : > > > Hmm, could you give an example of this with Sequel?  In general, most > > of the database adapters don't support multiple SQL statements inside > > a single call.  The native MySQL adapter is an

Re: Sequel 3.4.0 Released

2009-09-03 Thread Jeremy Evans
On Sep 3, 10:45 am, Joel VanderWerf wrote: > I was thinking in terms of ruby style rather than how queries are sent > to the database, but I can't really come up with any strong sylistic > reasons, other that "that's how most[1] other #<< methods work", which > is pretty weak! > > Maybe that argu

Re: Sequel 3.4.0 Released

2009-09-03 Thread Jeremy Evans
On Sep 3, 11:06 am, Tal wrote: > Sorry for being such a novice about this. But i'm not sure how to > setup timestamps using the new plugin inside of a model? The timestamps plugin is designed so that if you want, you can use it for all models easily: Sequel::Model.plugin :timestamps Then, as

Re: mysql dump/load problems with enum columns

2009-09-03 Thread Jeremy Evans
On Aug 31, 1:47 pm, Jeremy Evans wrote: > There's two ways to handle this: > > 1) Convert unparseable column defaults to nil, instead of using > the .lit hack (which apparently doesn't work most of the time for > MySQL). > > 2) Handle the enum type in column_schem

Re: How to get the content of a Blow field?

2009-09-03 Thread Jeremy Evans
On Sep 3, 4:09 pm, Iñaki Baz Castillo wrote: > Hi, from a MySQL table I get a blob field (with attribute "BINARY"). But in > fact it's a string (a XML document). > > To extract the content I use #to_s and it seems to work, but I don't see it > documented. > > Am I right? It should be returned as

Re: Benchmark: Sequel VS DataMapper

2009-09-04 Thread Jeremy Evans
On Sep 4, 9:06 am, Iñaki Baz Castillo wrote: > Summary: > >                           Sequel     Sequel(prep. stament)    DataMapper > > ruby1.8 cpu usage:          85%                65%                 92% > mysqld cpu usage:           11%                30%                  5% > ruby1.8 mem us

Re: Benchmark: Sequel VS DataMapper

2009-09-04 Thread Jeremy Evans
On Sep 4, 11:39 am, Iñaki Baz Castillo wrote: > El Viernes, 4 de Septiembre de 2009, Jeremy Evans escribió: > > > There are various ways you can optimize the Sequel code.  Generally, > > for something that's very performance sensitive, you are going to want > > t

Re: On create timestamp not working

2009-09-04 Thread Jeremy Evans
On Sep 4, 12:38 pm, Tal wrote: > Using plugin :timestamp, :create => :created_at, :update > => :modified_at > > the update hook works just fine but it never puts in the created_at > value. Cant figure out why, I even tried :force => true. Are you overriding before_create in your model and not ca

Re: On MySQL restart prepared staments are lost

2009-09-04 Thread Jeremy Evans
On Sep 4, 2:14 pm, Iñaki Baz Castillo wrote: > If I create a MySQL prepared stament, use it and latter restart MySQL then > Sequel receives this error for the next query using the prepared stament: > >   !! Unexpected error while processing request: Mysql::Error: Unknown prepared >   statement ha

Re: On MySQL restart prepared staments are lost

2009-09-04 Thread Jeremy Evans
On Sep 4, 2:41 pm, Iñaki Baz Castillo wrote: > Ok, I've added a "begin, rescue" in the Rack #call method so now I see the > exception. There I see Sequel::DatabaseConnectionError. > > However, I still wonder how to detect that a prepared stament has been lost > due to a DB server restart... > > T

Re: On MySQL restart prepared staments are lost

2009-09-04 Thread Jeremy Evans
On Sep 4, 3:37 pm, Iñaki Baz Castillo wrote: > El Sábado, 5 de Septiembre de 2009, Iñaki Baz Castillo escribió: > > > > > Then I restart MySQL. I've configured a "begin - raise" so if a Sequel DB > > error occurs, I call again DB.set. However I reply "500 Internal Error" to > >  the  current requ

Re: wrapping exceptions

2009-09-04 Thread Jeremy Evans
On Sep 1, 12:29 pm, Joel VanderWerf wrote: > Jeremy Evans wrote: > > We could expand Sequel::Error to store the underlying exception class > > (if any): > > >   class Sequel::Error > >     attr_accessor :underlying_exception > >   end > > > That way a

Re: On MySQL restart prepared staments are lost

2009-09-04 Thread Jeremy Evans
On Sep 4, 4:06 pm, Iñaki Baz Castillo wrote: > El Sábado, 5 de Septiembre de 2009, Iñaki Baz Castillo escribió: > > El Sábado, 5 de Septiembre de 2009, Iñaki Baz Castillo escribió: > > > El Sábado, 5 de Septiembre de 2009, Jeremy Evans escribió: > > > > The pa

Re: On MySQL restart prepared staments are lost

2009-09-04 Thread Jeremy Evans
On Sep 4, 4:46 pm, Iñaki Baz Castillo wrote: > Humm, note what happens to me when trying to repeat your test: > > # ruby -I lib /usr/bin/sequel -E mysql://root:xx...@localhost/xxx > Error: Sequel::AdapterNotFound: Could not load mysql adapter: >   require 'mysql' did not define Mysql::CLIENT_

Re: On MySQL restart prepared staments are lost

2009-09-04 Thread Jeremy Evans
On Sep 4, 5:18 pm, Iñaki Baz Castillo wrote: > El Sábado, 5 de Septiembre de 2009, Jeremy Evans escribió: > > The difference could be due to the fact that I just committed an > > exception related change to the master branch.  Please try with the > > master branch and let

Re: Adding a Boolean Column

2009-09-04 Thread Jeremy Evans
On Sep 4, 8:07 pm, Scott LaBounty wrote: > I'm having trouble adding a Boolean column to a sqlite database. Here's what > I have: > >     def up >         alter_table(:deployments) do >             add_column :fixed_date, Boolean >         end >     end > > It looks like (and I remember Jeremy sa

Re: Optimize prepared staments #call method by setting all the variables in a single query (includes patch)

2009-09-08 Thread Jeremy Evans
On Sep 8, 1:28 am, Iñaki Baz Castillo wrote: > Hi, when using a prepared statement (using MySQL adapter) containing > two or more variables, Sequel does a "SET" query for each variable, > this is: > >   #prepare: >     PREPARE ps FROM "SELECT etag FROM storage WHERE username = ? AND > domain = ?"

Re: Optimize prepared staments #call method by setting all the variables in a single query (includes patch)

2009-09-08 Thread Jeremy Evans
On Sep 8, 2:59 pm, Iñaki Baz Castillo wrote: > 2009/9/8 Jeremy Evans : > > I tried a variant that set that variables and executed the prepared > > statement in a single call to _execute, but it failed some of the > > integration tests.  It looked to be safe for selects, b

Re: Optimize prepared staments #call method by setting all the variables in a single query (includes patch)

2009-09-08 Thread Jeremy Evans
On Sep 8, 3:58 pm, Iñaki Baz Castillo wrote: > El Miércoles, 9 de Septiembre de 2009, Jeremy Evans escribió: > > > On Sep 8, 2:59 pm, Iñaki Baz Castillo wrote: > > > 2009/9/8 Jeremy Evans : > > > > I tried a variant that set that variables and executed the prepa

Re: How to disable PostgreSQL's "INSERT ... RETURNING ..." in a model

2009-09-09 Thread Jeremy Evans
On Sep 9, 5:51 am, paddor wrote: > Hello > > I have to insert many datasets into a PostgreSQL table. The table is > partitioned and uses a trigger to redirect an inserted record to the > correct table behind it. It works without an ORM. > > I use a model for the table. > > Both ActiveRecord and S

Re: How to disable PostgreSQL's "INSERT ... RETURNING ..." in a model

2009-09-09 Thread Jeremy Evans
On Sep 9, 8:04 am, Jeremy Evans wrote: > This is a bug.  Dataset#insert_select should return nil if > disable_insert_returning is used.  I'll push a change to github later > today to take care of this. Fixed: http://github.com/jeremyevans/sequel/commit/c33499bfa9eeae652941adf867

Re: wrapping exceptions

2009-09-10 Thread Jeremy Evans
On Sep 8, 2:38 pm, Joel VanderWerf wrote: > Jeremy Evans wrote: > >http://github.com/jeremyevans/sequel/commit/53a1428c4e3e37369cb811640... > > Looks good. The only thing I would add is an inspect method: > > module Sequel >    class Error < ::Stand

<    3   4   5   6   7   8   9   10   11   12   >