public class InsertSql
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
InsertSql.CurrentDateTime
special replacement when creating insert
|
Constructor and Description |
---|
InsertSql(java.lang.String table,
java.sql.Connection connection)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addColumnStringValue(java.lang.String column,
java.lang.String value)
Add a string column value for the insert.
|
void |
addColumnValue(java.lang.String column,
java.lang.Object value)
Add a column value for the insert.
|
java.lang.Integer |
addedUniqueIdPosition() |
void |
addHexColumnValue(java.lang.String column,
java.lang.String value) |
void |
changeTable(java.lang.String table)
Change the target table of the insert.
|
java.lang.String |
generateInsertSelectSql()
Returns SQL in the form of: "insert into (
|
java.lang.String |
generateInsertSql()
Produce the insert statement given the data given.
|
java.lang.String |
getAddedUid() |
java.lang.String |
getAddedUidSequence() |
void |
setColumnValues(AttributeStorage sequenceDef)
Set values from the AttributeStorage object.
|
public InsertSql(java.lang.String table, java.sql.Connection connection) throws java.sql.SQLException
table
- Name of the table to insert into.serverType
- Type of database server to create the insert for.MXException
java.sql.SQLException
public void addColumnValue(java.lang.String column, java.lang.Object value)
column
- The name of the column.value
- The value can be a String (which will be quoted), a Boolean (converted to 0 or 1),
a CurrentDateTime (depends on server), or other (toString() will be used.)public void addColumnStringValue(java.lang.String column, java.lang.String value)
column
- The name of the column.value
- The value string, which will be formatted with quotes and internal double single quotes.public java.lang.String generateInsertSql() throws java.sql.SQLException
MXException
MXException
java.sql.SQLException
public java.lang.String generateInsertSelectSql() throws java.sql.SQLException
MXException
java.sql.SQLException
public void changeTable(java.lang.String table)
table
- Name of new table to generate an insert for.public void setColumnValues(AttributeStorage sequenceDef)
sequenceDef
- public void addHexColumnValue(java.lang.String column, java.lang.String value)
public java.lang.Integer addedUniqueIdPosition() throws java.sql.SQLException
java.sql.SQLException
public java.lang.String getAddedUidSequence() throws java.sql.SQLException
java.sql.SQLException
public java.lang.String getAddedUid() throws java.sql.SQLException
java.sql.SQLException