public class MSSQLKVDatabase extends SQLKVDatabase
SQLKVDatabase.
Automatically creates the key/value table on startup if it doesn't already exist.
Note: Because SQL Server
ignores trailing zero bytes when comparing VARBINARY values, we are forced to use "byte stuffing"
to encode keys, whereby 0x00 and 0x01 are replaced by 0x0101 and 0x0102, respectively.
| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEFAULT_LARGE_KEYS |
static boolean |
DEFAULT_LARGE_VALUES |
static int |
DEFAULT_LOCK_TIMEOUT |
static String |
DEFAULT_SCHEMA |
dataSource, DEFAULT_KEY_COLUMN_NAME, DEFAULT_TABLE_NAME, DEFAULT_VALUE_COLUMN_NAME, isolationLevel, keyColumnName, log, OPTION_ISOLATION, tableName, valueColumnName| Constructor and Description |
|---|
MSSQLKVDatabase() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
configureConnection(Connection connection) |
String |
createPutStatement() |
protected SQLKVTransaction |
createSQLKVTransaction(Connection connection) |
int |
getLockTimeout()
Get the lock timeout with which to configure new transactions.
|
String |
getSchema()
Get schema name.
|
protected void |
initializeDatabaseIfNecessary(Connection connection) |
boolean |
isLargeKeys()
Get whether support for large keys (greater than 8,000 bytes) are enabled.
|
boolean |
isLargeValues()
Get whether support for large values (greater than 8,000 bytes) are enabled.
|
String |
limitSingleRow(String sql) |
protected String |
quoteString(String value)
Encloses the given
name in single quotes and doubles up any single quotes therein. |
void |
setLargeKeys(boolean largeKeys) |
void |
setLargeValues(boolean largeValues) |
void |
setLockTimeout(int lockTimeout) |
void |
setSchema(String schema) |
KVTransactionException |
wrapException(SQLKVTransaction tx,
SQLException e) |
beginTransaction, createGetAllStatement, createGetAtLeastStatement, createGetAtMostStatement, createGetRangeStatement, createGetStatement, createRemoveAllStatement, createRemoveAtLeastStatement, createRemoveAtMostStatement, createRemoveRangeStatement, createRemoveStatement, createTransaction, createTransaction, createTransactionConnection, getDataSource, getIsolationLevel, getIsolationLevel, getKeyColumnName, getTableName, getValueColumnName, isRollbackForReadOnly, postBeginTransaction, preBeginTransaction, quote, setDataSource, setIsolationLevel, setKeyColumnName, setRollbackForReadOnly, setTableName, setValueColumnName, start, stoppublic static final String DEFAULT_SCHEMA
public static final boolean DEFAULT_LARGE_KEYS
public static final boolean DEFAULT_LARGE_VALUES
public static final int DEFAULT_LOCK_TIMEOUT
public void setSchema(String schema)
public boolean isLargeKeys()
This only affects initial table creation; it will have no effect on an already-initialized database.
Note that if large values are enabled, and any object field containing values greater than 8,000 bytes is indexed, then large keys must also be enabled.
Default is false.
public void setLargeKeys(boolean largeKeys)
public boolean isLargeValues()
This only affects initial table creation; it will have no effect on an already-initialized database.
Note that if large values are enabled, and any object field containing values greater than 8,000 bytes is indexed, then large keys must also be enabled.
Default is true.
public void setLargeValues(boolean largeValues)
public int getLockTimeout()
Default is 3000.
public void setLockTimeout(int lockTimeout)
protected void initializeDatabaseIfNecessary(Connection connection) throws SQLException
initializeDatabaseIfNecessary in class SQLKVDatabaseSQLExceptionprotected void configureConnection(Connection connection) throws SQLException
configureConnection in class SQLKVDatabaseSQLExceptionprotected SQLKVTransaction createSQLKVTransaction(Connection connection) throws SQLException
createSQLKVTransaction in class SQLKVDatabaseSQLExceptionpublic String createPutStatement()
createPutStatement in class SQLKVDatabaseprotected String quoteString(String value)
name in single quotes and doubles up any single quotes therein.value - string to quotepublic String limitSingleRow(String sql)
limitSingleRow in class SQLKVDatabasepublic KVTransactionException wrapException(SQLKVTransaction tx, SQLException e)
wrapException in class SQLKVDatabaseCopyright © 2018. All rights reserved.