You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by js...@apache.org on 2002/10/28 17:15:30 UTC
cvs commit: jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/builder SqlBuilder.java
jstrachan 2002/10/28 08:15:30
Modified: sql/src/java/org/apache/commons/sql/builder SqlBuilder.java
Log:
applied J. Russell Smyth 's patches
modified to work with these changes
modified getSqlType to do its own sql creation, allowing it
to be overridden in db specific builders.
Revision Changes Path
1.10 +14 -2 jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/builder/SqlBuilder.java
Index: SqlBuilder.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/sql/src/java/org/apache/commons/sql/builder/SqlBuilder.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- SqlBuilder.java 23 Sep 2002 16:56:06 -0000 1.9
+++ SqlBuilder.java 28 Oct 2002 16:15:29 -0000 1.10
@@ -76,6 +76,7 @@
import org.apache.commons.sql.model.ForeignKey;
import org.apache.commons.sql.model.Reference;
import org.apache.commons.sql.model.Table;
+import org.apache.commons.sql.model.TypeMap;
/**
* This class is a collection of Strategy methods for creating the DDL required to create and drop
@@ -392,9 +393,20 @@
* @return the full SQL type string including the size
*/
protected String getSqlType(Column column) {
- return column.getTypeString();
+ StringBuffer sqlType = new StringBuffer(column.getType());
+ if ( column.getSize() > 0 ) {
+ sqlType.append(" (");
+ sqlType.append(column.getSize());
+ sqlType.append(")");
+ }
+ if ( TypeMap.isDecimalType(column.getType()) ){
+ sqlType.append(",");
+ sqlType.append(column.getScale());
+ sqlType.append(")");
+ }
+ return sqlType.toString();
}
-
+
/**
* Writes the column types for a table
*/
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>