chicken-janitors
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-janitors] Re: #180: pandora egg depends on sqlite3 egg


From: Chicken Trac
Subject: [Chicken-janitors] Re: #180: pandora egg depends on sqlite3 egg
Date: Sat, 20 Mar 2010 19:27:31 -0000

#180: pandora egg depends on sqlite3 egg
-------------------------+--------------------------------------------------
 Reporter:  syn          |       Owner:  chust
     Type:  defect       |      Status:  new  
 Priority:  minor        |   Milestone:  4.5.0
Component:  extensions   |     Version:  4.3.x
 Keywords:  pandora egg  |  
-------------------------+--------------------------------------------------

Comment(by mario):

 Hi Thomas

 Replying to [comment:2 chust]:
 > The main reason for this dependency is that being able to test the code
 of Pandora requires an easy to setup database backend.

 You can use .meta's {{{test-depends}}} just like {{{needs}}}, but
 exclusively for tests.


 > I'm undecided whether it would be better to move the SQLite3 and
 PostgreSQL backends of Pandora out into their own eggs entirely and leave
 the Pandora base code without automated tests. It would make the
 installation somewhat more complex and tests of the base code would be
 moved into the backends where they don't really belong. However, it would
 also make the separation of the base and backend code cleaner and remove
 the necessity to include copies of import libraries for the database eggs,
 which is a somewhat questionable practice.

 I had this problem for [http://chicken.wiki.br/eggref/4/awful awful] too.
 I ended up defining some database-related parameters in awful and creating
 database-related eggs (e.g., [http://chicken.wiki.br/eggref/4/awful-
 sqlite3 awful-sqlite3] which set those parameters.  It's not an ideal
 solution either, but it works.

 For awful it was easy because it doesn't require much of the database egg
 API.  Basically, connection, disconnection and query procedures.

 For example, awful defines the following parameters:

 {{{
 ;; db-support parameters (set by awful-<db> eggs)
 (define missing-db-msg "Database access is not enabled (see `enable-
 db').")
 (define db-inquirer (make-parameter (lambda (query) (error '$db missing-
 db-msg))))
 (define db-connect (make-parameter (lambda (credentials) (error 'db-
 connect missing-db-msg))))
 (define db-disconnect (make-parameter (lambda (connection) (error 'db-
 disconnect missing-db-msg))))
 (define sql-quoter (make-parameter (lambda args (error 'sql-quote missing-
 db-msg))))
 (define db-make-row-obj (make-parameter (lambda (q) (error '$db-row-obj
 missing-db-msg))))
 }}}

 The database support eggs then just set the parameters to the actual
 procedures. If users want to use awful+postgresql, they {{{(use awful
 awful-postgresql)}}}.  If they want sqlite3, {{{(use awful awful-
 sqlite3)}}} and so on.

 It's kind of awful, but it works. :-)

 Hope it helps somehow.

-- 
Ticket URL: <http://www.irp.oist.jp/trac/chicken/ticket/180#comment:3>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]