Re: New Associations Implementation

2008-02-20 Thread Jeremy Evans
On Feb 20, 6:03 pm, dusty <[EMAIL PROTECTED]> wrote: > I have a question. I see a new way of doing models going on right now > in the new_relations branch. Is this in place of that, or competing > with it? What I'm referring to is here: > > http://ruby-sequel.googlecode.com/svn/branches/new_rel

Re: New Associations Implementation

2008-02-21 Thread Jeremy Evans
On Feb 21, 10:56 am, xraid <[EMAIL PROTECTED]> wrote: > where can one se this implementation ? It's in the Google Group's files: http://sequel-talk.googlegroups.com/web/sequel_associations.rb?gda=6CIKf0cAAACjj0h3C_nyRJEDrvK-YRwo1DekjSbC49EhwHeTaDPVrGG1qiJ7UbTIup-M2XPURDRdoKX9C_IEpR8gxO_6Dcxsf6xKx

Re: New project leaders for Sequel

2008-04-06 Thread Jeremy Evans
On Apr 5, 9:58 pm, Sharon Rosner <[EMAIL PROTECTED]> wrote: > Fortunately, others have agreed to pick up the glove and continue > maintaining and improving this project. Aman Gupta, a long time Sequel > contributor, will maintain sequel_core, and Jeremy Evans, who did some > o

Sequel-1.4.0 Released

