[postmodern-devel] [S-SQL] Multiple rows in INSERT INTO clause
Is there 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)), transformation can work like a MAPCAR: stop processing values sequences as soon as the end of the shortest one is reached. The reason to have such a feature is a performance issue: having a sequence of rows to be inserted we want to minimize the overhead related with sending queries to db; one query inserting, say, 50 rows is certainly faster than 50 queries each inserting 1 row. I would prepare the patch myself, but the syntax of s-sql.lisp is a bit too tricky for me :(. -- Timur Sufiev -- Timur Sufiev
On Tue, 25 Aug 2009 14:12:30 +0400 Timur Sufiev <tsufiev@gmail.com> wrote:
Is there 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 functionality already exists, albeit undocumented. (:insert-rows-into 'table :columns 'a 'b :values '((10 20) (30 40))) -- Daniel White
Is there 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 functionality already exists, albeit undocumented.
(:insert-rows-into 'table :columns 'a 'b :values '((10 20) (30 40)))
-- Daniel White Thanks, Daniel! -- Timur Sufiev
participants (2)
-
Daniel White
-
Timur Sufiev