On Saturday, December 5, 2015 at 11:33:09 AM UTC-6, Jeremy Evans wrote:

> On Saturday, December 5, 2015 at 9:10:43 AM UTC-8, Mike Pastore wrote:
>>
>>
>>    - Is there a quick and easy way to mark my models as "clean" after 
>>    the batch update is successfully applied?
>>    
>> I'm not sure  what you mean.  If you mean individual records, adding a 
> column that stores whether the record is clean should work.  If you mean 
> for the whole table, maybe another table with a single column that stores 
> the tables that have already been cleaned.
>

Hrrm, I was under the impression that setting a field with #set or #field= 
mutates @changed_columns and causes #modified? to return true. The model is 
"dirty" because it has unsaved changes. Calling #save or #refresh clears 
these bits with a database call. Is there a way to clear those bits without 
a database call? 

>
>>    - Are there any other style or performance suggestions you can make? 
>>    This is for some Sinatra/Sequel tests I'm working on for 
>>    FrameworkBenchmarks[1].
>>    
>> Well, for significantly better performance, you'd probably have to drop 
> to lower levels.  As a minor speedup, you could pass the block you are 
> passing to worlds.each to all, that would eliminate the method call to 
> worlds.each.  I'm not sure the sort! is necessary.  I doubt it would make a 
> difference on PostgreSQL, but maybe on MySQL it does.
>

I'll try that. Yeah, I was getting deadlock on MySQL without the sort. This 
post on Stack Overflow helped me figure out a solution: 
http://stackoverflow.com/questions/2332768/how-to-avoid-mysql-deadlock-found-when-trying-to-get-lock-try-restarting-trans
 

Thanks Jeremy! I love Sequel and appreciate all your hard work on it. 

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to