当前位置: 首页>>代码示例>>Java>>正文


Java SQLType类代码示例

本文整理汇总了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;
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:19,代码来源:PropertyChange.java

示例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;
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:19,代码来源:PropertyChange.java

示例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);
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:15,代码来源:DataEntryPanelChangeUtil.java

示例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.");
	}
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:66,代码来源:SqlTypeConverter.java


注:本文中的ca.sqlpower.sqlobject.SQLType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。