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 Scott Eade <se...@backstagetech.com.au> on 2002/12/30 22:29:03 UTC

Re: [PATCH] locating database.dtd in torque.jar [why accessing internet for dtd every execution? (solved)]

"tek1",

Patches are welcome, but can you please do the following:

1. Create unidiff patch files (cvs diff -u)
2. Create a patch issue in the appropriate module in Scarab
(http://scarab.werken.com/scarab/issues/) that describes the problem and
attach your patch file.  In this case the module would be "Torque > Source".

Thanks,

Scott
-- 
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au
.Mac Chat/AIM: seade at mac dot com

On 24/12/2002 12:09 PM, "tek1" <te...@pobox.com> wrote:

> sorry for the repost.  forgot to include "[PATCH]" in the subject.
> 
> this is a repost from torque-users as the below would like to be submitted
> as a possible patch. thank you.
> 
> ----
> 
> 
> thanks for your reply jake.
> 
> actually, the database.dtd file is inside the torque-3.0.jar file, but the
> DTDResolver class was not picking it up for some reason.
> 
> so i took a look inside the
> org.apache.torque.engine.database.transform.DTDResolver class' source code
> and found the problem.
> 
> i'm not 100% sure if this is correct, but in the constructor, instead of
> using:
> 
>        InputStream dtdStream = getClass().getResourceAsStream("database.dtd");
> 
> i used:
> 
>        InputStream dtdStream =
> this.getClass().getClassLoader().getResourceAsStream("database.dtd");
> 
> with this change, it's able to pickup the database.dtd from the .jar, so it
> no longer accesses the internet.
> 
> if this looks like a viable patch, to whom do we submit the patch?
> 
> thanks.
> 
> 
> 
> 
> At 13:30 02/12/23 -0800, you wrote:
>> Sure, put it on your local disk and change the refernce from the actual
>> XML file that is referencing it.
>> 
>> tek1 wrote:
>> 
>>> is there a way to disable torque from accessing the internet to lookup
>>> the dtd upon every execution?
>>> 
>>> ant is displaying:
>>> 
>>>     Resolver: used http://jakarta.apache.org/turbine/dtd/database.dtd
>>> 
>>> everytime...
>>> 
>>> thanks.


Re: [PATCH] using double quotes with postgresql table/column names

Posted by tek1 <te...@pobox.com>.
sorry about that scott.

i tried putting them into scarab.  hopefully, i did it correctly.

thanks again.



At 17:25 03/01/06 +1100, you wrote:
>To repeat my original reply:
>
>1. Create unidiff patch files (cvs diff -u)
>2. Create a patch issue in the appropriate module in Scarab
>(http://scarab.werken.com/scarab/issues/) that describes the problem and
>attach your patch file.  In this case the module would be "Torque > Source".
>
>Scott
>--
>Scott Eade
>Backstage Technologies Pty. Ltd.
>http://www.backstagetech.com.au
>.Mac Chat/AIM: seade at mac dot com


Re: [PATCH] using double quotes with postgresql table/column names

Posted by Scott Eade <se...@backstagetech.com.au>.
To repeat my original reply:

1. Create unidiff patch files (cvs diff -u)
2. Create a patch issue in the appropriate module in Scarab
(http://scarab.werken.com/scarab/issues/) that describes the problem and
attach your patch file.  In this case the module would be "Torque > Source".

Scott
-- 
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au
.Mac Chat/AIM: seade at mac dot com


On 6/01/2003 5:00 PM, "tek1" <te...@pobox.com> wrote:

> thanks scott.
> 
> here are the diffs:
> 
> #####
> 
> Index: columns.vm
> ===================================================================
> RCS file: 
> /home/cvspublic/jakarta-turbine-torque/src/templates/sql/base/postgresql/colum
> ns.vm,v
> retrieving revision 1.4
> diff -r1.4 columns.vm
> 0a1
>> #set($_DQ_='"')
> 18c19
> <     #set ( $entry = "$col.Name $type $size $default $nullString" )
> ---
>>     #set ( $entry = "$_DQ_$col.Name$_DQ_ $type $size $default $nullString" )
> 20c21
> <     #set ( $entry = $strings.select($col.isAutoIncrement(), "$col.Name
> $autoIncrement", $entry) )
> ---
>>     #set ( $entry = $strings.select($col.isAutoIncrement(),
> "$_DQ_$col.Name$_DQ_ $autoIncrement", $entry) )
> 
> #####
> 
> Index: table.vm
> ===================================================================
> RCS file: 
> /home/cvspublic/jakarta-turbine-torque/src/templates/sql/base/postgresql/table
> .vm,v
> retrieving revision 1.3
> diff -r1.3 table.vm
> 5c5
> < $generator.parse("$basepath/drop.vm", "", "table", $tbl)
> ---
>> ##$generator.parse("$basepath/drop.vm", "", "table", $tbl)
> 9c9
> < CREATE TABLE $table.Name
> ---
>> CREATE TABLE "$table.Name"
> 
> 
> #####
> 
> 
> Index: primarykey.vm
> ===================================================================
> RCS file: 
> /home/cvspublic/jakarta-turbine-torque/src/templates/sql/base/postgresql/prima
> rykey.vm,v
> retrieving revision 1.3
> diff -r1.3 primarykey.vm
> 0a1
>> #set($_DQ_='"')
> 2c3
> <     PRIMARY KEY ($table.printPrimaryKey()),
> ---
>>     PRIMARY KEY ($_DQ_$table.printPrimaryKey()$_DQ_),
> 
> 
> 
> #####
> 
> 
> Index: createdb.vm
> ===================================================================
> RCS file: 
> /home/cvspublic/jakarta-turbine-torque/src/templates/sql/db-init/postgresql/cr
> eatedb.vm,v
> retrieving revision 1.1
> diff -r1.1 createdb.vm
> 2c2
> < drop database $databaseName;
> ---
>> ##drop database $databaseName;
> 
> 
> #####
> 
> 
> Index: DTDResolver.java
> ===================================================================
> RCS file: 
> /home/cvspublic/jakarta-turbine-torque/src/java/org/apache/torque/engine/datab
> ase/transform/DTDResolver.java,v
> retrieving revision 1.10
> diff -r1.10 DTDResolver.java
> 86,87c86,87
> <             InputStream dtdStream
> <                     = getClass().getResourceAsStream("database.dtd");
> ---
>>             //InputStream dtdStream  =
> getClass().getResourceAsStream("database.dtd");
>>                       InputStream dtdStream =
> this.getClass().getClassLoader().getResourceAsStream("database.dtd");
> 95c95,97
> <             }
> ---
>>             } else {
>>                               System.out.println("dtdStream is null.");
>>                       }
> 
> 
> 
> 
> note: i removed the "dropdb"/"droptable" code from some of the templates
> b/c i'm only using the create-db and create-tables part of torque from
> another program and didn't want torque dropping my tables on each
> execution.  as such, you can ignore the drop... changes, if you want.
> ideally, it would be nice to have the drop template code in separate files
> from the create template code.
> 
> thanks again for the great work.  it is much appreciated.
> 
> 
> 
> At 15:21 03/01/06 +1100, you wrote:
>> On 6/01/2003 3:15 PM, "tek1" <te...@pobox.com> wrote:
>> 
>>> ok, will do, but what is the cvs login info?  it's not mentioned anywhere
>>> on the torque page.
>> http://jakarta.apache.org/site/cvsindex.html
>> 
>> Scott
>> --
>> Scott Eade
>> Backstage Technologies Pty. Ltd.
>> http://www.backstagetech.com.au
>> .Mac Chat/AIM: seade at mac dot com
>> 
>> 
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
>> <ma...@jakarta.apache.org>
> 
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


