From: ········@gmail.com
Subject: CLSQL: Stored Procedures?
Date: 
Message-ID: <1180140775.627278.55640@q69g2000hsb.googlegroups.com>
Looking through the user's manual of CLSQL, it doesn't look like there
is any facility to call stored procedures. Has anyone, in fact, built
anything on top of it that does so? Or is it (un)desirable to do so?
Working right now with SBCL 1.0.5 and MySQL 5.0.27.

Cheers,
JD

From: Vagif Verdi
Subject: Re: CLSQL: Stored Procedures?
Date: 
Message-ID: <1180146713.233638.294390@q19g2000prn.googlegroups.com>
if you want just execute stored procedure then
(execute-command "sp_bla 1, 2")

If your stored procedure returns table or single value then
(query "sp_bla 1, 2")
From: ········@gmail.com
Subject: Re: CLSQL: Stored Procedures?
Date: 
Message-ID: <1180147148.517598.297190@q75g2000hsh.googlegroups.com>
On May 25, 10:31 pm, Vagif Verdi <···········@gmail.com> wrote:
> if you want just execute stored procedure then
> (execute-command "sp_bla 1, 2")
>
> If your stored procedure returns table or single value then
> (query "sp_bla 1, 2")

I see, indirect support. Thanks.

Cheers,
JD
From: Pascal Bourguignon
Subject: Re: CLSQL: Stored Procedures?
Date: 
Message-ID: <87ejl4hyy5.fsf@thalassa.lan.informatimago.com>
········@gmail.com writes:

> On May 25, 10:31 pm, Vagif Verdi <···········@gmail.com> wrote:
>> if you want just execute stored procedure then
>> (execute-command "sp_bla 1, 2")
>>
>> If your stored procedure returns table or single value then
>> (query "sp_bla 1, 2")
>
> I see, indirect support. Thanks.

Well, what about:

(define-stored-procedure (name arglist &key stored-name gives-results)
  (let ((stored-name (or stored-name 
                        (substitute #\- #\_ (string-downcase name)))))
   `(defun name arglist
      (,(if gives-results 'query 'execute-command)
        ,@(com.informatimago.common-lisp.source-form:make-argument-list
           (com.informatimago.common-lisp.source-form:parse-lambda-list arglist))))))

So you can write:

(define-stored-procedure sp-blah (a b) :gives-result t)

(dolist (row (sp-blah 1 2))
   (print row))




-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

NOTE: The most fundamental particles in this product are held
together by a "gluing" force about which little is currently known
and whose adhesive power can therefore not be permanently
guaranteed.