[Templates] Re: Pulling no data using TT book example
[prev]
[thread]
[next]
[Date index for 2004/10/23]
"Charles Jardine" <cj10@xxx.xx.xx> wrote in
message news:417A3A80.3070107@xxx.xx.xx...
> Robert wrote:
>> I am using the TT book. On page 357, Example 9-1 it describes how to get
>> a
>> product listing. My code follows that example:
>>
>> [% USE DBI("dbi:Oracle:ELLTST", "*****", "*****") -%]
>>
>> [% FOREACH user = DBI.query("SELECT surname, first_name FROM msf810")
>> -%]
>>
>> <tr><td>[% user.surname %]</td><td>[% user.first_name %]</td></tr>
>>
>> [% END -%]
>>
>> When I run this I get a bunch of table rows with no data in them (and
>> there
>> is data there). Am I missing something (besides brains)?
>
> Oracle column names are really in UPPER CASE.
>
> Either user the upper case names to retrieve the values from the
> row, like:
>
> <tr><td>[% user.SURNAME %]</td><td>[% user.FIRST_NAME %]</td></tr>
>
> or better, ask the DBI to translate the names into lower case
> like:
>
> [% USE DBI("dbi:Oracle:ELLTST", "*****", "*****",
> { FetchHashKeyName='NAME_lc' }) -%]
>
> See 'perldoc DBI' to find out what you can put in the 4th
> argument to connect.
>
I bet it is the upper case thing. I went home and created a small SQLite
database and reran the example and it worked fine. I will try that when I
get back to work.
Robert
_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates