本文整理汇总了Java中ca.sqlpower.sqlobject.SQLType类的典型用法代码示例。如果您正苦于以下问题:Java SQLType类的具体用法?Java SQLType怎么用?Java SQLType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SQLType类属于ca.sqlpower.sqlobject包,在下文中一共展示了SQLType类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOldValue
import ca.sqlpower.sqlobject.SQLType; //导入依赖的package包/类
public String getOldValue() {
try {
if (propertyName.equals("type")) {
return SQLType.getTypeName(Integer.parseInt(oldValue));
}
} catch (NumberFormatException e) {
// The oldValue field has already been parsed
// TODO Have a better solution than this.
}
if (propertyName.equals("nullable")) {
if (oldValue.equals("0")) {
return "false";
} else if (oldValue.equals("1")) {
return "true";
}
}
return oldValue;
}
示例2: getNewValue
import ca.sqlpower.sqlobject.SQLType; //导入依赖的package包/类
public String getNewValue() {
try {
if (propertyName.equals("type")) {
return SQLType.getTypeName(Integer.parseInt(newValue));
}
} catch (NumberFormatException e) {
// The oldValue field has already been parsed
// TODO Have a better solution than this.
}
if (propertyName.equals("nullable")) {
if (newValue.equals("0")) {
return "false";
} else if (newValue.equals("1")) {
return "true";
}
}
return newValue;
}
示例3: incomingChange
import ca.sqlpower.sqlobject.SQLType; //导入依赖的package包/类
/**
* Sets the background color and creates a colored border in case of an incoming change/conflict.
*/
public static boolean incomingChange(JComboBox field, PropertyChangeEvent e) {
Object fieldValue = field.getSelectedItem();
if (field.getSelectedItem() instanceof String) {
changeBackground(field, (String) fieldValue, e);
} else if (field.getSelectedItem() instanceof SQLType) {
SQLType type = (SQLType) field.getSelectedItem();
fieldValue = type.getType();
changeBackground(field, fieldValue, e);
}
return changeBorder(field, fieldValue, e);
}
示例4: convertType
import ca.sqlpower.sqlobject.SQLType; //导入依赖的package包/类
/**
* A generic type converter. May not work with any database at
* all, but provides (what I hope is) a maximally standard set of
* defaults. This way, subclasses will be kept as small as
* possible.
*/
public String convertType(int sqlType, int precision, int scale) {
switch (sqlType) {
case Types.CHAR:
return "CHARACTER("+precision+")";
case SQLType.NCHAR:
return "NCHAR("+precision+")";
case Types.DATE:
return "DATE";
case Types.DECIMAL:
case Types.INTEGER:
case Types.SMALLINT:
case Types.TINYINT:
return "DECIMAL("+precision+")";
case Types.DOUBLE:
case Types.FLOAT:
case Types.NUMERIC:
case Types.REAL:
return "NUMBER("+precision+","+scale+")";
case Types.TIME:
return "TIME";
case Types.TIMESTAMP:
return "TIMESTAMP";
case Types.VARCHAR:
return "VARCHAR("+precision+")";
case SQLType.NVARCHAR:
return "NVARCHAR("+precision+")";
// we don't try to provide generic defaults for these types
case Types.ARRAY:
case Types.BIGINT:
case Types.BINARY:
case Types.BIT:
case Types.BLOB:
//case Types.BOOLEAN: JDBC 3
case Types.CLOB:
//case Types.DATALINK: JDBC 3
case Types.DISTINCT:
case Types.JAVA_OBJECT:
case Types.LONGVARBINARY:
case Types.LONGVARCHAR:
case Types.NULL:
case Types.OTHER:
case Types.REF:
case Types.STRUCT:
case Types.VARBINARY:
default:
throw new UnsupportedOperationException
("SQL Type "+sqlType+" is not implemented for this database.");
}
}