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_relations

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 outstanding work on model

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

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

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

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) AND (b=3) {:a = 1, :b

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 does

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 provided.

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 be able

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 just

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 c This

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

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 default in sequel_model 0.5

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) = #Audit @values={} 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(main):006:0 Audit.new(:user_id = 1) = #Audit @values={} user_id is not set

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 you call

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 am

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 count on this cloned dataset, which causes an issue

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 FROM [:clients]

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 was

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 git reset

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 is not

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 able to have parent'

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 = #Category @values={:description=nil, :name=asd, :parent_id=nil, :id=2} c.children ~ SELECT * FROM categories WHERE ('parent_id' = 2) ~ ERROR: invalid input

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 http://pastie.caboo.se/184224. FEATURES: * almost all pages served by Pages- or

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 take my

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

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

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 hasn't

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=#InPosition..., :categories=#Category...} Yeah, I've seen this, but. Maybe I want

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 slightly

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 = #InPosition... i.category = #Category... # No additional database trip If you really need

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. It is

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 Sequel::Model

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 template

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,

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{|y| puts y == x}} The issue

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 set save!

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 on

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| } not like:

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, if 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

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_success end end

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 without a good reason, in this case because I believe

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 not load

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 reason, in this case because I believe

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 of

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 demonstrate

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 to use

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,

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) proposed

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 dynamic

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,

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

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 PROTECTED] wrote: We could raise an error during the assignment phase

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 typecasts on assignment. In both cases, it appears

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 Integer('1') =

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, and

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

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

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, I get

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_request if

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 =

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 concerned. Anyone wishing to maintain one

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 really a

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 the

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

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 like Ramaze

Re: Sequel and ActiveRecord?

2008-05-29 Thread Jeremy Evans
On May 28, 6:46 pm, urbanus [EMAIL PROTECTED] wrote: Hi, I've been looking at the possibility of using Sequel in a Rails project -- not as a *replacement* for ActiveRecord, but *alongside* ActiveRecord. There are some places in our code where we're using SQL either for efficiency or to

Re: Both Sequel and ActiveRecord?

2008-06-01 Thread Jeremy Evans
On May 28, 11:49 pm, urbanus [EMAIL PROTECTED] wrote: Hi, I've been looking at the possibility of using Sequel in a Rails project -- not as a *replacement* for ActiveRecord, but *alongside* ActiveRecord. There are some places in our code where we're using SQL either for efficiency or to

Sequel 2.0.0 Released

2008-06-01 Thread Jeremy Evans
Sequel 2.0.0 has been released and should be available on the gem mirrors. 2.0.0 has the following exciting new features: Blockless Filter Expressions Before 2.0.0, in order to specify complex SQL expressions, you either had to resort to writing the SQL yourself in

Re: literal method

2008-06-01 Thread Jeremy Evans
On Jun 1, 3:25 pm, Shawn [EMAIL PROTECTED] wrote: Since the existing literal method in Sequel::Dataset makes no reference to the dataset from which it is invoked, it makes more sense for the entire method to be moved to Sequel::Database, and for Sequel::Dataset to get a new literal method

Re: DateTime and date/time fields

2008-06-02 Thread Jeremy Evans
On Jun 2, 7:56 am, Farrel [EMAIL PROTECTED] wrote: I noticed with Sequel 2.0 that the Ruby object for a Postgres timestamp field is now a DateTime instead of a Time object. Is DateTime the default for all date and time related fields or is Time and Date objects used in other cases? The

Re: literal method

2008-06-02 Thread Jeremy Evans
On Jun 2, 5:10 am, Shawn [EMAIL PROTECTED] wrote: I hope some of the points I've made tonight, and the above intended use case, will merit further consideration for moving the literal method from Dataset to Database. class Sequel::Database def literal(v) dataset.literal(v) end end

Re: not_naughty with 2.0

2008-06-02 Thread Jeremy Evans
On Jun 2, 8:59 pm, dusty [EMAIL PROTECTED] wrote: I'm having trouble getting my models to load up with sequel 2.0 and not_naughty 0.5.1 downloaded from rubyforge. It appears there has been some interface changes and not_naughty might need to be updated. Here is the error I get

Re: DateTime and date/time fields

2008-06-03 Thread Jeremy Evans
On Jun 3, 1:15 pm, Farrel [EMAIL PROTECTED] wrote: On Jun 2, 6:59 pm, Jeremy Evans [EMAIL PROTECTED] wrote: The value you get from the database is adapter specific (I think Time is used in most cases). When using models with typecasting, it will always cast to a DateTime and not a Time

Re: DateTime and date/time fields

2008-06-04 Thread Jeremy Evans
On Jun 4, 12:40 am, Farrel [EMAIL PROTECTED] wrote: On Jun 4, 1:21 am, Jeremy Evans [EMAIL PROTECTED] wrote: Yes, and that's the current expected behavior. As I mentioned, I'll accept patches to fix it so that DateTime is returned by the adapter. You should change the before_* hooks

Re: Dates like 0000-00...

2008-06-04 Thread Jeremy Evans
On Jun 4, 6:22 am, myobie [EMAIL PROTECTED] wrote: I am working with a legacy mysql database that defaults dates to all zero's for everything and sequel is not happy about it. I suppose when it typecasts the date when I do a find (Product.first) it gives an error that it's an invalid date.

Re: DateTime and date/time fields

2008-06-04 Thread Jeremy Evans
On Jun 4, 7:57 am, Farrel [EMAIL PROTECTED] wrote: On Jun 4, 4:46 pm, Jeremy Evans [EMAIL PROTECTED] wrote: What may not have been clear is that when you load data from the database, the model does not typecast it, so if the database adapter gives you a Time, it doesn't get converted

