From marijnh at gmail.com Sat Mar 1 23:33:22 2008 From: marijnh at gmail.com (Marijn Haverbeke) Date: Sun, 2 Mar 2008 00:33:22 +0100 Subject: [postmodern-devel] Incompatible changes coming up Message-ID: Hello list, The next version of Postmodern, 1.10, will include a number of incompatible changes. I have started pushing these changes to the repository, so if you need a stable interface, you should be careful when fetching patches. The repository at http://common-lisp.net/project/postmodern/darcs/postmodern-old holds only backwards-compatible changes. After 1.10 has been properly released and declared stable, I will stop supporting the old interface -- the changes are not that big, and I am too lazy to support multiple branches. So consider yourself warned ;) Cheers, Marijn From marijnh at gmail.com Fri Mar 7 21:59:04 2008 From: marijnh at gmail.com (Marijn Haverbeke) Date: Fri, 7 Mar 2008 22:59:04 +0100 Subject: [postmodern-devel] Re: Incompatible changes coming up In-Reply-To: References: Message-ID: Hi list, I hope I haven't made anyone too nervous by announcing upcoming incompatible changes. I have pushed a lot of patches the past week and I think that, except for some low-level CL-postgres issues, things are now pretty much as they should be. If you are not using the DAO interface, the changes will be largely irrelevant to you. Based on problems people on this list were having, and some stuff we ran into at Streamtech, I have revised the DAO interface to rely more on the MOP and less on macros. It should be more flexible now. You can read about it by pulling the updated documentation from the repository -- there's even a short migration guide: http://common-lisp.net/cgi-bin/darcsweb/darcsweb.cgi?r=postmodern-postmodern;a=headblob;f=/doc/migrating-to-1.10.html I would very much appreciate it if some people were to try out the new interface, and tell me what they think. There are probably some bugs in there -- the code uses a few rather dubious MOP tricks -- but on all major implementation that I could test (I couldn't get ECL to work on my Ubuntu system, for some reason) the basic stuff worked fine. Cheers, Marijn From attila.lendvai at gmail.com Sun Mar 16 17:17:02 2008 From: attila.lendvai at gmail.com (Attila Lendvai) Date: Sun, 16 Mar 2008 18:17:02 +0100 Subject: [postmodern-devel] postmodern integration Message-ID: dear lists, i've pushed changes into our local-time branch that contains an asdf-system-connection to cl-postgres: darcs pull http://www.common-lisp.net/project/cl-dwim/darcs/local-time Daniel, if you don't mind the extra dependency then please push it into the official. now it's possible to use postmodern so that it returns local-time values and at the same time does not interfere with other softwares that use its simple-date lib. the approach is similar to cl's readtables: (defparameter *custom-sql-readtable* (local-time:set-local-time-cl-postgres-readers (cl-postgres:copy-sql-readtable))) (let ((cl-postgres:*sql-readtable* *custom-sql-readtable*)) (cl-postgres:exec-prepared ...)) at the time of writing our postmodern branch contains a few extra patches. Marijn, please take a look at them and push to the official if you have no concerns with it. darcs pull http://www.common-lisp.net/project/cl-dwim/darcs/postmodern/ -- attila -------------- next part -------------- An HTML attachment was scrubbed... URL: From marijnh at gmail.com Sun Mar 16 17:51:47 2008 From: marijnh at gmail.com (Marijn Haverbeke) Date: Sun, 16 Mar 2008 18:51:47 +0100 Subject: [postmodern-devel] Re: [local-time-devel] postmodern integration In-Reply-To: References: Message-ID: Hi, I've taken over most of the patches from Attila's repo, except that registering readers for the 'timestamp with timezone' type is done with a different argument (:timestamp-with-timezone) to set-sql-datetime-readers, instead of being rolled into :timestamp. Cheers, Marijn From mikko.ahonen at iki.fi Tue Mar 18 17:36:11 2008 From: mikko.ahonen at iki.fi (Mikko Ahonen) Date: Tue, 18 Mar 2008 19:36:11 +0200 Subject: [postmodern-devel] Unbound slots on nullable values? Message-ID: <13c0bb3b0803181036s4987f96bm544eab02180d7aca@mail.gmail.com> Hello, I am new to the list, so please forgive me if this is a stupid user error. Am I doing something wrong or is there a bug in how postmodern handles non-null fields? Even very simple dao reports that slot is unbound although according table-description value may be NULL. This is the message I get: The slot TRX is unbound in the object #. I run - Postgres 8.3 - OS X Leopard 10.5.2 - SBCL 1.0.7 - I installed latest postmodern today. I attached output below. Best regards, Mikko Ahonen -- (asdf:oos 'asdf:load-op :postmodern) (use-package :postmodern) ; loading system definition from ; /usr/local/lib/sbcl/site-systems/postmodern.asd into # ; registering # as POSTMODERN ; registering # as POSTMODERN-TESTS ; loading system definition from ; /usr/local/lib/sbcl/site-systems/bordeaux-threads.asd into # ; registering # as BORDEAUX-THREADS ; registering # as ; BORDEAUX-THREADS-TEST ; loading system definition from /usr/local/lib/sbcl/site-systems/s-sql.asd ; into # ; registering # as S-SQL ; loading system definition from ; /usr/local/lib/sbcl/site-systems/simple-date.asd into # ; registering # as SIMPLE-DATE ; registering # as SIMPLE-DATE-TESTS ; loading system definition from ; /usr/local/lib/sbcl/site-systems/cl-postgres.asd into # ; registering # as CL-POSTGRES ; registering # as CL-POSTGRES-TESTS ; loading system definition from ; /usr/local/lib/sbcl/site-systems/trivial-utf-8.asd into # ; registering # as TRIVIAL-UTF-8 ; registering # as TRIVIAL-UTF-8-TESTS ; loading system definition from ; /usr/local/lib/sbcl/site-systems/ieee-floats.asd into # ; registering # as IEEE-FLOATS ; registering # as IEEE-FLOATS-TESTS ; loading system definition from /usr/local/lib/sbcl/site-systems/usocket.asd ; into # ; registering # as USOCKET ; loading system definition from ; /usr/local/lib/sbcl/site-systems/split-sequence.asd into # ; registering # as SPLIT-SEQUENCE ; loading system definition from /usr/local/lib/sbcl/site-systems/md5.asd into ; # ; registering # as MD5 WARNING: Either there is no Bordeaux-threads support for your implementation, or your implementation does not support threads therefore some features may not work. Feel free to implement it, or bug one of the maintainers to do so if your lisp supports threads at all. STYLE-WARNING: implicitly creating new generic function SOCKET-ACCEPT NIL * T (defparameter *db* "foobar") *DB* (defparameter *db-user* "mikko") *DB-USER* (defparameter *db-pwd* "") *DB-PWD* (defparameter *db-host* "localhost") *DB-HOST* * (connect-toplevel *db* *db-user* *db-pwd* *db-host*) (deftable koe () ((data-id :type integer :initarg :data-id :accessor data-id) (ver :type (or integer db-null) :initarg :ver :accessor ver) (trx :type (or integer db-null) :initarg :trx :accessor trx)) (:class-name koe) (:indices data-id)) * (drop-table 'koe) NIL * (create-table 'koe) WARNING: Postgres warning: CREATE TABLE / PRIMARY KEY will create implicit index "koe_pkey" for table "koe" NIL * (make-instance 'koe :data-id 1 :ver 3) # * (table-description 'koe) (("data_id" "int4" NIL) ("ver" "int4" T) ("trx" "int4" T)) * (make-instance 'koe :data-id 1 :ver 3) # * (save-dao *) debugger invoked on a UNBOUND-SLOT: The slot TRX is unbound in the object #. Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL. restarts (invokable by number or by possibly-abbreviated name): 0: [USE-VALUE ] Return a value as the slot-value. 1: [STORE-VALUE] Store and return a value as the slot-value. 2: [ABORT ] Exit debugger, returning to top level. ((SB-PCL::FAST-METHOD SLOT-UNBOUND (T T T)) # # # # TRX) 0] 2 From ryan at acceleration.net Tue Mar 18 17:57:33 2008 From: ryan at acceleration.net (Ryan Davis) Date: Tue, 18 Mar 2008 13:57:33 -0400 Subject: [postmodern-devel] Unbound slots on nullable values? In-Reply-To: <13c0bb3b0803181036s4987f96bm544eab02180d7aca@mail.gmail.com> References: <13c0bb3b0803181036s4987f96bm544eab02180d7aca@mail.gmail.com> Message-ID: <47E0028D.9060306@acceleration.net> If you want trx to be null by default, try changing the slot definition: (trx :type (or integer db-null) :initarg :trx :accessor trx :initform nil) HTH, Ryan Davis Acceleration.net Director of Programming Services 2831 NW 41st street, suite B Gainesville, FL 32606 Office: 352-335-6500 x 124 Fax: 352-335-6506 Mikko Ahonen wrote: > Hello, > > I am new to the list, so please forgive me if this is a stupid user error. > > Am I doing something wrong or is there a bug in how postmodern handles > non-null fields? > > Even very simple dao reports that slot is unbound although according > table-description value may be NULL. > > This is the message I get: > > The slot TRX is unbound in the object #. > > I run > - Postgres 8.3 > - OS X Leopard 10.5.2 > - SBCL 1.0.7 > - I installed latest postmodern today. > > I attached output below. > > Best regards, > > Mikko Ahonen > > -- > > (asdf:oos 'asdf:load-op :postmodern) > (use-package :postmodern) > > ; loading system definition from > ; /usr/local/lib/sbcl/site-systems/postmodern.asd into # > ; registering # as POSTMODERN > ; registering # as POSTMODERN-TESTS > ; loading system definition from > ; /usr/local/lib/sbcl/site-systems/bordeaux-threads.asd into # > ; registering # as BORDEAUX-THREADS > ; registering # as > ; BORDEAUX-THREADS-TEST > ; loading system definition from /usr/local/lib/sbcl/site-systems/s-sql.asd > ; into # > ; registering # as S-SQL > ; loading system definition from > ; /usr/local/lib/sbcl/site-systems/simple-date.asd into # > ; registering # as SIMPLE-DATE > ; registering # as SIMPLE-DATE-TESTS > ; loading system definition from > ; /usr/local/lib/sbcl/site-systems/cl-postgres.asd into # > ; registering # as CL-POSTGRES > ; registering # as CL-POSTGRES-TESTS > ; loading system definition from > ; /usr/local/lib/sbcl/site-systems/trivial-utf-8.asd into # > ; registering # as TRIVIAL-UTF-8 > ; registering # as TRIVIAL-UTF-8-TESTS > ; loading system definition from > ; /usr/local/lib/sbcl/site-systems/ieee-floats.asd into # > ; registering # as IEEE-FLOATS > ; registering # as IEEE-FLOATS-TESTS > ; loading system definition from /usr/local/lib/sbcl/site-systems/usocket.asd > ; into # > ; registering # as USOCKET > ; loading system definition from > ; /usr/local/lib/sbcl/site-systems/split-sequence.asd into # > ; registering # as SPLIT-SEQUENCE > ; loading system definition from /usr/local/lib/sbcl/site-systems/md5.asd into > ; # > ; registering # as MD5 > WARNING: Either there is no Bordeaux-threads support for your > implementation, or your implementation does not support threads > therefore some features may not work. Feel free to implement it, or > bug one of the maintainers to do so if your lisp supports threads at > all. > STYLE-WARNING: implicitly creating new generic function SOCKET-ACCEPT > NIL > * > T > (defparameter *db* "foobar") > > *DB* > (defparameter *db-user* "mikko") > > *DB-USER* > (defparameter *db-pwd* "") > > *DB-PWD* > (defparameter *db-host* "localhost") > > > *DB-HOST* > * (connect-toplevel *db* *db-user* *db-pwd* *db-host*) > > (deftable koe () > ((data-id :type integer :initarg :data-id :accessor data-id) > (ver :type (or integer db-null) :initarg :ver :accessor ver) > (trx :type (or integer db-null) :initarg :trx :accessor trx)) > > (:class-name koe) > (:indices data-id)) > > * (drop-table 'koe) > > NIL > * (create-table 'koe) > WARNING: > Postgres warning: CREATE TABLE / PRIMARY KEY will create implicit > index "koe_pkey" for table "koe" > > NIL > * (make-instance 'koe :data-id 1 :ver 3) > > # > * (table-description 'koe) > > (("data_id" "int4" NIL) ("ver" "int4" T) ("trx" "int4" T)) > * (make-instance 'koe :data-id 1 :ver 3) > > # > * (save-dao *) > > debugger invoked on a UNBOUND-SLOT: > The slot TRX is unbound in the object #. > > Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL. > > restarts (invokable by number or by possibly-abbreviated name): > 0: [USE-VALUE ] Return a value as the slot-value. > 1: [STORE-VALUE] Store and return a value as the slot-value. > 2: [ABORT ] Exit debugger, returning to top level. > > ((SB-PCL::FAST-METHOD SLOT-UNBOUND (T T T)) > # > # > # > # > TRX) > 0] 2 > _______________________________________________ > postmodern-devel mailing list > postmodern-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel > > From marijnh at gmail.com Tue Mar 18 18:43:45 2008 From: marijnh at gmail.com (Marijn Haverbeke) Date: Tue, 18 Mar 2008 19:43:45 +0100 Subject: [postmodern-devel] Unbound slots on nullable values? In-Reply-To: <13c0bb3b0803181036s4987f96bm544eab02180d7aca@mail.gmail.com> References: <13c0bb3b0803181036s4987f96bm544eab02180d7aca@mail.gmail.com> Message-ID: Hello Mikko, As Ryan mentioned, you have to use (:or db-null integer) to specify a regular integer field, since it will default to "NOT NULL". Also, if you are just starting to use the library, it is probably a better idea to get the current code from the darcs repository -- I'm about to release a new version with a slightly changed interface, and one of the changes is that the defclass macro is replaced by a dao-class metaclass, which handles unbound slots in a much nicer way. The repository contains docs which are updated for that version, and is not expected to change much before the 1.10 release. (I don't usually break backwards compatibility, but there were a few issues that required cleaning up, so 1.10 will.) On the subject of 1.10 -- has anyone apart from Attila tried the current code yet? Cheers, Marijn From mikko.ahonen at iki.fi Tue Mar 18 22:14:11 2008 From: mikko.ahonen at iki.fi (Mikko Ahonen) Date: Wed, 19 Mar 2008 00:14:11 +0200 Subject: [postmodern-devel] Unbound slots on nullable values? In-Reply-To: References: <13c0bb3b0803181036s4987f96bm544eab02180d7aca@mail.gmail.com> Message-ID: <13c0bb3b0803181514u365756b1hfaae886c7e5bd014@mail.gmail.com> Hello, Actually my definition had (:or integer db-null), but Ryan's suggestion made sense, as he recommended me to use :initform to define default NULL values for fields which I do not want to define manually. I think just documenting this behavior is fine. If the doc would say something like "all fields must have value when saving object, if you want to have NULL value, please use :initform to set it to NULL by default" it would be OK. Ryan's tip led me to the solution, but with a twist: "nil" should be ":null". "nil" is parsed (at least for SQL integers but probably others) into boolean value false, while ":null" to NULL. I also had some problems with deftable with long (over 80 characters long) lines. I will try the darcs version. Thanks for the help! Best regards, Mikko Ahonen On Tue, Mar 18, 2008 at 8:43 PM, Marijn Haverbeke wrote: > Hello Mikko, > > As Ryan mentioned, you have to use (:or db-null integer) to specify a > regular integer field, since it will default to "NOT NULL". Also, if > you are just starting to use the library, it is probably a better idea > to get the current code from the darcs repository -- I'm about to > release a new version with a slightly changed interface, and one of > the changes is that the defclass macro is replaced by a dao-class > metaclass, which handles unbound slots in a much nicer way. The > repository contains docs which are updated for that version, and is > not expected to change much before the 1.10 release. (I don't usually > break backwards compatibility, but there were a few issues that > required cleaning up, so 1.10 will.) > > On the subject of 1.10 -- has anyone apart from Attila tried the > current code yet? > > Cheers, > Marijn > > > _______________________________________________ > postmodern-devel mailing list > postmodern-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel > From marijnh at gmail.com Wed Mar 19 21:28:21 2008 From: marijnh at gmail.com (Marijn Haverbeke) Date: Wed, 19 Mar 2008 22:28:21 +0100 Subject: [postmodern-devel] Release 1.10 Message-ID: Hello list, After a lot of bad noise about incompatible changes and a spectacular new DAO system, I now present to you version 1.10 of postmodern. Please take a look -- And do not be afraid to port your code: one large system has already been ported with very little pain. Changes in the interface have turned out to be rather minor. The one subtle point that might bite you is the the way DAO objects are now initialized and saved, so you might want to closely read that part of the documentation. The good news is that the new way things work makes a lot more sense, and is less prone to break down for strange tables and exceptional situations. (Feedback is still appreciated, of course.) Regards, Marijn From gavindscott at gmail.com Sun Mar 30 02:57:49 2008 From: gavindscott at gmail.com (Gavin Scott) Date: Sat, 29 Mar 2008 21:57:49 -0500 Subject: [postmodern-devel] dao and *escape-sql-names-p* Message-ID: Hello, It appears that setting *escape-sql-names-p* breaks dao objects a bit. If it is t when defclass is called, calling get-dao on that class will result in an error from build-row-reader like "Field field does not exist in table class TABLE-CLASS", even though field does indeed exist. This is because slot-sql-name will return a quoted copy of the field name due to *escape-sql-names-p*. A fix is to change direct-column-slot's shared-initialize method to use s-sql:make-sql-name rather than to-sql-name; make-sql-name doesn't quote the column name. However, make-sql-name would then need to be exported by s-sql. A somewhat related issue is that the dao documentation example: http://common-lisp.net/project/postmodern/postmodern.html#daos (defclass user () ... ) has problems if *escape-sql-names-p* is not set since user is an sql keyword. I personally would prefer to see *escape-sql-names-p* set as the default, which would fix this issue. Another solution would be to pick a different example class name or to set *escape-sql-names-p*. Thanks, Gavin Scott gavindscott at gmail.com From marijnh at gmail.com Sun Mar 30 11:53:53 2008 From: marijnh at gmail.com (Marijn Haverbeke) Date: Sun, 30 Mar 2008 13:53:53 +0200 Subject: [postmodern-devel] dao and *escape-sql-names-p* In-Reply-To: References: Message-ID: Hi Gavin, Thanks for the report. I have made the following changes: to-sql-name now takes an optional second argument that overrides *escape-sql-names-p*, and the row-reader builder for DAO classes passes NIL when determining the names of rows. As for the user table -- I guess you caught me at not testing my own examples ;). I did run it through S-SQL, but not through the database. I have added a (possibly somewhat over-engineered) feature to solve this without turning on escaping for every single identifier: S-SQL now has a table of reserved words, and when *escape-sql-names-p* is :auto (the new default), it will escape those words when it comes across them. Let me know how this works for you. If there are no problems, I guess I'll do another release (since the get-dao issue is really rather bad). Cheers, Marijn From gavindscott at gmail.com Sun Mar 30 19:34:36 2008 From: gavindscott at gmail.com (Gavin Scott) Date: Sun, 30 Mar 2008 14:34:36 -0500 Subject: [postmodern-devel] dao and *escape-sql-names-p* In-Reply-To: References: Message-ID: That was fast! Your changes work for me. The *escape-sql-names-p* :auto solution looks like the best of both worlds, I wouldn't call it over-engineered ;-) Thanks, Gavin Scott gavindscott at gmail.com