Re: [PATCH] using double quotes with postgresql table/column names

Posted by tek1 <te...@pobox.com>.
thanks scott.

here are the diffs:

#####

Index: columns.vm
===================================================================
RCS file: 
/home/cvspublic/jakarta-turbine-torque/src/templates/sql/base/postgresql/columns.vm,v
retrieving revision 1.4
diff -r1.4 columns.vm
0a1
 > #set($_DQ_='"')
18c19
<     #set ( $entry = "$col.Name $type $size $default $nullString" )
---
 >     #set ( $entry = "$_DQ_$col.Name$_DQ_ $type $size $default $nullString" )
20c21
<     #set ( $entry = $strings.select($col.isAutoIncrement(), "$col.Name 
$autoIncrement", $entry) )
---
 >     #set ( $entry = $strings.select($col.isAutoIncrement(), 
"$_DQ_$col.Name$_DQ_ $autoIncrement", $entry) )

#####

Index: table.vm
===================================================================
RCS file: 
/home/cvspublic/jakarta-turbine-torque/src/templates/sql/base/postgresql/table.vm,v
retrieving revision 1.3
diff -r1.3 table.vm
5c5
< $generator.parse("$basepath/drop.vm", "", "table", $tbl)
---
 > ##$generator.parse("$basepath/drop.vm", "", "table", $tbl)
