com.esri.sde.sdk.client
Class SeTable

java.lang.Object
  extended by com.esri.sde.sdk.client.SeTable

public class SeTable
extends java.lang.Object

SeTable - An object that creates/alters/deletes/queries a DBMS table through an sde server.


Nested Class Summary
static class SeTable.SeTableIdRange
           
static class SeTable.SeTableIndexDefs
          SeTable inner class that stores the index definition information for a table.
static class SeTable.SeTableLock
          SeTable inner class that retrieves the locks information for a table.
static class SeTable.SeTableRowLockInfo
          SeTable inner class that retrieves the rowlocks information from the server.
static class SeTable.SeTableStats
          SeTable inner class that retrieves the statistics information for a column.
 
Field Summary
static int SE_TABLE_EXCLUSIVE_SCHEMA_LOCK
           
static int SE_TABLE_SHARED_SCHEMA_LOCK
           
static int SE_UPDATE_ADDS_TABLE_STATS
           
static int SE_UPDATE_ALL_TABLE_STATS
           
static int SE_UPDATE_BUSINESS_TABLE_STATS
           
static int SE_UPDATE_DELETES_TABLE_STATS
           
static int SE_UPDATE_FEATURE_TABLE_STATS
           
static int SE_UPDATE_RASTER_TABLE_STATS
           
static int SE_UPDATE_XML_TABLE_STATS
           
 
Constructor Summary
SeTable(SeConnection conn, java.lang.String qualifiedTabName)
          Table constructor with an SeConnection and qualified table name argument.
SeTable(SeConnection conn, java.lang.String databaseName, java.lang.String ownerName, java.lang.String tableName)
          Table constructor with an SeConnection, database, owner and table name argument that qualifies the table in RDBMS.
 
