[ic] Problems with [query]

Dan Browning interchange-users@interchange.redhat.com
Wed Sep 19 20:15:00 2001


At 05:29 PM 9/19/2001 -0600, you wrote:
>So I'm trying to do something with this tag
>and having no luck.  I have a 'section_display' table
>which links sections in the 'section' table to each
>other in a hierarchy with section 0 being the root.
>
>Here's the code:
>
>[query sql="select sd.sub_section_id, s.name, s.description from
>section_display as sd, section as s where sd.section_id = 0 and s.section_id
>= sd.sub_section_id and sd.workflow_status='a' order by sd.display_seq"
>type=list ]
>     [list]
>        <tr><td>[sql-param name]</td><td>[sql-param description]</td></tr>
>     [/list]
>[/query]
>
>That exact SQL run against the Postgres database yields this:
>
>  sub_section_id |    name    |  description
>
>----------------+------------+----------------------------------------------
>-------
>               1 | Books      | Many titles on the subjects you really want
>to know about.
>               2 | Videos     | More videos than you can shake a stick at.
>
>Any clue why the query above doesn't work?
>I've tried "type=html" and no joy resulted.
>
>Patrick Bennett
>http://www.ccgenesis.com

It isn't clear to me what you are saying:

1. I can't get [query] to work for anything.
2. I can't get [query] to work for only this SQL snippet.
3. I can't get [query] to work for any SQL snippet on these tables.
4. I can't get [query] to work when I use [list].
5. Other?

My first guess is that it's because you forgot list=1.

Also, I prefer the query written like this:

[query type=list list=1 sql=|
         SELECT  sd.sub_section_id, s.name, s.description
         FROM    section_display as sd, section as s
         WHERE   sd.section_id = 0 and s.section_id = sd.sub_section_id
         AND     sd.workflow_status='a'
         ORDER BY sd.display_seq; | ]
         [list]
                 <tr><td>[sql-param name]</td><td>[sql-param 
description]</td></tr>
         [/list]
[/query]

The following diagnostic info would be helpful:

CATROOT/dbconf/pgsql/section.pgsql
CATROOT/dbconf/pgsql/section_display.pgsql
CATROOT/error.log (if any)
psql:
         \d section
         \d section_display

HTH, HAND,

Dan Browning <danpb@mail.com>