/** * Returns a boolean value indicating whether or not the specified TableColumnInfo represents a database * column that holds binary type data. * * @param columnInfo * the TableColumnInfo to examine * @return true if binary; false otherwise. */ public static boolean isBinaryType(TableColumnInfo columnInfo) { boolean result = false; int type = columnInfo.getDataType(); if (type == Types.BINARY || type == Types.BLOB || type == Types.LONGVARBINARY || type == Types.VARBINARY) { result = true; } return result; }
private boolean isNumericValueCheck(TableColumnInfo tableColumnInfo) { int dataType = getUsedDataType(); return (getUsedGroup() == STDataType.GROUP_NUMERIC && (dataType == tableColumnInfo.getDataType() || (dataType == STDataType.USE_WHOLE_GROUP && SmarttoolsHelper.isDataTypeNumeric(tableColumnInfo.getDataType()))) && isValidColumnName(tableColumnInfo.getColumnName())); }
private boolean isStringValueCheck(TableColumnInfo tableColumnInfo) { int dataType = getUsedDataType(); return (getUsedGroup() == STDataType.GROUP_CHAR && (dataType == tableColumnInfo.getDataType() || (dataType == STDataType.USE_WHOLE_GROUP && SmarttoolsHelper.isDataTypeString(tableColumnInfo.getDataType()))) && isValidColumnName(tableColumnInfo.getColumnName())); }
private boolean isIntegerValueCheck(TableColumnInfo tableColumnInfo) { int dataType = getUsedDataType(); return (getUsedGroup() == STDataType.GROUP_INT && (dataType == tableColumnInfo.getDataType() || (dataType == STDataType.USE_WHOLE_GROUP && SmarttoolsHelper.isDataTypeInt(tableColumnInfo.getDataType()))) && isValidColumnName(tableColumnInfo.getColumnName())); }
public static List<String> getTypeAlterSQL(TableColumnInfo from, TableColumnInfo to, HibernateDialect dialect, DatabaseObjectQualifier qualifier, SqlGenerationPreferences prefs) { if (from.getDataType() == to.getDataType() && from.getColumnSize() == to.getColumnSize()) { return null; } return dialect.getColumnTypeAlterSQL(from, to, qualifier, prefs); }
private boolean isDateValueCheck(TableColumnInfo tableColumnInfo) { int dataType = getUsedDataType(); return (getUsedGroup() == STDataType.GROUP_DATE && (dataType == tableColumnInfo.getDataType() || (dataType == STDataType.USE_WHOLE_GROUP && SmarttoolsHelper.isDataTypeDate(tableColumnInfo.getDataType()))) && isValidColumnName(tableColumnInfo.getColumnName())); } } // ThreadSearching
public static int[] getColumnTypes(ISQLConnection con, ITableInfo ti) throws SQLException { TableColumnInfo[] infoArr = con.getSQLMetaData().getColumnInfo(ti); int[] result = new int[infoArr.length]; for (int i = 0; i < result.length; i++) { TableColumnInfo colInfo = infoArr[i]; result[i] = colInfo.getDataType(); } return result; }
public void setExistingColumnInfo(TableColumnInfo info) { tableNameTextField.setText(info.getTableName()); columnNameTextField.setText(info.getColumnName()); String dataType = JDBCTypeMapper.getJdbcTypeName(info.getDataType()); typeList.setSelectedItem(dataType); nullableCheckBox.setSelected(info.isNullable().equals("YES")); if (JDBCTypeMapper.isNumberType(info.getDataType())) { precisionSpinner.setValue(Integer.valueOf(info.getColumnSize())); } else { lengthSpinner.setValue(Integer.valueOf(info.getColumnSize())); } commentTextArea.setText(info.getRemarks()); defaultTextField.setText(info.getDefaultValue()); }
/** * * @param con * @param ti * @param column * @return * @throws SQLException */ public static int getColumnType(ISQLConnection con, ITableInfo ti, int column) throws SQLException { TableColumnInfo[] infoArr = con.getSQLMetaData().getColumnInfo(ti); TableColumnInfo colInfo = infoArr[column]; return colInfo.getDataType(); }
public void setExistingColumnInfo(TableColumnInfo info) { tableNameTextField.setText(info.getTableName()); columnNameTextField.setText(info.getColumnName()); String dataType = JDBCTypeMapper.getJdbcTypeName(info.getDataType()); typeList.setSelectedItem(dataType); nullableCheckBox.setSelected(info.isNullable().equals("YES")); if (JDBCTypeMapper.isNumberType(info.getDataType())) { precisionSpinner.setValue(Integer.valueOf(info.getColumnSize())); } else { lengthSpinner.setValue(Integer.valueOf(info.getColumnSize())); } commentTextArea.setText(info.getRemarks()); defaultTextField.setText(info.getDefaultValue()); }
/** * Returns the readable data type for the given tableColumnInfo * * @param tableColumnInfo * data to generate the readable data type info * @return readable data type info */ public static String getDataTypeForDisplay(TableColumnInfo tableColumnInfo) { StringBuilder buf = new StringBuilder(); buf.append(tableColumnInfo.getTypeName()); if (SmarttoolsHelper.isDataTypeString(tableColumnInfo.getDataType())) { buf.append(" (" + tableColumnInfo.getColumnSize() + ")"); } else if (SmarttoolsHelper.isDataTypeNumeric(tableColumnInfo.getDataType())) { buf.append(" (" + tableColumnInfo.getColumnSize() + "," + tableColumnInfo.getDecimalDigits() + ")"); } return buf.toString(); }
protected int getFirstColumnType(ITableInfo ti) throws SQLException { TableColumnInfo[] infos = _session.getSQLConnection().getSQLMetaData().getColumnInfo(ti); return infos[0].getDataType(); }
public static int[] getColumnTypes(ISQLConnection con, ITableInfo ti, String[] colNames) throws SQLException { TableColumnInfo[] tciArr = con.getSQLMetaData().getColumnInfo(ti); int[] result = new int[tciArr.length]; for (int i = 0; i < tciArr.length; i++) { boolean found = false; for (int j = 0; j < colNames.length && !found; j++) { String columnName = colNames[j]; if (tciArr[i].getColumnName().equalsIgnoreCase(columnName)) { result[i] = tciArr[i].getDataType(); found = true; } } } return result; }
/** * * @param con * @param synonym * @param columnName * @return * @throws SQLException */ public static int getColumnType(ISQLConnection con, ITableInfo ti, String columnName) throws SQLException { int result = -1; if (ti != null) { TableColumnInfo[] tciArr = con.getSQLMetaData().getColumnInfo(ti); for (int i = 0; i < tciArr.length; i++) { if (tciArr[i].getColumnName().equalsIgnoreCase(columnName)) { result = tciArr[i].getDataType(); break; } } } return result; }
public void setColumn2(TableColumnInfo c2) { col2Type = c2.getDataType(); col2Length = c2.getColumnSize(); col2IsNullable = c2.isNullable().equalsIgnoreCase("NO") ? false : true; tableName = c2.getTableName(); columnName = c2.getColumnName(); col2remarks = c2.getRemarks(); col2default = c2.getDefaultValue(); }
int colJdbcType = colInfo.getDataType(); if (colJdbcType == java.sql.Types.OTHER)
public void setColumn1(TableColumnInfo c1) { col1Type = c1.getDataType(); col1Length = c1.getColumnSize(); col1IsNullable = c1.isNullable().equalsIgnoreCase("NO") ? false : true; tableName = c1.getTableName(); columnName = c1.getColumnName(); col1remarks = c1.getRemarks(); col1default = c1.getDefaultValue(); }
private static int getColumnLength(ISession sourceSession, TableColumnInfo colInfo) throws UserCancelledOperationException { HibernateDialect dialect = DialectFactory.getDialect(DialectFactory.SOURCE_TYPE, sourceSession.getApplication().getMainFrame(), sourceSession.getMetaData()); int length = colInfo.getColumnSize(); int type = colInfo.getDataType(); length = dialect.getColumnLength(length, type); return length; }
public ExtendedColumnInfo(TableColumnInfo info, String simpleTableName) { _columnName = info.getColumnName(); _columnType = info.getTypeName(); _columnTypeID = info.getDataType(); _columnSize = info.getColumnSize(); _decimalDigits = info.getDecimalDigits(); _remarks = info.getRemarks(); if ("YES".equals(info.isNullable())) { _nullable = true; } else { _nullable = false; } _cat = info.getCatalogName(); _schem = info.getSchemaName(); _simpleTableName = simpleTableName; _qualifiedName = _cat + "." + _schem + "." + _simpleTableName + "." +_columnName; }
public ExtendedColumnInfo(TableColumnInfo info, String simpleTableName) { _columnName = info.getColumnName(); _columnType = info.getTypeName(); _columnTypeID = info.getDataType(); _columnSize = info.getColumnSize(); _decimalDigits = info.getDecimalDigits(); _remarks = info.getRemarks(); if ("YES".equals(info.isNullable())) { _nullable = true; } else { _nullable = false; } _cat = info.getCatalogName(); _schem = info.getSchemaName(); _simpleTableName = simpleTableName; _qualifiedName = _cat + "." + _schem + "." + _simpleTableName + "." +_columnName; }