Class JDBCFormatter
java.lang.Object
uk.ac.starlink.table.jdbc.JDBCFormatter
Handles conversion of a StarTable into a new table in an RDBMS.
- Author:
- Mark Taylor
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDescribes a column as it will be written to a table in an RDBMS. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateJDBCTable(String tableName, WriteMode mode) Writes data from this formatter's input table into the database.getColumn(int icol) Returns the SqlColumn object describing how a given column of this formatter's input table will be written into the RDBMS.getCreateStatement(String tableName) Returns the text of a suitable CREATE TABLE statement.getInsertStatement(String tableName) Returns the text of a suitable parametric statement for inserting a row.intgetSqlType(Class<?> clazz) Returns an SQL type code suitable for a given class.static voidMain method.typeName(int sqlType) Returns the name used by the connection's database to reference a JDBC type.
-
Constructor Details
-
JDBCFormatter
Constructor.- Parameters:
conn- JDBC connectiontable- input table- Throws:
SQLExceptionIOException
-
-
Method Details
-
getCreateStatement
-
getInsertStatement
-
createJDBCTable
Writes data from this formatter's input table into the database. This method is somewhat misnamed - depending on the write mode, a new table may or may not be created in the database.- Parameters:
tableName- name of the new table to write to in the databasemode- mode for writing records- Throws:
IOExceptionSQLException
-
getColumn
Returns the SqlColumn object describing how a given column of this formatter's input table will be written into the RDBMS. If the value for a given column isnull, it means that column cannot, and will not, be written.- Parameters:
icol- column index in input table- Returns:
- SQL column description
-
getSqlType
-
typeName
Returns the name used by the connection's database to reference a JDBC type.- Parameters:
sqlType- type id (as perTypes)- Returns:
- connection-specific type name
- Throws:
SQLException
-
main
Main method. Not really intended for use but may be helpful with debugging.- Throws:
IOExceptionSQLException
-