|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectadams.core.ConsoleObject
adams.data.spreadsheet.SqlUtils.Writer
public static class SqlUtils.Writer
For writing data to a database.
| Field Summary | |
|---|---|
protected ColumnNameConversion |
m_ColumnNameConversion
the column name conversion. |
protected String[] |
m_ColumnNames
the column names (shortened, disambiguated). |
protected Cell.ContentType[] |
m_ContentTypes
the type used for the table. |
protected int |
m_MaxColumnLength
the maximum length for column names. |
protected int |
m_MaxStringLength
the maximum length for strings. |
protected SpreadSheet |
m_Sheet
the underlying spreadm_Sheet. |
protected boolean |
m_Stopped
whether the last action was stopped. |
protected String |
m_StringColumnSQL
the SQL type for string columns. |
protected String |
m_Table
the table to write the data to. |
static String |
PLACEHOLDER_MAX
the placeholder for the maximum length for string values. |
| Constructor Summary | |
|---|---|
SqlUtils.Writer(SpreadSheet sheet,
String table,
int maxCol,
ColumnNameConversion colName,
String stringCol,
int maxStr)
Initializes the object. |
|
| Method Summary | |
|---|---|
String |
createTable(SQL sql)
Creates the table. |
protected String |
fixColumnName(String s)
Fixes the column name. |
protected void |
generate()
Generates the table setup. |
ColumnNameConversion |
getColumnNameConversion()
Returns how to convert the column headers into SQL table column names. |
String[] |
getColumnNames()
Returns the generated column names. |
Cell.ContentType[] |
getContentTypes()
Returns the content types of the columns. |
String |
getCreateStatement()
Generates the CREATE TABLE statement. |
String |
getInsertStatement()
Generates a statement for an insert statement. |
int |
getMaxStringLength()
Returns the maximum length for strings. |
String |
getStringColumnSQL()
Returns the SQL type for string columns for the CREATE statement. |
String |
getTable()
Returns the table to write the data to. |
void |
stopExecution()
Stops the execution. |
String |
writeData(SQL sql)
Writes the data to the table. |
| Methods inherited from class adams.core.ConsoleObject |
|---|
getDebugging, getSystemErr, getSystemOut, sizeOf |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String PLACEHOLDER_MAX
protected SpreadSheet m_Sheet
protected String m_Table
protected Cell.ContentType[] m_ContentTypes
protected int m_MaxColumnLength
protected String[] m_ColumnNames
protected ColumnNameConversion m_ColumnNameConversion
protected String m_StringColumnSQL
protected int m_MaxStringLength
protected boolean m_Stopped
| Constructor Detail |
|---|
public SqlUtils.Writer(SpreadSheet sheet,
String table,
int maxCol,
ColumnNameConversion colName,
String stringCol,
int maxStr)
m_Sheet - the underlying spreadm_Sheettable - the table namemaxCol - the maximum length for column namescolName - the conversion for column namesstringCol - the SQL type for string columnsmaxStr - the maximum length for strings (get truncated)| Method Detail |
|---|
protected void generate()
public String getTable()
public ColumnNameConversion getColumnNameConversion()
public int getMaxStringLength()
public String getStringColumnSQL()
protected String fixColumnName(String s)
s - the column name to fix
public String getCreateStatement()
public String getInsertStatement()
public String[] getColumnNames()
public Cell.ContentType[] getContentTypes()
public String createTable(SQL sql)
sql - for executing queries
public String writeData(SQL sql)
sql - for performing the writing
public void stopExecution()
stopExecution in interface Stoppable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||