public class DBRoomStorageConfig extends BaseStorageConfig
BaseStorageConfig
,
IRoomStorage
Modifier and Type | Field and Description |
---|---|
java.lang.String |
createTableSQL
This is the SQL statement used for creating the table, if it doesn't exist.
|
IDBManager |
dbManager
An custom DBManager, by default the one configured in the Zone is used
|
boolean |
debugSQL
When set to true it will log the SQL of each performed query
|
java.lang.String |
tableName
Name of the table to use for Room storage
|
java.lang.String |
testTableExistenceSQL
This SQL is used to test the existence of the table.
|
boolean |
useTextSerialization
Instead of using a binary serialization the Room data will be converted to JSON and stored as TEXT in
the database.
|
skipStaticRooms, storeInactiveRooms, storeRoomVariables
Constructor and Description |
---|
DBRoomStorageConfig() |
public IDBManager dbManager
public java.lang.String tableName
public java.lang.String testTableExistenceSQL
public java.lang.String createTableSQL
The default value we provide is specific for MySQL, if you are using another database you will need to use a custom statement using the SQL syntax of your DB.
The database structure is simple:
Field name | Type | Other |
---|---|---|
name | VARCHAR(200) | PRIMARY KEY, UNIQUE, NOT NULL |
groupId | VARCHAR(200) | KEY, NOT NULL |
roomData | BLOB(200) | NOT NULL |
For example this is the default MySQL statement:
CREATE TABLE %s ( `name` varchar(200) NOT NULL, `groupId` varchar(200) NOT NULL, `roomdata` %s NOT NULL, PRIMARY KEY (`name`), KEY `groupId` (`groupId`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;NOTE: the %s token after the CREATE TABLE is mandatory and it is replaced at runtime with the configured name of the table
NOTE: since version 2.9.2 the %s token in the roodata field declaration is mandatory, and it is replaced at runtime with the proper data-type, according to the useTextSerialization setting
public boolean debugSQL
public boolean useTextSerialization
The default value is false
PLEASE NOTE: you cannot change this flag after the table in the database has already been created. If you decide to switch from Binary to Text serialization make sure to delete your previous table before restarting the server.