[Cl-perec-devel] Troubles with cl-perec

Levente Mészáros levente.meszaros at gmail.com
Mon Jan 7 15:48:46 UTC 2008


On Jan 7, 2008 4:28 PM, Luís Oliveira <luismbo at gmail.com> wrote:
> Hello,
>
> I'm playing with cl-perec and cl-rdbms whose feature sets are
> impressive, but that unfortunately aren't working for me. I'm using
> PostgreSQL 8.2.5 from Darwin Ports and SBCL 1.0.12.15 (ppc). I'm
> pretty sure I have the latest stuff of everything (including the
> branches from cl-dwim) and I have wiped out all my fasls and started
> anew. So here's a small test case, taken from cl-perec website:
>
> CL-USER> (asdf:oos 'asdf:load-op :cl-perec)
> [...]
> NIL
> CL-USER> (asdf:oos 'asdf:load-op :cl-rdbms.postmodern)
> [...]
> NIL
> CL-USER> (asdf:oos 'asdf:load-op :cl-perec-test)
> [...]
> NIL
> PRCT> (setq *database*
>             (make-instance 'rdbms:postgresql-postmodern
> :connection-specification
>                      '(:database "rs" :user-name "rs" :password "rs")))
> #<POSTGRESQL-POSTMODERN {118AB229}>
> PRCT> (start-sql-recording)
> ; No value
> PRCT> (defpclass c1 ()
>         ((s1 :type string :initform "no" :initarg :s1 :accessor s1-of)))
> #<PERSISTENT-CLASS C1>
> PRCT> (with-transaction
>         (make-instance 'c1 :s1 "hello"))
> ; BEGIN
> ; SELECT relname FROM pg_class WHERE relkind = 'r'
> ; CREATE TABLE _c1 (_id BIGINT NOT NULL PRIMARY KEY, _s1 TEXT)
> WARNING:
>    Postgres warning: CREATE TABLE / PRIMARY KEY will create implicit
> index "_c1_pkey" for table "_c1"
> ; COMMIT
> ; BEGIN
> ; SELECT relname FROM pg_class WHERE relkind = 'S'
> ; CREATE SEQUENCE _instance_id
> ; SELECT NEXTVAL('_instance_id')
>
> Somewhere around here, I get this error:
>
> There is no applicable method for the generic function
>   #<STANDARD-GENERIC-FUNCTION CL-PEREC::CREATED-INSTANCES-OF (1)>
> when called with arguments
>   (#<#<STANDARD-CLASS NIL {146769C1}> :begin-executed-p #t {14663BF9}>).
>    [Condition of type SIMPLE-ERROR]
>
> ; COMMIT
> NIL
> T
> PRCT>
>
> Also, in this case I commited the transaction, had I not the
> _instance_id sequence wouldn't have been created but
> prc::*oid-instance-id-sequence-exists* would get set to T anyway and
> then I would get errors about _instance_id not existing.
>
> Any ideas?
Hi,

If you take a look at cl-perec-test.postgresql.asd:

(make-instance 'postgresql-postmodern
                                 :generated-transaction-class-name 'transaction
                                 :default-result-type 'vector
                                 :muffle-warnings t
                                 :transaction-mixin 'transaction-mixin
                                 :connection-specification
cl-perec-system::*test-database-connection-specification*)

where transaction-mixin is a class which contains the per transaction
instance cache. This class must be mixed into the RDBMS backend
specific transaction class. This is done by cl-rdbms when the
transaction is instantiated.

If you include the transaction-mixin class and the default-result-type
arguments then this problem should be solved. Let me know if there are
still issues.

levy

ps:  for a simple playground you may use (asdf:oos 'asdf:load-op
:cl-perec-test.postgresql) and have a database created at '(:host
"localhost" :database "perec-test" :user-name "perec-test" :password
"test123")

--
There's no perfectoin



More information about the cl-perec-devel mailing list