Method Summary
 void addColumn(SeColumnDefinition columnDef)
          Adds a column to the table.
 void addMetaData(int recordCount, SeMetaData[] metaData)
          Adds metadata records.
 void addRowLocks(int numLocks, SeObjectId[] rowIds, SeObjectId stateId)
          Adds one or more row locks.
 void addUUIDColumn(java.lang.String columnName)
          Adds a UUID column to the table.
 void alterColumn(SeRegisteredColumn column)
          Alter SDE Column Metadata.
 void alterMetaData(int recordCount, SeMetaData[] metaData)
          Alters metadata records.
 void create(SeColumnDefinition[] columnDefs)
          Creates the table with specified column definitions and the default configuration keyword.
 void create(SeColumnDefinition[] columnDefs, java.lang.String configKeyword)
          Creates the table with specified column definitions.
 void createIndex(java.lang.String column, boolean unique, boolean ascending, java.lang.String configKeyword, java.lang.String indexName)
          Creates a DBMS index on the specified column of a table.
 void createIndexes(short numIndexes, SeTable.SeTableIndexDefs[] indexDefs, java.lang.String configKeyword)
          Creates DBMS indexes on a table.
 void createMultiVersionView(java.lang.String viewName)
          Creates a multiversion DBMS view on the specified multiversion table.
 void createPrimaryConstraint(java.lang.String[] columns, java.lang.String constraintName, java.lang.String configKeyword)
          Creates primary constraint.
 void createUniqueConstraint(java.lang.String[] columns, java.lang.String constraintName, java.lang.String configKeyword)
          Creates unique constraint.
 void createView(java.lang.String viewName, java.lang.String[] viewColumns, java.lang.String[] tableColumns, SeSqlConstruct sqlC)
          Creates a DBMS view on a table.
 void delete()
          Drops a DBMS table.If the table is spatially enabled, all of its associated spatial information for the layer is also deleted.
 void deleteConstraint(java.lang.String constraintName)
          Deletes the named constraint from specified table.
 void deleteIndex(java.lang.String indexName)
          Drops a DBMS table index for the specified table.
 void deleteMetaData(int recordCount, SeObjectId[] recordIds)
          Deletes metadata records.
 void deleteMetaDataByWhere(java.lang.String whereClause)
          Deletes metadata records filtered by a where clause.
 void deleteMultiVersionView()
          Deletes a multiversion DBMS view on a multiversion table.
 SeColumnDefinition[] describe()
          Returns column definitions of the table.This function maps the underlying DBMS data types to ArcSDE data types.
 SeTable.SeTableIndexDefs[] describeIndexes()
          Returns index definitions.
 void dropColumn(java.lang.String column)
          Drops a column from the table.
 void freeLock()
          Frees the lock on a table.
 SeRegisteredColumn[] getColumnList()
          Returns the full column descriptions for this registered table.
 java.lang.String getDatabase()
          Returns the database's name.
 SeTable.SeTableIdRange getIds(int numIds)
          Returns a range of row id values.
 SeTable.SeTableLock[] getLocks()
          Returns a list of locks info for the table.
 SeMetaData[] getMetaDataInfoList()
          Returns the meta-data associated with a table.
 SeState[] getMvEditStates()
          Returns a list of states in which a multiversion table was edited.
 java.lang.String getName()
          Returns the table's name.
 java.lang.String getOwner()
          Returns the owner's name.
 int getPermissions()
          Returns the permissions for the table.
 java.lang.String getQualifiedName()
          Returns the table's name, qualified with the owner and database.
 SeTable.SeTableRowLockInfo getRowLocks()
          Returns the row locks information.
 SeTable.SeTableRowLockInfo getRowLocksByUser(java.lang.String user)
          Returns rowlocks set by the specified user.
 void grantAccess(int privilege, boolean grant, java.lang.String user)
          Grants specified privileges to the specified user.
 void lock(int lockMode)
          Locks the table.
 void migrateAttributeBinary(java.lang.String columnName, java.lang.String config_keyword)
          Changes the data type of a column from LONG RAW storage to BLOB based on the configuration keyword specified.
 void populateUUIDColumn(java.lang.String columnName)
           
 java.lang.String qualifyColumn(java.lang.String columnName)
          Returns a qualified column name.
 void rebuildIndex(SeObjectId indexMask)
          Rebuilds this table's indexes.
 void removeRowLocks(int numLocks, SeObjectId[] rowIds, SeObjectId stateId)
          Deletes one or more row locks.
 void rename(java.lang.String newTableName)
          Renames the table.
 void returnIds(SeObjectId startId, int numIds)
          Sends a set of unused id values back to the server.
 void revokeAccess(int privilege, java.lang.String user)
          Revokes specified privileges from the specified user.
 void truncate()
          Deletes the data from a table but keeps the table definition.
 void updateDBMSStats(java.lang.String indexName, java.lang.String mode, int tableUpdateMask)
          This method updates the DBMS statistics on the specified table.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SE_TABLE_SHARED_SCHEMA_LOCK

public static final int SE_TABLE_SHARED_SCHEMA_LOCK
See Also:
Constant Field Values

SE_TABLE_EXCLUSIVE_SCHEMA_LOCK

public static final int SE_TABLE_EXCLUSIVE_SCHEMA_LOCK
See Also:
Constant Field Values

SE_UPDATE_ADDS_TABLE_STATS

public static final int SE_UPDATE_ADDS_TABLE_STATS
See Also:
Constant Field Values

SE_UPDATE_DELETES_TABLE_STATS

public static final int SE_UPDATE_DELETES_TABLE_STATS
See Also:
Constant Field Values

SE_UPDATE_FEATURE_TABLE_STATS

public static final int SE_UPDATE_FEATURE_TABLE_STATS
See Also:
Constant Field Values

SE_UPDATE_BUSINESS_TABLE_STATS

public static final int SE_UPDATE_BUSINESS_TABLE_STATS
See Also:
Constant Field Values

SE_UPDATE_RASTER_TABLE_STATS

public static final int SE_UPDATE_RASTER_TABLE_STATS
See Also:
Constant Field Values

SE_UPDATE_XML_TABLE_STATS

public static final int SE_UPDATE_XML_TABLE_STATS
See Also:
Constant Field Values

SE_UPDATE_ALL_TABLE_STATS

public static final int SE_UPDATE_ALL_TABLE_STATS
See Also:
Constant Field Values
Constructor Detail

SeTable

public SeTable(SeConnection conn,
               java.lang.String qualifiedTabName)
        throws SeException
Table constructor with an SeConnection and qualified table name argument. A Connection handle and qualified table name are included as a constructor argument since an SeTable object is always associated with a table in the remote server which is represented by a connection handle.

