Connected to local sqlite DB
This commit is contained in:
parent
ee4e7f1466
commit
bde8026eca
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
25
src/main.cpp
25
src/main.cpp
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user