On Sat, Dec 11, 2021 at 12:02 PM Michael Davis <michael.davis...@gmail.com>
wrote:

> Here is snippit of code that is trying to select qualifying rows from a
> Movies table that has a Title column using bind parameters:
>
> Sequel.connect({ adapter: :sqlite, database: './tests/data/test.db' }) do
> |db|
>   ds = db.from(:Movies)
>   bind_parms = {}
>   bind_parms[:Title] = "Africa"
>   bind_parms[:Title2] = "Titantic"
>   ds = ds.where(Title: :$Title) # matches when it is the only the value
>   ds = ds.or(Sequel.like(:Title, :$Title2)) # matches when there is a
> value after this one
>   ds2 = ds.clone # to preserve the currently selected columns
>

Note that Dataset#clone is not needed, Dataset#clone with no arguments
returns self (datasets are immutable).


>   ds2.select { count.function.* } # change the selected columns to
> count(*)
>

I think you want ds2 = ds.select{ count.function.* } # ds2.select does not
modify receiver, datasets are immutable

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 sequel-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/CADGZSScbgTs1pS0%2BVAUaVfNJQi_QcuYYHmDQQkUxbw7Fwt2mxg%40mail.gmail.com.

Reply via email to