From zaries at global.co.za Wed Nov 4 16:15:58 2009 From: zaries at global.co.za (Phil Marneweck) Date: Wed, 04 Nov 2009 18:15:58 +0200 Subject: [postmodern-devel] Date Problem Message-ID: <1257351358.1780.25.camel@scatha> I get different date formats back from a postmodern query at different times. I am using SBCL 1.0.31.32 and the latest (as of the weekend) from clbuild. The steps. 1. I delete all my .fasl files for a project 2. I do a require for the project to load and compile 3. I run a query/function and I get the correct "date" data back => # 4. I close emacs and re-open it 5. I do a require of the project to load 6. I run a query/function and I get incorrect "date" data back => 3439756800 Any ideas? From marijnh at gmail.com Wed Nov 4 19:01:06 2009 From: marijnh at gmail.com (Marijn Haverbeke) Date: Wed, 4 Nov 2009 20:01:06 +0100 Subject: [postmodern-devel] Date Problem In-Reply-To: <1257351358.1780.25.camel@scatha> References: <1257351358.1780.25.camel@scatha> Message-ID: I guess you are using simple-date. If simple-date gets loaded after cl-postgres, it registers itself as the preferred date format. If it gets loaded before, nothing happens. That probably explains the strangeness. There is an extra system, :simple-date-postgres-glue, defined in simple-date.asd, which can be loaded to ensure the glue code is used. Does clbuild pull from the repository, or load the latest released version? From zaries at global.co.za Wed Nov 4 21:03:31 2009 From: zaries at global.co.za (Phil Marneweck) Date: Wed, 04 Nov 2009 23:03:31 +0200 Subject: [postmodern-devel] Date Problem In-Reply-To: References: <1257351358.1780.25.camel@scatha> Message-ID: <1257368611.12446.75.camel@scatha> clbuild pulls from darcs. Ok thanx I got it to work now. Just as a note to anybody else that might find this one day, if you use the defsystem depends-on to load systems then remeber that it loads them in the reverse order of what you give. That took me a couple of tries to figure out lol. Thank you for the assistance it is much appreciated. On Wed, 2009-11-04 at 20:01 +0100, Marijn Haverbeke wrote: > I guess you are using simple-date. If simple-date gets loaded after > cl-postgres, it registers itself as the preferred date format. If it > gets loaded before, nothing happens. That probably explains the > strangeness. There is an extra system, :simple-date-postgres-glue, > defined in simple-date.asd, which can be loaded to ensure the glue > code is used. > > Does clbuild pull from the repository, or load the latest released version? > > _______________________________________________ > postmodern-devel mailing list > postmodern-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel From zaries at global.co.za Fri Nov 6 16:33:06 2009 From: zaries at global.co.za (Phil Marneweck) Date: Fri, 06 Nov 2009 18:33:06 +0200 Subject: [postmodern-devel] Exlcuding slots dao-save In-Reply-To: <1256638317.32153.181.camel@scatha> References: <1256485507.32153.9.camel@scatha> <1256491061.32153.42.camel@scatha> <1256494147.32153.74.camel@scatha> <1256508729.32153.78.camel@scatha> <1256543487.32153.97.camel@scatha> <1256637129.32153.172.camel@scatha> <1256638317.32153.181.camel@scatha> Message-ID: <1257525186.1796.159.camel@scatha> > On Sun, 2009-10-25 at 17:17 +0100, Marijn Haverbeke wrote: > ..... Do you want extra slots in the > object that don't correspond to db columns? Then just don't give them > any Postmodern-specific options, and they will be normal slots. This does not seem to be true for me. But then again I could be defining the class wrong (my knowledge of clos is very limited). Using update-dao I get : SIMPLE-ERROR: There is no applicable method for the generic function # when called with arguments (#). The class: (defclass employee () ((id :accessor employee-id :col-type integer) (first-name :initarg :first-name :accessor first-name :col-type string) (last-name :initarg :last-name :accessor last-name :col-type string) (age :initarg :age :accessor age :col-type integer) (address-id :initarg :address-id :accessor employee-address-id :col-type integer ) (company-id :initarg :company-id :accessor employee-company-id :col-type integer ) (address :accessor employee-address :initform (make-instance 'address) :type address ) (company :accessor employee-company :type company ) ) From marijnh at gmail.com Fri Nov 6 16:55:20 2009 From: marijnh at gmail.com (Marijn Haverbeke) Date: Fri, 6 Nov 2009 17:55:20 +0100 Subject: [postmodern-devel] Exlcuding slots dao-save In-Reply-To: <1257525186.1796.159.camel@scatha> References: <1256485507.32153.9.camel@scatha> <1256494147.32153.74.camel@scatha> <1256508729.32153.78.camel@scatha> <1256543487.32153.97.camel@scatha> <1256637129.32153.172.camel@scatha> <1256638317.32153.181.camel@scatha> <1257525186.1796.159.camel@scatha> Message-ID: Your class definition does not contain a :metaclass clause. From zaries at global.co.za Fri Nov 6 17:28:08 2009 From: zaries at global.co.za (Phil Marneweck) Date: Fri, 06 Nov 2009 19:28:08 +0200 Subject: [postmodern-devel] Exlcuding slots dao-save In-Reply-To: References: <1256485507.32153.9.camel@scatha> <1256494147.32153.74.camel@scatha> <1256508729.32153.78.camel@scatha> <1256543487.32153.97.camel@scatha> <1256637129.32153.172.camel@scatha> <1256638317.32153.181.camel@scatha> <1257525186.1796.159.camel@scatha> Message-ID: <1257528488.1796.209.camel@scatha> Sorry it is there I just missed it in the cut and paste... On Fri, 2009-11-06 at 17:55 +0100, Marijn Haverbeke wrote: > Your class definition does not contain a :metaclass clause. > > _______________________________________________ > postmodern-devel mailing list > postmodern-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel From zaries at global.co.za Fri Nov 6 17:33:09 2009 From: zaries at global.co.za (Phil Marneweck) Date: Fri, 06 Nov 2009 19:33:09 +0200 Subject: [postmodern-devel] Exlcuding slots dao-save In-Reply-To: <1257525186.1796.159.camel@scatha> References: <1256485507.32153.9.camel@scatha> <1256491061.32153.42.camel@scatha> <1256494147.32153.74.camel@scatha> <1256508729.32153.78.camel@scatha> <1256543487.32153.97.camel@scatha> <1256637129.32153.172.camel@scatha> <1256638317.32153.181.camel@scatha> <1257525186.1796.159.camel@scatha> Message-ID: <1257528789.1796.215.camel@scatha> Some additional info: address and company are dao classes as well The idea is eventually(by tommorrow some time) to be able to update the child classes as well in the weblocks postmodern store I am working on. But for now I am just trying to get the main class to update. I dont know if some thing like updating the child classes from the main class could have value for postmodern itself. Any comments or suggestions would be most welcome. On Fri, 2009-11-06 at 18:33 +0200, Phil Marneweck wrote: > > On Sun, 2009-10-25 at 17:17 +0100, Marijn Haverbeke wrote: > > ..... Do you want extra slots in the > > object that don't correspond to db columns? Then just don't give them > > any Postmodern-specific options, and they will be normal slots. > > This does not seem to be true for me. But then again I could be defining > the class wrong (my knowledge of clos is very limited). > > Using update-dao I get : > > SIMPLE-ERROR: There is no applicable method for the generic function > # when called with > arguments (#). > > The class: > > (defclass employee () > ((id :accessor employee-id > :col-type integer) > (first-name :initarg :first-name > :accessor first-name > :col-type string) > (last-name :initarg :last-name > :accessor last-name > :col-type string) > (age :initarg :age > :accessor age > :col-type integer) > (address-id :initarg :address-id > :accessor employee-address-id > :col-type integer > ) > (company-id :initarg :company-id > :accessor employee-company-id > :col-type integer > ) > (address :accessor employee-address > :initform (make-instance 'address) > :type address > ) > (company :accessor employee-company > :type company > ) > ) > > > > > > From marijnh at gmail.com Fri Nov 6 17:56:08 2009 From: marijnh at gmail.com (Marijn Haverbeke) Date: Fri, 6 Nov 2009 18:56:08 +0100 Subject: [postmodern-devel] Exlcuding slots dao-save In-Reply-To: <1257528488.1796.209.camel@scatha> References: <1256485507.32153.9.camel@scatha> <1256543487.32153.97.camel@scatha> <1256637129.32153.172.camel@scatha> <1256638317.32153.181.camel@scatha> <1257525186.1796.159.camel@scatha> <1257528488.1796.209.camel@scatha> Message-ID: On Fri, Nov 6, 2009 at 6:28 PM, Phil Marneweck wrote: > Sorry it is there I just missed it in the cut and paste... Ah. Did you also leave out the :keys declaration? You need a primary key to be able to update. From zaries at global.co.za Fri Nov 6 18:02:03 2009 From: zaries at global.co.za (Phil Marneweck) Date: Fri, 06 Nov 2009 20:02:03 +0200 Subject: [postmodern-devel] Exlcuding slots dao-save In-Reply-To: References: <1256485507.32153.9.camel@scatha> <1256543487.32153.97.camel@scatha> <1256637129.32153.172.camel@scatha> <1256638317.32153.181.camel@scatha> <1257525186.1796.159.camel@scatha> <1257528488.1796.209.camel@scatha> Message-ID: <1257530523.1796.227.camel@scatha> Ah..that was the problem...sorry to be posting with such simple mistake..I just had to many versions of the class as I tried different things today...the key got lost on the way...*blush* On Fri, 2009-11-06 at 18:56 +0100, Marijn Haverbeke wrote: > On Fri, Nov 6, 2009 at 6:28 PM, Phil Marneweck wrote: > > Sorry it is there I just missed it in the cut and paste... > > Ah. Did you also leave out the :keys declaration? You need a primary > key to be able to update. > > _______________________________________________ > 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 Fri Nov 6 18:08:28 2009 From: marijnh at gmail.com (Marijn Haverbeke) Date: Fri, 6 Nov 2009 19:08:28 +0100 Subject: [postmodern-devel] Exlcuding slots dao-save In-Reply-To: <1257530523.1796.227.camel@scatha> References: <1256485507.32153.9.camel@scatha> <1256637129.32153.172.camel@scatha> <1256638317.32153.181.camel@scatha> <1257525186.1796.159.camel@scatha> <1257528488.1796.209.camel@scatha> <1257530523.1796.227.camel@scatha> Message-ID: No problem! From zaries at global.co.za Sat Nov 7 15:30:42 2009 From: zaries at global.co.za (Phil Marneweck) Date: Sat, 07 Nov 2009 17:30:42 +0200 Subject: [postmodern-devel] Postmodern Store for Weblocks In-Reply-To: References: <1256485507.32153.9.camel@scatha> <1256637129.32153.172.camel@scatha> <1256638317.32153.181.camel@scatha> <1257525186.1796.159.camel@scatha> <1257528488.1796.209.camel@scatha> <1257530523.1796.227.camel@scatha> Message-ID: <1257607842.1838.101.camel@scatha> Hi I have completed the postmodern store I was working on and I am including the code in this mail. There are two "modes" that you can use the store in. The default is by supplying your own unique ids for all tables in the db so that weblocks can work. The second mode uses oid's to supply weblocks with unique ids. To facilitate the use of oid's you will need the latest postmodern code that has the :ghost functionality (clbuild retrieves this version). Things to look at: 1. I create a new class based on dao-class called dao-store-class. I do this to add the direct slot for foreign keys. Currently you need to pass lists to this slot. If mop was used to create a slot-class for this it could replace the lists. I am however far from comfortable with mop (even after staring at the code in postmodern's table.lisp or maybe it was because I looked at that as an example that I did not feel up to the task). The other matter is that the handling of foreign keys might be nice to add into postmodern itself. 2. I used strings to build some of the select statments. This is because I could not get the syntax right to have a compile-sql use s-sql to build these selects. See comments in code. 3. The unit tests I have written to test the store without weblocks are really crappy and need to be redone to be lispy and to handle more scenarios. Some of the tests dont clean up after themselves properly when they fail so test can't be re-run without cleaning the db. The unit tests also only test the OID version of the store. I have tested the store (in default mode) with the weblocks store demo code that I adjusted to work with the postmodern store and all scenarios there work fine. Any and all comments/code would be welcome. I am relatively new to lisp and will remain relatively new for some time still to come. There is a lot to learn and a lot I still need to practice. Regards -------------- next part -------------- A non-text attachment was scrubbed... Name: postmodern.tar.gz Type: application/x-compressed-tar Size: 23898 bytes Desc: not available URL: From marijnh at gmail.com Sat Nov 7 17:54:46 2009 From: marijnh at gmail.com (Marijn Haverbeke) Date: Sat, 7 Nov 2009 18:54:46 +0100 Subject: [postmodern-devel] Postmodern Store for Weblocks In-Reply-To: <1257607842.1838.101.camel@scatha> References: <1256485507.32153.9.camel@scatha> <1256638317.32153.181.camel@scatha> <1257525186.1796.159.camel@scatha> <1257528488.1796.209.camel@scatha> <1257530523.1796.227.camel@scatha> <1257607842.1838.101.camel@scatha> Message-ID: Great! Does it have a project page yet? You should put it on github. From zaries at global.co.za Sat Nov 7 18:36:24 2009 From: zaries at global.co.za (Phil Marneweck) Date: Sat, 07 Nov 2009 20:36:24 +0200 Subject: [postmodern-devel] Postmodern Store for Weblocks In-Reply-To: References: <1256485507.32153.9.camel@scatha> <1256638317.32153.181.camel@scatha> <1257525186.1796.159.camel@scatha> <1257528488.1796.209.camel@scatha> <1257530523.1796.227.camel@scatha> <1257607842.1838.101.camel@scatha> Message-ID: <1257618984.12236.30.camel@scatha> I did not really want to create a separate project for it. I was just hoping for some feedback here on this list before I hand it of to the weblocks guys. If they are happy enough with it they can work it into their repositories. From there anybody that is interested can then hack away. I just wanted to make sure that I did not "miss use" postmodern in my attempt to comply to what I interpreted to be the requirements of a weblocks store. I spent a good amount of time digging in the postmodern code to better understand how to use postmodern in the store. The main difference between the store and my day to day use of posmodern is that the store hangs onto the connection object to re-use it. In a sense I already deviated a bit from this by disconnecting from the db after using it in the store (anticipating that the store would mostly be used by weblocks widgets that have a specific use scenario, giving me the chance to reconnect in the back ground). The store should be using postmodern's connection pooling to make reconnecting more efficient. There should also be some tracking of "explicit transactions" so as to not disconnect from the db when a transaction is active on a store. In the mean time I am using it for a project that has to be finished by Monday so it will see a lot of use in the next 30 hours. This will hopefully sort out any glaring bugs. What is left is bad lisp style and other stupid mistakes...;) On Sat, 2009-11-07 at 18:54 +0100, Marijn Haverbeke wrote: > Great! Does it have a project page yet? You should put it on github. > > _______________________________________________ > postmodern-devel mailing list > postmodern-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel From zaries at global.co.za Sat Nov 7 19:34:28 2009 From: zaries at global.co.za (Phil Marneweck) Date: Sat, 07 Nov 2009 21:34:28 +0200 Subject: [postmodern-devel] Postmodern Store for Weblocks In-Reply-To: <1257618984.12236.30.camel@scatha> References: <1256485507.32153.9.camel@scatha> <1256638317.32153.181.camel@scatha> <1257525186.1796.159.camel@scatha> <1257528488.1796.209.camel@scatha> <1257530523.1796.227.camel@scatha> <1257607842.1838.101.camel@scatha> <1257618984.12236.30.camel@scatha> Message-ID: <1257622468.12236.33.camel@scatha> Found my first booboo I added some doucmentation notes before I mailed the code and messed up the class definition for dao-store-class...it should be as follows... (defclass dao-store-class (dao-class) ((foreign-keys :initarg :foreign-keys :initform nil :reader foreign-keys)) (:documentation "Expected Values are for foreign-keys is a list of foreign-key-id-slot-name foreign-key-boject-slot-name foreign-object-id-slot-name include-in-delete-p.")) Sorry every one. On Sat, 2009-11-07 at 20:36 +0200, Phil Marneweck wrote: > I did not really want to create a separate project for it. I was just > hoping for some feedback here on this list before I hand it of to the > weblocks guys. If they are happy enough with it they can work it into > their repositories. From there anybody that is interested can then hack > away. > > I just wanted to make sure that I did not "miss use" postmodern in my > attempt to comply to what I interpreted to be the requirements of a > weblocks store. > > I spent a good amount of time digging in the postmodern code to better > understand how to use postmodern in the store. > > The main difference between the store and my day to day use of posmodern > is that the store hangs onto the connection object to re-use it. In a > sense I already deviated a bit from this by disconnecting from the db > after using it in the store (anticipating that the store would mostly be > used by weblocks widgets that have a specific use scenario, giving me > the chance to reconnect in the back ground). > > The store should be using postmodern's connection pooling to make > reconnecting more efficient. > > There should also be some tracking of "explicit transactions" so as to > not disconnect from the db when a transaction is active on a store. > > In the mean time I am using it for a project that has to be finished by > Monday so it will see a lot of use in the next 30 hours. This will > hopefully sort out any glaring bugs. > > What is left is bad lisp style and other stupid mistakes...;) > > > > On Sat, 2009-11-07 at 18:54 +0100, Marijn Haverbeke wrote: > > Great! Does it have a project page yet? You should put it on github. > > > > _______________________________________________ > > postmodern-devel mailing list > > postmodern-devel at common-lisp.net > > http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel > > > > _______________________________________________ > postmodern-devel mailing list > postmodern-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel From zaries at global.co.za Tue Nov 10 18:49:16 2009 From: zaries at global.co.za (Phil Marneweck) Date: Tue, 10 Nov 2009 20:49:16 +0200 Subject: [postmodern-devel] Postmodern Store for Weblocks In-Reply-To: <1257622468.12236.33.camel@scatha> References: <1256485507.32153.9.camel@scatha> <1256638317.32153.181.camel@scatha> <1257525186.1796.159.camel@scatha> <1257528488.1796.209.camel@scatha> <1257530523.1796.227.camel@scatha> <1257607842.1838.101.camel@scatha> <1257618984.12236.30.camel@scatha> <1257622468.12236.33.camel@scatha> Message-ID: <1257878956.1843.159.camel@scatha> Just an update on the weblocks-postmodern store. It now has a home at http://bitbucket.org/harag/weblocks-dev/wiki/Home. This is a fork of the weblocks-dev repository while it is still under heavy development. If you clone this repository you will have what you need to run weblocks(not its dependencies) and the postmodern store. There is a demo of the postmodern store under the examples directory.