On Dec 13, 4:44 pm, Jeremy Evans <[email protected]> wrote:
> > Now, without this option, where I used to get back nil, I get now an > > array containing sql queries that were just executed. Not sure if this > > is intentional, and it is certainly confusing. > > It's not intentional. If you don't specify you want the primary key > returned, the return value is arbitrary. In that case, you are using > the method purely for side effects, so the return value shouldn't > matter. That would be more or less correct if Sequel was part of the "in-house- app". It is not, it is public API, and some people will start to rely on those queries returned, and then when this changes in some newer version of the Sequel, their code will stop working. I understand that this is arguable either way, so lets agree to disagree :) > A simpler rhetorical question is this: Why should Sequel throw an > exception for a case that it currently handles correctly? It depends on the definition of 'correctness' in the first place :) I do not think it is correct to insert records one-by-one if it is part of the 'contract' of method multi-insert to insert all data in one step. > I fail to see why you think this is a problem. multi_insert/import/ > insert_multiple all do basically the same type of thing (insert all > related records). What do you think is wrong with the current > implementation? Please provide specific examples with code. I guess you just wrote the main reason of my dissatisfaction with this api: both methods insert_multiple and multi_insert do pretty much same thing, and their names are just artificially different. The only distinction for them is that one of them will generate list of inserts, and the other one will ATTEMPT to perform one SQL "to do it all". There are just too many cases where they both will do EXACT same thing (generate multiple insert statements), and it makes things confusing. Maybe it would be better (as is in 'less confusing') if there was just one method for insertion of multiple records at a time, and that method would take options that would try to "hint" on how that should be done, without any guarantees? Again, current API is functional, it is just a bit vague because of a 'mushy' contract of multi_insert method. -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en.
