From alexeys9 at mail.ru Wed Dec 10 05:02:14 2008 From: alexeys9 at mail.ru (Makarov Alexey) Date: Wed, 10 Dec 2008 10:02:14 +0500 Subject: [Cl-perec-devel] Problem with one-to-many association type Message-ID: <1228885334.6637.27.camel@makarov> Hello! I have two classes: (defpclass employee () ((first-name :initarg :name :type string :accessor name-of) (second-name :initarg :second-name type string :accessor second-name-of) (third-name :initarg :third-name :type string :accessor third-name-of))) (defpclass project () ((code :initarg :code :type string :accessor code-of) (short-name :initarg :short-name :type string :accessor name-of) (full-name :initarg :full-name :type string :accessor full-name-of))) I define association (one-to-many), and can't work with this classes any more because of error: (defassociation ((:class project :slot members :type (set employee) :accessor members-of :initarg :members) (:class employee :slot project :type project :accessor project-of :initarg :project))) query: (with-transaction (select (o) (from (o project)))) appear this error: There is no applicable method for the generic function # when called with arguments (T NIL). [Condition of type SIMPLE-ERROR] I'm use fresh cl-rdbms and fresh cl-perec. How to solve this error and use one-to-many association? -------------- next part -------------- An HTML attachment was scrubbed... URL: From tomi.borbely at gmail.com Wed Dec 10 08:23:14 2008 From: tomi.borbely at gmail.com (=?ISO-8859-1?Q?Borb=E9ly_Tam=E1s_?=) Date: Wed, 10 Dec 2008 09:23:14 +0100 Subject: [Cl-perec-devel] Problem with one-to-many association type In-Reply-To: <1228885334.6637.27.camel@makarov> References: <1228885334.6637.27.camel@makarov> Message-ID: <53c1332f0812100023l2f50d05ey839c5629a16a5ce0@mail.gmail.com> It works for me. Stacktrace? Removing the .fasl files before loading cl-perec might help. -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexeys9 at mail.ru Wed Dec 10 10:26:53 2008 From: alexeys9 at mail.ru (Makarov Alexey) Date: Wed, 10 Dec 2008 15:26:53 +0500 Subject: [Cl-perec-devel] Problem with one-to-many association type Message-ID: <1228904813.15226.1.camel@makarov> >It works for me. Stacktrace? >Removing the .fasl files before loading cl-perec might help. I tried remove fasls, but error appear as before. Stacktrace here. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: backtrace.tar.bz2 Type: application/x-bzip-compressed-tar Size: 1267 bytes Desc: not available URL: From levente.meszaros at gmail.com Wed Dec 10 10:04:05 2008 From: levente.meszaros at gmail.com (=?ISO-8859-1?Q?Levente_M=E9sz=E1ros?=) Date: Wed, 10 Dec 2008 11:04:05 +0100 Subject: [Cl-perec-devel] Problem with one-to-many association type In-Reply-To: <1228885334.6637.27.camel@makarov> References: <1228885334.6637.27.camel@makarov> Message-ID: 2008/12/10 Makarov Alexey : > > There is no applicable method for the generic function > # > when called with arguments > (T NIL). > [Condition of type SIMPLE-ERROR] Some of your systems must be out of date, the exact code you have sent runs without problems. Double check that cl-perec dependencies are up to date (especially cl-rdbms and computed-class). Remove all fasl files. If none of the above helps, give us more details of the error. PRCT> (defpclass employee () ((first-name :initarg :name :type string :accessor name-of) (second-name :initarg :second-name type string :accessor second-name-of) (third-name :initarg :third-name :type string :accessor third-name-of))) # PRCT> (defpclass project () ((code :initarg :code :type string :accessor code-of) (short-name :initarg :short-name :type string :accessor name-of) (full-name :initarg :full-name :type string :accessor full-name-of))) # PRCT> (defassociation ((:class project :slot members :type (set employee) :accessor members-of :initarg :members) (:class employee :slot project :type project :accessor project-of :initarg :project))) PROJECT~MEMBERS~EMPLOYEE~PROJECT PRCT> (start-sql-recording) ; No value PRCT> (with-transaction (select (o) (from (o project)))) ; BEGIN ; SELECT _o._oid, _o._code, _o._short_name, _o._full_name FROM _project_ap _o ; COMMIT NIL levy -- There's no perfectoin From levente.meszaros at gmail.com Wed Dec 10 11:01:12 2008 From: levente.meszaros at gmail.com (=?ISO-8859-1?Q?Levente_M=E9sz=E1ros?=) Date: Wed, 10 Dec 2008 12:01:12 +0100 Subject: [Cl-perec-devel] Problem with one-to-many association type In-Reply-To: <1228904813.15226.1.camel@makarov> References: <1228904813.15226.1.camel@makarov> Message-ID: 2008/12/10 Makarov Alexey : >>It works for me. Stacktrace? >>Removing the .fasl files before loading cl-perec might help. > > I tried remove fasls, but error appear as before. > Stacktrace here. If something weird is happening then it might be a package problem. >From the stacktrace it turned out that the association you have defined is not a one to many association. The reason for that is the symbol 'set' in the association definition is not the one available from cl-perec and thus the type is unknown to the type system. There must certainly be a good error message for this case, I will fix that. The solution is that you make sure that the symbol cl-perec:set is used in your defassociation form, ie. don't shadow this in your package or qualify explicitly. levy -- There's no perfectoin From alexeys9 at mail.ru Wed Dec 10 11:37:05 2008 From: alexeys9 at mail.ru (Makarov Alexey) Date: Wed, 10 Dec 2008 16:37:05 +0500 Subject: [Cl-perec-devel] Problem with one-to-many association type Message-ID: <1228909025.16920.3.camel@makarov> Thank you! That's get worked! :) -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexeys9 at mail.ru Fri Dec 12 19:10:02 2008 From: alexeys9 at mail.ru (Makarov Alexey) Date: Sat, 13 Dec 2008 00:10:02 +0500 Subject: [Cl-perec-devel] Idea to query language Message-ID: <1229109002.7457.10.camel@reginleif.ufanet.ru> Hello. I have an idea about query language. Often I write conditions for querying objects that contains in their slots (objects have the same class) one of values containing in the list, and form "from" of query turn into long form "or" (or (eq slot 1) (eq slot 2) ...), i create function that construct this condition: (defun in (slot-name values) `(or ,@(mapcar (lambda (v) `(eq (quote ,slot-name) ,v)) values))) Then I can write: (eval `(with-transaction (select (p) (from (o rank)) (where ,(in 'name '("one" "two" "three")))))) in PostgreSQL query language this presented as: SELECT * FROM class_table WHERE slot IN VALUES (1::int,2,3) http://www.postgresql.org/docs/8.3/interactive/sql-values.html In databases that query languages support this syntax construction, transform this as is, in databases that query language not support this syntax, extract to long form "OR". As I know this feature included in SQL standard. Maybe this would be worth to include as form in cl-perec query language? We will can be use it without quote and outer "eval". -------------- next part -------------- An HTML attachment was scrubbed... URL: From levente.meszaros at gmail.com Fri Dec 12 19:56:10 2008 From: levente.meszaros at gmail.com (=?ISO-8859-1?Q?Levente_M=E9sz=E1ros?=) Date: Fri, 12 Dec 2008 20:56:10 +0100 Subject: [Cl-perec-devel] Idea to query language In-Reply-To: <1229109002.7457.10.camel@reginleif.ufanet.ru> References: <1229109002.7457.10.camel@reginleif.ufanet.ru> Message-ID: 2008/12/12 Makarov Alexey : > Hello. > I have an idea about query language. > Often I write conditions for querying objects that contains in their slots > (objects have the same class) one of values containing in the list, and form-- I'm not sure, but is this what you really want? PRCT> (defpclass* xxx () ((slot :type integer-16))) # PRCT> (with-transaction (make-instance 'xxx :slot 1)) # PRCT> (start-sql-recording) ; No value PRCT> (with-transaction (select (i) (from (i xxx)) (where (member (slot-of i) '(1 2 3))))) ; BEGIN ; SELECT _i._oid, _i._slot FROM _xxx_ap _i WHERE ((_i._slot IN (1, 2, 3))) ; COMMIT (#) PRCT> (with-transaction (select (i) (from (i xxx)) (where (member (slot-of i) '(10 20 30))))) ; BEGIN ; SELECT _i._oid, _i._slot FROM _xxx_ap _i WHERE ((_i._slot IN (10, 20, 30))) ; COMMIT NIL levy There's no perfectoin From alexeys9 at mail.ru Sat Dec 13 07:11:10 2008 From: alexeys9 at mail.ru (=?koi8-r?Q?=E1=CC=C5=CB=D3=C5=CA_=ED=C1=CB=C1=D2=CF=D7?=) Date: Sat, 13 Dec 2008 10:11:10 +0300 Subject: [Cl-perec-devel] =?koi8-r?b?SWRlYSB0byBxdWVyeSBsYW5ndWFnZQ==?= In-Reply-To: References: Message-ID: Yes, this is I want, thanks!