[Special Characters][A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z]
ilike See like, ilike
Now using s-sql. Notice there are two ways. First directly setting the columns, using the :set keyword and alternating column names and values. This means that the :insert-into clause expects the arguments to :set to be in multiples of two. Odd arguments will trigger an error.
Notice that a list with two items is a single item, not a multiple of two. You can use sql-compile to deal with this. See this example from the mailing list.
The second method, without the :set keyword, uses :select, followed by values.
Postmodern has an update-dao and an insert-dao function. My tendency is to check and see if the dao that I'm currently dealing with has its primary key set (in which case I am editing an existing object and need to use update-dao. If not, then I'm dealing with a brand new object and will need to set the primary key and use the insert-dao method, using something like this:
The question was asked on the postmodern mailing list whether there is some way in S-SQL to generate INSERT INTO clauses with multiple rows, e.g. "INSERT INTO \"table\" (a, b) VALUES (10, 20), (30, 40)" ? Desired sexp format is `(:insert-into table :set a (10 20) b (30 40)),
The answer was that the functionality already exists, albeit undocumented.
Insert into does not cover all the use cases. You can either use it with a select form, as in:
or with set and alternating field names and values, as in:
Assume you have a plist where the keys are interned that you want to insert as a record. Consider the following:
That gives you the opportunity to generalize into something like this:
Intersect produces a result contain rows that appear on all the sub-selects.
Postmodern examples >