[cvs] expresso commit by fgalli: DBTool now generates field string contants

JCorporate Ltd jcorp at jcorporate.com
Fri Aug 5 13:26:01 UTC 2005


Log Message:
-----------
DBTool now generates field string contants like this:

public final static String FLD_FLDNAME = "fldname";
[...]
addField(FLD_FLDNAME, [...]);

Modified Files:
--------------
    expresso/expresso-web/expresso/doc:
        ChangeLog.xml
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/utility:
        DBTool.java

Revision Data
-------------
Index: ChangeLog.xml
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/expresso/doc/ChangeLog.xml,v
retrieving revision 1.314
retrieving revision 1.315
diff -Lexpresso-web/expresso/doc/ChangeLog.xml -Lexpresso-web/expresso/doc/ChangeLog.xml -u -r1.314 -r1.315
--- expresso-web/expresso/doc/ChangeLog.xml
+++ expresso-web/expresso/doc/ChangeLog.xml
@@ -5,6 +5,12 @@
 	<project name="Expresso">
 		<version name="5.7" releaseDate="Not released yet">
 			<comment>Continued Updates</comment>
+			<new-feature title="DBTool naming conventions changes">
+				<explanation>DBTool now generates fields using the FLD_<NAME_IN_UPPERCASE> format when generating string constants. This avoids the generation of field names with reserved words (like "abstract") and follows Expresso's conventions.
+                </explanation>
+				<contributor>Francesco Galli</contributor>
+			</new-feature>
+
 			<new-feature title="EMailSender sends email even in non-standard ports">
 				<explanation>The SMTP port, which defaults to 25, is now a setup value. This can be changed for mail servers not listening on the standard port. Run DBCreate to setup this new value if upgrading an old Expresso install.
                 </explanation>
Index: DBTool.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/utility/DBTool.java,v
retrieving revision 1.62
retrieving revision 1.63
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/utility/DBTool.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/utility/DBTool.java -u -r1.62 -r1.63
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/utility/DBTool.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/utility/DBTool.java
@@ -993,7 +993,7 @@
 
             fieldName = rs.getString(4);
             listOfColumnNames.add("\tpublic static final String "
-                    + fieldName + " = \"" + fieldName + "\";");
+                    + "FLD_"+fieldName.toUpperCase() + " = \"" + fieldName + "\";");
 
             fieldSize = rs.getInt(7);
 
@@ -1013,7 +1013,7 @@
 
             }
 
-            f.print("\t\taddField(" + fieldName + ", \"" + expressoType);
+            f.print("\t\taddField(FLD_" + fieldName.toUpperCase() + ", \"" + expressoType);
 
             f.print("\", " + fieldSize + ", ");
 
@@ -1039,7 +1039,7 @@
         ResultSet rspk = dm.getPrimaryKeys(null, "%", tableName);
 
         while (rspk.next()) {
-            f.println("\t\taddKey(" + rspk.getString("COLUMN_NAME") + ");");
+            f.println("\t\taddKey(FLD_" + rspk.getString("COLUMN_NAME").toUpperCase() + ");");
         }
 
         f.println("\t} /* setupFields() */");


More information about the cvs mailing list