I'm trying to use the full "power" of SQL (ahem) to read some data from a
CSV file and do SQL-ish things with it.  I'm using ttree only (no custom
Perl) and can't figure out the right incantation to get it all working.  I
tried:

[% USE DBI('DBI:CSV:','','') %]
<table>
[% FOREACH entry = DBI.query('SELECT * FROM matrix') %]
<tr>
  <td>[% entry.column1 %]</td><td>[% entry.column2 %]</td><td>[%
entry.column3 %]</td>
</tr>
[% END %]
</table>

But this gives me a warning in the DBI plugin and no output.  One example I
found for DBD:CSV showed having to explicitly map the filename
("matrix.csv") to the table name ("matrix"), but I couldn't make that work
using the DBI plugin.  I also tried setting the "f_dir" argument in the
initial USE call to DBI, e.g.:

[% USE DBI('DBI:CSV:f_dir=.','','') %]

But no luck there, either.  Any guidance (other than "put it in a real
database", which unfortunately isn't an option) would be much appreciated!

Dustin



_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to