You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by Chris Greenlee <CG...@demandsolutions.com> on 2003/03/19 03:36:58 UTC

Precision, scale, and index tablespaces.

Hello all,

we've been using Torque for a while to generate SQL based on our OJB
repository.  We've had to tweak a few things to get them to work though,
and we thought we should contribute them back.

1.  When generating DECIMAL columns, we needed to generate precision and
scale.

2.  When generating indexes, we needed (at least on Oracle) to be able to
specify the tablespace for the index.  It's a huge performance boost to
have the index located on a separate drive from the table.

3.  We use non-native auto incrementing heavily, and needed to be able to
turn it off.  Although Table has an Id Method, it wasn't being checked in
the velocity macros.  We needed to enable that.

4.  There were some weird end of file characters in some of the velocity
templates that caused SQL generation to die a horrible death under
Windows.

Attached is a patch that addresses all these issues.  Here's a short list
of the affected files:

src/generator/src/dtd/database.dtd
src/generator/src/java/org/apache/torque/engine/database/model/Column.java
src/generator/src/java/org/apache/torque/engine/database/model/Table.java
src/generator/src/templates/sql/base/mssql/columns.vm
src/generator/src/templates/sql/base/mssql/db.props
src/generator/src/templates/sql/base/oracle/columns.vm
src/generator/src/templates/sql/base/oracle/db.props
src/generator/src/templates/sql/base/oracle/index.vm
src/generator/src/templates/sql/base/oracle/primarykey.vm
src/generator/src/templates/sql/base/oracle/unique.vm
src/generator/src/templates/sql/base/postgresql/columns.vm
src/generator/src/templates/sql/base/postgresql/db.props
src/generator/src/templates/sql/base/postgresql/index.vm
src/generator/src/templates/sql/base/postgresql/table.vm

We've only modified Oracle, PostgreSQL, and MS SQL velocity macros because
those are the only databases we've been hitting.  As we add more, we'll be
glad to submit those changes back as well.

If you have any questions, I'd be glad to answer them.  We're eager to get
the changes into Torque so that we don't have to maintain a separate local
version.

Regards,

Chris Greenlee


Re: Precision, scale, and index tablespaces.

Posted by Eric Emminger <er...@ericemminger.com>.
Hi Chris!

> we've been using Torque for a while to generate SQL based on our OJB
> repository.  We've had to tweak a few things to get them to work though,
> and we thought we should contribute them back.

These sound like great updates.

Would you like to comment on using OJB with Torque? I'd be very 
interested in your perspective. I've been using Torque for a while, and 
OJB appears to have some interesting advantages, so I'm wondering about 
switching. Or, using both together may be even better. What do you think?

> Attached is a patch that addresses all these issues.  Here's a short list
> of the affected files:

> If you have any questions, I'd be glad to answer them.  We're eager to get
> the changes into Torque so that we don't have to maintain a separate local
> version.

Could you add this into Scarab? I believe that will make it easier for a 
developer to review and commit the changes.

Eric