List of usage examples for java.sql Types OTHER
int OTHER
To view the source code for java.sql Types OTHER.
Click Source Link
getObject
and setObject
. From source file:com.manydesigns.portofino.sync.DatabaseSyncer.java
protected void syncColumns(final liquibase.database.structure.Table liquibaseTable, final Table sourceTable, final Table targetTable) { logger.debug("Synchronizing columns"); for (liquibase.database.structure.Column liquibaseColumn : liquibaseTable.getColumns()) { logger.debug("Processing column: {}", liquibaseColumn.getName()); Column targetColumn = new Column(targetTable); targetColumn.setColumnName(liquibaseColumn.getName()); // hongliangpan add targetColumn.setMemo(liquibaseColumn.getRemarks()); logger.debug("Merging column attributes and annotations"); targetColumn.setAutoincrement(liquibaseColumn.isAutoIncrement()); int jdbcType = liquibaseColumn.getDataType(); if (jdbcType == Types.OTHER) { logger.debug("jdbcType = OTHER, trying to determine more specific type from type name"); String jdbcTypeName = liquibaseColumn.getTypeName(); try { Field field = Types.class.getField(jdbcTypeName); jdbcType = (Integer) field.get(null); } catch (Exception e) { logger.debug("Could not determine type (type name = {})", jdbcTypeName); }//from w w w. j av a 2s . c o m } targetColumn.setJdbcType(jdbcType); targetColumn.setColumnType(liquibaseColumn.getTypeName()); targetColumn.setLength(liquibaseColumn.getColumnSize()); targetColumn.setNullable(liquibaseColumn.isNullable()); targetColumn.setScale(liquibaseColumn.getDecimalDigits()); // TODO liquibaseColumn.getLengthSemantics() Column sourceColumn = DatabaseLogic.findColumnByNameIgnoreCase(sourceTable, liquibaseColumn.getName()); if (sourceColumn != null) { targetColumn.setPropertyName(sourceColumn.getPropertyName()); targetColumn.setJavaType(sourceColumn.getJavaType()); copyAnnotations(sourceColumn, targetColumn); // hongliangpan add targetColumn.setNullable(sourceColumn.isNullable()); } // hongliangpan add if (targetColumn.getColumnName().startsWith("c_is_")) { targetColumn.setJavaType(Boolean.class.getName()); } // "TIMESTAMP"?hongliangpan add if ("TIMESTAMP".equals(liquibaseColumn.getTypeName()) || "DATETIME".equals(liquibaseColumn.getTypeName())) { targetColumn.setNullable(true); addAnnotation(targetColumn, "com.manydesigns.elements.annotations.DateFormat", "yyyy-MM-dd HH:mm:ss"); } logger.debug("Column creation successfull. Adding column to table."); targetTable.getColumns().add(targetColumn); } logger.debug("Sorting columns to preserve their previous order as much as possible"); Collections.sort(targetTable.getColumns(), new Comparator<Column>() { private int oldIndex(final Column c) { int i = 0; for (Column old : sourceTable.getColumns()) { if (old.getColumnName().equals(c.getColumnName())) { return i; } i++; } return -1; } @Override public int compare(final Column c1, final Column c2) { Integer index1 = oldIndex(c1); Integer index2 = oldIndex(c2); if (index1 != -1) { if (index2 != -1) { return index1.compareTo(index2); } else { return -1; } } else { return index2 == -1 ? 0 : 1; } } }); }
From source file:org.sakaiproject.warehouse.util.db.DbLoader.java
protected int getJavaSqlType(String genericDataTypeName) { // Find the type code for this generic type name int dataTypeCode = 0; if (genericDataTypeName.equalsIgnoreCase("BIT")) dataTypeCode = Types.BIT; // -7 else if (genericDataTypeName.equalsIgnoreCase("TINYINT")) dataTypeCode = Types.TINYINT; // -6 else if (genericDataTypeName.equalsIgnoreCase("SMALLINT")) dataTypeCode = Types.SMALLINT; // 5 else if (genericDataTypeName.equalsIgnoreCase("INTEGER")) dataTypeCode = Types.INTEGER; // 4 else if (genericDataTypeName.equalsIgnoreCase("BIGINT")) dataTypeCode = Types.BIGINT; // -5 else if (genericDataTypeName.equalsIgnoreCase("FLOAT")) dataTypeCode = Types.FLOAT; // 6 else if (genericDataTypeName.equalsIgnoreCase("REAL")) dataTypeCode = Types.REAL; // 7 else if (genericDataTypeName.equalsIgnoreCase("DOUBLE")) dataTypeCode = Types.DOUBLE; // 8 else if (genericDataTypeName.equalsIgnoreCase("NUMERIC")) dataTypeCode = Types.NUMERIC; // 2 else if (genericDataTypeName.equalsIgnoreCase("DECIMAL")) dataTypeCode = Types.DECIMAL; // 3 else if (genericDataTypeName.equalsIgnoreCase("CHAR")) dataTypeCode = Types.CHAR; // 1 else if (genericDataTypeName.equalsIgnoreCase("VARCHAR")) dataTypeCode = Types.VARCHAR; // 12 else if (genericDataTypeName.equalsIgnoreCase("LONGVARCHAR")) dataTypeCode = Types.LONGVARCHAR; // -1 else if (genericDataTypeName.equalsIgnoreCase("DATE")) dataTypeCode = Types.DATE; // 91 else if (genericDataTypeName.equalsIgnoreCase("TIME")) dataTypeCode = Types.TIME; // 92 else if (genericDataTypeName.equalsIgnoreCase("TIMESTAMP")) dataTypeCode = Types.TIMESTAMP; // 93 else if (genericDataTypeName.equalsIgnoreCase("BINARY")) dataTypeCode = Types.BINARY; // -2 else if (genericDataTypeName.equalsIgnoreCase("VARBINARY")) dataTypeCode = Types.VARBINARY; // -3 else if (genericDataTypeName.equalsIgnoreCase("LONGVARBINARY")) dataTypeCode = Types.LONGVARBINARY; // -4 else if (genericDataTypeName.equalsIgnoreCase("NULL")) dataTypeCode = Types.NULL; // 0 else if (genericDataTypeName.equalsIgnoreCase("OTHER")) dataTypeCode = Types.OTHER; // 1111 else if (genericDataTypeName.equalsIgnoreCase("JAVA_OBJECT")) dataTypeCode = Types.JAVA_OBJECT; // 2000 else if (genericDataTypeName.equalsIgnoreCase("DISTINCT")) dataTypeCode = Types.DISTINCT; // 2001 else if (genericDataTypeName.equalsIgnoreCase("STRUCT")) dataTypeCode = Types.STRUCT; // 2002 else if (genericDataTypeName.equalsIgnoreCase("ARRAY")) dataTypeCode = Types.ARRAY; // 2003 else if (genericDataTypeName.equalsIgnoreCase("BLOB")) dataTypeCode = Types.BLOB; // 2004 else if (genericDataTypeName.equalsIgnoreCase("CLOB")) dataTypeCode = Types.CLOB; // 2005 else if (genericDataTypeName.equalsIgnoreCase("REF")) dataTypeCode = Types.REF; // 2006 return dataTypeCode; }
From source file:edu.ncsa.sstde.indexing.postgis.PostgisIndexer.java
private int getSQLType(Object object) { if (object instanceof PGgeometry) { return Types.OTHER; } else if (object instanceof Timestamp) { return Types.TIMESTAMP; } else if (object instanceof String) { return Types.VARCHAR; } else if (object instanceof Double) { return Types.DOUBLE; } else if (object instanceof Float) { return Types.FLOAT; } else if (object instanceof Integer) { return Types.INTEGER; } else if (object instanceof Time) { return Types.TIME; }/* w w w. java 2s . co m*/ return Types.OTHER; }
From source file:org.jumpmind.symmetric.db.sqlanywhere.SqlAnywhereTriggerTemplate.java
@Override protected String buildKeyVariablesDeclare(Column[] columns, String prefix) { String text = ""; for (int i = 0; i < columns.length; i++) { text += "declare @" + prefix + "pk" + i + " "; switch (columns[i].getMappedTypeCode()) { case Types.TINYINT: case Types.SMALLINT: case Types.INTEGER: case Types.BIGINT: text += "bigint\n"; break; case Types.NUMERIC: case Types.DECIMAL: text += "decimal\n"; break; case Types.FLOAT: case Types.REAL: case Types.DOUBLE: text += "float\n"; break; case Types.CHAR: case Types.VARCHAR: case ColumnTypes.NVARCHAR: case ColumnTypes.LONGNVARCHAR: case Types.LONGVARCHAR: text += "varchar(1000)\n"; break; case Types.DATE: text += "date\n"; break; case Types.TIME: text += "time\n"; break; case Types.TIMESTAMP: text += "datetime\n"; break; case Types.BOOLEAN: case Types.BIT: text += "bit\n"; break; case Types.CLOB: text += "varchar(16384)\n"; break; case Types.BLOB: case Types.BINARY: case Types.VARBINARY: case Types.LONGVARBINARY: case -10: // SQL-Server ntext binary type text += "varbinary(16384)\n"; break; case Types.OTHER: text += "varbinary(16384)\n"; break; default:// w w w . j a v a 2 s .com if (columns[i].getJdbcTypeName() != null && columns[i].getJdbcTypeName().equalsIgnoreCase("interval")) { text += "interval"; break; } throw new NotImplementedException(columns[i] + " is of type " + columns[i].getMappedType()); } } return text; }
From source file:es.juntadeandalucia.panelGestion.negocio.utiles.JDBCConnector.java
public int executeFeatureInsertLowLevel(String sql, SimpleFeature feature, List<ColumnVO> columns) throws Exception { Exception error = null;/*from w w w . j ava2 s . c om*/ int numRowsAffected = 0; if (columns.size() > 0) { Connection connection = null; PreparedStatement preparedStmnt = null; try { DataSource dataSource = poolDataSources.get(schemaId); connection = dataSource.getConnection(); connection.setAutoCommit(false); preparedStmnt = connection.prepareStatement(sql); int paramPosition = 1; for (ColumnVO column : columns) { String dataValue = null; Object attribute = feature.getAttribute(column.getFilePosition()); if (attribute != null) { dataValue = attribute.toString(); } Integer dataType = column.getSqlType(); if (dataType == Types.OTHER) { // it is a geometry // ((org.postgresql.PGConnection)connection).addDataType(column.getName(), // column.getTypeClass()); preparedStmnt.setObject(paramPosition, dataValue); } else { if (StringUtils.isEmpty(dataValue)) { preparedStmnt.setNull(paramPosition, dataType); } else { preparedStmnt.setObject(paramPosition, dataValue, dataType); } } paramPosition++; } numRowsAffected = preparedStmnt.executeUpdate(); connection.commit(); } catch (SQLException e) { error = e; } finally { if (preparedStmnt != null) { try { preparedStmnt.close(); } catch (SQLException se2) { log.warn("No se pudo cerrar el statment: ".concat(se2.getLocalizedMessage())); } } if (connection != null) { try { if (error != null) { connection.rollback(); } } catch (SQLException se) { log.warn("Se produjo un error al manejar la conexin: ".concat(se.getLocalizedMessage())); } try { connection.close(); } catch (SQLException se) { log.warn("Se produjo un error al intentar cerrar la conexin: " .concat(se.getLocalizedMessage())); } } } if (error != null) { throw error; } } return numRowsAffected; }
From source file:org.apache.openjpa.jdbc.meta.MappingInfo.java
/** * Merge the given columns if possible.// w ww .jav a2 s . c o m * * @param context the mapping we're retrieving columns for * @param prefix localized error message key prefix * @param tmplate template for expected column information * @param compat whether the existing column type must be compatible * with the type of the template column * @param given the given column information from mapping info * @param table the table for the columns * @param adapt whether we can modify the existing mapping or schema * @param fill whether to default missing column information */ protected static Column mergeColumn(MetaDataContext context, String prefix, Column tmplate, boolean compat, Column given, Table table, boolean adapt, boolean fill) { assertTable(context, table); // if not adapting must provide column name at a minimum DBIdentifier colName = (given == null) ? DBIdentifier.NULL : given.getIdentifier(); if (DBIdentifier.isNull(colName) && !adapt && !fill) throw new MetaDataException(_loc.get(prefix + "-no-col-name", context)); MappingRepository repos = (MappingRepository) context.getRepository(); DBDictionary dict = repos.getDBDictionary(); // determine the column name based on given info, or template if none; // also make sure that if the user gave a column name, he didn't try // to put the column in an unexpected table if (DBIdentifier.isNull(colName)) colName = tmplate.getIdentifier(); QualifiedDBIdentifier path = QualifiedDBIdentifier.getPath(colName); if (path.isUnqualifiedColumn()) { colName = path.getIdentifier(); } else if (!DBIdentifier.isNull(path.getObjectTableName())) { findTable(context, path.getObjectTableName(), table, null, null); colName = path.getUnqualifiedName(); } // find existing column Column col = table.getColumn(colName); if (col == null && !adapt) { // // See if column name has already been validated in a dynamic table. // If so then want to use that validated column name instead. This // should seldom if ever occur as long as the database dictionaries // are kept up-to-date. // if ((colName.getName().length() > dict.maxColumnNameLength) || dict.getInvalidColumnWordSet().contains(DBIdentifier.toUpper(colName).getName()) && !(table.getClass().getName().contains("DynamicTable"))) { colName = dict.getValidColumnName(colName, new Table()); col = table.getColumn(colName); if (col == null && !adapt) { throw new MetaDataException(_loc.get(prefix + "-bad-col-name", context, colName, table)); } } else { throw new MetaDataException(_loc.get(prefix + "-bad-col-name", context, colName, table)); } } // use information from template column by default, allowing any // user-given specifics to override it int type = tmplate.getType(); int size = tmplate.getSize(); if (type == Types.OTHER) { int precis = 0; int scale = 0; if (given != null) { precis = given.getSize(); scale = given.getDecimalDigits(); } type = dict.getJDBCType(tmplate.getJavaType(), size == -1, precis, scale, tmplate.isXML()); } boolean ttype = true; int otype = type; String typeName = tmplate.getTypeName(); Boolean notNull = null; if (tmplate.isNotNullExplicit()) notNull = (tmplate.isNotNull()) ? Boolean.TRUE : Boolean.FALSE; int decimals = tmplate.getDecimalDigits(); String defStr = tmplate.getDefaultString(); boolean autoAssign = tmplate.isAutoAssigned(); boolean relationId = tmplate.isRelationId(); boolean implicitRelation = tmplate.isImplicitRelation(); String targetField = tmplate.getTargetField(); if (given != null) { // use given type if provided, but warn if it isn't compatible with // the expected column type if (given.getType() != Types.OTHER) { ttype = false; if (compat && !given.isCompatible(type, typeName, size, decimals)) { Log log = repos.getLog(); if (log.isWarnEnabled()) log.warn(_loc.get(prefix + "-incompat-col", context, colName, Schemas.getJDBCName(type))); } otype = given.getType(); type = dict.getPreferredType(otype); } typeName = given.getTypeName(); if (given.getSize() > 0) size = given.getSize(); decimals = given.getDecimalDigits(); // leave this info as the template defaults unless the user // explicitly turns it on in the given column if (given.isNotNullExplicit()) notNull = (given.isNotNull()) ? Boolean.TRUE : Boolean.FALSE; if (given.getDefaultString() != null) defStr = given.getDefaultString(); if (given.isAutoAssigned()) autoAssign = true; if (given.isRelationId()) relationId = true; if (given.isImplicitRelation()) implicitRelation = true; } // default char column size if original type is char (test original // type rather than final type because orig might be clob, translated // to an unsized varchar, which is supported by some dbs) if (size == 0 && (otype == Types.VARCHAR || otype == Types.CHAR)) size = dict.characterColumnSize; // create column, or make sure existing column matches expected type if (col == null) { col = table.addColumn(colName); col.setType(type); } else if ((compat || !ttype) && !col.isCompatible(type, typeName, size, decimals)) { // if existing column isn't compatible with desired type, die if // can't adapt, else warn and change the existing column type Message msg = _loc.get(prefix + "-bad-col", context, Schemas.getJDBCName(type), col.getDescription()); if (!adapt) throw new MetaDataException(msg); Log log = repos.getLog(); if (log.isWarnEnabled()) log.warn(msg); col.setType(type); } else if (given != null && given.getType() != Types.OTHER) { // as long as types are compatible, set column to expected type col.setType(type); } // always set the java type and autoassign to expected values, even on // an existing column, since we don't get this from the DB if (compat) col.setJavaType(tmplate.getJavaType()); else if (col.getJavaType() == JavaTypes.OBJECT) { if (given != null && given.getJavaType() != JavaTypes.OBJECT) col.setJavaType(given.getJavaType()); else col.setJavaType(JavaTypes .getTypeCode(Schemas.getJavaType(col.getType(), col.getSize(), col.getDecimalDigits()))); } col.setAutoAssigned(autoAssign); col.setRelationId(relationId); col.setImplicitRelation(implicitRelation); col.setTargetField(targetField); // we need this for runtime, and the dynamic schema factory might // not know it, so set it even if not adapting if (defStr != null) col.setDefaultString(defStr); if (notNull != null) col.setNotNull(notNull.booleanValue()); // add other details if adapting if (adapt) { if (typeName != null) col.setTypeName(typeName); if (size != 0) col.setSize(size); if (decimals != 0) col.setDecimalDigits(decimals); } if (tmplate.hasComment()) col.setComment(tmplate.getComment()); if (tmplate.isXML()) col.setXML(tmplate.isXML()); return col; }
From source file:org.nuxeo.ecm.core.storage.sql.jdbc.dialect.DialectOracle.java
@Override public Array createArrayOf(int type, Object[] elements, Connection connection) throws SQLException { if (elements == null || elements.length == 0) { return null; }// w w w . j a v a 2 s . c om String typeName; switch (type) { case Types.VARCHAR: typeName = "NX_STRING_TABLE"; break; case Types.OTHER: // id switch (idType) { case VARCHAR: typeName = "NX_STRING_TABLE"; break; case SEQUENCE: typeName = "NX_INT_TABLE"; break; default: throw new AssertionError("Unknown id type: " + idType); } break; default: throw new AssertionError("Unknown type: " + type); } try { connection = ConnectionHelper.unwrap(connection); Object arrayDescriptor = arrayDescriptorConstructor.newInstance(typeName, connection); return (Array) arrayConstructor.newInstance(arrayDescriptor, connection, elements); } catch (Exception e) { throw new SQLException(e.getMessage(), e); } }
From source file:com.streamsets.pipeline.lib.jdbc.JdbcUtil.java
public Field resultToField(ResultSetMetaData md, ResultSet rs, int columnIndex, int maxClobSize, int maxBlobSize, DataType userSpecifiedType, UnknownTypeAction unknownTypeAction, boolean timestampToString) throws SQLException, IOException, StageException { Field field;/*from w w w. ja va 2s.c o m*/ if (userSpecifiedType != DataType.USE_COLUMN_TYPE) { // If user specifies the data type, overwrite the column type returned by database. field = Field.create(Field.Type.valueOf(userSpecifiedType.getLabel()), rs.getObject(columnIndex)); } else { // All types as of JDBC 2.0 are here: // https://docs.oracle.com/javase/8/docs/api/constant-values.html#java.sql.Types.ARRAY // Good source of recommended mappings is here: // http://www.cs.mun.ca/java-api-1.5/guide/jdbc/getstart/mapping.html switch (md.getColumnType(columnIndex)) { case Types.BIGINT: field = Field.create(Field.Type.LONG, rs.getObject(columnIndex)); break; case Types.BINARY: case Types.LONGVARBINARY: case Types.VARBINARY: field = Field.create(Field.Type.BYTE_ARRAY, rs.getBytes(columnIndex)); break; case Types.BIT: case Types.BOOLEAN: field = Field.create(Field.Type.BOOLEAN, rs.getObject(columnIndex)); break; case Types.CHAR: case Types.LONGNVARCHAR: case Types.LONGVARCHAR: case Types.NCHAR: case Types.NVARCHAR: case Types.VARCHAR: field = Field.create(Field.Type.STRING, rs.getObject(columnIndex)); break; case Types.CLOB: case Types.NCLOB: field = Field.create(Field.Type.STRING, getClobString(rs.getClob(columnIndex), maxClobSize)); break; case Types.BLOB: field = Field.create(Field.Type.BYTE_ARRAY, getBlobBytes(rs.getBlob(columnIndex), maxBlobSize)); break; case Types.DATE: field = Field.create(Field.Type.DATE, rs.getDate(columnIndex)); break; case Types.DECIMAL: case Types.NUMERIC: field = Field.create(Field.Type.DECIMAL, rs.getBigDecimal(columnIndex)); field.setAttribute(HeaderAttributeConstants.ATTR_SCALE, String.valueOf(rs.getMetaData().getScale(columnIndex))); field.setAttribute(HeaderAttributeConstants.ATTR_PRECISION, String.valueOf(rs.getMetaData().getPrecision(columnIndex))); break; case Types.DOUBLE: field = Field.create(Field.Type.DOUBLE, rs.getObject(columnIndex)); break; case Types.FLOAT: case Types.REAL: field = Field.create(Field.Type.FLOAT, rs.getObject(columnIndex)); break; case Types.INTEGER: field = Field.create(Field.Type.INTEGER, rs.getObject(columnIndex)); break; case Types.ROWID: field = Field.create(Field.Type.STRING, rs.getRowId(columnIndex).toString()); break; case Types.SMALLINT: case Types.TINYINT: field = Field.create(Field.Type.SHORT, rs.getObject(columnIndex)); break; case Types.TIME: field = Field.create(Field.Type.TIME, rs.getObject(columnIndex)); break; case Types.TIMESTAMP: final Timestamp timestamp = rs.getTimestamp(columnIndex); if (timestampToString) { field = Field.create(Field.Type.STRING, timestamp == null ? null : timestamp.toString()); } else { field = Field.create(Field.Type.DATETIME, timestamp); if (timestamp != null) { final long actualNanos = timestamp.getNanos() % NANOS_TO_MILLIS_ADJUSTMENT; if (actualNanos > 0) { field.setAttribute(FIELD_ATTRIBUTE_NANOSECONDS, String.valueOf(actualNanos)); } } } break; // Ugly hack until we can support LocalTime, LocalDate, LocalDateTime, etc. case Types.TIME_WITH_TIMEZONE: OffsetTime offsetTime = rs.getObject(columnIndex, OffsetTime.class); field = Field.create(Field.Type.TIME, Date.from(offsetTime.atDate(LocalDate.MIN).toInstant())); break; case Types.TIMESTAMP_WITH_TIMEZONE: OffsetDateTime offsetDateTime = rs.getObject(columnIndex, OffsetDateTime.class); field = Field.create(Field.Type.ZONED_DATETIME, offsetDateTime.toZonedDateTime()); break; //case Types.REF_CURSOR: // JDK8 only case Types.SQLXML: case Types.STRUCT: case Types.ARRAY: case Types.DATALINK: case Types.DISTINCT: case Types.JAVA_OBJECT: case Types.NULL: case Types.OTHER: case Types.REF: default: if (unknownTypeAction == null) { return null; } switch (unknownTypeAction) { case STOP_PIPELINE: throw new StageException(JdbcErrors.JDBC_37, md.getColumnType(columnIndex), md.getColumnLabel(columnIndex)); case CONVERT_TO_STRING: Object value = rs.getObject(columnIndex); if (value != null) { field = Field.create(Field.Type.STRING, rs.getObject(columnIndex).toString()); } else { field = Field.create(Field.Type.STRING, null); } break; default: throw new IllegalStateException("Unknown action: " + unknownTypeAction); } } } return field; }
From source file:org.apache.openjpa.jdbc.schema.Column.java
/** * Copy information from the given column to this one. *///from w w w . j a v a 2 s . co m public void copy(Column from) { if (from == null) return; if (DBIdentifier.isNull(getIdentifier())) setIdentifier(from.getIdentifier()); if (getType() == Types.OTHER) setType(from.getType()); if (DBIdentifier.isNull(getTypeIdentifier())) setTypeIdentifier(from.getTypeIdentifier()); if (getJavaType() == JavaTypes.OBJECT) setJavaType(from.getJavaType()); if (getSize() == 0) setSize(from.getSize()); if (getDecimalDigits() == 0) setDecimalDigits(from.getDecimalDigits()); if (getScale() == 0) setScale(from.getScale()); if (getPrecision() == 0) setPrecision(from.getPrecision()); if (getRadix() == 10) setRadix(from.getRadix()); if (getDefaultString() == null) setDefaultString(from.getDefaultString()); if (!isNotNullExplicit() && from.isNotNullExplicit()) setNotNull(from.isNotNull()); if (!isAutoAssigned()) setAutoAssigned(from.isAutoAssigned()); if (!isRelationId()) setRelationId(from.isRelationId()); if (!isImplicitRelation()) setImplicitRelation(from.isRelationId()); if (DBIdentifier.isNull(getTargetIdentifier())) setTargetIdentifier(from.getTargetIdentifier()); if (getTargetField() == null) setTargetField(from.getTargetField()); if (_flags == 0) _flags = from._flags; if (!isXML()) setXML(from.isXML()); if (!isUni1MFK()) setUni1MFK(from.isUni1MFK()); for (Constraint c : _constraints) { addConstraint(c); } }
From source file:com.nextep.designer.sqlclient.ui.services.impl.SQLClientService.java
private int getSqlTypeFor(Object o) { if (o instanceof String) { return Types.VARCHAR; } else if (o instanceof Date) { return Types.DATE; } else if (o instanceof Integer) { return Types.INTEGER; } else if (o instanceof Double) { return Types.DOUBLE; } else if (o instanceof Float) { return Types.FLOAT; } else if (o instanceof BigInteger) { return Types.BIGINT; } else if (o instanceof BigDecimal) { return Types.NUMERIC; } else {/*ww w. j av a2s.c om*/ return Types.OTHER; } }