Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/tools
In directory sc8-pr-cvs1:/tmp/cvs-serv19712/hibernate/tools
Modified Files:
SchemaExport.java
Log Message:
fixed a bug where delimiter was sometimes not appended
Index: SchemaExport.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/tools/SchemaExport.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** SchemaExport.java 19 Dec 2002 11:29:03 -0000 1.14
--- SchemaExport.java 17 Jan 2003 23:53:29 -0000 1.15
***************
*** 2,8 ****
package cirrus.hibernate.tools;
! import java.io.*;
! import java.sql.*;
! import java.util.*;
import cirrus.hibernate.Datastore;
--- 2,13 ----
package cirrus.hibernate.tools;
! import java.io.FileInputStream;
! import java.io.FileWriter;
! import java.io.IOException;
! import java.sql.Connection;
! import java.sql.SQLException;
! import java.sql.Statement;
! import java.util.Properties;
! import java.util.StringTokenizer;
import cirrus.hibernate.Datastore;
***************
*** 10,14 ****
import cirrus.hibernate.Hibernate;
import cirrus.hibernate.HibernateException;
! import cirrus.hibernate.connection.*;
import cirrus.hibernate.helpers.JDBCExceptionReporter;
import cirrus.hibernate.sql.Dialect;
--- 15,20 ----
import cirrus.hibernate.Hibernate;
import cirrus.hibernate.HibernateException;
! import cirrus.hibernate.connection.ConnectionProvider;
! import cirrus.hibernate.connection.ConnectionProviderFactory;
import cirrus.hibernate.helpers.JDBCExceptionReporter;
import cirrus.hibernate.sql.Dialect;
***************
*** 124,128 ****
for(int j = 0; j < createSQL.length; j++) {
try {
! String formatted = format ? format( createSQL[j], delimiter ) : createSQL[j];
if (script) System.out.println( formatted );
if (outputFile != null) fileOutput.write( formatted + "\n" );
--- 130,135 ----
for(int j = 0; j < createSQL.length; j++) {
try {
! String formatted = format ? format( createSQL[j] ) : createSQL[j];
! if (delimiter!=null) formatted+=delimiter;
if (script) System.out.println( formatted );
if (outputFile != null) fileOutput.write( formatted + "\n" );
***************
*** 179,187 ****
* a) Insert newline after each comma;
* b) Indent three spaces after each inserted newline;
- * c) Append an optional delimiter to the SQL statement.
* If the statement contains single/double quotes return unchanged,
* it is too complex and could be broken by simple formatting.
*/
! private static String format(String sql, String delimiter) {
if ( sql.indexOf("\"") > 0 || sql.indexOf("'") > 0) {
--- 186,193 ----
* a) Insert newline after each comma;
* b) Indent three spaces after each inserted newline;
* If the statement contains single/double quotes return unchanged,
* it is too complex and could be broken by simple formatting.
*/
! private static String format(String sql) {
if ( sql.indexOf("\"") > 0 || sql.indexOf("'") > 0) {
***************
*** 189,193 ****
}
! final String formatted;
if ( sql.toLowerCase().startsWith("create table") ) {
--- 195,199 ----
}
! String formatted;
if ( sql.toLowerCase().startsWith("create table") ) {
***************
*** 219,223 ****
}
! return (delimiter!=null) ? formatted + delimiter : formatted;
}
--- 225,229 ----
}
! return formatted;
}
|