home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 4.8 KB | 201 lines |
- /*
- * @(#JDBCColumnMetaData.java
- *
- * Copyright (c) 1997 Symantec Corporation. All Rights Reserved.
- *
- */
- /**
- * <P> This class stores all information needed for a column
- */
-
- package symantec.itools.db.beans.jdbc;
-
- import symantec.itools.db.beans.binding.*;
-
- public class ColumnMetaData implements PersistentObjectMemberModel
- {
- //if the column is in a invalid state, therefore it won't be included in a where clause
- final static int VALID_STATE=1;
- final static int INVALID_STATE=0;
- //Constructors
- /**
- * Constructor. An empty constructor
- */
- public ColumnMetaData() {
- }
-
- private boolean isPrimaryKey=false;
- private int columnState=VALID_STATE;
- public String m_ColumnName;
-
-
-
- /**
- * Gets if a Column is Primary Key
- * @return boolean. .
- */
- public synchronized boolean isPrimaryKey() {
- return isPrimaryKey;
- }
-
- /**
- * Sets if a Column is Primary Key
- * @param value.
- */
- public synchronized void setPrimaryKey(boolean value) {
- isPrimaryKey= value;
- }
-
-
- public synchronized boolean canBeIncludedInWhereClause()
- {
- boolean isNotBlob = !(getColumnDataType()==java.sql.Types.LONGVARBINARY ||
- getColumnDataType()==java.sql.Types.LONGVARCHAR);
- boolean isComparable=getIsComparable();
- boolean isValid=(getColumnState()==VALID_STATE);
- return isNotBlob && isComparable && isValid;
- }
-
-
- /**
- * Gets the State of the Column
- * @return int. The state of the Column .
- */
- public synchronized int getColumnState() {
- return columnState;
- }
-
- /**
- * Sets the State of the Column
- * @param value. The state of the Column.
- */
- public synchronized void setColumnState(int value) {
- if (value!= VALID_STATE || value !=INVALID_STATE){
- return;
- }
- columnState = value;
- }
-
- /**
- * Gets the Name of the Column
- * @return String. The name of the Column .
- */
- public String getColumnName() {
- return m_ColumnName;
- }
-
- /**
- * Gets the Name of the Column
- * @param value. The name of the Column.
- */
- public void setColumnName(String value) {
- m_ColumnName = value;
- }
-
- public int m_ColumnDataType;
-
- /**
- * Gets the DataType of the Column
- * @return String. The JDBC Data Type of the Column .
- */
- public int getColumnDataType() {
- return m_ColumnDataType;
- }
-
- /**
- * Sets the DataType of the Column
- * @param value. The JDBC Data Type of the Column .
- */
- public void setColumnDataType(int value) {
- m_ColumnDataType = value;
- }
-
- public boolean m_IsComparable;
-
- /**
- * Gets if the data type of a column is comparable with <,>,=,!=
- * @return boolean. .
- */
- public boolean getIsComparable() {
- return m_IsComparable;
- }
-
- /**
- * Sets if the data type of a column is comparable with <,>,=,!=
- * @param value. .
- */
- public void setIsComparable(boolean value) {
- m_IsComparable = value;
- }
-
- public boolean m_IsAutoIncrement;
-
- /**
- * Gets if the data type of a column is comparable with <,>,=,!=
- * @return boolean. .
- */
- public boolean getIsAutoIncrement() {
- return m_IsAutoIncrement;
- }
-
- /**
- * Sets if the data type of a column is comparable with <,>,=,!=
- * @param value. .
- */
- public void setIsAutoIncrement(boolean value) {
- m_IsAutoIncrement = value;
- }
- public boolean m_IsSigned;
-
- /**
- * Gets if the data type of a column is comparable with <,>,=,!=
- * @return boolean. .
- */
- public boolean getIsSigned() {
- return m_IsSigned;
- }
-
- /**
- * Sets if the data type of a column is comparable with <,>,=,!=
- * @param value. .
- */
- public void setIsSigned(boolean value) {
- m_IsSigned = value;
- }
-
- public boolean m_IsReadOnly;
-
- /**
- * Gets if the data type of a column is comparable with <,>,=,!=
- * @return boolean. .
- */
- public boolean getIsReadOnly() {
- return m_IsReadOnly;
- }
-
- /**
- * Sets if the data type of a column is comparable with <,>,=,!=
- * @param value. .
- */
- public void setIsReadOnly(boolean value) {
- m_IsReadOnly = value;
- }
-
- // PersistentObjectMemberModel interface methods...
-
- public String getName()
- {
- return getColumnName();
- }
-
- public int getType()
- {
- return getColumnDataType();
- }
-
- public boolean isWritable()
- {
- return !getIsReadOnly();
- }
- }
-