Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.j256.ormlite.db;
 
 import java.util.List;
 
IBM DB2 database type information used to create the tables, etc..

WARNING: I have not tested this unfortunately because of a lack of access to a DB2 instance. Love to get 1-2 hours of access to an database to test/tweak this. Undoubtably is it wrong. Please contact the author if you'd like to help.

Author(s):
graywatson
public class Db2DatabaseType extends BaseDatabaseType implements DatabaseType {
	private final static String DATABASE_URL_PORTION = "db2";
	private final static String DRIVER_CLASS_NAME = "COM.ibm.db2.jdbc.app.DB2Driver";
	public String getDriverUrlPart() {
	}
	}
	protected void appendBooleanType(StringBuilder sb) {
		sb.append("SMALLINT");
	}
	protected void appendByteType(StringBuilder sb) {
		sb.append("SMALLINT");
	}
	protected void appendObjectType(StringBuilder sb) {
		sb.append("VARCHAR [] FOR BIT DATA");
	}
	protected void configureGeneratedId(StringBuilder sbFieldType fieldTypeList<StringstatementsBefore,
			List<StringadditionalArgsList<StringqueriesAfter) {
		sb.append("GENERATED ALWAYS AS IDENTITY ");
		configureId(sbfieldTypestatementsBeforeadditionalArgsqueriesAfter);
	}
	public void appendEscapedEntityName(StringBuilder sbString word) {
		sb.append('\"').append(word).append('\"');
	}
	protected void appendUnique(StringBuilder sbFieldType fieldTypeList<StringstatementsAfter) {
		StringBuilder alterSb = new StringBuilder();
		alterSb.append("ALTER TABLE ");
		appendEscapedEntityName(alterSbfieldType.getTableName());
		alterSb.append(" ADD UNIQUE (");
		alterSb.append(");");
		statementsAfter.add(alterSb.toString());
	}
New to GrepCode? Check out our FAQ X