9c9
< CREATE TABLE $table.Name
---
 > CREATE TABLE "$table.Name"


#####


Index: primarykey.vm
===================================================================
RCS file: 
/home/cvspublic/jakarta-turbine-torque/src/templates/sql/base/postgresql/primarykey.vm,v
retrieving revision 1.3
diff -r1.3 primarykey.vm
0a1
 > #set($_DQ_='"')
2c3
<     PRIMARY KEY ($table.printPrimaryKey()),
---
 >     PRIMARY KEY ($_DQ_$table.printPrimaryKey()$_DQ_),



#####


Index: createdb.vm
===================================================================
RCS file: 
/home/cvspublic/jakarta-turbine-torque/src/templates/sql/db-init/postgresql/createdb.vm,v
retrieving revision 1.1
diff -r1.1 createdb.vm
2c2
< drop database $databaseName;
---
 > ##drop database $databaseName;


#####


Index: DTDResolver.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-turbine-torque/src/java/org/apache/torque/engine/database/transform/DTDResolver.java,v
retrieving revision 1.10
diff -r1.10 DTDResolver.java
86,87c86,87
<             InputStream dtdStream
<                     = getClass().getResourceAsStream("database.dtd");
---
 >             //InputStream dtdStream  = 
getClass().getResourceAsStream("database.dtd");
 >                       InputStream dtdStream = 
this.getClass().getClassLoader().getResourceAsStream("database.dtd");
95c95,97
<             }
---
 >             } else {
 >                               System.out.println("dtdStream is null.");
 >                       }




note: i removed the "dropdb"/"droptable" code from some of the templates 
b/c i'm only using the create-db and create-tables part of torque from 
another program and didn't want torque dropping my tables on each 
execution.  as such, you can ignore the drop... changes, if you want. 
ideally, it would be nice to have the drop template code in separate files 
from the create template code.

thanks again for the great work.  it is much appreciated.



At 15:21 03/01/06 +1100, you wrote:
>On 6/01/2003 3:15 PM, "tek1" <te...@pobox.com> wrote:
>
> > ok, will do, but what is the cvs login info?  it's not mentioned anywhere
> > on the torque page.
>http://jakarta.apache.org/site/cvsindex.html
>
>Scott
>--
>Scott Eade
>Backstage Technologies Pty. Ltd.
>http://www.backstagetech.com.au
>.Mac Chat/AIM: seade at mac dot com
>
>
>--
>To unsubscribe, e-mail: 
><ma...@jakarta.apache.org>
>For additional commands, e-mail: 
><ma...@jakarta.apache.org>


Re: [PATCH] locating database.dtd / PATCH for postgresql table/column names

Posted by Scott Eade <se...@backstagetech.com.au>.
On 6/01/2003 3:15 PM, "tek1" <te...@pobox.com> wrote:

> ok, will do, but what is the cvs login info?  it's not mentioned anywhere
> on the torque page.
http://jakarta.apache.org/site/cvsindex.html

Scott
-- 
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au
.Mac Chat/AIM: seade at mac dot com


Re: [PATCH] locating database.dtd / PATCH for postgresql table/column names

Posted by tek1 <te...@pobox.com>.
ok, will do, but what is the cvs login info?  it's not mentioned anywhere 
on the torque page.

i have a few other patches related to postgresql .sql generation, 
specifically the table name and column names needing double quotes around 
them.  otherwise, when you execute the sql without the double quotes, 
postgresql automatically makes the entire table name or column lowercase. 
for example, "loginId" defined in the table creation sql becomes "loginid" 
in the database.  i've fixed this locally, but need to know the cvs info to 
get you the diffs.

thanks.



At 08:29 02/12/31 +1100, you wrote:
>"tek1",
>
>Patches are welcome, but can you please do the following:
>
>1. Create unidiff patch files (cvs diff -u)
>2. Create a patch issue in the appropriate module in Scarab
>(http://scarab.werken.com/scarab/issues/) that describes the problem and
>attach your patch file.  In this case the module would be "Torque > Source".
>
>Thanks,
>
>Scott
>--
>Scott Eade