xx
This commit is contained in:
1 parent
541738319d
commit
83f6dde860
12 files changed
+68
-22
No files matched your search
@@ -13,6 +13,7 @@
|
||||
#include <dfs_posix.h>
|
||||
#include "DB_SQLite.h"
|
||||
#include "sqlite3.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#define DB_NAME "/sddisk/SC828.db"
|
||||
int db_HelperInit;
|
||||
@@ -180,6 +181,10 @@ void close_db_immediately(void) {
|
||||
void db_sqlite_init_full(void)
|
||||
{
|
||||
LOG_D("[DataBase] Init SQLite");
|
||||
|
||||
rt_uint8_t * ptr = rt_malloc(1024*4);
|
||||
sqlite3_config(SQLITE_CONFIG_PAGECACHE, ptr, 4096, 1);
|
||||
|
||||
sqlite3_initialize();
|
||||
|
||||
if (access(DB_NAME, F_OK) != 0)
|
||||
@@ -194,6 +199,9 @@ void db_sqlite_init_full(void)
|
||||
}
|
||||
return; //
|
||||
} else{
|
||||
|
||||
sqlite3_exec(g_db, "PRAGMA cache_size = 8;", 0, 0, 0);
|
||||
|
||||
if(sqlite3_exec(g_db,sql_upgrade_workorder_steps, 0, 0, 0)==0)
|
||||
{
|
||||
LOG_D("[DataBASE]WorkorderSteps Created successfully ");
|
||||
@@ -339,7 +347,7 @@ static void db_sqlite(void *parameter) {
|
||||
continue;
|
||||
} else {
|
||||
//限制缓存大小 (KB)
|
||||
sqlite3_exec(g_db, "PRAGMA cache_size = 8;", 0, 0, 0);
|
||||
//sqlite3_exec(g_db, "PRAGMA cache_size = 8;", 0, 0, 0);
|
||||
//设置临时存储为文件模式 (节省内存)
|
||||
//sqlite3_exec(g_db, "PRAGMA temp_store = FILE;", 0, 0, 0);
|
||||
//rt_kprintf("Opened database: %s\n", DB_NAME);
|
||||
|
||||
Reference in new issue
Block a user