Missing %get-int in sql/generic-postgresql.lisp

"A. Mattox Beckman, Jr." <[email protected]> Tue, 20 Sep 2011 19:14:01 -0500
Newsgroups gmane.lisp.clsql.general
Message-ID <CADo-LBDMrULYBzEq0s4gtaV5E3Ee8Y3HWmB3wS4tJFs0kfRL+w@mail.gmail.com>
Hi all,

I'm relatively new to common lisp, and to cl-sql.  I was trying to
write a sample program (best way to learn is to write something) using
sequences and encountered the following error.  Here is a runtime with
Slime 2011-08-26, SBCL 1.0.45, and clsql form the git archive
as of 20110829.

; SLIME 2011-08-26:
CL-USER> (ql:quickload :clsql)
; Loading system definition from
; /home/mattox/quicklisp/dists/quicklisp/software/uffi-20101107-git/uffi.asd
; into #<PACKAGE "ASDF1">
; Registering #<SYSTEM "uffi">
To load "clsql":
  Load 1 ASDF system:
    clsql
; Loading "clsql"
......
(:CLSQL)
CL-USER> (use-package :clsql)
T
CL-USER> (connect '("localhost" "test" "mattox" "") :database-type :postgresql)
#<CLSQL-POSTGRESQL:POSTGRESQL-DATABASE localhost/test/mattox OPEN {100389A971}>
CL-USER> (create-sequence 'foo)
; No value
CL-USER> (sequence-next 'foo)

This causes the error:

The function CLSQL-SYS::%GET-INT is undefined.
   [Condition of type UNDEFINED-FUNCTION]


Looking around in the code, I found that the
sql/generic-postgresql.lisp file references %GET-INT, which is defined
in test/util.

(defun %get-int (v)
  (etypecase v
    (string (parse-integer v :junk-allowed t))
    (integer v)
    (number (truncate v))))

So, as a workaround, I put the function into
sql/generic-postgresql.lisp, and that solved my problem, so I thought
I would write it up in case someone else ran into this or in case I'm
missing something that would be obvious to more experienced lispers.

Cheers,
Mattox

-- 
A. Mattox Beckman, Jr.  <[email protected]>
-- "Those who would give up Essential Liberty to purchase a little
Temporary Safety, deserve neither Liberty nor Safety." - Benjamin
Franklin