2008-04-08 Thread Jeremy Evans
Sequel 1.4.0 has been released and should be avaiable on the gem mirrors shortly. 1.4.0 has the following exciting new features: Eager loading for all types of associations: Artist.eager(:albums).all Album.eager(:artist, :genre, :tracks).all Album.eager(:artist).eager(:genre).eager(:track

Sequel Todo

2008-04-09 Thread Jeremy Evans
Even though 1.4.0 has just been released, we are already starting work on the next version of sequel. Aman will be working on adding reflection information to sequel (so you can ask a model/dataset for the types of its columns). I have a long todo list of various stuff (http://code.jeremyevans.n

Re: Sequel Todo

2008-04-10 Thread Jeremy Evans
On Apr 10, 9:44 am, David Lee <[EMAIL PROTECTED]> wrote: > I found that Sequel is slower than AR or DM in handling large > datasets. I haven't done any performance testing. Could you give a rough estimation of the speed differences for the model/dataset between: Sequel: Database[:table].all Seq

Re: sequel model w/ cache

2008-04-10 Thread Jeremy Evans
On Apr 9, 1:07 pm, dusty <[EMAIL PROTECTED]> wrote: > Already did, its #213. Forgot to include that in my original post, > sorry. > > http://code.google.com/p/ruby-sequel/issues/detail?id=213 Fixed (http://github.com/jeremyevans/sequel/commit/ d9afacc8bafe5b8d1fa94df0a201f8c318dff720) --~--~

Re: 'AND' and 'OR' conditional statements using hashes

2008-04-10 Thread Jeremy Evans
On Apr 10, 12:23 pm, David Lee <[EMAIL PROTECTED]> wrote: > A way to implement 'AND' and 'OR' conditional statements using hashes > > {:a => 1}.or(:b => 3) > # => (a=1) OR (b=3) > > {:a => 1, :b => 3} > # => (a=1) AND (b=3) > > {:a => 1}.and(:b => 3) > # => {:a => 1, :b => 3} > # => (a=1) A

Re: Sequel Todo

2008-04-10 Thread Jeremy Evans
On Apr 10, 2:37 pm, "Tim Uckun" <[EMAIL PROTECTED]> wrote: > I think the ADO drivers need a little TLC. I saw the ADO issue on the tracker. I don't use it but I'll work with you to get it in. Can you try the patch at http://p.ramaze.net/1080? Jeremy --~--~-~--~~~---

Re: has_many :through does not run callbacks on join model

2008-04-10 Thread Jeremy Evans
On Apr 10, 6:30 pm, Dado <[EMAIL PROTECTED]> wrote: > I am trying the new many_to_many feature allowing for > has_many :through-style associations. Everything works as expected, > the correct record is created etc. However, it appears that callbacks > are not run in the join model. many_to_many d

Re: 'AND' and 'OR' conditional statements using hashes

2008-04-11 Thread Jeremy Evans
On Apr 10, 8:55 pm, David Lee <[EMAIL PROTECTED]> wrote: > > The following is probably old-hat for some, but others might find it > > interesting if not useful: > > >http://www.xaop.com/blog/2007/10/07/video-how-to-create-a-domain-spec... > > I like the DSL that they demonstrate in the link you pr

Re: 'AND' and 'OR' conditional statements using hashes

2008-04-11 Thread Jeremy Evans
On Apr 11, 11:58 am, David Lee <[EMAIL PROTECTED]> wrote: > How would you negate a statement using this DSL? > > I would prefer to go the hash way if we can only implement the DSL > half-way. > > For instance, p.author_id == nil would work, but p.author_id != nil > would not work. > You would not

Re: 'AND' and 'OR' conditional statements using hashes

2008-04-11 Thread Jeremy Evans
On Apr 11, 1:54 pm, David Lee <[EMAIL PROTECTED]> wrote: > > Don't forget that the two are not incompatible. The hash conditions > > aren't inside a block, and could be used in addition to any proposed > > new block filter syntax. > > It's great to have multiple ways to describe conditions. I'm j

Re: select.distinct.count generates incorrect SQL ?

2008-04-13 Thread Jeremy Evans
On Apr 13, 2:08 pm, Jerry <[EMAIL PROTECTED]> wrote: > I am trying to count the number of distinct names in a table. > > I expected "C.select(:name).distinct.count" to generate the > appropriate SQL, i.e. SELECT COUNT(DISTINCT name) FROM c. > > Instead it generates SELECT DISTINCT COUNT(*) FROM

Re: Sequel Todo

2008-04-14 Thread Jeremy Evans
On Apr 13, 8:51 pm, "Tim Uckun" <[EMAIL PROTECTED]> wrote: > > On Apr 10, 2:37 pm, "Tim Uckun" <[EMAIL PROTECTED]> wrote: > > > I think the ADO drivers need a little TLC. > > > I saw the ADO issue on the tracker. I don't use it but I'll work with > > you to get it in. Can you try the patch a

Re: Sequel Todo

2008-04-15 Thread Jeremy Evans
On Apr 9, 11:11 am, Jeremy Evans <[EMAIL PROTECTED]> wrote: > Even though 1.4.0 has just been released, we are already starting work > on the next version of sequel. Aman will be working on adding > reflection information to sequel (so you can ask a model/dataset for > the ty

Re: Sequel-1.4.0 Released

2008-04-17 Thread Jeremy Evans
On Apr 17, 8:03 am, ylg <[EMAIL PROTECTED]> wrote: > On Apr 8, 9:23 pm, Jeremy Evans <[EMAIL PROTECTED]> wrote: > > > Unfortunately, eager loading comes at the expense of a small amount of > > backward compatibility. If you were using uncached associations (the &

The Deprecation Has Begun

2008-04-17 Thread Jeremy Evans
I just pushed a change that adds the deprecation framework that we are going to be using. It's nice a flexible and hopefully will make it easy for Sequel users to get their code read for Sequel 2.0. From the commit message: Setup deprecation structure, deprecate Dataset#method_missing Deprecat

Re: eql? and hash for Sequel::Model

2008-04-18 Thread Jeremy Evans
On Apr 18, 5:13 am, Farrel <[EMAIL PROTECTED]> wrote: > I noticed that eql? and hash are not implemented on Sequel Model. For > instance in the following spec: > > it( "should be valid if the user belongs to the organisation") do > user = generate_valid_new_user( @organisation ) # This calls

Re: has_many/habtm - why arrays?

2008-04-20 Thread Jeremy Evans
On Apr 19, 11:20 am, Uzytkownik <[EMAIL PROTECTED]> wrote: > Why those macros returns array instead of dataset? They must return arrays for eager loading to work. If you want the dataset, there is the association_dataset method (i.e. user.posts_dataset). > I guess it was done so for caching in

Re: Bug: columns not loaded before new()

2008-04-20 Thread Jeremy Evans
On Apr 20, 2:28 pm, "pawel.gajda" <[EMAIL PROTECTED]> wrote: > It seems that Model's initialize() should load table columns before > setting values: > > irb(main):006:0> Audit.new(:user_id => 1) > => # > > user_id is not set, but after loading columns info: > > irb(main):007:0> Audit.columns > =>

Re: Bug: columns not loaded before new()

2008-04-20 Thread Jeremy Evans
On Apr 20, 6:25 pm, Jeremy Evans <[EMAIL PROTECTED]> wrote: > On Apr 20, 2:28 pm, "pawel.gajda" <[EMAIL PROTECTED]> wrote: > > > > > It seems that Model's initialize() should load table columns before > > setting values: > > > irb(mai

Re: Bug? Pagination with MySQL using LIMIT/OFFSET incorrectly.

2008-04-22 Thread Jeremy Evans
On Apr 22, 7:09 am, samc <[EMAIL PROTECTED]> wrote: > I'm pretty sure I've found a bug with Sequel 1.4 when used with MySql > (5.0.51a in my case). > > I'm using pagination to get a page of my Location entities: > @locations = Location.order(:name).paginate(page_num, NUM_PER_PAGE) > > Having turne

Re: before_update is not triggered

2008-04-22 Thread Jeremy Evans
On Apr 22, 2:11 pm, zdenko <[EMAIL PROTECTED]> wrote: > hi, > > I'm not sure what I'm doing wrong, but it seems that before_update is > never triggered (I have also tried with before_save, after_update, > after_save). > However, before_create is triggered. before_update is called, just not when y

Re: Bug? Pagination with MySQL using LIMIT/OFFSET incorrectly.

2008-04-22 Thread Jeremy Evans
On Apr 22, 3:33 pm, samc <[EMAIL PROTECTED]> wrote: > I certainly think it would be good to not get the count unless it is > really necessary, to save those oh so precious DB hits. I don't see > why it's necessary to do a separate count even if it is the last page. > But I'm very new to Sequel so

Re: Bug? Pagination with MySQL using LIMIT/OFFSET incorrectly.

2008-04-23 Thread Jeremy Evans
On Apr 23, 1:53 am, "sam carr" <[EMAIL PROTECTED]> wrote: > On Wed, Apr 23, 2008 at 12:57 AM, Jeremy Evans <[EMAIL PROTECTED]> > wrote: > > > paginate does return a cloned dataset, with the limit and offset > > already set. However, you were calling cou

Re: insert/delete sql in 1.4.0

2008-04-24 Thread Jeremy Evans
On Apr 24, 9:15 am, "Victor 'Zverok' Shepelev" <[EMAIL PROTECTED]> wrote: > Sequel 1.4.0: > > class Client < Sequel::Model > end > > Client.dataset.select_sql #=> "SELECT * FROM clients" > Client.dataset.insert_sql #=> "INSERT INTO [:clients] DEFAULT VALUES" > Client.dataset.delete_sql #=> "DELETE

Re: sqlite3 busy_timeout

2008-04-24 Thread Jeremy Evans
On Apr 24, 9:00 am, Zach Chadwick <[EMAIL PROTECTED]> wrote: > Hi, > > I am trying to set the busy_timeout on the underlying > SQLite3::Database object inside of a Sequel::Database. I wasn't sure > if there was any way to access that lower level object from above, or > if the only solution was to

Re: insert/delete sql in 1.4.0

2008-04-28 Thread Jeremy Evans
On Apr 24, 1:26 pm, "Victor 'Zverok' Shepelev" <[EMAIL PROTECTED]> wrote: > The full code: > > require 'sequel' > > DB = Sequel.sqlite '' > class Client < Sequel::Model; end > puts Client.dataset.insert_sql > puts Client.dataset.delete_sql > puts Client.dataset.sql > > output1: > INSERT INTO clie

Re: sqlite3 busy_timeout

2008-04-28 Thread Jeremy Evans
On Apr 24, 11:59 am, Zach Chadwick <[EMAIL PROTECTED]> wrote: > > See the patch athttp://code.google.com/p/ruby-sequel/issues/detail?id=218, > > which adds a :timeout option to the Sqlite database adapter. If it > > works for you, let me know and I'll apply it. > > Thanks, that is exactly what I

Re: Unbreaking merb's error_messages_for compatability

2008-04-28 Thread Jeremy Evans
On Apr 25, 3:25 am, Inviz <[EMAIL PROTECTED]> wrote: > Adds methods to unbreak merb's error_messages_for compatability > # Please enter the commit message for your changes. > # (Comment lines starting with '#' will not be included) > # On branch my_bugfix > # Changes to be committed: > # (use "g

Re: who the self ego stupid ...

2008-04-28 Thread Jeremy Evans
On Apr 24, 3:57 pm, xraid <[EMAIL PROTECTED]> wrote: > There is some like this in master code : > > Copyright (c) 2007 Sharon Rosner, Wayne E. Seguin, Aman Gupta > > please get rid of it like yesterday ... > > thanks > xraid Perhaps you should read about copyright law. Sequel is MIT licensed, it

Re: Self refering associations

2008-04-28 Thread Jeremy Evans
On Apr 27, 5:48 am, teamon <[EMAIL PROTECTED]> wrote: > class Category < Sequel::Model > has_many :children, :class => Category, :key => "parent_id" > belongs_to :parent, :class => Category, :key => "parent_id" > end > > when i do @category.children i get > > PGError in 'Category should be abl

Re: Incorrect SQL

2008-04-28 Thread Jeremy Evans
On Apr 27, 7:05 am, teamon <[EMAIL PROTECTED]> wrote: > postgresql: > ~ SELECT * FROM categories WHERE ("id" = 2) LIMIT 1 > ~ COMMIT > => # @values={:description=>nil, :name=>"asd", :parent_id=>nil, :id=>2}>>> > c.children > > ~ SELECT * FROM categories WHERE ('parent_id' = 2) > ~ ERROR: i

Re: insert/delete sql in 1.4.0

2008-04-28 Thread Jeremy Evans
On Apr 28, 9:38 am, "Victor 'Zverok' Shepelev" <[EMAIL PROTECTED]> wrote: > As for my project, it was only two things I've changed in Sequel to run on > 1.9: this thing you already fixed and commented out require 'base64' > (there's no 'base64' library in 1.9, all base64 coding/decoding should be

Re: Launched www.ruby-sequel.org!

2008-04-28 Thread Jeremy Evans
On Apr 27, 10:19 am, Florian Aßmann <[EMAIL PROTECTED]> wrote: > Dear Ruby Sequel community, I finally implemented almost all planned features > for the Ruby Sequel website and moved it to my ISP. > > See . > > FEATURES: > * almost all pages served by Pages- or Arti

Re: insert/delete sql in 1.4.0

2008-04-28 Thread Jeremy Evans
On Apr 28, 10:24 am, "Victor 'Zverok' Shepelev" <[EMAIL PROTECTED]> wrote: > >Obviously, the more help that you can provide, the faster things will > >move along. Any patches you can contribute that make it work on 1.9 > >without breaking compatibility with 1.8 will be fast tracked. > > OK, I'll

Sequel 1.5.0 Released

2008-04-29 Thread Jeremy Evans
Sequel 1.5.0 has been released and should be available on the gem mirrors. 1.5.0 has the following exciting new features: You can now graph a dataset and have the result split into component tables: DB[:artists].graph(:albums, :artist_id=>:id).first # => {:artists=>{:id=>artists.id, :name=>

Sequel 1.5.1 Release

2008-04-30 Thread Jeremy Evans
Sequel 1.5.1 has been released and should be available soon on the gem mirrors. 1.5.1 is a bug fix release that changes how graph and eager_graph handle missing records in associated tables (which occur because graph defaults to LEFT OUTER joins by design). 1.5.0: # If the first artist doesn'

Re: Field shadowing on join

2008-05-01 Thread Jeremy Evans
On May 1, 10:38 am, "Victor 'Zverok' Shepelev" <[EMAIL PROTECTED]> wrote: > Hello all. > > I have two models: InPosition and Category, with both tables having title > field (they are different) and in_positions having category_id foreign key. > > Then, I have relatively simple request: > > puts In

Re: insert/delete sql in 1.4.0

2008-05-01 Thread Jeremy Evans
On May 1, 10:34 am, Zverok <[EMAIL PROTECTED]> wrote: > Hmm... Have somebody seen my message with a patch? At least, google > groups see it > athttp://groups.google.com/group/sequel-talk/msg/362aeb048651cdb4 > > If you have seen it, can you provide further instructions? I've seen the patch. It

Re: Field shadowing on join

2008-05-01 Thread Jeremy Evans
On May 1, 12:45 pm, "Victor 'Zverok' Shepelev" <[EMAIL PROTECTED]> wrote: > OK, thanks. I've already found the solution you show, but it still seems a > bit uncomfortable for me... I'd prefer selective renaming of conflict fields > (alongside with warnings on conflict, maybe debug-mode only). Like

Re: Field shadowing on join

2008-05-01 Thread Jeremy Evans
On May 1, 1:16 pm, "Victor 'Zverok' Shepelev" <[EMAIL PROTECTED]> wrote: > >You probably understand incorrectly. :) graph is really what you > >want: > > > InPosition.graph(Category, :id=> :category_id) > > => {:in_positions=>#, :categories=>#} > > Yeah, I've seen this, but. Maybe I want too mo

Re: insert/delete sql in 1.4.0

2008-05-01 Thread Jeremy Evans
On May 1, 10:34 am, Zverok <[EMAIL PROTECTED]> wrote: > Hmm... Have somebody seen my message with a patch? At least, google > groups see it > athttp://groups.google.com/group/sequel-talk/msg/362aeb048651cdb4 > > If you have seen it, can you provide further instructions? I just committed a slight

Re: Field shadowing on join

2008-05-02 Thread Jeremy Evans
On May 1, 3:53 pm, "Victor 'Zverok' Shepelev" <[EMAIL PROTECTED]> wrote: > >Then you want eager: > > > InPosition.many_to_one :category > > i = InPosition.eager(:category).all.first # You need to use all > > => # > > i.category > > => # # No additional database trip > > >If you really need on

Re: Times prior to 1900 don't work

2008-05-02 Thread Jeremy Evans
On May 1, 7:56 pm, Paul Dlug <[EMAIL PROTECTED]> wrote: > Perhaps this is just a problem unique to me but Time.parse does not > support times prior to 1900. The datetime type in most DB's does allow > these (where as timestamp is usually limited to unix epoch) so I > imagine it would be good to su

Re: Field shadowing on join

2008-05-02 Thread Jeremy Evans
On May 2, 9:27 am, "Victor 'Zverok' Shepelev" <[EMAIL PROTECTED]> wrote: > BTW, can you also point me to explanation, why eager's don't use INNER JOIN? > (Sorry, I'm boring, I know) eager doesn't use join. eager_graph uses LEFT OUTER JOIN, because INNER JOIN will result in dropping records that

Re: Times prior to 1900 don't work

2008-05-02 Thread Jeremy Evans
On May 2, 10:41 am, Paul Dlug <[EMAIL PROTECTED]> wrote: > > Ruby's Time object does not support dates prior to 1901-12-14. Make > > created_at a date field instead of a datetime field if you need to > > store dates before that date. > > I can make it a date but that's sort of missing the point.

Re: Field shadowing on join

2008-05-02 Thread Jeremy Evans
On May 2, 1:12 pm, "Victor 'Zverok' Shepelev" <[EMAIL PROTECTED]> wrote: > Haven't you bored of my notes? (I post to list irregullary: typically, it is > when I refactor one of my projects, change Sequel version and think about > "how it all works". In addition, my English is... hmmm, I hope, > un

Re: Issue 222 in ruby-sequel: Model classes inside module aren't seen with inflector

2008-05-02 Thread Jeremy Evans
On May 2, 1:06 pm, "Victor 'Zverok' Shepelev" <[EMAIL PROTECTED]> wrote: > Faithfully, I think, that the most naturally will be to do.. well, the most > natural thing: > > class D < Sequel::Model > end > > class B < Sequel::Model > end > > module A > class B < Sequel::Model > end > > class C

Re: auto migration

2008-05-03 Thread Jeremy Evans
On May 2, 4:37 pm, besthope <[EMAIL PROTECTED]> wrote: > Does Sequel support auto-migration? Sort of. You can define the schema with set_schema and then use create_table! to drop the table (if it exists), and create a table with the schema you defined. Jeremy --~--~-~--~~---

Re: Remove filter from dataset

2008-05-03 Thread Jeremy Evans
On May 3, 10:58 am, Michal Bugno <[EMAIL PROTECTED]> wrote: > The solution is ok, yet I find it not so elegant. I thought it would > be possible just to remove the filter, that feature would be nice (if > it doesn't exist already, but I couldn't find it). Still thanks for > the possible approach,

Re: Stored Procedures and bound params

2008-05-06 Thread Jeremy Evans
On May 5, 10:39 am, notmuch <[EMAIL PROTECTED]> wrote: > I am trying to call an oracle stored procedure, which returns a > resultset(cursor) via an OUT parameter. > I have tried several variations and could not find a way to bind(and > retrieve) a value/variable to the parameter. Here's a raw temp

Re: Postgres bytea problem

2008-05-06 Thread Jeremy Evans
On May 6, 8:18 am, ivanb <[EMAIL PROTECTED]> wrote: > Hi. > I have Postgres and I am having trouble accessing bytea field. > I guess data doesn't get escaped the right way. > How to do this? Is there something in connection string, or in model > or where? > > I searched and searched and couldn't f

Connection Pool Patch Feedback Wanted

2008-05-06 Thread Jeremy Evans
Currently, when Sequel is used with some databases (such as MySQL), it reuses connections when it shouldn't do so. For example, this will cause problems on MySQL: DB[:items].each{|x| DB[:items].each{|y| puts y == x}} The issue is Sequel tries to reuse the same connection for both selects, whic

Re: Connection Pool Patch Feedback Wanted

2008-05-07 Thread Jeremy Evans
On May 6, 4:58 pm, Jeremy Evans <[EMAIL PROTECTED]> wrote: > Currently, when Sequel is used with some databases (such as MySQL), it > reuses connections when it shouldn't do so. For example, this will > cause problems on MySQL: > > DB[:items].each{|x| DB[:items].each

Re: Validations and create_before

2008-05-08 Thread Jeremy Evans
On May 8, 5:03 am, Farrel <[EMAIL PROTECTED]> wrote: > On May 8, 11:33 am, Farrel <[EMAIL PROTECTED]> wrote: > > > What's the suggested way to specify a 'validates_presence_of :attr' > > validation where 'attr' is set in the before_create block? > > save returns false and says that 'attr' is not s

Re: Merb 0.9.3 And Sequel 1.5.1

2008-05-08 Thread Jeremy Evans
On May 7, 10:05 pm, Davo <[EMAIL PROTECTED]> wrote: > Hi, > > I originally posted this in the Merb discussion group but Ezra advised > that you guys might be able to help. > > After upgrading to the above versions I have the following issue. When > I run merb the console shows the usual loading of

Re: Models have no attributes

2008-05-12 Thread Jeremy Evans
On May 9, 12:59 am, Farrel <[EMAIL PROTECTED]> wrote: > After some discussion in the IRC channel and some experimentation I > received this error message: > Sequel::Model#method_missing is deprecated, and will be removed in > Sequel 2.0. Use model[:name]. > > Am I correct in stating that from now

Re: 3 small things

2008-05-12 Thread Jeremy Evans
On May 9, 3:57 am, "ARAI Shunichi" <[EMAIL PROTECTED]> wrote: > Hi all, > > I've started using Sequel in my new project, and I have 3 small requests. > > 1. Sequel.connect should take block > > I want to write like: > > Sequel.connect('postgres://test:[EMAIL PROTECTED]/egalite') { |db| > >

Re: flawed transactions

2008-05-14 Thread Jeremy Evans
On May 13, 8:50 pm, "ara.t.howard" <[EMAIL PROTECTED]> wrote: > afaikt sequel suffers from this slippery bug: > > cfp:~/site/votelink.com > cat a.rb > def (Db = Object.new).execute string > puts string > end > > def (UnSafe = Db.clone).transaction > begin > execute 'BEGIN' > yield >

Re: Circulate a daily IRC log?

2008-05-14 Thread Jeremy Evans
On May 14, 1:59 am, "Mark V" <[EMAIL PROTECTED]> wrote: > Hi Devs, > What are your thoughts on circulating, via the sequel-talk mail list, > a log of the sequel IRC channel each 24 hrs? > DataMapper does this and it can be handy way to review what has been > discussed debated in the IRC channel. >

Re: Issues with Seque migrations on Merb

2008-05-14 Thread Jeremy Evans
On May 14, 1:47 pm, Farrel <[EMAIL PROTECTED]> wrote: > Hi all, > > Is there a merb_sequel maintainer? I have been getting the following > errors whenever I try to do a migration on Merb: There may be, but merb_sequel not maintained by the Sequel maintainer (me). That may change in the future, i

MAJOR changes: Make identifier quoting optional, quote all identifiers, force explicit table aliasing when joining

2008-05-14 Thread Jeremy Evans
I just made some major changes to the master branch, which could break some existing code. I don't do such a thing without a good reason, in this case because I believe the current design was fatally flawed. Three major changes have just been committed 1) Identifier (table/column) quoting is now

Re: flawed transactions

2008-05-14 Thread Jeremy Evans
On May 14, 2:40 pm, "ara.t.howard" <[EMAIL PROTECTED]> wrote: > just a quick note, this pattern is more robust, as it's possible to > have something lying around in $!: > > error = nil > > begin > yield > rescue Object => error > ensure > if error > handle_error > else > handle_succe

Re: Issues with Seque migrations on Merb

2008-05-15 Thread Jeremy Evans
On May 14, 11:04 pm, Farrel <[EMAIL PROTECTED]> wrote: > On May 15, 12:00 am, Jeremy Evans <[EMAIL PROTECTED]> wrote: > > > The traceback makes it look like this is an active_support problem. > > Assuming that this is happening with an association, try specifying >

Re: MAJOR changes: Make identifier quoting optional, quote all identifiers, force explicit table aliasing when joining

2008-05-15 Thread Jeremy Evans
On May 15, 9:14 am, "ara.t.howard" <[EMAIL PROTECTED]> wrote: > On May 14, 4:13 pm, Jeremy Evans <[EMAIL PROTECTED]> wrote: > > > I just made some major changes to the master branch, which could break > > some existing code. I don't do such a thing wi

Re: MySQL adapter problem

2008-05-15 Thread Jeremy Evans
On May 15, 1:06 pm, Xavier Lange <[EMAIL PROTECTED]> wrote: > I'm trying to get sequel to use the native c mysql adapter on OS X. > > gem list | grep mysql > mysql (2.7) > > and the command I use to connect to the db (a local one) > > sequel mysql://me:[EMAIL PROTECTED]/db > db_opts = {} > Could n

Re: MAJOR changes: Make identifier quoting optional, quote all identifiers, force explicit table aliasing when joining

2008-05-15 Thread Jeremy Evans
On May 15, 3:10 pm, Farrel <[EMAIL PROTECTED]> wrote: > On May 15, 12:13 am, Jeremy Evans <[EMAIL PROTECTED]> wrote: > > > I just made some major changes to the master branch, which could break > > some existing code. I don't do such a thing without a good

Re: MAJOR changes: Make identifier quoting optional, quote all identifiers, force explicit table aliasing when joining

2008-05-16 Thread Jeremy Evans
On May 15, 11:55 pm, Farrel <[EMAIL PROTECTED]> wrote: > In that case I'll probably have to go back to using the stable 1.5.1 > gems. Is there any chance of a 1.5.2 release with before_validations > support soon? That was the only reason I was using the latest source. No. There have been a lot o

Re: Using Sequel::Model with namespaced classes

2008-05-16 Thread Jeremy Evans
On May 15, 8:35 pm, Xavier Lange <[EMAIL PROTECTED]> wrote: > I'm trying to get the class to set its dataset but it's just not > sticking. The classes is going back to its class name. It will, > however, stick after I set using dataset=new_dataset. Any ideas? > > Here's the code that will demonstr

Re: Using Sequel::Model with namespaced classes

2008-05-16 Thread Jeremy Evans
On May 16, 12:30 am, Xavier Lange <[EMAIL PROTECTED]> wrote: > It looks like ARAI Shunichi found this bug as well. I was able to push > my way through and continue working but I have hit another dataset > problem. > > How can I use a polymorphic many_to_many relationship if Sequel::Model > wants t

Re: Using Sequel::Model with namespaced classes

2008-05-16 Thread Jeremy Evans
On May 16, 9:53 am, Xavier Lange <[EMAIL PROTECTED]> wrote: One of your errors may be you got the order of things mixed up, it should be like this: class Factor < ItemContainer set_dataset Sequel::Model.db[:item_containers].where{:kind == 'Factor'} dataset.set_model(:kind, Hash.new {|h

OMFG: Add support for blockless filters, lose a little backwards compatibility

2008-05-16 Thread Jeremy Evans
The commit message: The block filters from previous Sequel versions are no longer necessary, as you now can do pretty much everything with a blockless filter. The basics of the block filters are the usual arithmetic, inequality, and binary operators: + = addition - = subtraction * = multi

Re: bug in mysql adapter?

2008-05-17 Thread Jeremy Evans
On May 17, 2:16 am, Shawn <[EMAIL PROTECTED]> wrote: > /Library/Ruby/Gems/1.8/gems/sequel_core-1.5.1/lib/sequel_core/adapters/ > mysql.rb, line 58: in each_array > > undefined method `keys=' for []:Array > > line 58 of mysql.rb is calling row.keys, when row is an array (from > fetch_row) > > p

Re: Sequel::Model column value assignment : update

2008-05-17 Thread Jeremy Evans
On May 17, 3:41 am, Shawn <[EMAIL PROTECTED]> wrote: > Sorry, false alarm on the Sequel::Model column value assignment > problem. But I'll describe what happened more fully in case anyone > else is similarly affected. > > Sequel::Model has changed to set values internally using []=. The > dynami

Re: Support for additional multi methods and SQL statement options

2008-05-17 Thread Jeremy Evans
On May 16, 9:54 pm, "Mark V" <[EMAIL PROTECTED]> wrote: > Hi Devs, > I'd appreciate any voices for/against the following. > > I'd like to add multi_update, multi_insert!. > In the process it became clear there is lots of parsing of an 'args' > array that this would have to get factored out, > see

Re: Support for additional multi methods and SQL statement options

2008-05-17 Thread Jeremy Evans
On May 17, 8:44 am, "Aman Gupta" <[EMAIL PROTECTED]> wrote: > I liked Jeremy's suggestion of adding another dataset method that could be > chained: > Model.insert_options(:ignore, :slice => 5).import({:field=>1}, > {:field=>2}) > > Aman That's another option, and possibly a better one than my

Re: basic join call.

2008-05-18 Thread Jeremy Evans
On May 17, 7:06 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, > > I'm fairly new to sequel.. Joins seemed pretty straightforward. > Track.left_outer_join(:votes, :votee_id => :id) where dopes is a votes > table where tracks are the being voted on. > > # > > I've tried variations: > DB[:

Re: Support for additional multi methods and SQL statement options

2008-05-18 Thread Jeremy Evans
On May 17, 4:58 pm, "Mark V" <[EMAIL PROTECTED]> wrote: > On Sun, May 18, 2008 at 3:18 AM, Jeremy Evans <[EMAIL PROTECTED]> wrote: > > > On May 17, 8:44 am, "Aman Gupta" <[EMAIL PROTECTED]> wrote: > >> I liked Jeremy's sugges

Blockless filter SQL string concatenation operator

2008-05-18 Thread Jeremy Evans
I'm thinking about adding an SQL string concatenation operator to the blockless filter syntax. We are a little low on available operators, but I thinking of using <<, seeing as it is the ruby operator for string concatenation (though it modifies the receiver). String concatenation is different t

Re: Blockless filter SQL string concatenation operator

2008-05-18 Thread Jeremy Evans
On May 18, 3:37 pm, "Mark V" <[EMAIL PROTECTED]> wrote: > On Mon, May 19, 2008 at 1:45 AM, Jeremy Evans <[EMAIL PROTECTED]> wrote: > > But I reject that as counterintuitive. Instead, I think we should add > > an Array#sql_join method: > > Hmm if I saw

Reflection Support

2008-05-19 Thread Jeremy Evans
I just added limited reflection support to sequel_core (http:// github.com/jeremyevans/sequel/commit/ 73e06a86bb44a49e70bdccf4c22ecf101b9f8716). This support allows you to see information about columns for a given table: DB.schema_for_table(:artist) => [[:id, {:type=>:integer, :default=>"nex

Typecasting on Assignment Thoughts

2008-05-20 Thread Jeremy Evans
Typecasting on assignment for Sequel::Model objects is one of the only things left for 2.0. I haven't started work on it yet, but I will soon. However, I'm still thinking about how I want to implement it, especially in regards to validation and/or raising exceptions. First, to make it obvious w

Re: Typecasting on Assignment Thoughts

2008-05-20 Thread Jeremy Evans
On May 20, 10:11 am, Farrel <[EMAIL PROTECTED]> wrote: > On May 20, 6:42 pm, Jeremy Evans <[EMAIL PROTECTED]> wrote: > > > We could raise an error during the assignment phase: > > > model.number = 'a' # Raise error > > I don't like t

Re: Typecasting on Assignment Thoughts

2008-05-20 Thread Jeremy Evans
On May 20, 1:49 pm, "Mark V" <[EMAIL PROTECTED]> wrote: > On Wed, May 21, 2008 at 5:51 AM, Jeremy Evans <[EMAIL PROTECTED]> wrote: > > > On May 20, 10:11 am, Farrel <[EMAIL PROTECTED]> wrote: > >> On May 20, 6:42 pm, Jeremy Evans <[EMAIL PROTEC

Re: Typecasting on Assignment Thoughts

2008-05-21 Thread Jeremy Evans
On May 20, 7:09 pm, "Mark V" <[EMAIL PROTECTED]> wrote: > On Wed, May 21, 2008 at 8:02 AM, Jeremy Evans <[EMAIL PROTECTED]> wrote: > >> > Just for fun, I looked at what ActiveRecord does. With 1.2.6, it > >> > typecasts on access, with 2.0.2, it t

Re: Typecasting on Assignment Thoughts

2008-05-21 Thread Jeremy Evans
On May 20, 11:49 pm, "ARAI Shunichi" <[EMAIL PROTECTED]> wrote: > > model.number = '1' # => 1 > > model.number = 'a' # Raise error > > How can we acheive it? > By doing regexp matching to number.to_s and then to_i? As mentioned above, using Integer (a Kernel method). irb(main):002:0> Integ

Re: literal method

2008-05-21 Thread Jeremy Evans
On May 20, 10:33 pm, Shawn <[EMAIL PROTECTED]> wrote: > Why is the literal() method defined in the dataset classes (e.g. > Sequel::MySQL::Dataset) instead of the Database classes (e.g. > Sequel::MySQL::Database)? There are times when I want to quote a > string without/before creating a dataset, a

Re: Typecasting on Assignment Thoughts

2008-05-21 Thread Jeremy Evans
The typecasting on assignment code was just committed: http://github.com/jeremyevans/sequel/commit/2c7fd272cab1bc3f9fc183ebe9417c11a8ab0b67 It allows you to turn off typecasting on a global, per class, and even per instance basis, as well as easily modifying the typecasting rules by overriding th

Sequel 2.0 Release Candidate

2008-05-21 Thread Jeremy Evans
The methods deprecated in Sequel 1.5.0 have now been removed, and Sequel is officially at the 2.0 Release Candidate stage. No new features will be added between now and 2.0. The only work left to be done is some major updates to the documentation, as well as fixing any bugs found between now and

Model Plugins Removal

2008-05-22 Thread Jeremy Evans
I plan on removing the model_plugins directory from the master repository. I don't support any of plugins there and don't test any of them. They are basically just deadweight as far as I am concerned. Anyone wishing to maintain one of the plugins should copy the plugin to a new repository and h

Re: allow_null with typecast

2008-05-26 Thread Jeremy Evans
On May 25, 11:00 am, dusty <[EMAIL PROTECTED]> wrote: > I have a timestamp field in my model that I want to allow null on, I'm > not sure how to do this. Right now I have it with :allow_null => true > in my set_schema declaration. However, when I set that attribute to > nil and save the record,

Re: changed_columns with after callback

2008-05-26 Thread Jeremy Evans
On May 26, 8:28 am, dusty <[EMAIL PROTECTED]> wrote: > I am using the changed_columns method to fire off an action after a > save, if a particular column was changed. > > For example: > > after_save do > send_email_activation > end > > def send_email_activation > self.send_activation

Re: questions about validations

2008-05-26 Thread Jeremy Evans
On May 26, 8:20 am, dusty <[EMAIL PROTECTED]> wrote: > Is there an :if option available with validations? I am trying to > reproduce the restful_authentication plugin to work with sequel and > using something like this. > > attr_accessor :password > validates_presence_of :password, :if => :passwo

Re: Model Plugins Removal

2008-05-26 Thread Jeremy Evans
On May 22, 12:13 pm, Jeremy Evans <[EMAIL PROTECTED]> wrote: > I plan on removing the model_plugins directory from the master > repository. I don't support any of plugins there and don't test any > of them. They are basically just deadweight as far as I am > c

Re: several warning messages

2008-05-26 Thread Jeremy Evans
On May 25, 12:26 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I am a newbie with sequel. My little commandline test scripts produce > the expected results in the database, but they generate also several > warning messages: This is expected. Sequel is not -w warning free, and it's not rea

Re: MySQL, encoding, Lost connection

2008-05-27 Thread Jeremy Evans
On May 27, 7:04 am, "Victor 'Zverok' Shepelev" <[EMAIL PROTECTED]> wrote: > Hello all. > > I have something like client-server app, and encountered with very complex > case: after one client have caused problem "Lost connection to MySQL server > during query" (server still working) next actions of

Re: MySQL, encoding, Lost connection

2008-05-27 Thread Jeremy Evans
On May 27, 10:15 am, "Victor 'Zverok' Shepelev" <[EMAIL PROTECTED]> wrote: > Really, the problem is here: > > #1. performs additional operations on connection > if encoding = @opts[:encoding] || @opts[:charset] > conn.query("set character_set_connection = '#{encoding}'") > conn.query("set char

Re: what's your favorite framework w/ sequel?

2008-05-28 Thread Jeremy Evans
On May 28, 9:17 am, dusty <[EMAIL PROTECTED]> wrote: > Just wondering, what are your favorite frameworks when using sequel > for db access in a web app? I've been recently using it with merb. > > What else do you guys use? > > merb > sinatra > ramaze > mack > waves > rails? > anything else... I

  1   2   3   4   5   6   7   8   9   10   >