Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.knowgate.dataobjs
Class DBTable

    java.lang.Object
      com.knowgate.dataobjs.DBTable

Direct Known Subclasses:
  TableLoader

    public class DBTable

extends java.lang.Object

A database table as a Java Object

Constructor Summary
`DBTable(java.lang.String sTableName)` Constructor Catalog and schema names are set to null.
`DBTable(java.lang.String sCatalogName, java.lang.String sSchemaName, java.lang.String sTableName, int iIndex)` Constructor

Method Summary
`int` | `columnCount()`
`boolean` | `deleteRegister(JDCConnection oConn, java.util.HashMap AllValues)` Delete a single register from this table at the database
`boolean` | `existsRegister(JDCConnection oConn, java.util.HashMap AllValues)` Checks if register exists at this table
`boolean` | `existsRegister(JDCConnection oConn, java.lang.String sQueryString)` Checks if register exists at this table
`boolean` | `existsRegister(JDCConnection oConn, java.lang.String sQueryString, java.lang.Object[] oQueryParams)` Checks if register exists at this table
`java.lang.String` | `getCatalog()`
`DBColumn` | `getColumnByName(java.lang.String sColumnName)` Get DBColumn by name
`int` | `getColumnIndex(java.lang.String sColumnName)` Get DBColumn index given its by name
`java.util.LinkedList<DBColumn>` | `getColumns()`
`java.lang.String` | `getColumnsStr()`
`java.util.LinkedList<DBIndex>` | `getIndexes()`
`java.lang.String` | `getName()`
`java.util.LinkedList<java.lang.String>` | `getPrimaryKey()`
`java.lang.String` | `getSchema()`
`int` | `hashCode()`
`boolean` | `loadRegister(JDCConnection oConn, java.lang.Object[] PKValues, java.util.HashMap AllValues)` Load a single table register into a Java HashMap
`void` | `readColumns(java.sql.Connection oConn, java.sql.DatabaseMetaData oMData)` Read DBColumn List from DatabaseMetaData This is primarily an internal initialization method for DBTable object.
`void` | `setCatalog(java.lang.String sCatalogName)`
`void` | `setSchema(java.lang.String sSchemaName)` Set schema name
`boolean` | `storeRegister(JDCConnection oConn, java.util.HashMap AllValues)` Store a single register at the database representing a Java Object for register containing LONGVARBINARY, IMAGE, BYTEA or BLOB fields use storeRegisterLong() method.
`boolean` | `storeRegisterLong(JDCConnection oConn, java.util.HashMap AllValues, java.util.HashMap BinaryLengths)` Store a single register at the database representing a Java Object for register NOT containing LONGVARBINARY, IMAGE, BYTEA or BLOB fields use storeRegister() method witch is faster than storeRegisterLong().

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DBTable

    public DBTable(java.lang.String sTableName)

  Constructor

  Catalog and schema names are set to null.
  Table index is set to 1.

  Parameters:
    `sSchemaName` - Database schema name

### DBTable

    public DBTable(java.lang.String sCatalogName,
                   java.lang.String sSchemaName,
                   java.lang.String sTableName,
                   int iIndex)

  Constructor

  Parameters:
    `sCatalogName` - Database catalog name
    `sSchemaName` - Database schema name
    `sTableName` - Database table name (not qualified)
    `iIndex` - Ordinal number identifier for table

Method Detail

### columnCount

    public int columnCount()
                    throws java.lang.IllegalStateException

  Returns:
    Column Count for this table
  Throws:
    `java.lang.IllegalStateException` - if columns list has not been initialized

### loadRegister

    public boolean loadRegister(JDCConnection oConn,
                                java.lang.Object[] PKValues,
                                java.util.HashMap AllValues)
                         throws java.sql.SQLException,
                                java.lang.NullPointerException,
                                java.lang.IllegalStateException

  Load a single table register into a Java HashMap

  Parameters:
    `oConn` - Database Connection
    `PKValues` - Primary key values of register to be readed, in the same order as they appear in table source.
    `AllValues` - Output parameter. Readed values.
  Returns:
    true if register was found false otherwise.
  Throws:
    `java.lang.NullPointerException` - If all objects in PKValues array are null (only debug version)
    `java.lang.IllegalStateException` - if columns list has not been initialized
    `java.sql.SQLException`

### storeRegister

    public boolean storeRegister(JDCConnection oConn,
                                 java.util.HashMap AllValues)
                          throws java.sql.SQLException

  Store a single register at the database representing a Java Object

  for register containing LONGVARBINARY, IMAGE, BYTEA or BLOB fields use storeRegisterLong() method. Columns named "dt_created" are invisible for storeRegister() method so that register creation timestamp is not altered by afterwards updates.

  Parameters:
    `oConn` - Database Connection
    `AllValues` - Values to assign to fields.
  Returns:
    true if register was inserted for first time, if it was updated.
  Throws:
    `java.sql.SQLException`

