com.frameworkset.common.poolman.sql.ColumnMetaData Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bboss-persistent Show documentation
Show all versions of bboss-persistent Show documentation
bboss is a j2ee framework include aop/ioc,mvc,persistent,taglib,rpc,event ,bean-xml serializable and so on.http://www.bbossgroups.com
The newest version!
package com.frameworkset.common.poolman.sql;
import java.io.Serializable;
import com.frameworkset.orm.adapter.DB;
import com.frameworkset.orm.engine.model.Domain;
import com.frameworkset.orm.engine.model.SchemaType;
/*
TABLE_CAT String => table catalog (may be null
)
* TABLE_SCHEM String => table schema (may be null
)
* TABLE_NAME String => table name
* COLUMN_NAME String => column name
* DATA_TYPE int => SQL type from java.sql.Types
* TYPE_NAME String => Data source dependent type name,
* for a UDT the type name is fully qualified
* COLUMN_SIZE int => column size. For char or date
* types this is the maximum number of characters, for numeric or
* decimal types this is precision.
* BUFFER_LENGTH is not used.
* DECIMAL_DIGITS int => the number of fractional digits
* NUM_PREC_RADIX int => Radix (typically either 10 or 2)
* NULLABLE int => is NULL allowed.
*
* - columnNoNulls - might not allow
NULL
values
* - columnNullable - definitely allows
NULL
values
* - columnNullableUnknown - nullability unknown
*
* REMARKS String => comment describing column (may be null
)
* COLUMN_DEF String => default value (may be null
)
* SQL_DATA_TYPE int => unused
* SQL_DATETIME_SUB int => unused
* CHAR_OCTET_LENGTH int => for char types the
* maximum number of bytes in the column
* ORDINAL_POSITION int => index of column in table
* (starting at 1)
* IS_NULLABLE String => "NO" means column definitely
* does not allow NULL values; "YES" means the column might
* allow NULL values. An empty string means nobody knows.
* SCOPE_CATLOG String => catalog of table that is the scope
* of a reference attribute (null
if DATA_TYPE isn't REF)
* SCOPE_SCHEMA String => schema of table that is the scope
* of a reference attribute (null
if the DATA_TYPE isn't REF)
* SCOPE_TABLE String => table name that this the scope
* of a reference attribure (null
if the DATA_TYPE isn't REF)
* SOURCE_DATA_TYPE short => source type of a distinct type or user-generated
* Ref type, SQL type from java.sql.Types (null
if DATA_TYPE
* isn't DISTINCT or user-generated REF)
* */
public class ColumnMetaData implements Comparable,Serializable{
private TableMetaData tableMetaData;
private String columnName;
private int dataType;
private String typeName;
private int colunmSize;
private int numPrecRadix;
private String columnDefaultValue;
private String remarks;
private DB db;
private Domain domain;
private SchemaType schemaType;
private int DECIMAL_DIGITS;
/**
* yes,no, unknown
*/
private String nullable;
private int CHAR_OCTET_LENGTH;
public String getColumnDefaultValue() {
return columnDefaultValue;
}
public void setColumnDefaultValue(String columnDefaultValue) {
this.columnDefaultValue = columnDefaultValue;
}
public String getColumnName() {
return columnName;
}
public void setColumnName(String columnName) {
this.columnName = columnName;
}
public int getColunmSize() {
return colunmSize;
}
public void setColunmSize(int colunmSize) {
this.colunmSize = colunmSize;
}
public int getDataType() {
return dataType;
}
public void setDataType(int dataType,String datatypeName) {
this.domain = db.getDomainForSchemaType(dataType, datatypeName);
this.schemaType = domain.getType();
this.dataType = dataType;
}
public String getNullable() {
return nullable;
}
public void setIsNullable(String isNullable) {
this.nullable = isNullable;
}
public int getNumPrecRadix() {
return numPrecRadix;
}
public void setNumPrecRadix(int numPrecRadix) {
this.numPrecRadix = numPrecRadix;
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public TableMetaData getTableMetaData() {
return tableMetaData;
}
public void setTableMetaData(TableMetaData tableMetaData) {
this.tableMetaData = tableMetaData;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
public String toString()
{
StringBuilder ret = new StringBuilder();
ret.append(" columnName=")
.append(columnName)
.append(",")
.append("dataType=")
.append(dataType)
.append(",")
.append("typeName=")
.append(typeName)
.append(",")
.append("colunmSize=")
.append(colunmSize)
.append(",")
.append("numPrecRadix=")
.append(numPrecRadix)
.append(",")
.append("DECIMAL_DIGITS=")
.append(this.getDECIMAL_DIGITS())
.append(",")
.append("columnDefaultValue=")
.append(columnDefaultValue)
.append(",")
.append("remarks=")
.append(remarks)
.append(",")
.append("nullable=")
.append(nullable);
return ret.toString();
}
public ColumnMetaData(DB db)
{
this.db = db;
}
public SchemaType getSchemaType() {
return schemaType;
}
public int compareTo(Object obj) {
if(obj instanceof ColumnMetaData)
{
ColumnMetaData temp = (ColumnMetaData)obj;
if(temp != null)
{
int ret = this.getColumnName().toLowerCase().compareTo(temp.getColumnName().toLowerCase());
return ret;
}
else
{
return 0;
}
}
else
return 0;
}
public int getDECIMAL_DIGITS() {
return DECIMAL_DIGITS;
}
public void setDECIMAL_DIGITS(int decimal_digits) {
DECIMAL_DIGITS = decimal_digits;
}
public void setCHAR_OCTET_LENGTH(int CHAR_OCTET_LENGTH) {
this.CHAR_OCTET_LENGTH = CHAR_OCTET_LENGTH;
}
public int getCHAR_OCTET_LENGTH() {
return CHAR_OCTET_LENGTH;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy