How to use clsql-sys:query in the function?

Discussion of Common Lisp

How to use clsql-sys:query in the function?

Postby nitinkapoor25 » Sat Feb 21, 2009 6:32 am

Hi,

Can anyone help to "clsql-sys:query" in the function. I had done the below but got the error message.

(defun output_query
(clsql-sys:query "select * from article_master"))


Error Message after compiling:
--------------------------------------------
Execution of a form compiled with errors.
Form:
(%DEFUN 'SELECT
(NAMED-LAMBDA SELECT (QUERY select * from article_master)
(BLOCK SELECT))
NIL 'NIL (SOURCE-LOCATION))
Compile-time error:
Required argument is not a symbol: "select * from article_master"
[Condition of type SB-INT:COMPILED-PROGRAM-ERROR]

Restarts:
0: [ABORT] Abort SLIME compilation.
1: [ABORT] Return to SLIME's top level.
2: [TERMINATE-THREAD] Terminate this thread (#<THREAD "worker" RUNNING {AC71731}>)

Backtrace:
0: (SB-FASL::LOAD-FASL-GROUP #<SB-SYS:FD-STREAM for "file /tmp/fileDoML7w.fasl" {ACC2AA1}>)
1: ((FLET SB-THREAD::WITH-RECURSIVE-LOCK-THUNK))
2: ((FLET #:WITHOUT-INTERRUPTS-BODY-[CALL-WITH-RECURSIVE-LOCK]508))
3: (SB-THREAD::CALL-WITH-RECURSIVE-LOCK #<CLOSURE (FLET SB-THREAD::WITH-RECURSIVE-LOCK-THUNK) {B600397D}> #S(SB-THREAD:MUTEX :NAME "big compiler lock" :%OWNER #<SB-THREAD:THREAD "worker" RUNNING {AC71731}> :STATE 1))
4: (SB-FASL::LOAD-AS-FASL #<SB-SYS:FD-STREAM for "file /tmp/fileDoML7w.fasl" {ACC2AA1}> NIL #<unavailable argument>)
5: ((FLET SB-FASL::LOAD-STREAM) #<SB-SYS:FD-STREAM for "file /tmp/fileDoML7w.fasl" {ACC2AA1}>)
6: (LOAD #P"/tmp/fileDoML7w.fasl")[:EXTERNAL]
7: ((LAMBDA (STRING &KEY SWANK-BACKEND::BUFFER POSITION DIRECTORY)) "(defun select
(clsql-sys:query \"select * from article_master\"))
" :BUFFER "query.lisp" :POSITION 29 :DIRECTORY "/home/administrator/")
8: ((LAMBDA NIL))
9: (SWANK::MEASURE-TIME-INTERVAL #<CLOSURE (LAMBDA NIL) {AC8B945}>)
10: (SWANK::SWANK-COMPILER #<CLOSURE (LAMBDA NIL) {AC8B945}>)
11: ((LAMBDA (SWANK-BACKEND::FN)) #<CLOSURE (LAMBDA NIL) {AC8B925}>)
12: (SWANK::CALL-WITH-BUFFER-SYNTAX #<CLOSURE (LAMBDA NIL) {AC8B925}>)
13: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SWANK:COMPILE-STRING-FOR-EMACS "(defun select
(clsql-sys:query \"select * from article_master\"))
" "query.lisp" 29 "/home/administrator/") #<NULL-LEXENV>)
14: ((LAMBDA NIL))
15: ((FLET #:FORM-FUN1570))
16: ((FLET #:FORM-FUN1570))
17: ((LAMBDA (SWANK-BACKEND::HOOK SWANK-BACKEND::FUN)) #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE (LAMBDA NIL) {AC89105}>)
18: ((LAMBDA NIL))
19: ((FLET #:FORM-FUN1570))
20: ((FLET #:FORM-FUN1570))
21: ((LAMBDA (SWANK-BACKEND::HOOK SWANK-BACKEND::FUN)) #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<FUNCTION (LAMBDA NIL) {B9ABE15}>)
22: (SWANK::CALL-WITH-REDIRECTED-IO #<SWANK::CONNECTION {B3AC001}> #<CLOSURE (LAMBDA NIL) {AC89025}>)
23: (SWANK::CALL-WITH-CONNECTION #<SWANK::CONNECTION {B3AC001}> #<FUNCTION (LAMBDA NIL) {B9ABE15}>)
24: (SWANK::HANDLE-REQUEST #<SWANK::CONNECTION {B3AC001}>)
25: (SWANK::CALL-WITH-BINDINGS NIL #<CLOSURE (LAMBDA NIL) {AC89005}>)
26: ((FLET SB-THREAD::WITH-MUTEX-THUNK))
27: ((FLET #:WITHOUT-INTERRUPTS-BODY-[CALL-WITH-MUTEX]477))
28: (SB-THREAD::CALL-WITH-MUTEX #<CLOSURE (FLET SB-THREAD::WITH-MUTEX-THUNK) {B6004215}> #S(SB-THREAD:MUTEX :NAME "thread result lock" :%OWNER #<SB-THREAD:THREAD "worker" RUNNING {AC71731}> :STATE 1) #<SB-THREAD:THREAD "worker" RUNNING {AC71731}> T)
29: ((LAMBDA NIL))
30: ("foreign function: #x8064EFC")
31: ("foreign function: #x8052D31")
32: ("foreign function: #x805C1AD")
33: ("foreign function: #xB7FBC50F")
nitinkapoor25
 
Posts: 11
Joined: Mon Jan 05, 2009 10:17 am

Re: How to use clsql-sys:query in the function?

Postby Harleqin » Sat Feb 21, 2009 7:13 am

You just forgot the parameter list for your defun:

Code: Select all
(defun output_query ()
  (clsql-sys:query "select * from article_master"))
"Just throw more hardware at it" is the root of all evil.
Svante
Harleqin
 
Posts: 71
Joined: Wed Dec 17, 2008 5:18 am
Location: Bonn, Germany

Re: How to use clsql-sys:query in the function?

Postby nitinkapoor25 » Sat Feb 21, 2009 8:23 am

thx buddy
nitinkapoor25
 
Posts: 11
Joined: Mon Jan 05, 2009 10:17 am


Return to Common Lisp

Who is online

Users browsing this forum: No registered users and 6 guests