Re: Dates like 0000-00...

2008-06-04 Thread Jeremy Evans
On Jun 4, 1:07 pm, Aman Gupta [EMAIL PROTECTED] wrote: You can patch sequel_core to handle the '-00-00' = nil case:http://p.ramaze.net/1541 Aman Gupta myobie, This may work for your use case, but it has some issues: 1) Model[1].save will convert -00-00 to nil in the database.

2.0.1 Released

2008-06-04 Thread Jeremy Evans
2.0.0 had a lot of changes, and in some cases it caught an edge. Here are the changes made in 2.0.1, from the CHANGELOGs: sequel: * Make the choice of Time or DateTime optional for typecasting :datetime types, default to Time (jeremyevans) * Reload database schema for table when calling

Re: Clarification for Sequel::Migration

2008-06-05 Thread Jeremy Evans
On Jun 5, 6:39 am, Maz [EMAIL PROTECTED] wrote: It would be nice if the Sequel::Migration documentation would target users to Sequel::Schema::Generator. It might not be obvious for everyone. At least, it wasn't, for me. Sounds like a good idea to me, so applied:

Renamed Sequel.time_class option (added in 2.0.1) to Sequel.datetime_class

2008-06-05 Thread Jeremy Evans
I decided to rename the time_class option I added in 2.0.1, because it was poorly named. SQL time fields (which specify times without dates) are always handled by Time, it's datetime/timestamp fields that are handled by the option. Because of that, I think the option's name was misleading, so I

Re: Bind Variables

2008-06-10 Thread Jeremy Evans
On Jun 9, 9:28 pm, NathanD [EMAIL PROTECTED] wrote: I am evaluating Ruby, Ruby on Rails for use by my company for the creation of a new reports web application. We initially will be using Oracle and PostSQL as out target databases but will wish to expand out to more. A important issue for use

Re: MySql last_insert_id

2008-06-10 Thread Jeremy Evans
On Jun 10, 9:40 am, 360R8 [EMAIL PROTECTED] wrote: Can someone please show me how to obtain the last_insert_id from a mysql table? I don't use MySQL, but it's possible that on MySQL: id = DB[:items].insert(:name='Name') id # id of the row you just inserted Note that this is just

Re: Multiple databases

2008-06-12 Thread Jeremy Evans
On Jun 12, 9:45 am, Shawn [EMAIL PROTECTED] wrote: Is it possible for one Ruby process to access multiple database connections via Sequel::Model? It seems that Sequel::Model keeps the most recent Sequel connection in Sequel::Model.db, meaning that only one database can be accessed at a time.

Re: connection pools

2008-06-15 Thread Jeremy Evans
On Jun 14, 7:00 am, Joe Holt [EMAIL PROTECTED] wrote: I'm writing a threaded Ruby app and I've determined that some of the threads need their own exclusive persistent connection to the database. I'm about to patch ConnectionPool to make acquire() public, so that I can do this... Thread.new

Re: Bug with sequel CGI

2008-06-15 Thread Jeremy Evans
On Jun 14, 5:57 pm, Shawn [EMAIL PROTECTED] wrote: Getting a SystemExit exception with require sequel 2.0.[01] in a CGI script, running on Apache 2.2 on Mac OS X 10.5. Here's the script: #/usr/local/bin/ruby require 'rubygems' begin require 'sequel' rescue Exception = e print

Re: Update selected fields only

2008-06-15 Thread Jeremy Evans
ARAI Shunichi wrote: Hi all, I think that if a method like below are added to Sequel::Model, it will help Web application developers from carelessly making a security hole. It can be used as, update_select([:name, :password], http_params) It prevents an attack which injects HTTP

Re: Update selected fields only

2008-06-15 Thread Jeremy Evans
On Jun 15, 8:59 am, Jeremy Evans [EMAIL PROTECTED] wrote: ARAI Shunichi wrote: Hi all, I think that if a method like below are added to Sequel::Model, it will help Web application developers from carelessly making a security hole. It can be used as, update_select([:name, :password

Re: connection pools

2008-06-15 Thread Jeremy Evans
On Jun 15, 8:50 am, Jeremy Evans [EMAIL PROTECTED] wrote: On Jun 14, 7:00 am, Joe Holt [EMAIL PROTECTED] wrote: I'm writing a threaded Ruby app and I've determined that some of the threads need their own exclusive persistent connection to the database. I'm about to patch ConnectionPool

ParseTree support is officially deprecated

2008-06-15 Thread Jeremy Evans
Commit here: http://github.com/jeremyevans/sequel/commit/b94bf8ef0534f37364c94f0620a031ee4abeeebc Commit message: Deprecate ParseTree filters, allow expression (blockless) filters inside blocks, default to ParseTree filters ParseTree filters are now officially deprecated and are scheduled for

Re: Association methods don't update reciprocal associations

2008-06-16 Thread Jeremy Evans
On Jun 16, 12:11 am, David Lee [EMAIL PROTECTED] wrote: post = Post.create user = User.create post.user #= nil user.posts #= [] post.user = user post.user #= user user.posts #= [] (should be [post]) post.save user.posts #= still [] (should be [post]) irb(main):001:0 e =

Re: Models should be cached based on primary key

2008-06-16 Thread Jeremy Evans
On Jun 16, 12:13 am, David Lee [EMAIL PROTECTED] wrote: I thought this was already implemented, but I guess not: User[1].object_id == User[1].object_id #= false (should be true) No, it shouldn't. This isn't DataMapper, we don't use an identity map. It should always be true that: User[1]

  1   2   3   4   5   6   7   8   9   10   >