41 lines
1.1 KiB
C++
41 lines
1.1 KiB
C++
#include <iostream>
|
|
#include <string>
|
|
#include "headers/3rd-party/sqlite_orm.h"
|
|
|
|
using namespace sqlite_orm;
|
|
|
|
static inline std::string getPath(){
|
|
std::string filePath(__FILE__);
|
|
return filePath.substr( 0, filePath.length() - std::string("main.cpp").length());
|
|
}
|
|
|
|
static const std::string sqlitedb = getPath() + "/sqlite.db3";
|
|
|
|
struct employee{
|
|
int id;
|
|
std::string first_name;
|
|
std::string last_name;
|
|
double salary;
|
|
};
|
|
|
|
auto employees = make_storage("sqlite.db3",
|
|
make_table("Employees",
|
|
make_column("id", &employee::id, autoincrement(), primary_key()),
|
|
make_column("first_name", &employee::first_name),
|
|
make_column("last_name", &employee::last_name),
|
|
make_column("salary", &employee::salary)
|
|
)
|
|
);
|
|
|
|
// class item{
|
|
// public:
|
|
|
|
// private:
|
|
// };
|
|
|
|
int main(){
|
|
employees.sync_schema();
|
|
//std::cout << sqlitedb;
|
|
system("PAUSE");
|
|
return 0;
|
|
} |