You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jo...@apache.org on 2001/09/05 11:39:28 UTC
cvs commit: jakarta-turbine-torque/src/java/org/apache/torque/oid IDBroker.java
jon 01/09/05 02:39:28
Modified: src/java/org/apache/torque/oid IDBroker.java
Log:
made things point to constants
thanks to: Patrick Tonidandel <pa...@wuerth.it> for the
notice
Revision Changes Path
1.4 +18 -11 jakarta-turbine-torque/src/java/org/apache/torque/oid/IDBroker.java
Index: IDBroker.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/oid/IDBroker.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- IDBroker.java 2001/08/27 02:14:35 1.3
+++ IDBroker.java 2001/09/05 09:39:28 1.4
@@ -114,23 +114,30 @@
*
* @author <a href="mailto:frank.kim@clearink.com">Frank Y. Kim</a>
* @author <a href="mailto:jmcnally@collab.net">John D. McNally</a>
- * @version $Id: IDBroker.java,v 1.3 2001/08/27 02:14:35 dlr Exp $
+ * @version $Id: IDBroker.java,v 1.4 2001/09/05 09:39:28 jon Exp $
*/
public class IDBroker
implements Runnable, IdGenerator
{
/**
+ * Name of the ID_TABLE = ID_TABLE
+ */
+ public static final String ID_TABLE = "ID_TABLE";
+
+ /**
* Fully qualified Table_Name column name
*/
- public static final String TABLE_NAME = "ID_TABLE.TABLE_NAME";
+ public static final String TABLE_NAME = ID_TABLE + ".TABLE_NAME";
+
/**
* Fully qualified Next_ID column name
*/
- public static final String NEXT_ID = "ID_TABLE.NEXT_ID";
+ public static final String NEXT_ID = ID_TABLE + ".NEXT_ID";
+
/**
* Fully qualified Quantity column name
*/
- public static final String QUANTITY = "ID_TABLE.QUANTITY";
+ public static final String QUANTITY = ID_TABLE + ".QUANTITY";
/** The TableMap referencing the ID_TABLE for this IDBroker. */
private TableMap tableMap;
@@ -723,9 +730,9 @@
throws Exception
{
StringBuffer stmt = new StringBuffer();
- stmt.append( "SELECT NEXT_ID, QUANTITY" )
- .append( " FROM ID_TABLE" )
- .append( " WHERE TABLE_NAME = '" )
+ stmt.append( "SELECT " + NEXT_ID + ", " + QUANTITY)
+ .append( " FROM " + ID_TABLE )
+ .append( " WHERE " + TABLE_NAME + " = '" )
.append( tableName )
.append( '\'' );
@@ -748,7 +755,7 @@
else
{
throw new TorqueException("The table "+tableName+
- " does not have a proper entry in the ID_TABLE");
+ " does not have a proper entry in the " + ID_TABLE);
}
}
finally
@@ -775,10 +782,10 @@
{
StringBuffer stmt =
new StringBuffer(id.length() + tableName.length() + 50);
- stmt.append( "UPDATE ID_TABLE" )
- .append( " SET next_id = " )
+ stmt.append( "UPDATE " + ID_TABLE )
+ .append( " SET " + NEXT_ID + " = " )
.append( id )
- .append( " WHERE TABLE_NAME = '" )
+ .append( " WHERE " + TABLE_NAME + " = '" )
.append( tableName )
.append( '\'' );
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org