### storeRegisterLong

    public boolean storeRegisterLong(JDCConnection oConn,
                                     java.util.HashMap AllValues,
                                     java.util.HashMap BinaryLengths)
                              throws java.io.IOException,
                                     java.sql.SQLException

  Store a single register at the database representing a Java Object

  for register NOT containing LONGVARBINARY, IMAGE, BYTEA or BLOB fields use storeRegister() method witch is faster than storeRegisterLong(). Columns named "dt_created" are invisible for storeRegisterLong() method so that register creation timestamp is not altered by afterwards updates.

  Parameters:
    `oConn` - Database Connection
    `AllValues` - Values to assign to fields.
    `BinaryLengths` - map of lengths for long fields.
  Returns:
    true if register was inserted for first time, if it was updated.
  Throws:
    `java.sql.SQLException`
    `java.io.IOException`

### deleteRegister

    public boolean deleteRegister(JDCConnection oConn,
                                  java.util.HashMap AllValues)
                           throws java.sql.SQLException

  Delete a single register from this table at the database

  Parameters:
    `oConn` - Database connection
    `AllValues` - A Map with, at least, the primary key values for the register. Other Map values are ignored.
  Returns:
    true if register was delete, false if register to be deleted was not found.
  Throws:
    `java.sql.SQLException`

### existsRegister

    public boolean existsRegister(JDCConnection oConn,
                                  java.lang.String sQueryString)
                           throws java.sql.SQLException

  Checks if register exists at this table

  Parameters:
    `oConn` - Database Connection
    `sQueryString` - Register Query String, as a SQL WHERE clause syntax
  Returns:
    true if register exists, false otherwise.
  Throws:
    `java.sql.SQLException`

### existsRegister

    public boolean existsRegister(JDCConnection oConn,
                                  java.lang.String sQueryString,
                                  java.lang.Object[] oQueryParams)
                           throws java.sql.SQLException

  Checks if register exists at this table

  Parameters:
    `oConn` - Database Connection
    `sQueryString` - Register Query String, as a SQL WHERE clause syntax
  Returns:
    true if register exists, false otherwise.
  Throws:
    `java.sql.SQLException`

### existsRegister

    public boolean existsRegister(JDCConnection oConn,
                                  java.util.HashMap AllValues)
                           throws java.sql.SQLException

  Checks if register exists at this table

  Parameters:
    `oConn` - Database Connection
  Returns:
    true if register exists, false otherwise.
  Throws:
    `java.sql.SQLException`

### getColumns

    public java.util.LinkedList<DBColumn> getColumns()

  Returns:
    List of `DBColumn` objects composing this table.

### getIndexes

    public java.util.LinkedList<DBIndex> getIndexes()

  Returns:
    List of `DBIndex` objects of this table.
  Since:
    6.0

### getColumnsStr

    public java.lang.String getColumnsStr()
                                   throws java.lang.IllegalStateException

  Returns:
    Columns names separated by commas
  Throws:
    `java.lang.IllegalStateException`

### getColumnByName

    public DBColumn getColumnByName(java.lang.String sColumnName)
                             throws java.lang.IllegalStateException

  Get DBColumn by name

  Parameters:
    `sColumnName` - Column Name
  Returns:
    Reference to DBColumn ot null if no column with such name was found.
  Throws:
    `java.lang.IllegalStateException` - If column list for table has not been initialized

### getColumnIndex

    public int getColumnIndex(java.lang.String sColumnName)

  Get DBColumn index given its by name

  Parameters:
    `sColumnName` - Column Name
  Returns:
    Column Index[1..columnsCount()] or -1 if no column with such name was found.

### getPrimaryKey

    public java.util.LinkedList<java.lang.String> getPrimaryKey()

  Returns:
    List of primary key column names

### getName

    public java.lang.String getName()

  Returns:
    Unqualified table name

### getCatalog

    public java.lang.String getCatalog()

  Returns:
    Catalog name

### setCatalog

    public void setCatalog(java.lang.String sCatalogName)

### getSchema

    public java.lang.String getSchema()

  Returns:
    Schema name

### setSchema

    public void setSchema(java.lang.String sSchemaName)

  Set schema name

  Parameters:
    `sSchemaName` - String

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `java.lang.Object`

### readColumns

    public void readColumns(java.sql.Connection oConn,
                            java.sql.DatabaseMetaData oMData)
                     throws java.sql.SQLException

  Read DBColumn List from DatabaseMetaData

  This is primarily an internal initialization method for DBTable object. Usually there is no need to call it from any other class.

  Parameters:
    `oConn` - Database Connection
    `oMData` - DatabaseMetaData
  Throws:
    `java.sql.SQLException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD