APIdia Launch Partner
Top Fields Constructors Methods
net.ucanaccess.commands

public Class InsertCommand

extends Object
implements ICommand
Class Inheritance
All Implemented Interfaces
net.ucanaccess.commands.ICommand
Imports
io.github.spannm.jackcess.*, .Table.ColumnOrder, io.github.spannm.jackcess.complex.ComplexValueForeignKey, io.github.spannm.jackcess.impl.ColumnImpl, net.ucanaccess.complex.Attachment, .ComplexBase, .SingleValue, .Version, net.ucanaccess.converters.Metadata, .Persist2Jet, net.ucanaccess.exception.UcanaccessSQLException, net.ucanaccess.jdbc.DBReference, .DBReferenceSingleton, .UcanaccessConnection, net.ucanaccess.triggers.AutoNumberManager, java.io.File, .IOException, java.sql.SQLException, java.util.AbstractMap.SimpleImmutableEntry, .Arrays, .List, .Map

Field Summary

Modifier and TypeField and Description
private Database
private final String
private Object[]
private Table
private final String

Constructor Summary

AccessConstructor and Description
public
InsertCommand(String tableName, Database dbIO, Object[] newRow, String execId)

public
InsertCommand(Table table, Object[] newRow, String execId)

Method Summary

Modifier and TypeMethod and Description
public String
getExecId()

Implements net.ucanaccess.commands.ICommand.getExecId.

Returns the unique execution identifier.

public String
getTableName()

Implements net.ucanaccess.commands.ICommand.getTableName.

Returns the name of the table affected by this command.

public ICommand.CommandType
getType()

Implements net.ucanaccess.commands.ICommand.getType.

Returns the type of this command.

private static boolean
hasNativeDefault(Column col)

Only a native HSQLDB column default leaves an explicit null in the row.

private void
private Map.Entry<Table, RowId>

Returns:

the table the row was added to and the id of the new row
insertRow
(Table tbl)

Adds the new row to the given table.

private Object[]
public IFeedbackAction
persist()

Implements net.ucanaccess.commands.ICommand.persist.

Persists the changes to the underlying Access database file.

private void
restoreExplicitNulls(Table tbl, RowId rowId, Object[] memento, List<? extends Column> colList)

Jackcess replaces null with the column default on insert.

public IFeedbackAction
rollback()

Implements net.ucanaccess.commands.ICommand.rollback.

Reverts the changes made by this command.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dbIOback to summary
private Database dbIO
execIdback to summary
private final String execId
newRowback to summary
private Object[] newRow
tableback to summary
private Table table
tableNameback to summary
private final String tableName

Constructor Detail

InsertCommandback to summary
public InsertCommand(String tableName, Database dbIO, Object[] newRow, String execId)
InsertCommandback to summary
public InsertCommand(Table table, Object[] newRow, String execId)

Method Detail

getExecIdback to summary
public String getExecId()

Implements net.ucanaccess.commands.ICommand.getExecId.

Doc from net.ucanaccess.commands.ICommand.getExecId.

Returns the unique execution identifier.

Annotations
@Override
getTableNameback to summary
public String getTableName()

Implements net.ucanaccess.commands.ICommand.getTableName.

Doc from net.ucanaccess.commands.ICommand.getTableName.

Returns the name of the table affected by this command.

Annotations
@Override
getTypeback to summary
public ICommand.CommandType getType()

Implements net.ucanaccess.commands.ICommand.getType.

Doc from net.ucanaccess.commands.ICommand.getType.

Returns the type of this command.

Annotations
@Override
hasNativeDefaultback to summary
private static boolean hasNativeDefault(Column col) throws SQLException

Only a native HSQLDB column default leaves an explicit null in the row. Defaults that UCanAccess could not translate are left to Jackcess.

initComplexback to summary
private void initComplex()
insertRowback to summary
private Map.Entry<Table, RowId> insertRow(Table tbl) throws IOException

Adds the new row to the given table.

Returns:Map.Entry<Table, RowId>

the table the row was added to and the id of the new row

mementoRowback to summary
private Object[] mementoRow()
persistback to summary
public IFeedbackAction persist() throws SQLException

Implements net.ucanaccess.commands.ICommand.persist.

Doc from net.ucanaccess.commands.ICommand.persist.

Persists the changes to the underlying Access database file.

Annotations
@Override
Exceptions
SQLException:
if a database error occurs during persistence
restoreExplicitNullsback to summary
private void restoreExplicitNulls(Table tbl, RowId rowId, Object[] memento, List<? extends Column> colList) throws IOException, SQLException

Jackcess replaces null with the column default on insert. The row has already been inserted into HSQLDB, which applied the defaults of omitted columns, so a remaining null was set explicitly and is restored.

rollbackback to summary
public IFeedbackAction rollback() throws SQLException

Implements net.ucanaccess.commands.ICommand.rollback.

Doc from net.ucanaccess.commands.ICommand.rollback.

Reverts the changes made by this command.

Annotations
@Override
Exceptions
SQLException:
if a database error occurs during rollback