You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jm...@apache.org on 2001/12/13 17:58:07 UTC
cvs commit: jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model Database.java Table.java
jmcnally 01/12/13 08:58:07
Modified: src/dtd database.dtd
src/java/org/apache/torque/engine/database/model
Database.java Table.java
Log:
added flag to shut off heavy indexing on a table by table basis or for the entire schema.
Revision Changes Path
1.7 +3 -2 jakarta-turbine-torque/src/dtd/database.dtd
Index: database.dtd
===================================================================
RCS file: /home/cvs/jakarta-turbine-torque/src/dtd/database.dtd,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- database.dtd 2001/11/07 19:54:12 1.6
+++ database.dtd 2001/12/13 16:58:07 1.7
@@ -1,6 +1,6 @@
<!--
Torque XML database schema DTD
- $Id: database.dtd,v 1.6 2001/11/07 19:54:12 jvanzyl Exp $
+ $Id: database.dtd,v 1.7 2001/12/13 16:58:07 jmcnally Exp $
-->
<!--
@@ -38,8 +38,8 @@
package CDATA #IMPLIED
baseClass CDATA #IMPLIED
basePeer CDATA #IMPLIED
-
defaultJavaNamingMethod (nochange|underscore|javaname) "underscore"
+ skipHeavyIndexing (true|false) "false"
>
<!ELEMENT table (column+,(foreign-key|index|unique|id-method-parameter)*)>
@@ -53,6 +53,7 @@
basePeer CDATA #IMPLIED
alias CDATA #IMPLIED
javaNamingMethod (nochange|underscore|javaname) #IMPLIED
+ skipHeavyIndexing (true|false) "false"
>
<!ELEMENT id-method-parameter EMPTY>
1.8 +23 -2 jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/Database.java
Index: Database.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/Database.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Database.java 2001/11/08 17:20:52 1.7
+++ Database.java 2001/12/13 16:58:07 1.8
@@ -76,7 +76,7 @@
* @author <a href="mailto:mpoeschl@marmot.at>Martin Poeschl</a>
* @author <a href="mailto:dlr@collab.net>Daniel Rall</a>
* @author <a href="mailto:byron_foster@byron_foster@yahoo.com>Byron Foster</a>
- * @version $Id: Database.java,v 1.7 2001/11/08 17:20:52 mpoeschl Exp $
+ * @version $Id: Database.java,v 1.8 2001/12/13 16:58:07 jmcnally Exp $
*/
public class Database
{
@@ -92,7 +92,8 @@
private AppData dbParent;
private Hashtable tablesByName = new Hashtable();
private Hashtable tablesByJavaName = new Hashtable();
-
+ private boolean skipHeavyIndexing;
+
/**
* Creates a new instance with unset attributes.
*/
@@ -115,6 +116,8 @@
{
defaultJavaNamingMethod = NameGenerator.CONV_METHOD_UNDERSCORE;
}
+ skipHeavyIndexing = "true"
+ .equals(attrib.getValue("skipHeavyIndexing"));
}
/**
@@ -232,6 +235,24 @@
this.defaultJavaNamingMethod = v;
}
+ /**
+ * Get the value of skipHeavyIndexing.
+ * @return value of skipHeavyIndexing.
+ */
+ public boolean isSkipHeavyIndexing()
+ {
+ return skipHeavyIndexing;
+ }
+
+ /**
+ * Set the value of skipHeavyIndexing.
+ * @param v Value to assign to skipHeavyIndexing.
+ */
+ public void setSkipHeavyIndexing(boolean v)
+ {
+ this.skipHeavyIndexing = v;
+ }
+
/**
* Return an array of all tables
*/
1.19 +9 -4 jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/Table.java
Index: Table.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/Table.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- Table.java 2001/12/13 01:09:28 1.18
+++ Table.java 2001/12/13 16:58:07 1.19
@@ -75,7 +75,7 @@
* @author <a href="mailto:jmcnally@collab.net>John McNally</a>
* @author <a href="mailto:dlr@collab.net>Daniel Rall</a>
* @author <a href="mailto:byron_foster@byron_foster@yahoo.com>Byron Foster</a>
- * @version $Id: Table.java,v 1.18 2001/12/13 01:09:28 dlr Exp $
+ * @version $Id: Table.java,v 1.19 2001/12/13 16:58:07 jmcnally Exp $
*/
public class Table implements IDMethod
{
@@ -105,6 +105,7 @@
private Hashtable columnsByName;
private Hashtable columnsByJavaName;
private boolean needsTransactionInPostgres;
+ private boolean skipHeavyIndexing;
/**
* Default Constructor
@@ -164,6 +165,8 @@
baseClass = attrib.getValue("baseClass");
basePeer = attrib.getValue("basePeer");
alias = attrib.getValue("alias");
+ skipHeavyIndexing = "true"
+ .equals(attrib.getValue("skipHeavyIndexing"));
}
/**
@@ -178,9 +181,11 @@
{
// Heavy indexing must wait until after all columns composing
// a table's primary key have been parsed.
- // TODO: Make this conditional on Torque or RDBMS property.
- doHeavyIndexing();
-
+ if (!skipHeavyIndexing && !getDatabase().isSkipHeavyIndexing())
+ {
+ doHeavyIndexing();
+ }
+
// Name any indices which are missing a name using the
// appropriate algorithm.
doNaming();
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: New heavy indexing behavior (cvs commit: jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model Database.java Table.java)
Posted by Daniel Rall <dl...@finemaltcoding.com>.
John McNally <jm...@collab.net> writes:
> Daniel Rall wrote:
> >
>> When feasible, I prefer avoiding double negative logic. Was there any
>> reason in particular you used a skipHeavyIndexing=false attribute
>> instead of a heavyIndexing=true attribute?
>>
>
> To keep the behavior the same as it is when the attribute is not
> mentioned. I guess I liked the double negative better than making
> heavyIndexing=true the default. But you are right, it is better
> syntax. Do you think it should be left on by default?
Hrm. I prefer the syntax I suggested, but didn't think about the fact
that it's inconsistant with the usage for other toggled attributes. I
would be okay with turning it off by default. It's a side effect of
SQL schema generation; the schema author should have to explicitly
turn on all side effects.
<schema ... heavyIndexing="true">
...
<table ... heavyIndexing="false">
...
</table>
</schema>
So the property would be renamed to heavyIndexing and it would default
to false if not specified for the schema. Ideally, the heavyIndexing
attribute would be specified at both the schema and table levels, with
the table's value overriding the schema's value.
Dan
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: cvs commit:
jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model
Database.java Table.java
Posted by John McNally <jm...@collab.net>.
Daniel Rall wrote:
>
> When feasible, I prefer avoiding double negative logic. Was there any
> reason in particular you used a skipHeavyIndexing=false attribute
> instead of a heavyIndexing=true attribute?
>
To keep the behavior the same as it is when the attribute is not
mentioned. I guess I liked the double negative better than making
heavyIndexing=true the default. But you are right, it is better
syntax. Do you think it should be left on by default?
john mcnally
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: cvs commit: jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model Database.java Table.java
Posted by Daniel Rall <dl...@finemaltcoding.com>.
When feasible, I prefer avoiding double negative logic. Was there any
reason in particular you used a skipHeavyIndexing=false attribute
instead of a heavyIndexing=true attribute?
jmcnally@apache.org writes:
> jmcnally 01/12/13 08:58:07
>
> Modified: src/dtd database.dtd
> src/java/org/apache/torque/engine/database/model
> Database.java Table.java
> Log:
> added flag to shut off heavy indexing on a table by table basis or for the entire schema.
>
> Revision Changes Path
> 1.7 +3 -2 jakarta-turbine-torque/src/dtd/database.dtd
>
> Index: database.dtd
> ===================================================================
> RCS file: /home/cvs/jakarta-turbine-torque/src/dtd/database.dtd,v
> retrieving revision 1.6
> retrieving revision 1.7
> diff -u -r1.6 -r1.7
> --- database.dtd 2001/11/07 19:54:12 1.6
> +++ database.dtd 2001/12/13 16:58:07 1.7
> @@ -1,6 +1,6 @@
> <!--
> Torque XML database schema DTD
> - $Id: database.dtd,v 1.6 2001/11/07 19:54:12 jvanzyl Exp $
> + $Id: database.dtd,v 1.7 2001/12/13 16:58:07 jmcnally Exp $
> -->
>
> <!--
> @@ -38,8 +38,8 @@
> package CDATA #IMPLIED
> baseClass CDATA #IMPLIED
> basePeer CDATA #IMPLIED
> -
> defaultJavaNamingMethod (nochange|underscore|javaname) "underscore"
> + skipHeavyIndexing (true|false) "false"
> >
>
> <!ELEMENT table (column+,(foreign-key|index|unique|id-method-parameter)*)>
> @@ -53,6 +53,7 @@
> basePeer CDATA #IMPLIED
> alias CDATA #IMPLIED
> javaNamingMethod (nochange|underscore|javaname) #IMPLIED
> + skipHeavyIndexing (true|false) "false"
> >
>
> <!ELEMENT id-method-parameter EMPTY>
>
>
>
> 1.8 +23 -2 jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/Database.java
>
> Index: Database.java
> ===================================================================
> RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/Database.java,v
> retrieving revision 1.7
> retrieving revision 1.8
> diff -u -r1.7 -r1.8
> --- Database.java 2001/11/08 17:20:52 1.7
> +++ Database.java 2001/12/13 16:58:07 1.8
> @@ -76,7 +76,7 @@
> * @author <a href="mailto:mpoeschl@marmot.at>Martin Poeschl</a>
> * @author <a href="mailto:dlr@collab.net>Daniel Rall</a>
> * @author <a href="mailto:byron_foster@byron_foster@yahoo.com>Byron Foster</a>
> - * @version $Id: Database.java,v 1.7 2001/11/08 17:20:52 mpoeschl Exp $
> + * @version $Id: Database.java,v 1.8 2001/12/13 16:58:07 jmcnally Exp $
> */
> public class Database
> {
> @@ -92,7 +92,8 @@
> private AppData dbParent;
> private Hashtable tablesByName = new Hashtable();
> private Hashtable tablesByJavaName = new Hashtable();
> -
> + private boolean skipHeavyIndexing;
> +
> /**
> * Creates a new instance with unset attributes.
> */
> @@ -115,6 +116,8 @@
> {
> defaultJavaNamingMethod = NameGenerator.CONV_METHOD_UNDERSCORE;
> }
> + skipHeavyIndexing = "true"
> + .equals(attrib.getValue("skipHeavyIndexing"));
> }
>
> /**
> @@ -232,6 +235,24 @@
> this.defaultJavaNamingMethod = v;
> }
>
> + /**
> + * Get the value of skipHeavyIndexing.
> + * @return value of skipHeavyIndexing.
> + */
> + public boolean isSkipHeavyIndexing()
> + {
> + return skipHeavyIndexing;
> + }
> +
> + /**
> + * Set the value of skipHeavyIndexing.
> + * @param v Value to assign to skipHeavyIndexing.
> + */
> + public void setSkipHeavyIndexing(boolean v)
> + {
> + this.skipHeavyIndexing = v;
> + }
> +
> /**
> * Return an array of all tables
> */
>
>
>
> 1.19 +9 -4 jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/Table.java
>
> Index: Table.java
> ===================================================================
> RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/Table.java,v
> retrieving revision 1.18
> retrieving revision 1.19
> diff -u -r1.18 -r1.19
> --- Table.java 2001/12/13 01:09:28 1.18
> +++ Table.java 2001/12/13 16:58:07 1.19
> @@ -75,7 +75,7 @@
> * @author <a href="mailto:jmcnally@collab.net>John McNally</a>
> * @author <a href="mailto:dlr@collab.net>Daniel Rall</a>
> * @author <a href="mailto:byron_foster@byron_foster@yahoo.com>Byron Foster</a>
> - * @version $Id: Table.java,v 1.18 2001/12/13 01:09:28 dlr Exp $
> + * @version $Id: Table.java,v 1.19 2001/12/13 16:58:07 jmcnally Exp $
> */
> public class Table implements IDMethod
> {
> @@ -105,6 +105,7 @@
> private Hashtable columnsByName;
> private Hashtable columnsByJavaName;
> private boolean needsTransactionInPostgres;
> + private boolean skipHeavyIndexing;
>
> /**
> * Default Constructor
> @@ -164,6 +165,8 @@
> baseClass = attrib.getValue("baseClass");
> basePeer = attrib.getValue("basePeer");
> alias = attrib.getValue("alias");
> + skipHeavyIndexing = "true"
> + .equals(attrib.getValue("skipHeavyIndexing"));
> }
>
> /**
> @@ -178,9 +181,11 @@
> {
> // Heavy indexing must wait until after all columns composing
> // a table's primary key have been parsed.
> - // TODO: Make this conditional on Torque or RDBMS property.
> - doHeavyIndexing();
> -
> + if (!skipHeavyIndexing && !getDatabase().isSkipHeavyIndexing())
> + {
> + doHeavyIndexing();
> + }
> +
> // Name any indices which are missing a name using the
> // appropriate algorithm.
> doNaming();
>
>
>
>
> --
> 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>