| java.lang.Object org.geotools.data.jdbc.JDBCUtils
JDBCUtils | public class JDBCUtils (Code) | | Collection of convenience methods for jdbc datastores.
author: Justin Deoliveira, The Open Planning Project |
Method Summary | |
final public static FeatureType | buildFeatureType(TypeName typeName, JDBCDataStore dataStore) Builds a feature type for a particular type name / table name.
THe attributes of the feature type are derived from the database
meta data.
Parameters: typeName - The name of the type / table. Parameters: dataStore - The datastore. | final public static PrimaryKey | primaryKey(TypeName typeName, JDBCDataStore dataStore) Determines the elements of a primary key of a feature type / table.
The primary key is derived from the database metadata.
Parameters: typeName - The feature type / table name. Parameters: dataStore - The data store. | final public static String[] | sqlTypeNames(FeatureType featureType, JDBCDataStore dataStore) Returns a list of sql type names which correspond to the attribute types
of the provided feature type.
Parameters: featureType - The feature type. Parameters: dataStore - The datastore. | public static Object | statement(Connection connection, JDBCRunnable runnable) Utility method to safely execute an sql statement. | public static Object | statement(JDBCDataStore dataStore, JDBCRunnable runnable) Utility method to safely execute an sql statement.
This method will obtain a new connection from the datastore, and close it
when it is done, therefore it is not suitable for executing a statement
that is intended to be part of a transaction. | final public static List | typeNames(JDBCDataStore dataStore) Creates a list of the type names ( table names )
The list of names is generated from the database metadata obtained from
the database connection provided via the datastore. |
buildFeatureType | final public static FeatureType buildFeatureType(TypeName typeName, JDBCDataStore dataStore) throws Exception(Code) | | Builds a feature type for a particular type name / table name.
THe attributes of the feature type are derived from the database
meta data.
Parameters: typeName - The name of the type / table. Parameters: dataStore - The datastore. The built type. throws: Exception - Any I/O errors that occur. |
primaryKey | final public static PrimaryKey primaryKey(TypeName typeName, JDBCDataStore dataStore) throws Exception(Code) | | Determines the elements of a primary key of a feature type / table.
The primary key is derived from the database metadata.
Parameters: typeName - The feature type / table name. Parameters: dataStore - The data store. The primary key. throws: Exception - Any I/O errors that occur. |
sqlTypeNames | final public static String[] sqlTypeNames(FeatureType featureType, JDBCDataStore dataStore) throws Exception(Code) | | Returns a list of sql type names which correspond to the attribute types
of the provided feature type.
Parameters: featureType - The feature type. Parameters: dataStore - The datastore. A list of database dependent type names. throws: Exception - Any I/O errors that occur. |
statement | public static Object statement(Connection connection, JDBCRunnable runnable) throws IOException(Code) | | Utility method to safely execute an sql statement.
This method ensures that statements are properly closed, even when
exceptions occur.
Any
SQLException 's generated are wrapped in
IOException .
If an error occurs closing the statement n it is logged and not rethrown.
Parameters: connection - The database connection Parameters: runner - The code block to execute. |
statement | public static Object statement(JDBCDataStore dataStore, JDBCRunnable runnable) throws IOException(Code) | | Utility method to safely execute an sql statement.
This method will obtain a new connection from the datastore, and close it
when it is done, therefore it is not suitable for executing a statement
that is intended to be part of a transaction. Use
JDBCUtils.statement(Connection,JDBCRunnable) for this case.
This method ensures that statements and connections are properly closed,
even when exceptions occur.
Any
SQLException 's generated are wrapped in
IOException .
If an error occurs closing the statement, or connection it is logged and
not rethrown.
Parameters: dataStore - The datastore. Parameters: runner - The code block to execute. |
typeNames | final public static List typeNames(JDBCDataStore dataStore) throws Exception(Code) | | Creates a list of the type names ( table names )
The list of names is generated from the database metadata obtained from
the database connection provided via the datastore.
A list of TypeName. |
|
|