Package anderix.datajets
Class TableDefinition
java.lang.Object
anderix.datajets.TableDefinition
Contains information about a physical database table. TableDefinition
allows a DataJet to contain all the information neccessary to build
a corresponding table in which to store its data. When using a
TableDefinition object, it is usually neccessary to include
information about your database platform that may not be portable
to other platforms.
- See Also:
-
Constructor Summary
ConstructorDescriptionTableDefinition
(String table, String idField, String idFieldProperties) Constructor that begins the physical table definition. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a field to the table definition.Creates a SqlBuilder object based on the TableDefinition.void
createTable
(ConnectionGenerator generator, boolean dropTableFirst) Creates a physical database table based on the TableDefinition.void
createTable
(String driver, String connectionString, boolean dropTableFirst) Creates a physical database table based on the TableDefinition.void
createTable
(Connection con, boolean dropTableFirst) Creates a physical database table based on the TableDefinition.getFieldName
(int fieldIndex) Returns the name of the field located at the specified index.String[]
Returns the names of all field specified.String[]
Returns the properties of all field specified.getFieldProperties
(int fieldIndex) Returns the properties for the field located at the specified index.getTable()
Returns the name of the table.int
Finds the index of the field specified.
-
Constructor Details
-
TableDefinition
Constructor that begins the physical table definition.- Parameters:
table
- name of the physical database tableidField
- name of the field to use as identityidFieldProperties
- string that defines the id field
-
-
Method Details
-
addField
Adds a field to the table definition.- Parameters:
fieldName
- name of the field to addfieldProperties
- string that defines the field
-
getTable
Returns the name of the table.- Returns:
- name of the table
-
indexOf
Finds the index of the field specified.- Parameters:
fieldName
- name of field to find index of- Returns:
- index of the field; or -1 if not found
-
getFieldName
Returns the name of the field located at the specified index.- Parameters:
fieldIndex
- index of field to return- Returns:
- name of the field
-
getFieldNames
Returns the names of all field specified.- Returns:
- array containing all the names of the fields
-
getFieldProperties
Returns the properties for the field located at the specified index.- Parameters:
fieldIndex
- index of field to return- Returns:
- properties of the field
-
getFieldProperties
Returns the properties of all field specified.- Returns:
- array containing all the properties of the fields
-
createSqlBuilder
Creates a SqlBuilder object based on the TableDefinition.- Returns:
- new SqlBuilder object
-
createTable
public void createTable(ConnectionGenerator generator, boolean dropTableFirst) throws DataJetException Creates a physical database table based on the TableDefinition.- Parameters:
generator
- ConnectionGenerator with database connection informationdropTableFirst
- set to true to drop existing table before creating table- Throws:
DataJetException
- if the connection information provided to the DataJet object is incorrect or if the DataJet has not been initialized
-
createTable
public void createTable(String driver, String connectionString, boolean dropTableFirst) throws DataJetException Creates a physical database table based on the TableDefinition.- Parameters:
driver
- string name of driver class to loadconnectionString
- database url to create Connection objectdropTableFirst
- set to true to drop existing table before creating table- Throws:
DataJetException
- if the connection information provided to the DataJet object is incorrect or if the DataJet has not been initialized
-
createTable
Creates a physical database table based on the TableDefinition.- Parameters:
con
- existing connection to the database serverdropTableFirst
- set to true to drop existing table before creating table- Throws:
DataJetException
- if the DataJet has not been initialized
-