db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Garcia" <SGar...@qrs.com>
Subject $generator object quirkyness
Date Wed, 19 Nov 2003 19:21:05 GMT
I've noticed that I can't use the $generator.parse method more than once in
the same VM template, when the object value I pass in for the handle is
different.  

For instance, I have in my template:

Table Class: $table.Class
ModifyClass: $table.ColumnsToModify.Class
Modify Size: $table.ColumnsToModify.size()
AddClass:    $table.ColumnsToAdd.Class
AddSize:     $table.ColumnsToAdd.size()
Modify Columns:
#foreach ($col in $table.ColumnsToModify) $col #end
Add Columns:
#foreach ($col in $table.ColumnsToAdd) $col #end

$generator.parse("${basepath}/columns.vm", "", "table",
$table.ColumnsToModify)
$generator.parse("${basepath}/columns.vm", "", "table", $table.ColumnsToAdd)

And my output is 

Table Class: class org.apache.torque.engine.database.model.AlterTable
ModifyClass: class
org.apache.torque.engine.database.model.AlterTable$TableList
Modify Size: 2
AddClass:    class
org.apache.torque.engine.database.model.AlterTable$TableList
AddSize:     1
Modify Columns:
     <column name="FIRST_NAME" javaName="FirstName" required="true"
type="VARCHAR" size="32" />
     <column name="LAST_NAME" javaName="LastName" required="true"
type="VARCHAR" size="32" />
Add Columns:
     <column name="ADDRESS" javaName="Address" required="true"
type="VARCHAR" size="128" />
 
    FIRST_NAME VARCHAR2 (32) NOT NULL,
    LAST_NAME VARCHAR2 (32) NOT NULL,

    FIRST_NAME VARCHAR2 (32) NOT NULL,
    LAST_NAME VARCHAR2 (32) NOT NULL,

The second $generator.parse line prints out the data in
$table.ColumnsToModify, not $table.ColumnsToAdd!  Is this an intended
feature?

I've gotten this to work a different way, but my original method circumvents
the existing sql/base/* templates which I want to use.  

Any help would be appreciated.  Thanks!

-- Steve



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message