Parameters:
conn - SeConnection object handle.
qualifiedTabName - qualified table name.
Throws:
SeException

SeTable

public SeTable(SeConnection conn,
               java.lang.String databaseName,
               java.lang.String ownerName,
               java.lang.String tableName)
        throws SeException
Table constructor with an SeConnection, database, owner and table name argument that qualifies the table in RDBMS.

Parameters:
conn - SeConnection object handle.
databaseName - database name.
ownerName - owner name.
tableName - table name.
Throws:
SeException
Method Detail

qualifyColumn

public java.lang.String qualifyColumn(java.lang.String columnName)
                               throws SeException
Returns a qualified column name.

Parameters:
columnName - columnName.
Returns:
String
Throws:
SeException

populateUUIDColumn

public void populateUUIDColumn(java.lang.String columnName)
                        throws SeException
Throws:
SeException

addUUIDColumn

public void addUUIDColumn(java.lang.String columnName)
                   throws SeException
Adds a UUID column to the table.

Parameters:
columnName - The uuid column name.
Throws:
SeException

addColumn

public void addColumn(SeColumnDefinition columnDef)
               throws SeException
Adds a column to the table. The column is defined by an SeColumnDefinition object. The new column is added immediately to the existing table.

Parameters:
columnDef - an SeColumnDefinition object.
Throws:
SeException

alterColumn

public void alterColumn(SeRegisteredColumn column)
                 throws SeException
Alter SDE Column Metadata.

Parameters:
column - The new description of the column, matched by name and table.
Throws:
SeException

addMetaData

public void addMetaData(int recordCount,
                        SeMetaData[] metaData)
                 throws SeException
Adds metadata records.

Parameters:
recordCount - number of records to insert.
metaData - list of metadata records to be inserted.
Throws:
SeException

alterMetaData

public void alterMetaData(int recordCount,
                          SeMetaData[] metaData)
                   throws SeException
Alters metadata records.

Parameters:
recordCount - number of records to alter.
metaData - list of metadata records to be altered.
Throws:
SeException

deleteMetaData

public void deleteMetaData(int recordCount,
                           SeObjectId[] recordIds)
                    throws SeException
Deletes metadata records.

Parameters:
recordCount - number of records to delete.
recordIds - list of metadata record ids to be deleted.
Throws:
SeException

deleteMetaDataByWhere

public void deleteMetaDataByWhere(java.lang.String whereClause)
                           throws SeException
Deletes metadata records filtered by a where clause.

Parameters:
whereClause - where clause used to delete the records.
Throws:
SeException

getMvEditStates

public SeState[] getMvEditStates()
                          throws SeException
Returns a list of states in which a multiversion table was edited.

Returns:
SeState[]
Throws:
SeException

getMetaDataInfoList

public SeMetaData[] getMetaDataInfoList()
                                 throws SeException
Returns the meta-data associated with a table.

Returns:
SeMetaData[]
Throws:
SeException

dropColumn

public void dropColumn(java.lang.String column)
                throws SeException
Drops a column from the table. You can't delete spatial columns with this function.
NOTE: Dropping columns is only allowed in DB2 DBMSs beginning with DB2 version 9. It is not allowed in DB2 z/OS. Each time a column is dropped from a table in DB2 9, a REORG and RUNSTATS operation is performed on the table to bring the DB2 data pages up to date. These operations take place after each and every column drop. Be aware that if the table is extremely large, the REORG operation could take a significant amount of time and database resources to complete.

Parameters:
column - column to be dropped.
Throws:
SeException

create

public void create(SeColumnDefinition[] columnDefs)
            throws SeException
Creates the table with specified column definitions and the default configuration keyword. Table created is not spatially enabled.

Parameters:
columnDefs - An array of SeColumnDefinition objects.
Throws:
SeException

create

public void create(SeColumnDefinition[] columnDefs,
                   java.lang.String configKeyword)
            throws SeException
Creates the table with specified column definitions. Table created is not spatially enabled.

Parameters:
columnDefs - An array of SeColumnDefinition objects.
configKeyword - The keyword corresponding to an ArcSDE table configuration. The keyword and its corresponding table configuration must be defined in the dbtune table. Refer the ArcSDE Configuration and Tuning guide for more information on setting up the dbtune.sde configuration parameters.
Throws:
SeException

