Re: Alias in database descriptor file

2003-06-12 Thread Christian Haul
On 12.Jun.2003 -- 12:42 AM, Amelie Cordier wrote:
  On 11.Jun.2003 -- 03:42 PM, Amelie Cordier wrote:
   How do you know it doesn't work?
 
  I've two forms : one to fill the DB according to the first description
  and the other to fill it according to the second one... when I use the
  2 separately it works...
  If you use the default parameter names, change the input fields to
  @name=incrit2.foo instead of @name=incrit.foo. I reckon it will work
  then.
 
 Yes it works ! I should have thought about it earlier :(

Great! Glad to see your problem resolved.

 I've tried the other solutions... none were successfull for the moment...
 I'll have a closer look on this during the week and then, I will try to do
 something on wiki...

Please keep us updated.

 Thanks again for the time you spent on this problem... that's nice...

You're welcome.

Chris.
-- 
C h r i s t i a n   H a u l
[EMAIL PROTECTED]
fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Alias in database descriptor file

2003-06-11 Thread Amelie Cordier
Hello !

Is anybody knows where I can find documentation about alias that are
used in database descriptor files?

I'm looking for a solution to a simple problem : I want to describe a
table in two different way and call the first one in one table-set and the
other one in a second table-set...

Thanks in advance

Amélie



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Alias in database descriptor file

2003-06-11 Thread Antonio Gallardo
Amelie Cordier dijo:
 I want to describe a
 table in two different way and call the first one in one table-set and
 the other one in a second table-set...

Hi, check this:

http://wiki.cocoondev.org/Wiki.jsp?page=ModularDatabaseActions

Sorry, I can't explain in more detail this. I am too busy now. :(

Antonio Gallardo




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Alias in database descriptor file

2003-06-11 Thread Amelie Cordier
Thanks...

I have already looked at it but with no success so I'm looking for an
example...

Anyway, thanks for the time you spend to answer my question :)

Amelie

 Amelie Cordier dijo:
 I want to describe a
 table in two different way and call the first one in one table-set and
 the other one in a second table-set...

 Hi, check this:

 http://wiki.cocoondev.org/Wiki.jsp?page=ModularDatabaseActions

 Sorry, I can't explain in more detail this. I am too busy now. :(

 Antonio Gallardo




 - To
 unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Alias in database descriptor file

2003-06-11 Thread Christian Haul
On 11.Jun.2003 -- 11:32 AM, Amelie Cordier wrote:
 Thanks...
 
 I have already looked at it but with no success so I'm looking for an
 example...
 
 Anyway, thanks for the time you spend to answer my question :)

In a table-set you need to refer to tables by @name. This @name is
used to create the SQL statements. However, you might need different
views to a table (different number of columns, different keys) or even
have injected a SQL expression into the @name like a join
expression. In these cases you may refer to the @alias instead of the
@name of a table. For the lookup, @name and @alias are
equivalent. Search starts at the top and uses the first matching
table.

  table name=foo
!-- = INSERT INTO foo(one,two) VALUES (?,?) --
!-- = DELETE FROM foo WHERE one = ? --
keys
  key name=one type=string/
/keys
values
  value name=two type=string/
/values
  /table

  table name=foo alias=foo2
!-- = INSERT INTO foo(one,two,three,four) VALUES (?,?,?,?) --
!-- = DELETE FROM foo WHERE one = ? --
keys
  key name=one type=string/
/keys
values
  value name=two type=string/
  value name=three type=string/
  value name=four type=string/
/values
  /table

  table name=foo alias=foo3
!-- = INSERT INTO foo(four,one,two,three) VALUES (?,?,?,?) --
!-- = DELETE FROM foo WHERE four = ? --
keys
  key name=four type=string/
/keys
values
  value name=one type=string/
  value name=two type=string/
  value name=three type=string/
/values
  /table

  table-set name=alpha
!-- uses the first table definition --
table name=foo/
  /table-set

  table-set name=beta
!-- uses the second table definition --
table name=foo2/
  /table-set

  table-set name=gamma
!-- uses the third table definition --
table name=foo3/
  /table-set

