From info at jensteich.de Sat Nov 1 22:26:49 2008 From: info at jensteich.de (Jens Teich) Date: Sat, 01 Nov 2008 23:26:49 +0100 Subject: [postmodern-devel] select distinct Message-ID: <490CD7A9.6020403@jensteich.de> How do I express a SELECT statement in s-sql using DISTINCT to receive only unique values? Jens From marijnh at gmail.com Sun Nov 2 07:29:55 2008 From: marijnh at gmail.com (Marijn Haverbeke) Date: Sun, 2 Nov 2008 08:29:55 +0100 Subject: [postmodern-devel] select distinct In-Reply-To: <490CD7A9.6020403@jensteich.de> References: <490CD7A9.6020403@jensteich.de> Message-ID: Hey Jens, (:select '* :distinct :from 'something) -- for practical reasons, the :distinct goes after the list of columns. Best, Marijn On Sat, Nov 1, 2008 at 11:26 PM, Jens Teich wrote: > How do I express a SELECT statement in s-sql using DISTINCT to receive > only unique values? > > Jens > > _______________________________________________ > postmodern-devel mailing list > postmodern-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel > From info at jensteich.de Sun Nov 2 09:14:13 2008 From: info at jensteich.de (Jens Teich) Date: Sun, 02 Nov 2008 10:14:13 +0100 Subject: [postmodern-devel] select distinct In-Reply-To: References: <490CD7A9.6020403@jensteich.de> Message-ID: <490D6F65.6010105@jensteich.de> Thanks Marijn, I didn't find it because I was still on aged version 1.02. -Jens Marijn Haverbeke schrieb: > Hey Jens, > > (:select '* :distinct :from 'something) -- for practical reasons, the > :distinct goes after the list of columns. > > Best, > Marijn > > > On Sat, Nov 1, 2008 at 11:26 PM, Jens Teich wrote: >> How do I express a SELECT statement in s-sql using DISTINCT to receive >> only unique values? >> >> Jens >> >> _______________________________________________ >> 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 > -- dr. jens teich filemaker 7+8+9 certified developer filemaker authorized trainer meiendorfer strasse 56 d 22145 hamburg 040-67 99 88 44 http://jensteich.de info at jensteich.de From harry at oshean.org Tue Nov 11 18:39:40 2008 From: harry at oshean.org (Harry Bock) Date: Tue, 11 Nov 2008 13:39:40 -0500 Subject: [postmodern-devel] Multirow inserts and transactions in postmodern Message-ID: <1226428780.5011.7.camel@localhost.localdomain> Hi, I'm wonder what the proper :insert-into syntax would be to insert multiple rows simultaneously, like so: "INSERT INTO my_table (col1, col2, col3) VALUES ('1', '2', '3'), ('4', '5', '6'), ...;" As this tends to be much faster when inserting large data sets. Also, the transaction functionality of postmodern doesn't seem to be well-documented. Is the only method of working with them to wrap calls in the with-transaction macro? Thanks, Harry -- Harry Bock Software Developer, Package Maintainer OSHEAN, Inc. Email: harry at oshean.org PGP Key ID: 546CC353 From marijnh at gmail.com Tue Nov 11 23:42:14 2008 From: marijnh at gmail.com (Marijn Haverbeke) Date: Wed, 12 Nov 2008 00:42:14 +0100 Subject: [postmodern-devel] Multirow inserts and transactions in postmodern In-Reply-To: <1226428780.5011.7.camel@localhost.localdomain> References: <1226428780.5011.7.camel@localhost.localdomain> Message-ID: Hello Harry, > I'm wonder what the proper :insert-into syntax would be to insert > multiple rows simultaneously, like so: This isn't currently supported by S-SQL. Feel free to propose a syntax. The current one (which tries to resemble UPDATE) is rather unsuitable for this. Maybe we could add a new operator. :insert-rows-into? > Also, the transaction functionality of postmodern doesn't seem to be > well-documented. Is the only method of working with them to wrap calls > in the with-transaction macro? Yes, if you want the unwind-protect automatic cleanup you'll have to use with-transaction. You're free to just do (execute "begin"), (execute "commit") etcetera, of course. Cheers, Marijn From harry at oshean.org Wed Nov 12 03:40:56 2008 From: harry at oshean.org (Harry Bock) Date: Tue, 11 Nov 2008 22:40:56 -0500 Subject: [postmodern-devel] Multirow inserts and transactions in postmodern In-Reply-To: References: <1226428780.5011.7.camel@localhost.localdomain> Message-ID: <1226461256.5011.219.camel@localhost.localdomain> Hi again Marijn, On Wed, 2008-11-12 at 00:42 +0100, Marijn Haverbeke wrote: > This isn't currently supported by S-SQL. Feel free to propose a > syntax. The current one (which tries to resemble UPDATE) is rather > unsuitable for this. Maybe we could add a new operator. > :insert-rows-into? Creating a new operator sounds like a good idea. I've attached a patch that implements the operator, let me know if it's good enough to apply to your repo :) It works like so: (:insert-rows-into 'pg-table :columns ('a 'b 'c) :values ((1 2 3) (4 5 6))) It does length-checking against the columns and values lists, allows omission of the columns list, and includes RETURNING support. > Yes, if you want the unwind-protect automatic cleanup you'll have to > use with-transaction. You're free to just do (execute "begin"), > (execute "commit") etcetera, of course. Great, thanks :) Regards, Harry > Cheers, > Marijn > > _______________________________________________ > postmodern-devel mailing list > postmodern-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel -- Harry Bock Software Developer, Package Maintainer OSHEAN, Inc. Email: harry at oshean.org PGP Key ID: 546CC353 -------------- next part -------------- A non-text attachment was scrubbed... Name: s-sql-insert-rows-into.patch Type: text/x-patch Size: 1264 bytes Desc: not available URL: From marijnh at gmail.com Wed Nov 12 09:06:26 2008 From: marijnh at gmail.com (Marijn Haverbeke) Date: Wed, 12 Nov 2008 10:06:26 +0100 Subject: [postmodern-devel] Multirow inserts and transactions in postmodern In-Reply-To: <1226461256.5011.219.camel@localhost.localdomain> References: <1226428780.5011.7.camel@localhost.localdomain> <1226461256.5011.219.camel@localhost.localdomain> Message-ID: Hi Harry, I've pushed a version of the operator where the list given as :values is evaluated and checked at run-time -- I suppose you'll rarely know exactly how many rows you are inserting at compile-time, so doing the length checks and expansion then seems unpractical. Also (for consistency with out operators) removed the parentheses around the :columns list. Your example would now look like this: > (:insert-rows-into 'pg-table > :columns 'a 'b 'c > :values '((1 2 3) (4 5 6))) See if this works for you. Best, Marijn From fusion at storytotell.org Sat Nov 22 09:22:45 2008 From: fusion at storytotell.org (Daniel Lyons) Date: Sat, 22 Nov 2008 02:22:45 -0700 Subject: [postmodern-devel] Clozure CL Unicode support Message-ID: <991A89BB-3B9F-494F-B01D-538B10666604@storytotell.org> Hi, I have a trivial change request, which I am currently hacking around. Currently, cl-postgres.asd contains: (defparameter *unicode* #+(or sb-unicode unicode ics) t #-(or sb-unicode unicode ics) nil) It would make life slightly easier and less confusing for Clozure users if this could be extended just slightly: (defparameter *unicode* #+(or sb-unicode unicode ics ccl) t #-(or sb-unicode unicode ics ccl) nil) Clozure supposedly only uses Unicode for characters, so it ought to be a fine assumption. I've gotten around this on a current project by placing these lines in my .asd file: #+ccl (push :unicode *features*) The *features* variable seems to also include some other options if you'd rather (I don't know if any of these are deprecated or preferable, I'm a bit new to all this): :clozure, :clozure-common- lisp, :openmcl-unicode-strings. Oh, and incidentally, thanks for this library! I haven't been so pleased with a database library for as long as I can remember. It's really a joy to use. ? Daniel Lyons http://www.storytotell.org -- Tell It! -------------- next part -------------- An HTML attachment was scrubbed... URL: From marijnh at gmail.com Mon Nov 24 13:28:10 2008 From: marijnh at gmail.com (Marijn Haverbeke) Date: Mon, 24 Nov 2008 14:28:10 +0100 Subject: [postmodern-devel] Clozure CL Unicode support In-Reply-To: <991A89BB-3B9F-494F-B01D-538B10666604@storytotell.org> References: <991A89BB-3B9F-494F-B01D-538B10666604@storytotell.org> Message-ID: Hello Daniel, Maciej already fixed this last month [1], so if you use a darcs checkout instead of the latest release it should work. It's probably about time for another release. [1] http://common-lisp.net/cgi-bin/darcsweb/darcsweb.cgi?r=postmodern-postmodern;a=filediff;h=20081008213910-21f96-f809d4b0de311ecf0b0a667a85c8b2f52d4e87f2.gz;f=cl-postgres.asd\ Best, Marijn 2008/11/22 Daniel Lyons : > Hi, > I have a trivial change request, which I am currently hacking around. > Currently, cl-postgres.asd contains: > (defparameter *unicode* > #+(or sb-unicode unicode ics) t > #-(or sb-unicode unicode ics) nil) > It would make life slightly easier and less confusing for Clozure users if > this could be extended just slightly: > (defparameter *unicode* > #+(or sb-unicode unicode ics ccl) t > #-(or sb-unicode unicode ics ccl) nil) > Clozure supposedly only uses Unicode for characters, so it ought to be a > fine assumption. I've gotten around this on a current project by placing > these lines in my .asd file: > #+ccl > (push :unicode *features*) > The *features* variable seems to also include some other options if you'd > rather (I don't know if any of these are deprecated or preferable, I'm a bit > new to all this): :clozure, :clozure-common-lisp, :openmcl-unicode-strings. > Oh, and incidentally, thanks for this library! I haven't been so pleased > with a database library for as long as I can remember. It's really a joy to > use. > ? > Daniel Lyons > http://www.storytotell.org -- Tell It! > > _______________________________________________ > postmodern-devel mailing list > postmodern-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel > > From maciej at pasternacki.net Tue Nov 25 00:46:20 2008 From: maciej at pasternacki.net (Maciej Pasternacki) Date: Tue, 25 Nov 2008 01:46:20 +0100 Subject: [postmodern-devel] [patch] export postmodern:dao-keys Message-ID: <2BCF9FC5-059D-484D-AC64-867E842D0C4E@pasternacki.net> Hello, I just written a simple DAO cache for my app (for curious: http://paste.lisp.org/display/70998 - I wrap Hunchentoot request handler body with WITH-DAO-CACHE and it caches DAO of given class and primary key to avoid repeated SELECTs when serving a single request). For the caching to work well, I need to figure out keys of a DAO, and this functionality is unexported. Attached patch exports (and documents) DAO-KEYS, adds method for a symbol (invoking DAO-KEYS on class named by a symbol), and for a DAO instance (returning list of values that are instance's primary key). Regards, Maciej -- Maciej Pasternacki -><- http://www.pasternacki.net/ -><- http://www.3ofcoins.net/ -------------- next part -------------- A non-text attachment was scrubbed... Name: daokeys.cset.gz Type: application/x-gzip Size: 8677 bytes Desc: not available URL: From marijnh at gmail.com Tue Nov 25 09:11:45 2008 From: marijnh at gmail.com (Marijn Haverbeke) Date: Tue, 25 Nov 2008 10:11:45 +0100 Subject: [postmodern-devel] [patch] export postmodern:dao-keys In-Reply-To: <2BCF9FC5-059D-484D-AC64-867E842D0C4E@pasternacki.net> References: <2BCF9FC5-059D-484D-AC64-867E842D0C4E@pasternacki.net> Message-ID: Looks good. And you even documented your changes! See people, that's how it's done ;). Applied. 2008/11/25 Maciej Pasternacki : > Hello, > > I just written a simple DAO cache for my app (for curious: > http://paste.lisp.org/display/70998 - I wrap Hunchentoot request handler > body with WITH-DAO-CACHE and it caches DAO of given class and primary key to > avoid repeated SELECTs when serving a single request). For the caching to > work well, I need to figure out keys of a DAO, and this functionality is > unexported. Attached patch exports (and documents) DAO-KEYS, adds method > for a symbol (invoking DAO-KEYS on class named by a symbol), and for a DAO > instance (returning list of values that are instance's primary key). > > Regards, > Maciej > > -- > Maciej Pasternacki -><- http://www.pasternacki.net/ -><- > http://www.3ofcoins.net/ > > _______________________________________________ > postmodern-devel mailing list > postmodern-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel > >