Template::Plugin::JavaSQL 0.4 review
Download
|
|
Template::Plugin::JavaSQL is a Perl module to help generate Java from database schemas.
SYNOPSES
Within an XML file processed by the Java plugin:
< sql:
query="select foo as f, bar as b from some_table"
>
or
< sql:
table="some_table"
>
Via a template such as:
[% USE Java %]
[% Use JavaSQL %]
...
String query =
"select [% JavaSQL.columnNames.join(", ") %] from [% JavaSQL.tables.join(", ") %]";
[% IF JavaSQL.where %]
query += " where [% JavaSQL.where %] ";
[% ELSE %]
query += " where 0=0 ";
[% END %]
[% FOREACH JavaSQL.columns %]
if (${varName}Set) { query += " and $name = ?"; }
[% END %]
[% IF JavaSQL.order %]
query += "order by [% JavaSQL.order %]";
[% END %]
stmt = myConnection.prepareStatement(query);
Just use the DBClass.template from the distribution for fully functional database classes.
In addition to methods that refer to parts of a SQL query, any columns resultant from the query or table will be added as java variables to the variables hash, with close-as-possible mapped types.
Requirements:
Perl
Template::Plugin::JavaSQL 0.4 search tags