public class JDBCFormatter extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
JDBCFormatter.SqlColumn
Describes a column as it will be written to a table in an RDBMS.
|
| Constructor and Description |
|---|
JDBCFormatter(Connection conn,
StarTable table)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
createJDBCTable(String tableName,
WriteMode mode)
Writes data from this formatter's input table into the database.
|
JDBCFormatter.SqlColumn |
getColumn(int icol)
Returns the SqlColumn object describing how a given column of this
formatter's input table will be written into the RDBMS.
|
String |
getCreateStatement(String tableName)
Returns the text of a suitable CREATE TABLE statement.
|
String |
getInsertStatement(String tableName)
Returns the text of a suitable parametric statement for inserting a
row.
|
int |
getSqlType(Class<?> clazz)
Returns an SQL type code suitable for a given class.
|
static void |
main(String[] args)
Main method.
|
String |
typeName(int sqlType)
Returns the name used by the connection's database to reference a
JDBC type.
|
public JDBCFormatter(Connection conn, StarTable table) throws SQLException, IOException
conn - JDBC connectiontable - input tableSQLExceptionIOExceptionpublic String getCreateStatement(String tableName)
tableName - name of the new SQL tablepublic String getInsertStatement(String tableName)
tableName - name SQL table for insertionpublic void createJDBCTable(String tableName, WriteMode mode) throws IOException, SQLException
tableName - name of the new table to write to in the databasemode - mode for writing recordsIOExceptionSQLExceptionpublic JDBCFormatter.SqlColumn getColumn(int icol)
null, it means that
column cannot, and will not, be written.icol - column index in input tablepublic int getSqlType(Class<?> clazz)
clazz - java class of dataTypes codespublic String typeName(int sqlType) throws SQLException
sqlType - type id (as per Types)SQLExceptionpublic static void main(String[] args) throws IOException, SQLException
IOExceptionSQLExceptionCopyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.