public class InsertIdentityOperation extends AbstractOperation
If you are using the Microsoft driver (i.e.
com.microsoft.jdbc.sqlserver.SQLServerDriver
), you'll need to
use the SelectMethod=cursor
parameter in the JDBC connection
string. Your databaseUrl would look something like the following:
jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=mydb;SelectMethod=cursor
Thanks to Jeremy Stein who has submitted multiple patches.
Modifier and Type | Field and Description |
---|---|
static DatabaseOperation |
CLEAN_INSERT |
static IColumnFilter |
IDENTITY_FILTER_EXTENDED
Accepts columns that have one of the remarks
GENERATED BY DEFAULT AS IDENTITY
GENERATED ALWAYS AS IDENTITY
set which is the SQL standard syntax to describe auto-generated key columns.
|
static DatabaseOperation |
INSERT |
static DatabaseOperation |
REFRESH |
DELETE, DELETE_ALL, NONE, TRUNCATE_TABLE, UPDATE
Constructor and Description |
---|
InsertIdentityOperation(DatabaseOperation operation)
Creates a new InsertIdentityOperation object that decorates the
specified operation.
|
Modifier and Type | Method and Description |
---|---|
void |
execute(IDatabaseConnection connection,
IDataSet dataSet)
Executes this operation on the specified database using the specified
dataset contents.
|
getQualifiedName
CLOSE_CONNECTION, TRANSACTION
public static final DatabaseOperation INSERT
public static final DatabaseOperation CLEAN_INSERT
public static final DatabaseOperation REFRESH
public static final IColumnFilter IDENTITY_FILTER_EXTENDED
true
(note that
it does not yet have the ability to check whether the column is a primary key col).public InsertIdentityOperation(DatabaseOperation operation)
public void execute(IDatabaseConnection connection, IDataSet dataSet) throws DatabaseUnitException, java.sql.SQLException
DatabaseOperation
execute
in class DatabaseOperation
connection
- the database connection.dataSet
- the dataset to be used by this operation.DatabaseUnitException
java.sql.SQLException
Copyright © 2002-2020. All Rights Reserved.