Connected to local sqlite DB

This commit is contained in:
ganome 2025-01-30 23:48:45 -07:00
parent ee4e7f1466
commit bde8026eca
Signed by untrusted user who does not match committer: Ganome
GPG Key ID: 944DE53336D81B83
2 changed files with 23 additions and 7 deletions

View File

@ -2,11 +2,14 @@ cmake_minimum_required(VERSION 3.30)
project(hardwareDB VERSION 0.0.1) project(hardwareDB VERSION 0.0.1)
# set(SOURCE_FILES main.cpp) # set(SOURCE_FILES main.cpp)
# find_package(SQLite3) # This is used when building against the system library target_link_libraries below
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/lists) ${CMAKE_CURRENT_SOURCE_DIR}/lists)
add_executable(${PROJECT_NAME} src/main.cpp) add_executable(${PROJECT_NAME} src/main.cpp)
# target_link_libraries(${PROJECT_NAME} SQLite::SQLite3) # This targets the system sqlite3
add_subdirectory(lib) add_subdirectory(lib) #This will build the sqlite3 lib from source

View File

@ -10,17 +10,17 @@
#include <sqlite3.h> #include <sqlite3.h>
// Begin testing of SQLite3 // Begin testing of SQLite3
// static int createDB(const char* s); static int createDB(const char* s);
// static int createTable(const char* s); static int createTable(const char* s);
int main() { int main() {
// const char* dbfile = "hardware.db"; const char* dir = "hardware.db";
// sqlite3* hardwareDB; sqlite3* hardwareDB;
// createDB(dbfile); createDB(dir);
// createTable(dbfile); // createTable(dir);
@ -50,3 +50,16 @@ int main() {
system("sleep 1s"); system("sleep 1s");
return 0; return 0;
} }
static int createDB(const char* s) {
sqlite3* hardwareDB;
int exit = 0;
exit = sqlite3_open(s, &hardwareDB);
sqlite3_close(hardwareDB);
return 0;
}