Class DBRoomStorageConfig
java.lang.Object
com.smartfoxserver.persistence.room.BaseStorageConfig
com.smartfoxserver.persistence.room.DBRoomStorageConfig
Provides configuration settings for the Database based Room persistence API
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionThis is the SQL statement used for creating the table, if it doesn't exist.An custom DBManager, by default the one configured in the Zone is usedbooleanWhen set to true it will log the SQL of each performed queryName of the table to use for Room storageThis SQL is used to test the existence of the table.booleanInstead of using a binary serialization the Room data will be converted to JSON and stored as TEXT in the database.Fields inherited from class com.smartfoxserver.persistence.room.BaseStorageConfig
customStorageClassName, skipStaticRooms, storeInactiveRooms, storeRoomVariables -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
dbManager
An custom DBManager, by default the one configured in the Zone is used -
tableName
Name of the table to use for Room storage -
testTableExistenceSQL
This SQL is used to test the existence of the table. By default there's no need to change this setting. -
createTableSQL
This is the SQL statement used for creating the table, if it doesn't exist.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 tableNOTE: 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
-
debugSQL
public boolean debugSQLWhen set to true it will log the SQL of each performed query -
useTextSerialization
public boolean useTextSerializationInstead of using a binary serialization the Room data will be converted to JSON and stored as TEXT in the database. This can be helpful if you experience errors with the binary serialization and the blob-type field.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.
-
-
Constructor Details
-
DBRoomStorageConfig
public DBRoomStorageConfig()
-