From vamlists at gmail.com Sun Feb 11 07:54:49 2007 From: vamlists at gmail.com (Vamsee Kanakala) Date: Sun, 11 Feb 2007 13:24:49 +0530 Subject: [postmodern-devel] How to use auto-id? Message-ID: <45CECBC9.5020609@gmail.com> Hi, I'm not sure how to use auto-id in my deftable statement. I have something like this: (deftable cities () ((id :type integer :initarg :id :accessor id) (name :type string :initarg :name :accessor name)) (:class-name city) (:auto-id t)) However, if I use something like (select-dao 'city) To get the list of all cities, I get this error: The assertion (= (LENGTH POSTMODERN::QUERY-FIELDS) POSTMODERN::N-FIELDS) failed. What am I doing wrong? TIA, Vamsee. From vamlists at gmail.com Sun Feb 11 08:52:47 2007 From: vamlists at gmail.com (Vamsee Kanakala) Date: Sun, 11 Feb 2007 14:22:47 +0530 Subject: [postmodern-devel] Re: How to use auto-id? In-Reply-To: <45CECBC9.5020609@gmail.com> References: <45CECBC9.5020609@gmail.com> Message-ID: <45CED95F.7070708@gmail.com> Oops. Nevermind. I got it - read the source now :) Vamsee Kanakala wrote: > Hi, > > I'm not sure how to use auto-id in my deftable statement. I have > something like this: > From marijnh at gmail.com Thu Feb 15 12:40:34 2007 From: marijnh at gmail.com (Marijn Haverbeke) Date: Thu, 15 Feb 2007 13:40:34 +0100 Subject: [postmodern-devel] postmodern, pg, cl-rdbms In-Reply-To: References: Message-ID: Hi, In case anybody is hesitating to start using Postmodern because this thread seems to indicate that there is a huge overhaul/merge imminent... do not worry about this. It seems that both Attila and me have our hands too full to spend serious time on merging the libraries at the moment. (Also, we have difficulty agreeing whether documentation and premature optimization are a good thing or a bad thing.) Cheers, Marijn From vamlists at gmail.com Thu Feb 15 17:27:40 2007 From: vamlists at gmail.com (Vamsee Kanakala) Date: Thu, 15 Feb 2007 22:57:40 +0530 Subject: [postmodern-devel] postmodern, pg, cl-rdbms In-Reply-To: References: Message-ID: <45D4980C.5010507@gmail.com> Hi Marijn, Marijn Haverbeke wrote: > > In case anybody is hesitating to start using Postmodern because this > thread seems to indicate that there is a huge overhaul/merge > imminent... I have been meaning to write about my experience using Postmodern for a while, I'll take this opportunity. Only one thing to say - thank you! I was using CLSQL for a web project of mine, it was not really working out for me. There are little problems that used to leave my head scratching. No knock against CLSQL, it's an incredibly useful library, but there are some little things which I thought could have been simpler to do. I found about Postmodern in Zach's blog, and I was initially skeptical about using it as the version is still 0.23 and the project page says there are still some things to be done. But I was totally wrong. Apart from a bit of initial confusion (about auto-id - perhaps an example would do well there - very good documentation, apart from that), I have to say it's very simple to use, and I find that it's very well thought out. Perhaps automatic joins in select-dao/get-dao a la CLSQL select would be cool, but it's not really show stopper for me - using the query interface is just as simple, and good enough for me. Perhaps would be nice as a future feature, just for completeness. I always preferred PostgreSQL over MySQL for my projects, so it's like almost the perfect library for me. And just in time! :). Thank you once again. I like Postmodern just the way it is, but I won't really complain if you're adding more features - but I hope you keep it as clean and simple to use as it is now :) Cheers, Vamsee. From marijnh at gmail.com Fri Feb 16 07:52:54 2007 From: marijnh at gmail.com (Marijn Haverbeke) Date: Fri, 16 Feb 2007 08:52:54 +0100 Subject: [postmodern-devel] postmodern, pg, cl-rdbms In-Reply-To: <45D4980C.5010507@gmail.com> References: <45D4980C.5010507@gmail.com> Message-ID: Hey, Thanks for the encouraging words! About the DAO interface: The reason it is so simple now is that I couldn't think of a more complex approach that would be general enough to be really useful. I had some ideas, but they all ended up locking the library user into a certain way of working with databases, and I didn't want to do that. If you (or anyone on this list) knows of some library (lisp or otherwise) that manages to abstract DAOs in an elegant way, let me know. Also, if you have some proposal for a change or addition to the library, send it to this list. The current interface is by no means set in stone -- though I try not to introduce incompatible changes too often ;). While we are at the subject: One thing that is missing from the DAOs is that you can not retrieve one, update its primary key, and then store the changes -- it will be saved as a new record, instead of updating the old one. One way around this would be to have a hidden field in every DAO object, and to store their primary keys (as a list) in there when they are retrieved from the database. But this feels a bit clunky, so any suggestions are welcome. Cheers, Marijn From attila.lendvai at gmail.com Fri Feb 16 10:59:46 2007 From: attila.lendvai at gmail.com (Attila Lendvai) Date: Fri, 16 Feb 2007 11:59:46 +0100 Subject: [postmodern-devel] postmodern, pg, cl-rdbms In-Reply-To: References: <45D4980C.5010507@gmail.com> Message-ID: > (or anyone on this list) knows of some library (lisp or otherwise) > that manages to abstract DAOs in an elegant way, let me know. Also, if http://common-lisp.net/project/cl-perec/ may be interesting when talking about DAOs and joins. it is the persistency part of cl-wdim. basically it's a CLOS metaclass that brings in rdbms based persistency, pretty much how rucksack or allegro cache works, but with an RDBMS backend. it also have a declarative query language that handles joins transparently among other things. we only recently factored it out from cl-wdim and there are various patched dependencies, but there was already a user who could successfully run the test suite. -- - attila "- The truth is that I've been too considerate, and so became unintentionally cruel... - I understand. - No, you don't understand! We don't speak the same language!" (Ingmar Bergman - Smultronst?llet)