createIndex

public void createIndex(java.lang.String column,
                        boolean unique,
                        boolean ascending,
                        java.lang.String configKeyword,
                        java.lang.String indexName)
                 throws SeException
Creates a DBMS index on the specified column of a table.

Parameters:
column - column name.
unique - set to TRUE if index is unique.
ascending - set to TRUE if index is ascending.
configKeyword - keyword indicating alternate default configurations. The keyword is found in the dbtune.sde file.
indexName - index name.
Throws:
SeException

createIndexes

public void createIndexes(short numIndexes,
                          SeTable.SeTableIndexDefs[] indexDefs,
                          java.lang.String configKeyword)
                   throws SeException
Creates DBMS indexes on a table.

Parameters:
numIndexes - number of indexes to create.
indexDefs - an aray of SeTableIndexDefs objects defining index properties.
configKeyword - keyword indicating alternate default configurations. The keyword is found in the dbtune.sde file.
Throws:
SeException

createPrimaryConstraint

public void createPrimaryConstraint(java.lang.String[] columns,
                                    java.lang.String constraintName,
                                    java.lang.String configKeyword)
                             throws SeException
Creates primary constraint.

Parameters:
columns - array of column names.
constraintName - the constraint name.
configKeyword - the configuration keyword.
Throws:
SeException

createUniqueConstraint

public void createUniqueConstraint(java.lang.String[] columns,
                                   java.lang.String constraintName,
                                   java.lang.String configKeyword)
                            throws SeException
Creates unique constraint.

Parameters:
columns - array of column names.
constraintName - the constraint name.
configKeyword - the configuration keyword.
Throws:
SeException

describeIndexes

public SeTable.SeTableIndexDefs[] describeIndexes()
                                           throws SeException
Returns index definitions. Index definitions are defined in SeTable inner class SeTableIndexDefs.

Returns:
SeColumnDefinition[]
Throws:
SeException
See Also:
SeColumnDefinition

rebuildIndex

public void rebuildIndex(SeObjectId indexMask)
                  throws SeException
Rebuilds this table's indexes.

Parameters:
indexMask - SeObjectId indexMask The type of index.
Throws:
SeException

describe

public SeColumnDefinition[] describe()
                              throws SeException
Returns column definitions of the table.This function maps the underlying DBMS data types to ArcSDE data types. Column definitions are defined in SeColumnDefinition class.

Returns:
SeColumnDefinition[]
Throws:
SeException
See Also:
SeColumnDefinition

getColumnList

public SeRegisteredColumn[] getColumnList()
                                   throws SeException
Returns the full column descriptions for this registered table.

Returns:
SeRegisteredColumn[] The column descriptions.
Throws:
SeException
See Also:
SeRegisteredColumn

delete

public void delete()
            throws SeException
Drops a DBMS table.If the table is spatially enabled, all of its associated spatial information for the layer is also deleted.

Throws:
SeException

deleteConstraint

public void deleteConstraint(java.lang.String constraintName)
                      throws SeException
Deletes the named constraint from specified table.

Throws:
SeException

deleteIndex

public void deleteIndex(java.lang.String indexName)
                 throws SeException
Drops a DBMS table index for the specified table. Some DBMSs require unique index names within a namespace. Therefore, they do not require a table name to uniquely identify an index. Depending on the DBMS, you may need to prefix the index with the owner's name (e.g., `owner.index')

Throws:
SeException

truncate

public void truncate()
              throws SeException
Deletes the data from a table but keeps the table definition. If the table is spatially enabled, all of its associated spatial information for the layer is also truncated. The layer definition remains intact.

Throws:
SeException

lock

public void lock(int lockMode)
          throws SeException
Locks the table. Lock modes are SE_TABLE_SHARED_SCHEMA_LOCK and SE_TABLE_EXCLUSIVE_SCHEMA_LOCK. A shared schema lock will prevent others from changing the table schema until the lock is released. A shared schema lock will also prevent someone from deleting a table or changing its permissions. Multiple users can establish shared schema locks. If a shared schema lock exists on a table, other users can't establish an exclusive schema lock until all shared schema locks are released. Use an exclusive schema lock to change a table's schema. An exclusive schema lock will prevent other users from setting exclusive or shared schema locks until the exclusive schema lock is freed. If a user has already placed a schema lock on a table, the lock mode is updated to reflect the most recent call.

