From eb237f5dc564d2216b88a0bfc7422181c7d1ec9c Mon Sep 17 00:00:00 2001 From: huangxin Date: Tue, 29 Nov 2022 14:32:13 +0800 Subject: [PATCH] =?UTF-8?q?OCT=201.=20=E5=A2=9E=E5=8A=A0SQLite3=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E9=A1=B9=E8=AF=BB=E5=8F=96=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 4 ++-- srcs/libs/configure/config_help.c | 10 ++++++++++ srcs/libs/include/config.h | 4 ++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e6514f..8f3e4c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,11 +3,11 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.10 FATAL_ERROR) PROJECT(vCPE_project) OPTION(VCPE_AGENT "Enable vCPE agent test application" OFF) -OPTION(USED_LWIP "PPPoE for vCPE" OFF) +OPTION(USED_LWIP "PPPoE of LWIP support for vCPE" OFF) OPTION(USED_OPENDHCPD "DHCP server for vCPE" ON) OPTION(USED_OPENDHCPDDNS "DHCP And DNS server for vCPE" OFF) - +# 数据库开关 OPTION(USED_REDIS "Add redis database support for vCPE" OFF) OPTION(USED_MYSQL "Add mysql database support for vCPE" OFF) OPTION(USED_SQLITE "Add sqlite3 database support for vCPE" ON) diff --git a/srcs/libs/configure/config_help.c b/srcs/libs/configure/config_help.c index 083c462..fd697d9 100644 --- a/srcs/libs/configure/config_help.c +++ b/srcs/libs/configure/config_help.c @@ -99,6 +99,16 @@ unsigned int cfg_get_sensor_refresh_period() { return cfg_get_integral_value(CFG_SENSOR_REFRESH); } +#ifdef USED_SQLITE +const char *cfg_get_sqlite_db_name() { + return cfg_get_string_value(CFG_DB_SQLITE_DB_NAME); +} + +const char *cfg_get_sqlite_passwd() { + return cfg_get_string_value(CFG_DB_SQLITE_PASSWD); +} +#endif + #ifdef USED_REDIS const char *cfg_get_redis_server() { return cfg_get_string_value(CFG_DB_REDIS_SERVER); diff --git a/srcs/libs/include/config.h b/srcs/libs/include/config.h index 01e480f..9484c3b 100644 --- a/srcs/libs/include/config.h +++ b/srcs/libs/include/config.h @@ -103,6 +103,10 @@ const char *cfg_get_mysql_user(); const char *cfg_get_mysql_passwd(); const char *cfg_get_mysql_database(); #endif +#ifdef USED_SQLITE +const char *cfg_get_sqlite_db_name(); +const char *cfg_get_sqlite_passwd(); +#endif int cfg_get_zero_mq_port(); const char *cfg_get_zero_mq_data_path();