Could you have a look at the wiki page and modify it in a way you find
the description better / extent it? That would really by great!

Thanks.

Chris.
-- 
C h r i s t i a n   H a u l
[EMAIL PROTECTED]
fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Alias in database descriptor file

2003-06-11 Thread Amelie Cordier
Thanks for your explantion... this is what I understood by reading the
wiki page... but the matter is it still doesn't work... I wonder if there
is an option to check in order to enable aliases or something like that...

And,by the way, I do want to modifiy the wiki page but I need to make it
work first... :)

Here is what I've done so far :

-- database.xml --


table name=inscrit
  keys
 key name=id_1 type=int
mode name=request-param type=all/
 /key
 key name=id_2 type=int
mode name=request-param type=all/
 /key
 key name=id_3 type=int
mode name=request-param type=all/
 /key
 key name=id_4 type=int set=master
mode name=request-param type=all/
 /key
  /keys
  values
 value name=val1 type=int
mode name=request-param type=all/
 /value
 value name=val2 type=string
mode name=request-param type=all/
 /value
 value name=val3 type=float
mode name=request-param type=all/
 /value
  /values
   /table


   table name=inscrit alias=inscrit2
  keys
 key name=id_1 type=int
mode name=request-param type=all/
 /key
 key name=id_2 type=int
mode name=request-param type=all/
 /key
 key name=id_3 type=int
mode name=request-param type=all/
 /key
 key name=id_4 type=int set=master
mode name=request-param type=all/
/key
  /keys
  values
 value name=val1 type=int set=slave
mode name=request-param type=all/
 /value
 value name=val2 type=string set=slave
mode name=request-param type=all/
 /value
 value name=val3 type=float set=slave
mode name=request-param type=all/
 /value
  /values
   /table


!-- ... --

   table-set name=saisie
  table name=inscrit2/
   /table-set

   table-set name=inscrit
  table name=inscrit/
   /table-set

-- END database.xml --

The two descriptions work independently, I've check them both...but when 
they are together in the file, only the first one works (inscrit).

Furthermore, there is something strange in the sitemap.log... I don't know
if it is really correct...

-- sitemap.log --
...
DEBUG   (2003-06-11) 12:57.12:274   [sitemap] (/cocoon/myappli/toto)
Thread-12/DatabaseAction: query: UPDATE inscrit SET val1= ?, val2= ?,
val3= ? WHERE id_1= ? AND id_2= ? AND id_3= ? AND id_4= ?
DEBUG   (2003-06-11) 12:57.12:275   [sitemap] (/cocoon/myappli/toto)
Thread-12/DatabaseAction: Trying to set column inscrit2.id_1 from
request-param using getAttribute method
...
-- END sitemap.log --

WHY inscrit2 ???

Any ideas?

Thanks...
Amélie

 In a table-set you need to refer to tables by @name. This @name is used
 to create the SQL statements. However, you might need different views to
 a table (different number of columns, different keys) or even have
 injected a SQL expression into the @name like a join
 expression. In these cases you may refer to the @alias instead of the
 @name of a table. For the lookup, @name and @alias are
 equivalent. Search starts at the top and uses the first matching
 table.



 Could you have a look at the wiki page and modify it in a way you find
 the description better / extent it? That would really by great!




 Thanks.

   Chris.
 --
 C h r i s t i a n   H a u l
 [EMAIL PROTECTED]
 fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

 - To
 unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Alias in database descriptor file

2003-06-11 Thread Christian Haul
On 11.Jun.2003 -- 01:23 PM, Amelie Cordier wrote:
 Thanks for your explantion... this is what I understood by reading the
 wiki page... but the matter is it still doesn't work... I wonder if there
 is an option to check in order to enable aliases or something like that...
 
 And,by the way, I do want to modifiy the wiki page but I need to make it
 work first... :)

:-)

 Here is what I've done so far :

snip what=correct code/

 The two descriptions work independently, I've check them both...but when 
 they are together in the file, only the first one works (inscrit).