Parameters:
lockMode - lock type.
Throws:
SeException

getIds

public SeTable.SeTableIdRange getIds(int numIds)
                              throws SeException
Returns a range of row id values.

Parameters:
numIds - number of id values requested.
Returns:
SeRangeId
Throws:
SeException

returnIds

public void returnIds(SeObjectId startId,
                      int numIds)
               throws SeException
Sends a set of unused id values back to the server.

Parameters:
startId - start id of the range being released.
numIds - number of id values returned.
Throws:
SeException

getLocks

public SeTable.SeTableLock[] getLocks()
                               throws SeException
Returns a list of locks info for the table.

Returns:
SeTableLock[]
Throws:
SeException

freeLock

public void freeLock()
              throws SeException
Frees the lock on a table.

Throws:
SeException

addRowLocks

public void addRowLocks(int numLocks,
                        SeObjectId[] rowIds,
                        SeObjectId stateId)
                 throws SeException
Adds one or more row locks. If a row doesn't exist in the specified state or is already locked, the operation will fail. First failed rowid is returned as SeException error message. This operation automatically executes a commit.

Parameters:
numLocks - number of locks.
rowIds - array of rowid to lock.
stateId - state id to use. Set to SE_NULL_STATE_ID if the table isn't multiversioned.
Throws:
SeException

removeRowLocks

public void removeRowLocks(int numLocks,
                           SeObjectId[] rowIds,
                           SeObjectId stateId)
                    throws SeException
Deletes one or more row locks. If a row doesn't exist in the specified state or is already locked, the operation will fail. First failed rowid is returned as SeException error message. This operation automatically executes a commit.

Parameters:
numLocks - number of locks.
rowIds - array of rowid to remove lock from.
stateId - state id to use. Set to SE_NULL_STATE_ID if the table isn't multiversioned.
Throws:
SeException

getRowLocks

public SeTable.SeTableRowLockInfo getRowLocks()
                                       throws SeException
Returns the row locks information.

Returns:
SeTableRowLockInfo
Throws:
SeException
See Also:
SeTable.SeTableRowLockInfo

getRowLocksByUser

public SeTable.SeTableRowLockInfo getRowLocksByUser(java.lang.String user)
                                             throws SeException
Returns rowlocks set by the specified user.

Returns:
SeTableRowLockInfo
Throws:
SeException
See Also:
SeTable.SeTableRowLockInfo

createView

public void createView(java.lang.String viewName,
                       java.lang.String[] viewColumns,
                       java.lang.String[] tableColumns,
                       SeSqlConstruct sqlC)
                throws SeException
Creates a DBMS view on a table.

Parameters:
viewName - Name of the view to be created.
viewColumns - an array of view columns names.
tableColumns - an array of table columns names.
Throws:
SeException

createMultiVersionView

public void createMultiVersionView(java.lang.String viewName)
                            throws SeException
Creates a multiversion DBMS view on the specified multiversion table. A multiversion table may have only one multiversion view at a time.

Parameters:
viewName - name of the view to be created.
Throws:
SeException

deleteMultiVersionView

public void deleteMultiVersionView()
                            throws SeException
Deletes a multiversion DBMS view on a multiversion table.

Throws:
SeException

rename

public void rename(java.lang.String newTableName)
            throws SeException
Renames the table. If the table is registered, the registration entry is updated to reflect the new name. If the table is spatially enabled, the layer definition is updated. Any associated mango definitions are also updated.If the operation is successful current instance of SeTable will also update the table name.

Parameters:
newTableName - new name of the table.
Throws:
SeException

updateDBMSStats

public void updateDBMSStats(java.lang.String indexName,
                            java.lang.String mode,
                            int tableUpdateMask)
                     throws SeException
This method updates the DBMS statistics on the specified table. If the table is a layer, statistics are generated for all related layer objects including indexes unless a partcular table is specified via the tableUpdateMask parameter.

The mode values for Oracle are:

  COMPUTE
  ESTIMATE
 

