         [ dup column-name>> 0% 2, ] interleave
 
         " from " 0% 0%
-        dupd
-        [ slot-name>> swap get-slot-named ] with filter
-        dup empty? [ 2drop ] [ where-clause ] if ";" 0%
+        where-clause
     ] query-make ;

    "(" 0% call ")" 0% ; inline

M: interval where ( spec obj -- )
    dup [ from>> ] [ to>> ] bi
    [ first fp-infinity? ] bi@ and [
        2drop
        " 1 = 1 " 0% ! dummy
    ] [
        [
            [ from>> "from" where-interval ] [
                nip [ from>> ] [ to>> ] bi
                [ first fp-infinity? ] bi@ or [ " and " 0% ] unless
            ] [ to>> "to" where-interval ] 2tri
        ] in-parens
    ] if ;

M: sequence where ( spec obj -- )
    [


: query-make ( class quot -- )
    >r sql-props r>
    [ 0 sql-counter rot with-variable ";" 0% ] { "" { } { } } nmake
    <simple-statement> maybe-make-retryable ; inline

M: db begin-transaction ( -- ) "BEGIN" sql-command ;
