鴻蒙OS StoreConfig

2022-08-20 10:04 更新

StoreConfig

java.lang.Object

|---ohos.data.rdb.StoreConfig

public class StoreConfig
extends Object

管理關(guān)系數(shù)據(jù)庫配置。

嵌套類摘要

修飾符和類型 描述
static class StoreConfig.Builder 表示 StoreConfig 的構(gòu)建器。
static class StoreConfig.JournalMode 描述數(shù)據(jù)庫的日志模式。
static class StoreConfig.StorageMode 枚舉存儲(chǔ)模式。
static class StoreConfig.SyncMode 枚舉數(shù)據(jù)庫同步模式。

字段摘要

修飾符和類型 字段 描述
static int MAX_ENCRYPT_KEY_SIZE 加密密鑰的最大大小。

方法總結(jié)

修飾符和類型 方法 描述
DatabaseFileSecurityLevel getDatabaseFileSecurityLevel() 獲取數(shù)據(jù)庫文件的安全級(jí)別。
DatabaseFileType getDatabaseFileType() 獲取此 StoreConfig 對(duì)象中的數(shù)據(jù)庫文件類型。
byte[] getEncryptKey() 獲取此 StoreConfig 對(duì)象中的加密密鑰。
StoreConfig.JournalMode getJournalMode() 獲取此 StoreConfig 對(duì)象中的日志模式。
String getName() 獲取數(shù)據(jù)庫名稱。
StoreConfig.StorageMode getStorageMode() 獲取存儲(chǔ)模式。
StoreConfig.SyncMode getSyncMode() 獲取此 StoreConfig 對(duì)象中的同步模式。
boolean isReadOnly() 檢查數(shù)據(jù)庫是否是只讀的。
static StoreConfig newDefaultConfig(String name) 通過指定數(shù)據(jù)庫名稱使用默認(rèn)配置創(chuàng)建數(shù)據(jù)庫配置。
static StoreConfig newMemoryConfig() 創(chuàng)建內(nèi)存數(shù)據(jù)庫配置。
static StoreConfig newReadOnlyConfig(String name) 通過指定數(shù)據(jù)庫名稱創(chuàng)建只讀數(shù)據(jù)庫配置。
從類 java.lang.Object 繼承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

字段詳細(xì)信息

MAX_ENCRYPT_KEY_SIZE

public static final int MAX_ENCRYPT_KEY_SIZE

加密密鑰的最大大小。

方法詳情

newDefaultConfig

public static StoreConfig newDefaultConfig(String name)

通過指定數(shù)據(jù)庫名稱使用默認(rèn)配置創(chuàng)建數(shù)據(jù)庫配置。

使用此配置創(chuàng)建的數(shù)據(jù)庫處于磁盤存儲(chǔ)模式,可讀寫。

參數(shù):

參數(shù)名稱 參數(shù)描述
name 表示數(shù)據(jù)庫名稱。

返回:

返回創(chuàng)建的數(shù)據(jù)庫配置。

newMemoryConfig

public static StoreConfig newMemoryConfig()

創(chuàng)建內(nèi)存數(shù)據(jù)庫配置。

使用此配置創(chuàng)建的數(shù)據(jù)庫處于內(nèi)存存儲(chǔ)模式,可讀寫。

返回:

返回創(chuàng)建的數(shù)據(jù)庫配置。

newReadOnlyConfig

public static StoreConfig newReadOnlyConfig(String name)

通過指定數(shù)據(jù)庫名稱創(chuàng)建只讀數(shù)據(jù)庫配置。

使用此配置創(chuàng)建的數(shù)據(jù)庫處于磁盤存儲(chǔ)模式。

參數(shù):

參數(shù)名稱 參數(shù)描述
name 表示數(shù)據(jù)庫名稱。

返回:

返回創(chuàng)建的數(shù)據(jù)庫配置。

getName

public String getName()

獲取數(shù)據(jù)庫名稱。

返回:

返回?cái)?shù)據(jù)庫名稱。

getStorageMode

public StoreConfig.StorageMode getStorageMode()

獲取存儲(chǔ)模式。

返回:

返回存儲(chǔ)模式。

getJournalMode

public StoreConfig.JournalMode getJournalMode()

獲取此 StoreConfig 對(duì)象中的日志模式。

返回:

返回此 StoreConfig 對(duì)象中的日志模式。

getSyncMode

public StoreConfig.SyncMode getSyncMode()

獲取此 StoreConfig 對(duì)象中的同步模式。

返回:

返回此 StoreConfig 對(duì)象中的同步模式,如 SyncMode 中所枚舉。

getEncryptKey

public byte[] getEncryptKey()

獲取此 StoreConfig 對(duì)象中的加密密鑰。

返回:

返回此 StoreConfig 對(duì)象中的加密密鑰。

isReadOnly

public boolean isReadOnly()

檢查數(shù)據(jù)庫是否是只讀的。

返回:

如果數(shù)據(jù)庫是只讀的,則返回 true; 否則返回 false。

getDatabaseFileType

public DatabaseFileType getDatabaseFileType()

獲取此 StoreConfig 對(duì)象中的數(shù)據(jù)庫文件類型。

返回:

返回?cái)?shù)據(jù)庫文件類型,如 DatabaseFileType 中所枚舉。

getDatabaseFileSecurityLevel

public DatabaseFileSecurityLevel getDatabaseFileSecurityLevel()

獲取數(shù)據(jù)庫文件的安全級(jí)別。

返回:

返回安全級(jí)別。

以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)