From sabra.crolleton at gmail.com Sun Jan 13 05:58:30 2013 From: sabra.crolleton at gmail.com (Sabra Crolleton) Date: Sat, 12 Jan 2013 21:58:30 -0800 Subject: [postmodern-devel] Inserting into an array Message-ID: I thought I understood the s-sql syntax on inserting into an array. Then I tried it. No, I do not understand the s-sql array syntax for an insert-into statement. Does anyone have a simple example? As a sampe: (query (:create-table test2 ((id :type serial) (name :type text) (stuff1 :type int4[]) (stuff1 :type int4[])))) What would be the equivalent s-sql to (query "insert into test2 values (1,'t2','{22,24,21,20}','{{2,4},{6,7}}')") Such that (query (:select (:[] 'stuff2 1 1) :from 'test2 :where (:= 'id 1)) :single) #2A((2 4)) Thank you for any explanations or pointers. Sabra Crolleton -------------- next part -------------- An HTML attachment was scrubbed... URL: From marijnh at gmail.com Sun Jan 13 20:31:40 2013 From: marijnh at gmail.com (Marijn Haverbeke) Date: Sun, 13 Jan 2013 21:31:40 +0100 Subject: [postmodern-devel] Inserting into an array In-Reply-To: References: Message-ID: This seems to work: (pomo:execute (:insert-into 'test2 :set 'id 1 'name "t2" 'stuff1 #(22 24 21 20) 'stuff2 #(#(2 4) #(6 7)))) Best, Marijn On Sun, Jan 13, 2013 at 6:58 AM, Sabra Crolleton wrote: > I thought I understood the s-sql syntax on inserting into an array. Then I > tried it. No, I do not understand the s-sql array syntax for an insert-into > statement. > > Does anyone have a simple example? > > As a sampe: > (query (:create-table test2 ((id :type serial) (name :type text) (stuff1 > :type int4[]) (stuff1 :type int4[])))) > > What would be the equivalent s-sql to > > (query "insert into test2 values (1,'t2','{22,24,21,20}','{{2,4},{6,7}}')") > > Such that > > (query (:select (:[] 'stuff2 1 1) :from 'test2 :where (:= 'id 1)) :single) > #2A((2 4)) > > Thank you for any explanations or pointers. > > Sabra Crolleton > > _______________________________________________ > postmodern-devel mailing list > postmodern-devel at common-lisp.net > http://lists.common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel > From sabra.crolleton at gmail.com Sun Jan 13 21:35:31 2013 From: sabra.crolleton at gmail.com (Sabra Crolleton) Date: Sun, 13 Jan 2013 13:35:31 -0800 Subject: [postmodern-devel] Inserting into an array In-Reply-To: References: Message-ID: Thank you. Sabra On Sun, Jan 13, 2013 at 12:31 PM, Marijn Haverbeke wrote: > This seems to work: > > (pomo:execute (:insert-into 'test2 :set 'id 1 'name "t2" 'stuff1 > #(22 24 21 20) 'stuff2 #(#(2 4) #(6 7)))) > > Best, > Marijn > > On Sun, Jan 13, 2013 at 6:58 AM, Sabra Crolleton > wrote: > > I thought I understood the s-sql syntax on inserting into an array. Then > I > > tried it. No, I do not understand the s-sql array syntax for an > insert-into > > statement. > > > > Does anyone have a simple example? > > > > As a sampe: > > (query (:create-table test2 ((id :type serial) (name :type text) (stuff1 > > :type int4[]) (stuff1 :type int4[])))) > > > > What would be the equivalent s-sql to > > > > (query "insert into test2 values > (1,'t2','{22,24,21,20}','{{2,4},{6,7}}')") > > > > Such that > > > > (query (:select (:[] 'stuff2 1 1) :from 'test2 :where (:= 'id 1)) > :single) > > #2A((2 4)) > > > > Thank you for any explanations or pointers. > > > > Sabra Crolleton > > > > _______________________________________________ > > postmodern-devel mailing list > > postmodern-devel at common-lisp.net > > http://lists.common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel > > > > _______________________________________________ > postmodern-devel mailing list > postmodern-devel at common-lisp.net > http://lists.common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: