Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect In directory sc8-pr-cvs1:/tmp/cvs-serv14211/src/net/sf/hibernate/dialect Modified Files: DB2Dialect.java Dialect.java GenericDialect.java HSQLDialect.java InterbaseDialect.java MckoiDialect.java MySQLDialect.java OracleDialect.java PointbaseDialect.java PostgreSQLDialect.java ProgressDialect.java SAPDBDialect.java SybaseDialect.java TypeNames.java Log Message: reformatted code with beautiful, shiny, happy TABS! improved an exception Index: DB2Dialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/DB2Dialect.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** DB2Dialect.java 1 Jan 2003 13:54:12 -0000 1.1.1.1 --- DB2Dialect.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 6,10 **** import net.sf.hibernate.Environment; ! /** * An SQL dialect for DB2. */ --- 6,10 ---- import net.sf.hibernate.Environment; ! /** * An SQL dialect for DB2. */ *************** *** 40,56 **** return false; } ! public boolean supportsIdentityColumns() { ! return true; ! } ! public String getIdentitySelectString() { ! return "values IDENTITY_VAL_LOCAL()"; ! } ! public String getIdentityColumnString() { ! return "not null generated by default as identity"; ! } ! public String getIdentityInsertString() { ! return "default"; ! } ! public String getSequenceNextValString(String sequenceName) { return "values nextval for " + sequenceName; --- 40,56 ---- return false; } ! public boolean supportsIdentityColumns() { ! return true; ! } ! public String getIdentitySelectString() { ! return "values IDENTITY_VAL_LOCAL()"; ! } ! public String getIdentityColumnString() { ! return "not null generated by default as identity"; ! } ! public String getIdentityInsertString() { ! return "default"; ! } ! public String getSequenceNextValString(String sequenceName) { return "values nextval for " + sequenceName; *************** *** 59,65 **** return "create sequence " + sequenceName; } ! public String getDropSequenceString(String sequenceName) { ! return "drop sequence " + sequenceName + " restrict"; ! } ! } --- 59,68 ---- return "create sequence " + sequenceName; } ! public String getDropSequenceString(String sequenceName) { ! return "drop sequence " + sequenceName + " restrict"; ! } ! } + + + Index: Dialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/Dialect.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Dialect.java 1 Jan 2003 13:54:13 -0000 1.1.1.1 --- Dialect.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 19,26 **** /** ! * Represents a dialect of SQL implemented by a particular RDBMS. * Subclasses implement Hibernate compatibility with different systems.<br> * <br> ! * Subclasses should provide a public default constructor that <tt>register()</tt> * a set of type mappings and default Hibernate properties.<br> * <br> --- 19,26 ---- /** ! * Represents a dialect of SQL implemented by a particular RDBMS. * Subclasses implement Hibernate compatibility with different systems.<br> * <br> ! * Subclasses should provide a public default constructor that <tt>register()</tt> * a set of type mappings and default Hibernate properties.<br> * <br> *************** *** 31,57 **** static final String DEFAULT_BATCH_SIZE = "15"; static final String NO_BATCH = "0"; ! private static final Log log = LogFactory.getLog(Dialect.class); ! ! protected Dialect() { ! log.info( "Using dialect: " + this ); ! } ! ! public String toString() { ! return getClass().getName(); ! } ! private final TypeNames typeNames = new TypeNames("$l"); private final Properties properties = new Properties(); private final OuterJoinGenerator outerJoinGenerator = new AnsiOuterJoinGenerator(); ! /** * Characters used for quoting SQL identifiers */ public static final String QUOTE="`\""; ! ! /** ! * Get the name of the database type associated with the given * <tt>java.sql.Types</tt> typecode. * @param code <tt>java.sql.Types</tt> typecode --- 31,57 ---- static final String DEFAULT_BATCH_SIZE = "15"; static final String NO_BATCH = "0"; ! private static final Log log = LogFactory.getLog(Dialect.class); ! ! protected Dialect() { ! log.info( "Using dialect: " + this ); ! } ! ! public String toString() { ! return getClass().getName(); ! } ! private final TypeNames typeNames = new TypeNames("$l"); private final Properties properties = new Properties(); private final OuterJoinGenerator outerJoinGenerator = new AnsiOuterJoinGenerator(); ! /** * Characters used for quoting SQL identifiers */ public static final String QUOTE="`\""; ! ! /** ! * Get the name of the database type associated with the given * <tt>java.sql.Types</tt> typecode. * @param code <tt>java.sql.Types</tt> typecode *************** *** 59,71 **** * @throws HibernateException */ ! public String getTypeName(int code) throws HibernateException { ! String result = typeNames.get(code); ! if (result == null) ! throw new HibernateException("No default type mapping for (java.sql.Types) " + code); ! return result; ! } ! /** ! * Get the name of the database type associated with the given * <tt>java.sql.Types</tt> typecode. * @param code <tt>java.sql.Types</tt> typecode --- 59,71 ---- * @throws HibernateException */ ! public String getTypeName(int code) throws HibernateException { ! String result = typeNames.get(code); ! if (result == null) ! throw new HibernateException("No default type mapping for (java.sql.Types) " + code); ! return result; ! } ! /** ! * Get the name of the database type associated with the given * <tt>java.sql.Types</tt> typecode. * @param code <tt>java.sql.Types</tt> typecode *************** *** 74,84 **** * @throws HibernateException */ ! public String getTypeName(int code, int length) throws HibernateException { ! String result = typeNames.get(code, length); ! if (result == null) ! throw new HibernateException("No type mapping for (java.sql.Types) " + code + " of length " + length); ! return result; ! } ! /** * Subclasses register a typename for the given type code and maximum --- 74,84 ---- * @throws HibernateException */ ! public String getTypeName(int code, int length) throws HibernateException { ! String result = typeNames.get(code, length); ! if (result == null) ! throw new HibernateException("No type mapping for (java.sql.Types) " + code + " of length " + length); ! return result; ! } ! /** * Subclasses register a typename for the given type code and maximum *************** *** 89,146 **** * @param name the database type name */ ! protected void register(int code, int capacity, String name) { ! typeNames.put(code, capacity, name); ! } ! /** ! * Subclasses register a typename for the given type code. <tt>$l</tt> in * the type name with be replaced by the column length (if appropriate). * @param code <tt>java.sql.Types</tt> typecode * @param name the database type name */ ! protected void register(int code, String name) { ! typeNames.put(code, name); ! } ! /** * Does this dialect support the <tt>ALTER TABLE</tt> syntax? * @return boolean */ ! public boolean hasAlterTable() { ! return true; ! } ! /** * Do we need to drop constraints before dropping tables in this dialect? * @return boolean */ ! public boolean dropConstraints() { ! return true; ! } ! /** * Do we need to qualify index names with the schema name? * @return boolean */ ! public boolean qualifyIndexName() { ! return true; ! } ! /** * Does this dialect support the <tt>FOR UPDATE</tt> syntax? * @return boolean */ ! public boolean supportsForUpdate() { ! return true; ! } ! /** * Does this dialect support the Oracle-style <tt>FOR UPDATE NOWAIT</tt> syntax? * @return boolean */ ! public boolean supportsForUpdateNowait() { ! return false; ! } ! /** * Does this dialect support the <tt>UNIQUE</tt> column syntax? --- 89,146 ---- * @param name the database type name */ ! protected void register(int code, int capacity, String name) { ! typeNames.put(code, capacity, name); ! } ! /** ! * Subclasses register a typename for the given type code. <tt>$l</tt> in * the type name with be replaced by the column length (if appropriate). * @param code <tt>java.sql.Types</tt> typecode * @param name the database type name */ ! protected void register(int code, String name) { ! typeNames.put(code, name); ! } ! /** * Does this dialect support the <tt>ALTER TABLE</tt> syntax? * @return boolean */ ! public boolean hasAlterTable() { ! return true; ! } ! /** * Do we need to drop constraints before dropping tables in this dialect? * @return boolean */ ! public boolean dropConstraints() { ! return true; ! } ! /** * Do we need to qualify index names with the schema name? * @return boolean */ ! public boolean qualifyIndexName() { ! return true; ! } ! /** * Does this dialect support the <tt>FOR UPDATE</tt> syntax? * @return boolean */ ! public boolean supportsForUpdate() { ! return true; ! } ! /** * Does this dialect support the Oracle-style <tt>FOR UPDATE NOWAIT</tt> syntax? * @return boolean */ ! public boolean supportsForUpdateNowait() { ! return false; ! } ! /** * Does this dialect support the <tt>UNIQUE</tt> column syntax? *************** *** 150,154 **** return true; } ! /** * The syntax used to add a column to a table. --- 150,154 ---- return true; } ! /** * The syntax used to add a column to a table. *************** *** 156,241 **** * @return String */ ! public abstract String getAddColumnString(); ! /** * The syntax used to add a foreign key constraint to a table. * @return String */ ! public String getAddForeignKeyConstraintString(String constraintName, String[] foreignKey, String referencedTable, String[] primaryKey) { ! return new StringBuffer(30) ! .append(" add constraint ") ! .append(constraintName) ! .append(" foreign key (") ! .append( StringHelper.join(", ", foreignKey) ) ! .append(") references ") ! .append(referencedTable) ! .toString(); ! } ! /** * The syntax used to add a primary key constraint to a table. * @return String */ ! public String getAddPrimaryKeyConstraintString(String constraintName) { ! return " add constraint " + constraintName + " primary key "; ! } ! /** * The keyword used to specify a nullable column. * @return String */ ! public String getNullColumnString() { ! return ""; ! } ! /** * Does this dialect support identity column key generation? * @return boolean */ ! public boolean supportsIdentityColumns() { ! return false; ! } ! ! public Serializable getIdentityFrom(ResultSet rs) throws SQLException { ! return new Long( rs.getLong(1) ); ! } ! /** ! * The syntax that returns the identity value of the last insert, if native ! * key generation is supported. ! * @throws MappingException if no native key generation ! */ ! public String getIdentitySelectString() throws MappingException { ! throw new MappingException("Dialect does not support native key generation"); ! } ! /** ! * The keyword used to specify an identity column, if native key generation is ! * supported. ! * @throws MappingException if no native key generation ! */ ! public String getIdentityColumnString() throws MappingException { ! throw new MappingException("Dialect does not support native key generation"); ! } /** * The keyword used to insert a generated value into an identity column (or null) * @return String */ ! public String getIdentityInsertString() { ! return null; ! } ! /** ! * The keyword used to insert a row without specifying any column values ! */ ! public String getNoColumnsInsertString() { ! return "values ( )"; ! } /** ! * The syntax that fetches the next value of a sequence, if sequences are supported. * @param sequenceName the name of the sequence * @return String * @throws MappingException if no sequences */ ! public String getSequenceNextValString(String sequenceName) throws MappingException { ! throw new MappingException("Dialect does not support sequences"); ! } /** * The syntax used to create a sequence, if sequences are supported. --- 156,241 ---- * @return String */ ! public abstract String getAddColumnString(); ! /** * The syntax used to add a foreign key constraint to a table. * @return String */ ! public String getAddForeignKeyConstraintString(String constraintName, String[] foreignKey, String referencedTable, String[] primaryKey) { ! return new StringBuffer(30) ! .append(" add constraint ") ! .append(constraintName) ! .append(" foreign key (") ! .append( StringHelper.join(", ", foreignKey) ) ! .append(") references ") ! .append(referencedTable) ! .toString(); ! } ! /** * The syntax used to add a primary key constraint to a table. * @return String */ ! public String getAddPrimaryKeyConstraintString(String constraintName) { ! return " add constraint " + constraintName + " primary key "; ! } ! /** * The keyword used to specify a nullable column. * @return String */ ! public String getNullColumnString() { ! return ""; ! } ! /** * Does this dialect support identity column key generation? * @return boolean */ ! public boolean supportsIdentityColumns() { ! return false; ! } ! ! public Serializable getIdentityFrom(ResultSet rs) throws SQLException { ! return new Long( rs.getLong(1) ); ! } ! /** ! * The syntax that returns the identity value of the last insert, if native ! * key generation is supported. ! * @throws MappingException if no native key generation ! */ ! public String getIdentitySelectString() throws MappingException { ! throw new MappingException("Dialect does not support native key generation"); ! } ! /** ! * The keyword used to specify an identity column, if native key generation is ! * supported. ! * @throws MappingException if no native key generation ! */ ! public String getIdentityColumnString() throws MappingException { ! throw new MappingException("Dialect does not support native key generation"); ! } /** * The keyword used to insert a generated value into an identity column (or null) * @return String */ ! public String getIdentityInsertString() { ! return null; ! } /** ! * The keyword used to insert a row without specifying any column values ! */ ! public String getNoColumnsInsertString() { ! return "values ( )"; ! } ! /** ! * The syntax that fetches the next value of a sequence, if sequences are supported. * @param sequenceName the name of the sequence * @return String * @throws MappingException if no sequences */ ! public String getSequenceNextValString(String sequenceName) throws MappingException { ! throw new MappingException("Dialect does not support sequences"); ! } /** * The syntax used to create a sequence, if sequences are supported. *************** *** 244,250 **** * @throws MappingException if no sequences */ ! public String getCreateSequenceString(String sequenceName) throws MappingException { ! throw new MappingException("Dialect does not support sequences"); ! } /** * The syntax used to drop a sequence, if sequences are supported. --- 244,250 ---- * @throws MappingException if no sequences */ ! public String getCreateSequenceString(String sequenceName) throws MappingException { ! throw new MappingException("Dialect does not support sequences"); ! } /** * The syntax used to drop a sequence, if sequences are supported. *************** *** 253,263 **** * @throws MappingException if no sequences */ ! public String getDropSequenceString(String sequenceName) throws MappingException { ! throw new MappingException("Dialect does not support sequences"); ! } ! public String getQuerySequencesString() { ! return null; ! } ! /** * Get the <tt>Dialect</tt> specified by the current <tt>System</tt> properties. --- 253,263 ---- * @throws MappingException if no sequences */ ! public String getDropSequenceString(String sequenceName) throws MappingException { ! throw new MappingException("Dialect does not support sequences"); ! } ! public String getQuerySequencesString() { ! return null; ! } ! /** * Get the <tt>Dialect</tt> specified by the current <tt>System</tt> properties. *************** *** 278,283 **** } } ! ! /** * Get the <tt>Dialect</tt> specified by the given properties or system properties. --- 278,283 ---- } } ! ! /** * Get the <tt>Dialect</tt> specified by the given properties or system properties. *************** *** 315,319 **** return ""; } ! /** * Get the <tt>OuterJoinGenerator</tt> need to implement outer joins for this dialect. --- 315,319 ---- return ""; } ! /** * Get the <tt>OuterJoinGenerator</tt> need to implement outer joins for this dialect. *************** *** 325,327 **** --- 325,330 ---- } + + + Index: GenericDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/GenericDialect.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** GenericDialect.java 1 Jan 2003 13:54:13 -0000 1.1.1.1 --- GenericDialect.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 5,13 **** ! /** * A generic SQL dialect which may or may not work on any actual databases */ public class GenericDialect extends Dialect { ! public GenericDialect() { super(); --- 5,13 ---- ! /** * A generic SQL dialect which may or may not work on any actual databases */ public class GenericDialect extends Dialect { ! public GenericDialect() { super(); *************** *** 33,36 **** return "add column"; } ! } --- 33,39 ---- return "add column"; } ! } + + + Index: HSQLDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/HSQLDialect.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** HSQLDialect.java 1 Jan 2003 13:54:14 -0000 1.1.1.1 --- HSQLDialect.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 11,37 **** import net.sf.hibernate.Environment; ! /** * An SQL dialect compatible with HSQLDB (Hypersonic SQL). */ public class HSQLDialect extends Dialect { ! public HSQLDialect() { super(); register( Types.BIGINT, "BIGINT" ); register( Types.BINARY, "BINARY" ); ! register( Types.BIT, "BIT" ); register( Types.CHAR, "CHAR(1)" ); register( Types.DATE, "DATE" ); ! register( Types.DECIMAL, "DECIMAL" ); register( Types.DOUBLE, "DOUBLE" ); register( Types.FLOAT, "FLOAT" ); ! register( Types.INTEGER, "INTEGER" ); ! register( Types.LONGVARBINARY, "LONGVARBINARY" ); ! register( Types.LONGVARCHAR, "LONGVARCHAR" ); ! register( Types.SMALLINT, "SMALLINT" ); register( Types.TINYINT, "TINYINT" ); ! register( Types.TIME, "TIME" ); register( Types.TIMESTAMP, "TIMESTAMP" ); ! register( Types.VARCHAR, "VARCHAR($l)" ); register( Types.VARBINARY, "VARBINARY($l)" ); register( Types.NUMERIC, "NUMERIC" ); --- 11,37 ---- import net.sf.hibernate.Environment; ! /** * An SQL dialect compatible with HSQLDB (Hypersonic SQL). */ public class HSQLDialect extends Dialect { ! public HSQLDialect() { super(); register( Types.BIGINT, "BIGINT" ); register( Types.BINARY, "BINARY" ); ! register( Types.BIT, "BIT" ); register( Types.CHAR, "CHAR(1)" ); register( Types.DATE, "DATE" ); ! register( Types.DECIMAL, "DECIMAL" ); register( Types.DOUBLE, "DOUBLE" ); register( Types.FLOAT, "FLOAT" ); ! register( Types.INTEGER, "INTEGER" ); ! register( Types.LONGVARBINARY, "LONGVARBINARY" ); ! register( Types.LONGVARCHAR, "LONGVARCHAR" ); ! register( Types.SMALLINT, "SMALLINT" ); register( Types.TINYINT, "TINYINT" ); ! register( Types.TIME, "TIME" ); register( Types.TIMESTAMP, "TIMESTAMP" ); ! register( Types.VARCHAR, "VARCHAR($l)" ); register( Types.VARBINARY, "VARBINARY($l)" ); register( Types.NUMERIC, "NUMERIC" ); *************** *** 47,51 **** public boolean hasAlterTable(){ return false; ! } public boolean dropConstraints() { --- 47,51 ---- public boolean hasAlterTable(){ return false; ! } public boolean dropConstraints() { *************** *** 53,81 **** } ! public Serializable getIdentityFrom(ResultSet rs) throws SQLException { ! return new Integer( rs.getInt(1) ); ! } ! ! public boolean supportsIdentityColumns() { ! return true; ! } ! public String getIdentityColumnString() { ! return "NOT NULL IDENTITY"; ! } ! public String getIdentitySelectString() { ! return "call IDENTITY()"; ! } ! public String getIdentityInsertString() { ! return "null"; ! } ! public boolean supportsForUpdate() { return false; } - public boolean supportsUnique() { - return false; - } - } --- 53,84 ---- } ! public Serializable getIdentityFrom(ResultSet rs) throws SQLException { ! return new Integer( rs.getInt(1) ); ! } ! ! public boolean supportsIdentityColumns() { ! return true; ! } ! public String getIdentityColumnString() { ! return "NOT NULL IDENTITY"; ! } ! public String getIdentitySelectString() { ! return "call IDENTITY()"; ! } ! public String getIdentityInsertString() { ! return "null"; ! } ! public boolean supportsForUpdate() { return false; } + + public boolean supportsUnique() { + return false; + } + + + } Index: InterbaseDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/InterbaseDialect.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** InterbaseDialect.java 1 Jan 2003 13:54:14 -0000 1.1.1.1 --- InterbaseDialect.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 6,10 **** import net.sf.hibernate.Environment; ! /** * An SQL dialect for Interbase. */ --- 6,10 ---- import net.sf.hibernate.Environment; ! /** * An SQL dialect for Interbase. */ *************** *** 33,39 **** getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH); getDefaultProperties().setProperty(Environment.STATEMENT_CACHE_SIZE, "0"); ! } ! public String getAddColumnString() { return "add"; --- 33,39 ---- getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH); getDefaultProperties().setProperty(Environment.STATEMENT_CACHE_SIZE, "0"); ! } ! public String getAddColumnString() { return "add"; *************** *** 45,51 **** return "create generator " + sequenceName; } ! public String getDropSequenceString(String sequenceName) { ! return "delete from RDB$GENERATORS where RDB$GENERATOR_NAME = '" + sequenceName.toUpperCase() + "'"; ! } ! } \ No newline at end of file --- 45,53 ---- return "create generator " + sequenceName; } ! public String getDropSequenceString(String sequenceName) { ! return "delete from RDB$GENERATORS where RDB$GENERATOR_NAME = '" + sequenceName.toUpperCase() + "'"; ! } ! } ! ! Index: MckoiDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/MckoiDialect.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** MckoiDialect.java 1 Jan 2003 13:54:14 -0000 1.1.1.1 --- MckoiDialect.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 31,35 **** getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH); } ! public String getAddColumnString() { return "add column"; --- 31,35 ---- getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH); } ! public String getAddColumnString() { return "add column"; *************** *** 48,49 **** --- 48,52 ---- } } + + + Index: MySQLDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/MySQLDialect.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** MySQLDialect.java 1 Jan 2003 13:54:14 -0000 1.1.1.1 --- MySQLDialect.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 7,11 **** import net.sf.hibernate.util.StringHelper; ! /** * An SQL dialect for MySQL. */ --- 7,11 ---- import net.sf.hibernate.util.StringHelper; ! /** * An SQL dialect for MySQL. */ *************** *** 39,47 **** register( Types.CLOB, 16777215, "MEDIUMTEXT" ); register( Types.CLOB, 65535, "TEXT" ); ! getDefaultProperties().setProperty(Environment.OUTER_JOIN, "true"); getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE); } ! public String getAddColumnString() { return "add column"; --- 39,47 ---- register( Types.CLOB, 16777215, "MEDIUMTEXT" ); register( Types.CLOB, 65535, "TEXT" ); ! getDefaultProperties().setProperty(Environment.OUTER_JOIN, "true"); getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE); } ! public String getAddColumnString() { return "add column"; *************** *** 53,85 **** return false; } - public boolean supportsIdentityColumns() { - return true; - } - public String getIdentitySelectString() { - return "SELECT LAST_INSERT_ID()"; - } - - public String getIdentityColumnString() { - return "NOT NULL AUTO_INCREMENT"; - } - public String getAddForeignKeyConstraintString(String constraintName, String[] foreignKey, String referencedTable, String[] primaryKey) { - String cols = StringHelper.join(", ", foreignKey); - return new StringBuffer(30) - .append(" add index (") - .append(cols) - .append("), add constraint ") - .append(constraintName) - .append(" foreign key (") - .append(cols) - .append(") references ") - .append(referencedTable) - .append(" (") - .append( StringHelper.join(", ", primaryKey) ) - .append(')') - .toString(); - } - } --- 53,88 ---- return false; } + + public boolean supportsIdentityColumns() { + return true; + } + public String getIdentitySelectString() { + return "SELECT LAST_INSERT_ID()"; + } + + public String getIdentityColumnString() { + return "NOT NULL AUTO_INCREMENT"; + } + + public String getAddForeignKeyConstraintString(String constraintName, String[] foreignKey, String referencedTable, String[] primaryKey) { + String cols = StringHelper.join(", ", foreignKey); + return new StringBuffer(30) + .append(" add index (") + .append(cols) + .append("), add constraint ") + .append(constraintName) + .append(" foreign key (") + .append(cols) + .append(") references ") + .append(referencedTable) + .append(" (") + .append( StringHelper.join(", ", primaryKey) ) + .append(')') + .toString(); + } + + } Index: OracleDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/OracleDialect.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** OracleDialect.java 1 Jan 2003 13:54:15 -0000 1.1.1.1 --- OracleDialect.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 8,19 **** import net.sf.hibernate.loader.OracleOuterJoinGenerator; ! /** * An SQL dialect for Oracle. */ public class OracleDialect extends Dialect { ! private final OuterJoinGenerator outerJoinGenerator; ! public OracleDialect() { super(); --- 8,19 ---- import net.sf.hibernate.loader.OracleOuterJoinGenerator; ! /** * An SQL dialect for Oracle. */ public class OracleDialect extends Dialect { ! private final OuterJoinGenerator outerJoinGenerator; ! public OracleDialect() { super(); *************** *** 34,45 **** register( Types.BLOB, "BLOB" ); register( Types.CLOB, "CLOB" ); ! outerJoinGenerator = new OracleOuterJoinGenerator(); ! getDefaultProperties().setProperty(Environment.USE_STREAMS_FOR_BINARY, "true"); getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE); getDefaultProperties().setProperty(Environment.OUTER_JOIN, "true"); } ! public String getAddColumnString() { return "add"; --- 34,45 ---- register( Types.BLOB, "BLOB" ); register( Types.CLOB, "CLOB" ); ! outerJoinGenerator = new OracleOuterJoinGenerator(); ! getDefaultProperties().setProperty(Environment.USE_STREAMS_FOR_BINARY, "true"); getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE); getDefaultProperties().setProperty(Environment.OUTER_JOIN, "true"); } ! public String getAddColumnString() { return "add"; *************** *** 52,72 **** return "create sequence " + sequenceName; } ! public String getDropSequenceString(String sequenceName) { ! return "drop sequence " + sequenceName; ! } ! public String getCascadeConstraintsString() { return " cascade constraints"; } ! public OuterJoinGenerator getOuterJoinGenerator() { return outerJoinGenerator; } - public boolean supportsForUpdateNowait() { - return true; - } - } --- 52,75 ---- return "create sequence " + sequenceName; } ! public String getDropSequenceString(String sequenceName) { ! return "drop sequence " + sequenceName; ! } ! public String getCascadeConstraintsString() { return " cascade constraints"; } ! public OuterJoinGenerator getOuterJoinGenerator() { return outerJoinGenerator; } + + public boolean supportsForUpdateNowait() { + return true; + } + + } + Index: PointbaseDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/PointbaseDialect.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PointbaseDialect.java 1 Jan 2003 13:54:15 -0000 1.1.1.1 --- PointbaseDialect.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 12,42 **** */ public class PointbaseDialect extends net.sf.hibernate.dialect.Dialect { ! ! /** Creates new PointbaseDialect */ ! public PointbaseDialect() { ! super(); ! register( Types.BIT, "SMALLINT" ); //no pointbase BIT ! register( Types.BIGINT, "BIGINT" ); ! register( Types.SMALLINT, "SMALLINT" ); ! register( Types.TINYINT, "SMALLINT" ); //no pointbase TINYINT ! register( Types.INTEGER, "INTEGER" ); ! register( Types.CHAR, "CHAR(1)" ); ! register( Types.VARCHAR, "VARCHAR($l)" ); ! register( Types.FLOAT, "FLOAT" ); ! register( Types.DOUBLE, "DOUBLE PRECISION" ); ! register( Types.DATE, "DATE" ); ! register( Types.TIME, "TIME" ); ! register( Types.TIMESTAMP, "TIMESTAMP" ); ! //the BLOB type requires a size arguement - this defaults to ! //bytes - no arg defaults to 1 whole byte! ! //other argument mods include K - kilobyte, M - megabyte, G - gigabyte. ! //refer to the PBdevelopers guide for more info. ! register( Types.VARBINARY, "BLOB($l)" ); ! register( Types.NUMERIC, "NUMERIC(19, $l)" ); ! getDefaultProperties().setProperty(Environment.OUTER_JOIN, "true"); ! } ! /** * @see net.sf.hibernate.sql.Dialect#getAddColumnString() --- 12,42 ---- */ public class PointbaseDialect extends net.sf.hibernate.dialect.Dialect { ! ! /** Creates new PointbaseDialect */ ! public PointbaseDialect() { ! super(); ! register( Types.BIT, "SMALLINT" ); //no pointbase BIT ! register( Types.BIGINT, "BIGINT" ); ! register( Types.SMALLINT, "SMALLINT" ); ! register( Types.TINYINT, "SMALLINT" ); //no pointbase TINYINT ! register( Types.INTEGER, "INTEGER" ); ! register( Types.CHAR, "CHAR(1)" ); ! register( Types.VARCHAR, "VARCHAR($l)" ); ! register( Types.FLOAT, "FLOAT" ); ! register( Types.DOUBLE, "DOUBLE PRECISION" ); ! register( Types.DATE, "DATE" ); ! register( Types.TIME, "TIME" ); ! register( Types.TIMESTAMP, "TIMESTAMP" ); ! //the BLOB type requires a size arguement - this defaults to ! //bytes - no arg defaults to 1 whole byte! ! //other argument mods include K - kilobyte, M - megabyte, G - gigabyte. ! //refer to the PBdevelopers guide for more info. ! register( Types.VARBINARY, "BLOB($l)" ); ! register( Types.NUMERIC, "NUMERIC(19, $l)" ); ! getDefaultProperties().setProperty(Environment.OUTER_JOIN, "true"); ! } ! /** * @see net.sf.hibernate.sql.Dialect#getAddColumnString() *************** *** 45,49 **** return "add"; } ! /** * @see net.sf.hibernate.sql.Dialect#dropConstraints() --- 45,49 ---- return "add"; } ! /** * @see net.sf.hibernate.sql.Dialect#dropConstraints() *************** *** 52,56 **** return false; } ! /** * @see net.sf.hibernate.sql.Dialect#getCascadeConstraintsString() --- 52,56 ---- return false; } ! /** * @see net.sf.hibernate.sql.Dialect#getCascadeConstraintsString() *************** *** 59,63 **** return " cascade"; } ! /** * @see net.sf.hibernate.sql.Dialect#supportsForUpdate() --- 59,63 ---- return " cascade"; } ! /** * @see net.sf.hibernate.sql.Dialect#supportsForUpdate() *************** *** 66,70 **** return false; } ! } --- 66,73 ---- return false; } ! } + + + Index: PostgreSQLDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/PostgreSQLDialect.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PostgreSQLDialect.java 1 Jan 2003 13:54:15 -0000 1.1.1.1 --- PostgreSQLDialect.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 6,10 **** import net.sf.hibernate.Environment; ! /** * An SQL dialect for Postgres */ --- 6,10 ---- import net.sf.hibernate.Environment; ! /** * An SQL dialect for Postgres */ *************** *** 31,35 **** getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE); } ! public String getAddColumnString() { return "add column"; --- 31,35 ---- getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE); } ! public String getAddColumnString() { return "add column"; *************** *** 38,55 **** return false; } ! public String getSequenceNextValString(String sequenceName) { ! return "select nextval ('" + sequenceName +"')"; ! } public String getCreateSequenceString(String sequenceName) { return "create sequence " + sequenceName; } ! public String getDropSequenceString(String sequenceName) { ! return "drop sequence " + sequenceName; ! } ! public String getCascadeConstraintsString() { return " cascade"; } ! } --- 38,58 ---- return false; } ! public String getSequenceNextValString(String sequenceName) { ! return "select nextval ('" + sequenceName +"')"; ! } public String getCreateSequenceString(String sequenceName) { return "create sequence " + sequenceName; } ! public String getDropSequenceString(String sequenceName) { ! return "drop sequence " + sequenceName; ! } ! public String getCascadeConstraintsString() { return " cascade"; } ! } + + + Index: ProgressDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/ProgressDialect.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ProgressDialect.java 1 Jan 2003 13:54:15 -0000 1.1.1.1 --- ProgressDialect.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 5,9 **** import java.sql.Types; ! /** * An SQL dialect compatible with Progress 9.1C<br> *<br> --- 5,9 ---- import java.sql.Types; ! /** * An SQL dialect compatible with Progress 9.1C<br> *<br> *************** *** 16,20 **** * <li>hibernate.password password *</ul> ! * The WorkArounds parameter in the URL is required to avoid an error * in the Progress 9.1C JDBC driver related to PreparedStatements. * --- 16,20 ---- * <li>hibernate.password password *</ul> ! * The WorkArounds parameter in the URL is required to avoid an error * in the Progress 9.1C JDBC driver related to PreparedStatements. * *************** *** 38,54 **** register( Types.NUMERIC, "NUMERIC(19,$l)" ); } ! public boolean hasAlterTable(){ return false; ! } ! public String getAddColumnString() { return "add column"; } ! ! public boolean qualifyIndexName() { ! return false; ! } } ! \ No newline at end of file --- 38,56 ---- register( Types.NUMERIC, "NUMERIC(19,$l)" ); } ! public boolean hasAlterTable(){ return false; ! } ! public String getAddColumnString() { return "add column"; } ! ! public boolean qualifyIndexName() { ! return false; ! } } ! ! ! Index: SAPDBDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/SAPDBDialect.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SAPDBDialect.java 1 Jan 2003 13:54:16 -0000 1.1.1.1 --- SAPDBDialect.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 14,101 **** */ public class SAPDBDialect extends Dialect { ! private final OuterJoinGenerator outerJoinGenerator; ! ! public SAPDBDialect() { ! super(); ! register( Types.BIT, "BOOLEAN" ); ! register( Types.BIGINT, "FIXED(19,0)" ); ! register( Types.SMALLINT, "SMALLINT" ); ! register( Types.TINYINT, "FIXED(3,0)" ); ! register( Types.INTEGER, "INT" ); ! register( Types.CHAR, "CHAR(1)" ); ! register( Types.VARCHAR, "VARCHAR($l)" ); ! register( Types.FLOAT, "FLOAT" ); ! register( Types.DOUBLE, "DOUBLE PRECISION" ); ! register( Types.DATE, "DATE" ); ! register( Types.TIME, "TIME" ); ! register( Types.TIMESTAMP, "TIMESTAMP" ); ! register( Types.VARBINARY, "LONG BYTE" ); ! register( Types.NUMERIC, "FIXED(19,$l)" ); ! register( Types.CLOB, "LONG VARCHAR" ); ! register( Types.BLOB, "LONG BYTE" ); ! outerJoinGenerator = new OracleOuterJoinGenerator(); ! getDefaultProperties().setProperty(Environment.OUTER_JOIN, "true"); getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE); ! ! } ! ! public boolean hasAlterTable() { ! return true; ! } ! ! public boolean supportsForUpdate() { ! return false; ! } ! ! public boolean dropConstraints() { ! return false; ! } ! ! public String getAddColumnString() { ! return "add"; ! } ! ! public String getAddForeignKeyConstraintString(String constraintName, String[] foreignKey, String referencedTable, String[] primaryKey) { ! return new StringBuffer(30) ! .append(" foreign key ") ! .append(constraintName) ! .append(" (") ! .append( StringHelper.join(", ", foreignKey) ) ! .append(") references ") ! .append(referencedTable) ! .toString(); ! } ! ! public String getAddPrimaryKeyConstraintString(String constraintName) { ! return " primary key "; ! } ! ! public String getNullColumnString() { ! return " null"; ! } ! ! public String getSequenceNextValString(String sequenceName) { ! return "select " + sequenceName + ".nextval from dual"; ! } ! ! public String getCreateSequenceString(String sequenceName) { ! return "create sequence " + sequenceName; ! } ! ! public String getDropSequenceString(String sequenceName) { ! return "drop sequence " + sequenceName; ! } ! ! public String getQuerySequencesString() ! { ! return "select SEQUENCE_NAME from DOMAIN.SEQUENCES"; ! } ! public OuterJoinGenerator getOuterJoinGenerator() { return outerJoinGenerator; } - } \ No newline at end of file --- 14,103 ---- */ public class SAPDBDialect extends Dialect { ! private final OuterJoinGenerator outerJoinGenerator; ! ! public SAPDBDialect() { ! super(); ! register( Types.BIT, "BOOLEAN" ); ! register( Types.BIGINT, "FIXED(19,0)" ); ! register( Types.SMALLINT, "SMALLINT" ); ! register( Types.TINYINT, "FIXED(3,0)" ); ! register( Types.INTEGER, "INT" ); ! register( Types.CHAR, "CHAR(1)" ); ! register( Types.VARCHAR, "VARCHAR($l)" ); ! register( Types.FLOAT, "FLOAT" ); ! register( Types.DOUBLE, "DOUBLE PRECISION" ); ! register( Types.DATE, "DATE" ); ! register( Types.TIME, "TIME" ); ! register( Types.TIMESTAMP, "TIMESTAMP" ); ! register( Types.VARBINARY, "LONG BYTE" ); ! register( Types.NUMERIC, "FIXED(19,$l)" ); ! register( Types.CLOB, "LONG VARCHAR" ); ! register( Types.BLOB, "LONG BYTE" ); ! outerJoinGenerator = new OracleOuterJoinGenerator(); ! getDefaultProperties().setProperty(Environment.OUTER_JOIN, "true"); getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE); ! ! } ! ! public boolean hasAlterTable() { ! return true; ! } ! ! public boolean supportsForUpdate() { ! return false; ! } ! ! public boolean dropConstraints() { ! return false; ! } ! ! public String getAddColumnString() { ! return "add"; ! } ! ! public String getAddForeignKeyConstraintString(String constraintName, String[] foreignKey, String referencedTable, String[] primaryKey) { ! return new StringBuffer(30) ! .append(" foreign key ") ! .append(constraintName) ! .append(" (") ! .append( StringHelper.join(", ", foreignKey) ) ! .append(") references ") ! .append(referencedTable) ! .toString(); ! } ! ! public String getAddPrimaryKeyConstraintString(String constraintName) { ! return " primary key "; ! } ! ! public String getNullColumnString() { ! return " null"; ! } ! ! public String getSequenceNextValString(String sequenceName) { ! return "select " + sequenceName + ".nextval from dual"; ! } ! ! public String getCreateSequenceString(String sequenceName) { ! return "create sequence " + sequenceName; ! } ! ! public String getDropSequenceString(String sequenceName) { ! return "drop sequence " + sequenceName; ! } ! ! public String getQuerySequencesString() ! { ! return "select SEQUENCE_NAME from DOMAIN.SEQUENCES"; ! } ! public OuterJoinGenerator getOuterJoinGenerator() { return outerJoinGenerator; } + + } + Index: SybaseDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/SybaseDialect.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SybaseDialect.java 1 Jan 2003 13:54:16 -0000 1.1.1.1 --- SybaseDialect.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 6,10 **** import net.sf.hibernate.Environment; ! /** * An SQL dialect compatible with Sybase and MS SQL Server. */ --- 6,10 ---- import net.sf.hibernate.Environment; ! /** * An SQL dialect compatible with Sybase and MS SQL Server. */ *************** *** 29,37 **** register( Types.BLOB, "IMAGE" ); register( Types.CLOB, "TEXT" ); ! getDefaultProperties().setProperty(Environment.OUTER_JOIN, "true"); getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH); } ! public String getAddColumnString() { return "add"; --- 29,37 ---- register( Types.BLOB, "IMAGE" ); register( Types.CLOB, "TEXT" ); ! getDefaultProperties().setProperty(Environment.OUTER_JOIN, "true"); getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH); } ! public String getAddColumnString() { return "add"; *************** *** 47,64 **** return false; } ! ! public boolean supportsIdentityColumns() { ! return true; ! } ! public String getIdentitySelectString() { ! return "select @@identity"; ! } ! public String getIdentityColumnString() { ! return "IDENTITY NOT NULL"; ! } ! public String getNoColumnsInsertString() { return "DEFAULT VALUES"; } - } \ No newline at end of file --- 47,66 ---- return false; } ! ! public boolean supportsIdentityColumns() { ! return true; ! } ! public String getIdentitySelectString() { ! return "select @@identity"; ! } ! public String getIdentityColumnString() { ! return "IDENTITY NOT NULL"; ! } ! public String getNoColumnsInsertString() { return "DEFAULT VALUES"; } + + } + Index: TypeNames.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/TypeNames.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** TypeNames.java 1 Jan 2003 13:54:17 -0000 1.1.1.1 --- TypeNames.java 4 Jan 2003 11:15:28 -0000 1.2 *************** *** 45,49 **** private HashMap weighted = new HashMap(); private HashMap defaults = new HashMap(); ! /** * Constructor. --- 45,49 ---- private HashMap weighted = new HashMap(); private HashMap defaults = new HashMap(); ! /** * Constructor. *************** *** 52,59 **** public TypeNames(String placeholder) { super(); ! this.placeholder = placeholder; } ! /** * get default type name for specified type --- 52,59 ---- public TypeNames(String placeholder) { super(); ! this.placeholder = placeholder; } ! /** * get default type name for specified type *************** *** 61,68 **** * @return the default type name associated with specified key */ ! public String get(int typecode) { ! return (String) defaults.get( new Integer(typecode) ); ! } ! /** * get type name for specified type and size --- 61,68 ---- * @return the default type name associated with specified key */ ! public String get(int typecode) { ! return (String) defaults.get( new Integer(typecode) ); ! } ! /** * get type name for specified type and size *************** *** 72,82 **** * if available and the default type name otherwise */ ! public String get(int typecode, int size) { ! Map map = (Map) weighted.get( new Integer(typecode) ); ! if (map != null && map.size() > 0) { ! // iterate entries ordered by capacity to find first fit ! Iterator entries = map.entrySet().iterator(); ! while (entries.hasNext()) { ! Map.Entry entry = (Map.Entry)entries.next(); if (size <= ((Integer)entry.getKey()).intValue()) { return StringHelper.replaceOnce( --- 72,82 ---- * if available and the default type name otherwise */ ! public String get(int typecode, int size) { ! Map map = (Map) weighted.get( new Integer(typecode) ); ! if (map != null && map.size() > 0) { ! // iterate entries ordered by capacity to find first fit ! Iterator entries = map.entrySet().iterator(); ! while (entries.hasNext()) { ! Map.Entry entry = (Map.Entry)entries.next(); if (size <= ((Integer)entry.getKey()).intValue()) { return StringHelper.replaceOnce( *************** *** 86,94 **** ); } ! } ! } ! return StringHelper.replaceOnce( get(typecode), placeholder, Integer.toString(size) ); ! } ! /** * set a type name for specified type key and capacity --- 86,94 ---- ); } ! } ! } ! return StringHelper.replaceOnce( get(typecode), placeholder, Integer.toString(size) ); ! } ! /** * set a type name for specified type key and capacity *************** *** 96,105 **** */ public void put(int typecode, int capacity, String value) { ! TreeMap map = (TreeMap)weighted.get( new Integer(typecode) ); ! if (map == null) // add new ordered map ! weighted.put( new Integer(typecode), map = new TreeMap() ); ! map.put(new Integer(capacity), value); ! } ! /** * set a default type name for specified type key --- 96,105 ---- */ public void put(int typecode, int capacity, String value) { ! TreeMap map = (TreeMap)weighted.get( new Integer(typecode) ); ! if (map == null) // add new ordered map ! weighted.put( new Integer(typecode), map = new TreeMap() ); ! map.put(new Integer(capacity), value); ! } ! /** * set a default type name for specified type key *************** *** 108,111 **** public void put(int typecode, String value) { defaults.put( new Integer(typecode), value ); ! } } --- 108,114 ---- public void put(int typecode, String value) { defaults.put( new Integer(typecode), value ); ! } } + + + |