这是使用postmodern
.
这有效:
(sql (:INSERT-ROWS-INTO 'SCRAPE :COLUMNS 'TERM 'NAME 'ADDRESS :VALUES
'(("wine" "Bubba Wine & Spirits"
"1234 N San Fake Rd,")
("wine" "Wine Shop"
"123 Not Real Blvd,")
("wine" "Some Wine Group"
"777 S Does Not Exist Ave,"))))
回报:
"INSERT INTO scrape (term, name, address)
VALUES (E'wine', E'Bubba Wine & Spirits', E'1234 N San Fake Rd,'),
(E'wine', E'Wine Shop', E'123 Not Real Blvd,'),
(E'wine', E'Some Wine Group', E'777 S Does Not Exist Ave,')"
这不起作用:
(defvar *sql* '(:INSERT-ROWS-INTO 'SCRAPE :COLUMNS 'TERM 'NAME 'ADDRESS :VALUES
'(("wine" "Bubba Wine & Spirits"
"1234 N San Fake Rd,")
("wine" "Wine Shop"
"123 Not Real Blvd,")
("wine" "Some Wine Group"
"777 S Does Not Exist Ave,"))))
(sql *sql*)
这给了我:
Value (:INSERT-ROWS-INTO 'SCRAPE :COLUMNS 'TERM 'NAME 'ADDRESS
:VALUES
'(("wine" "Bubba Wine & Spirits"
"1234 N San Fake Rd,")
("wine" "Wine Shop" "123 Not Real Blvd,")
("wine" "Some Wine Group" "777 S Does Not Exist Ave,"))) can not be converted to an SQL literal.
[Condition of type SIMPLE-ERROR]
Restarts:
0: [ABORT] Exit debugger, returning to top level.
Backtrace:
0: ((SB-PCL::FAST-METHOD CL-POSTGRES:TO-SQL-STRING (T)) #<unavailable argument> #<unavailable argument> (:INSERT-ROWS-INTO 'SCRAPE :COLUMNS 'TERM 'NAME 'ADDRESS ...))
1: ((SB-PCL::FAST-METHOD SQL-ESCAPE (T)) #<unavailable argument> #<unavailable argument> (:INSERT-ROWS-INTO 'SCRAPE :COLUMNS 'TERM 'NAME 'ADDRESS ...))
2: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SQL *SQL*) #<NULL-LEXENV>)
3: (EVAL (SQL *SQL*))
4: (SB-EXT:INTERACTIVE-EVAL (SQL *SQL*) :EVAL NIL)
5: (SB-IMPL::REPL-FUN NIL)
6: ((LAMBDA () :IN SB-IMPL::TOPLEVEL-REPL))
7: (SB-IMPL::%WITH-REBOUND-IO-SYNTAX #<CLOSURE (LAMBDA # :IN SB-IMPL::TOPLEVEL-REPL) {BFC3BFD}>)
8: (SB-IMPL::TOPLEVEL-REPL NIL)
9: (SB-IMPL::TOPLEVEL-INIT)
10: ((FLET #:WITHOUT-INTERRUPTS-BODY-223764 :IN SB-EXT:SAVE-LISP-AND-DIE))
11: ((LABELS SB-IMPL::RESTART-LISP :IN SB-EXT:SAVE-LISP-AND-DIE))
所以我很明显搞砸了(sql *sql*)
,我一生都无法破译错误信息。