Thank you, now I understand! On Tuesday, June 27, 2017 at 2:47:58 PM UTC-7, Jeremy Evans wrote: > > On Tuesday, June 27, 2017 at 2:24:10 PM UTC-7, Andrei (L.A.) wrote: >> >> I've been getting similar errors and switching from Dataset#each to >> Dataset#all resolved some of them. Could you elaborate on why #each causes >> the errors and #all does not? >> >> Thank you. >> > > Dataset#each yields records as soon as the driver provides them. If the > driver provides rows before the query completes (i.e. it streams results), > and you issue a query inside the Dataset#each block, you end up sending > another query before the previous query finishes, which results in an error. > > Dataset#all retrieves all values up front, stores them in an array, then > iterates over the array. This makes sure the connection is not still in > use. > > It is possible to use Dataset#each and issue queries inside the > Dataset#each block, but you have to force the use of a different connection > via a separate Thread or shard. > > Thanks, > Jeremy >
-- 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 https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
