Return-Path: Delivered-To: apmail-xml-cocoon-users-archive@xml.apache.org Received: (qmail 71550 invoked by uid 500); 3 Apr 2002 19:18:42 -0000 Mailing-List: contact cocoon-users-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: cocoon-users@xml.apache.org Delivered-To: mailing list cocoon-users@xml.apache.org Delivered-To: moderator for cocoon-users@xml.apache.org Received: (qmail 77810 invoked from network); 3 Apr 2002 14:09:44 -0000 Message-ID: <6A345CB6C1398A428FAF3AFCF5433EE725C28D@kpbrisemail1> From: Rolfe Jenny To: cocoon-users@xml.apache.org Subject: Re: using MSQL's LAST_INSERT_ID() with DatabaseAddAction Date: Wed, 3 Apr 2002 15:06:24 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C1DB18.BD8CBDA0" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N ------_=_NextPart_001_01C1DB18.BD8CBDA0 Content-Type: text/plain; charset="iso-8859-1" I'm trying to do much the same thing as in the message beneath: xcpt
What I want to do is automatically generate an id in one table and pick this id up and put it in another table. The adding to multiple tables bit works fine but the childpageid column is empty. I have tried key:page:pageid and multiple variations on the theme but nothing seems to work. Any suggestions? thanks jenny ----- Original Message ----- From: "Christian Haul" > To: > Sent: Friday, March 01, 2002 3:38 PM Subject: Re: using MSQL's LAST_INSERT_ID() with DatabaseAddAction On 01.Mar.2002 -- 03:34 PM, Giuseppe Di Pierri wrote: > Hi there, > > I have a problem using the DatabaseAddAction in MySQL. > > I would do two table insertions, one after an other like the following > example: The value is written to a request attribute (table.column) that you can use if you were using the manual method of determining the id (looks up current max value +1). I was about to check in new database actions to scratchpad (atually, new versions of the ones already there) but since I encountered problems with datasources with today's CVS I cannot verify that they still work. Those do understand mysql's autoincrement columns. But they use a slightly different database.xml syntax *and* their name and their configuration sitemap-wise will change with my checkin. If you'd like to stay tuned.... should be only a matter of days now. > INSERT INTO base (id,...) VALUES(NULL,...); > # id is defined as INT NOT NULL AUTO_INCREMENT > > INSERT INTO derived (id,....) VALUES(LAST_INSERT_ID(),....); > > > personnel > > > > > > > >
> > > Christian, you gave me the trigger to look at the source: Is this also correct ? bye pino > > > > >
>
Chris. ------_=_NextPart_001_01C1DB18.BD8CBDA0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Re: using MSQL's LAST_INSERT_ID() with DatabaseAddAction =

I'm trying to do much the same = thing as in the message beneath:

<auth-descriptor>
<connection>xcpt</connection>
<table name=3D"page">

<keys>
<key param=3D"pageid" dbcol=3D"pageid" = type=3D"int" mode=3D"manual"/>
</keys>
<values>
<value param=3D"pagetitle" dbcol=3D"title" = type=3D"string"/>
<value param=3D"pagename" dbcol=3D"pagename" = type=3D"string"/>
<value param=3D"pagestructure" = dbcol=3D"templatenum" type=3D"string"/>
<value param=3D"location" dbcol=3D"techlocation" = type=3D"string"/>
<value param=3D"layoutnum" dbcol=3D"layoutnum" = type=3D"string"/>

</values>
</table>

<table name=3D"boalinks">
<values>
<value param=3D"page:pageid" = dbcol=3D"childpageid" type=3D"int" />
<value param=3D"layoutnum" dbcol=3D"parentboaid" = type=3D"string"/>

</values>
</table>

</auth-descriptor>

What I want to do is automatically generate an id in one table and pick = this
id up and put it in another table.
The adding to multiple tables bit works fine but the childpageid column = is
empty. I have tried key:page:pageid and multiple variations on the = theme
but nothing seems to work.

Any suggestions?
thanks
jenny




----- Original Message -----
From: "Christian Haul" <
haul@dvs1.informatik.tu-darmstadt.de = </cgi-bin/compose?curmbox=3DF000000001&a=3D7a875e2a05bac6e4ab7359= b7a491f3a2&mailto=3D1&to=3Dhaul@dvs1.informatik.tu-darmstadt.de&= amp;msg=3DMSG1017842688.30&start=3D967818&len=3D5177&src=3D&= amp;type=3Dx>>
To: <
cocoon-users@xml.apache.org = </cgi-bin/compose?curmbox=3DF000000001&a=3D7a875e2a05bac6e4ab7359= b7a491f3a2&mailto=3D1&to=3Dcocoon-users@xml.apache.org&msg=3D= MSG1017842688.30&start=3D967818&len=3D5177&src=3D&type=3D= x>>
Sent: Friday, March 01, 2002 3:38 PM
Subject: Re: using MSQL's LAST_INSERT_ID() with DatabaseAddAction


        =         On 01.Mar.2002 -- 03:34 PM, Giuseppe Di Pierri = wrote:  > Hi there,  > > I have  a problem = using the DatabaseAddAction in MySQL.  >  > I would do = two table insertions, one after an other like the following  > = example:   The value is written to a request attribute = (table.column) that you  can use if you were using the manual = method of determining the id  (looks up current max value = +1).    

        =          I was about to check in new database actions to = scratchpad (atually,  new versions of the ones already there) but = since I encountered  problems with datasources with today's CVS I = cannot verify that they  still work. Those do understand mysql's = autoincrement columns. But  they use a slightly different = database.xml syntax *and* their name  and their configuration = sitemap-wise will change with my checkin.   If you'd like to = stay tuned.... should be only a matter of days  now.   = > INSERT INTO base (id,...) VALUES(NULL,...);  > # id is = defined as INT NOT NULL AUTO_INCREMENT  >  > INSERT = INTO derived (id,....) VALUES(LAST_INSERT_ID(),....);  >  = > <employee>  > = <connection>personnel</connection>  > <table = name=3D"base">  > <keys>  > <key = param=3D"id" dbcol=3D"id" type=3D"int" = mode=3D"manual"/>  > </keys>  > = <values>  > <value param=3D"myparam" = dbcol=3D"...." type=3D"string" />  > = </values>  > </table>  > <table = name=3D"derived">  > <keys>  > = <!-- how can I use the mysql LAST_INSERT_ID() here,  > in = order to insert the previous inserted auto_increment value  > = <key param=3D"id" dbcol=3D"id" = type=3D"int"/>  > ?-->  <key = param=3D"base.id" dbcol=3D"id" = type=3D"int"/>     

Christian, you gave me the trigger = to look at the source:

Is this also correct ?
<key param=3D"key:base:id" dbcol=3D"id" = type=3D"int"/>

bye
pino

        =         > </keys>  > <values>  = > <value param=3D"..." dbcol=3D"..." = type=3D"string" />  > </values>  > = </table>  > </employee>   = Chris.      

------_=_NextPart_001_01C1DB18.BD8CBDA0--