How do you know it doesn't work?

 Furthermore, there is something strange in the sitemap.log... I don't know
 if it is really correct...
 
 ...
 DEBUG   (2003-06-11) 12:57.12:274   [sitemap] (/cocoon/myappli/toto)
 Thread-12/DatabaseAction: query: UPDATE inscrit SET val1= ?, val2= ?,
 val3= ? WHERE id_1= ? AND id_2= ? AND id_3= ? AND id_4= ?
 DEBUG   (2003-06-11) 12:57.12:275   [sitemap] (/cocoon/myappli/toto)
 Thread-12/DatabaseAction: Trying to set column inscrit2.id_1 from
 request-param using getAttribute method
 ...
 
 WHY inscrit2 ???

Because you are using the incrit2 alias. Maybe this isn't very smart
and the action should use the @name at all times Anyway, you might
want to explicitly refer to a request parameter or disable inclusion
of the table name for the automatic parameter name guessing.

If the two definitions were different, you would be able to see
different SQL statements.

Chris.
-- 
C h r i s t i a n   H a u l
[EMAIL PROTECTED]
fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Alias in database descriptor file

2003-06-11 Thread Amelie Cordier
 And,by the way, I do want to modifiy the wiki page but I need to make
 it work first... :)

 :-)

 Here is what I've done so far :

 snip what=correct code/

 The two descriptions work independently, I've check them both...but
 when  they are together in the file, only the first one works
 (inscrit).

 How do you know it doesn't work?

I've two forms : one to fill the DB according to the first description and
the other to fill it according to the second one... when I use the 2
separately it works...

I made an ultimate test :

table name=incrit
!-- ... --
/table

table-set name=inscrit
   table name=inscrit/
/table-set

= OK

table name=incrit alias=inscrit2
!-- ... --
/table

table-set name=inscrit
   table name=inscrit2/
/table-set

= KO... :( :(

 Anyway, you might want
 to explicitly refer to a request parameter or disable inclusion of the
 table name for the automatic parameter name guessing.

I'm sorry but I don't understand what you want me to do here... Is there a
way to change the behaviour of alias ?

Anyway, thanks again for all thoses tips...

Amélie


 If the two definitions were different, you would be able to see
 different SQL statements.

   Chris.
 --
 C h r i s t i a n   H a u l
 [EMAIL PROTECTED]
 fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

 - To
 unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Alias in database descriptor file

2003-06-11 Thread Christian Haul
On 11.Jun.2003 -- 03:42 PM, Amelie Cordier wrote:
  How do you know it doesn't work?
 
 I've two forms : one to fill the DB according to the first description and
 the other to fill it according to the second one... when I use the 2
 separately it works...

If you use the default parameter names, change the input fields to
@name=incrit2.foo instead of @name=incrit.foo. I reckon it will
work then.

  Anyway, you might want
  to explicitly refer to a request parameter or disable inclusion of the
  table name for the automatic parameter name guessing.
 
 I'm sorry but I don't understand what you want me to do here... Is there a
 way to change the behaviour of alias ?

You could add append-table-namefalse/append-table-name to the
configuration of the actions and they will use foo instead of
incrit.foo or incrit2.foo thus you don't have to worry about
this. Or you could do

  table name=incrit alias=incrit2
   .
   value name=foo type=string
 mode type=all name=request-param
   parameterfoo/parameter
 /mode
   value/
   .
  /table

IOW set the name explicitly. We could consider changing the way the
default name is constructed or make it configurable at least.
IMHO dropping the table name from the parameter name would be the best
option. 

Chris.
-- 
C h r i s t i a n   H a u l
[EMAIL PROTECTED]
fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Alias in database descriptor file

2003-06-11 Thread Amelie Cordier
 On 11.Jun.2003 -- 03:42 PM, Amelie Cordier wrote:
  How do you know it doesn't work?

 I've two forms : one to fill the DB according to the first description
 and the other to fill it according to the second one... when I use the
 2 separately it works...
 If you use the default parameter names, change the input fields to
 @name=incrit2.foo instead of @name=incrit.foo. I reckon it will work
 then.

Yes it works ! I should have thought about it earlier :(

I've tried the other solutions... none were successfull for the moment...
I'll have a closer look on this during the week and then, I will try to do
something on wiki...

Thanks again for the time you spent on this problem... that's nice...

Amelie



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]