The mode values for Informix are:

  LOW
  MEDIUM
  HIGH
  DISTRIBUTIONS
  DROP
  RESOLUTION
  SPECIFIC
  ROUTINE
  FUNCTION
  PROCEDURE
 

The mode values for Sqlserver are:

  with fullscan [index]
  with sample %% percent [index]
 

The mode value for DB2 is NULL( The DB2 mode implementation has been fixed at "with distributions and detailed indexes all" for all tables).

The tableUpdateMask can be an 'OR'ed combination of the following:

 
  SE_UPDATE_ADDS_TABLE_STATS
  SE_UPDATE_DELETES_TABLE_STATS
  SE_UPDATE_FEATURE_TABLE_STATS
  SE_UPDATE_BUSINESS_TABLE_STATS
  SE_UPDATE_RASTER_TABLE_STATS
  SE_UPDATE_ALL_TABLE_STATS
 
 

Parameters:
indexName - index name.
mode - Statistics mode.
tableUpdateMask - bitmask indicating the tables whose statistics needs to be updated.
Throws:
SeException

migrateAttributeBinary

public void migrateAttributeBinary(java.lang.String columnName,
                                   java.lang.String config_keyword)
                            throws SeException
Changes the data type of a column from LONG RAW storage to BLOB based on the configuration keyword specified. Applies to tables in Oracle databases only.

Notes

- It is strongly recommended to create a backup of data before geometry storage type migration. For example, this could be in the form of an sdeexport file.

- If the table was registered as versioned, migrating the LONG RAW column to a BLOB data type will also update the column in the Adds table. If the table has archiving enabled, the archive table's LONG RAW column will also be updated.

- Storage migration must be done by the user who owns the table.

Parameters:
config_keyword - The DBTUNE configuration keyword specifying the ATTRIBUTE_BINARY BLOB storage, plus storage clauses for the BLOB data such as tablespaces
Throws:
SeException - if an error occurs

grantAccess

public void grantAccess(int privilege,
                        boolean grant,
                        java.lang.String user)
                 throws SeException
Grants specified privileges to the specified user. Current DBMS user must have sufficient DBMS privileges for grant to work. Multiple privileges can be set in a single call by ORing the privilege bitmasks. If the grant boolean is TRUE, then the given user can in turn grant those privileges to other users. The available privilege bitmasks are:
  SeDefs.SE_SELECT_PRIVILEGE
  SeDefs.SE_UPDATE_PRIVILEGE
  SeDefs.SE_INSERT_PRIVILEGE
  SeDefs.SE_DELETE_PRIVILEGE
 

Parameters:
privilege - privilege to grant.
grant - granted user can/can't GRANT/REVOKE privilge.
user - DBMS user name to whom privilges need to be granted.
Throws:
SeException

revokeAccess

public void revokeAccess(int privilege,
                         java.lang.String user)
                  throws SeException
Revokes specified privileges from the specified user. Current DBMS user must have sufficient DBMS privileges for revoke to work. Multiple privileges can be set in a single call by ORing the privilege bitmasks. The available privilege bitmasks are:
  SeDefs.SE_SELECT_PRIVILEGE
  SeDefs.SE_UPDATE_PRIVILEGE
  SeDefs.SE_INSERT_PRIVILEGE
  SeDefs.SE_DELETE_PRIVILEGE
 

Parameters:
privilege - privilege to grant.
user - DBMS user name to whom privilges need to be granted.
Throws:
SeException

getPermissions

public int getPermissions()
                   throws SeException
Returns the permissions for the table. The permissions available are returned as a bitmask of one or more of the following values:
  SeDefs.SE_SELECT_PRIVILEGE
  SeDefs.SE_UPDATE_PRIVILEGE
  SeDefs.SE_INSERT_PRIVILEGE
  SeDefs.SE_DELETE_PRIVILEGE
 

Returns:
int
Throws:
SeException
See Also:
SeDefs

getName

public java.lang.String getName()
Returns the table's name.

Returns:
String

getDatabase

public java.lang.String getDatabase()
Returns the database's name.

Returns:
String

getOwner

public java.lang.String getOwner()
Returns the owner's name.

Returns:
String

getQualifiedName

public java.lang.String getQualifiedName()
Returns the table's name, qualified with the owner and database.

Returns:
String