[ic] query tag usage (solved)

Stefan Hornburg interchange-users@icdevgroup.org
Wed Jun 11 07:24:00 2003


On Wed, 11 Jun 2003 07:10:21 -0400
Interchange User <interchange@framework.cx> wrote:

> >>>>>     [query
> >>>>>     		sql="select * FROM nc_authorarticle where articleID = '31'"
> >>>>> 		type=list
> >>>>> 		list=1
> >>>>> 		more=1
> >>>>> 		ml=100
> >>>>> 		st=db
> >>>>>        ]
> >>>>>        [on_match]
> >>>>>          Match:[sql-field authorDisplay] [sql-field articleID] 
> >>>>> [sql-field authorship]<br>
> >>>>>        [/on_match]
> >>>>>     [/query]
> >>>>>
> >>>> Change your [on-match]...[/on-match] to [list]...[/list].
> >>>
> >>> Tried it, but got the same results.  It seems to find the data that I
> >>> want, but I just can't get it to display.
> >>
> >> And did you try my reply which said to use [sql-param] instead of
> >> [sql-field]?
> 
> Changing my results code to
> 
>          Match:[sql-param authordisplay] [sql-param articleid] 
> [sql-param authorship]<br>
> 
> works like a charm.
> 
> > I didn't notice the [sql-field] usage.  Yes - try [sql-param].  Also, 
> > do the following:
> >
> >   1. List your columns instead of using '*' (for efficiency).  Why
> >      select and transfer the entire row when you only need to use
> >      a couple of columns?
> 
> Thanks, but I need all the columns, in this case.  Okay, not in this 
> specific case, since I was just trying to get the bloody thing working, 
> but in the end I will. :)
> 
> >   2. Use lower-case column names.  MixedCaseColumnNames are ugly and
> >      are not supported by DBI.  You can use underscores to separate 
> > words
> >      in column names if you need to.  For instance, use "article_id"
> >      instead of "articleID".
> 
> That is what made the difference.  I had previously tried sql-param, 
> from one of the examples, but the mixed-case column names is what threw 
> off the results.  I can't claim credit for the design though - I'm 
> using an existing database that my client has me working on.

Alternatively you can use [sql-pos 0] or label the columns in the
query like:

select XyZ as foo, AbC as bar

Bye
	Racke

-- 
LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team