Skip to content

Commit

Permalink
Runner-up: Conformance fallback for NSMDI
Browse files Browse the repository at this point in the history
Amends commit 7bb1a39
  • Loading branch information
trueqbit committed Jan 24, 2023
1 parent 785868c commit a4c4e6b
Show file tree
Hide file tree
Showing 12 changed files with 130 additions and 1 deletion.
10 changes: 10 additions & 0 deletions examples/blob_binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ struct Rect {
int y = 0;
int width = 0;
int height = 0;

#ifndef SQLITE_ORM_AGGREGATE_NSDMI_SUPPORTED
Rect() = default;
Rect(int x, int y, int width, int height) : x{x}, y{y}, width{width}, height{height} {}
#endif
};

bool operator==(const Rect& lhs, const Rect& rhs) {
Expand All @@ -24,6 +29,11 @@ bool operator==(const Rect& lhs, const Rect& rhs) {
struct Zone {
int id = 0;
Rect rect; // this member will be mapped as BLOB column

#ifndef SQLITE_ORM_AGGREGATE_NSDMI_SUPPORTED
Zone() = default;
Zone(int id, Rect rect) : id{id}, rect{rect} {}
#endif
};

bool operator==(const Zone& lhs, const Zone& rhs) {
Expand Down
6 changes: 6 additions & 0 deletions examples/case.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ int main() {
std::string name;
std::string email;
float marks = 0;

#ifndef SQLITE_ORM_AGGREGATE_NSDMI_SUPPORTED
Student() {}
Student(int id, std::string name, std::string email, float marks) :
id{id}, name{move(name)}, email{move(email)}, marks{marks} {}
#endif
};

auto storage = make_storage({},
Expand Down
12 changes: 12 additions & 0 deletions examples/check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,25 @@ int main() {
std::string lastName;
std::string email;
std::string phone;

#ifndef SQLITE_ORM_AGGREGATE_NSDMI_SUPPORTED
Contact() {}
Contact(int id, std::string firstName, std::string lastName, std::string email, std::string phone) :
id{id}, firstName{move(firstName)}, lastName{move(lastName)}, email{move(email)}, phone{move(phone)} {}
#endif
};

struct Product {
int id = 0;
std::string name;
float listPrice = 0;
float discount = 0;

#ifndef SQLITE_ORM_AGGREGATE_NSDMI_SUPPORTED
Product() {}
Product(int id, std::string name, float listPrice, float discount) :
id{id}, name{move(name)}, listPrice{listPrice}, discount{discount} {}
#endif
};

auto storage = make_storage(":memory:",
Expand Down
6 changes: 6 additions & 0 deletions examples/column_aliases.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ void marvel_hero_ordered_by_o_pos() {
std::string name;
std::string abilities;
short points = 0;

#ifndef SQLITE_ORM_AGGREGATE_NSDMI_SUPPORTED
MarvelHero() {}
MarvelHero(int id, std::string name, std::string abilities, short points) :
id{id}, name{move(name)}, abilities{move(abilities)}, points{points} {}
#endif
};

auto storage = make_storage("",
Expand Down
33 changes: 33 additions & 0 deletions examples/core_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,25 @@ struct MarvelHero {
std::string name;
std::string abilities;
short points = 0;

#ifndef SQLITE_ORM_AGGREGATE_NSDMI_SUPPORTED
MarvelHero() {}
MarvelHero(int id, std::string name, std::string abilities, short points) :
id{id}, name{move(name)}, abilities{move(abilities)}, points{points} {}
#endif
};

struct Contact {
int id = 0;
std::string firstName;
std::string lastName;
std::string phone;

#ifndef SQLITE_ORM_AGGREGATE_NSDMI_SUPPORTED
Contact() {}
Contact(int id, std::string firstName, std::string lastName, std::string phone) :
id{id}, firstName{move(firstName)}, lastName{move(lastName)}, phone{move(phone)} {}
#endif
};

struct Customer {
Expand All @@ -33,6 +45,27 @@ struct Customer {
std::unique_ptr<std::string> fax;
std::string email;
int supportRepId = 0;

#ifndef SQLITE_ORM_AGGREGATE_NSDMI_SUPPORTED
Customer() {}
Customer(int id,
std::string firstName,
std::string lastName,
std::string company,
std::string address,
std::string city,
std::string state,
std::string country,
std::string postalCode,
std::string phone,
std::unique_ptr<std::string> fax,
std::string email,
int supportRepId) :
id{id},
firstName{move(firstName)}, lastName{move(lastName)}, company{move(company)}, address{move(address)},
city{move(city)}, state{move(state)}, country{move(country)}, postalCode{move(postalCode)}, phone{move(phone)},
fax{move(fax)}, email{move(email)}, supportRepId{supportRepId} {}
#endif
};

int main(int, char** argv) {
Expand Down
11 changes: 11 additions & 0 deletions examples/custom_aliases.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,23 @@ struct Employee {
int age = 0;
std::string address;
float salary = 0;

#ifndef SQLITE_ORM_AGGREGATE_NSDMI_SUPPORTED
Employee() {}
Employee(int id, std::string name, int age, std::string address, float salary) :
id{id}, name{move(name)}, age{age}, address{move(address)}, salary{salary} {}
#endif
};

struct Department {
int id = 0;
std::string dept;
int empId = 0;

#ifndef SQLITE_ORM_AGGREGATE_NSDMI_SUPPORTED
Department() {}
Department(int id, std::string dept, int empId) : id{id}, dept{move(dept)}, empId{empId} {}
#endif
};

using namespace sqlite_orm;
Expand Down
16 changes: 16 additions & 0 deletions examples/except_intersection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ using std::endl;
struct DeptMaster {
int deptId = 0;
std::string deptName;

#ifndef SQLITE_ORM_AGGREGATE_NSDMI_SUPPORTED
DeptMaster() = default;
DeptMaster(int deptId, std::string deptName) : deptId{deptId}, deptName{move(deptName)} {}
#endif
};

struct EmpMaster {
Expand All @@ -19,6 +24,17 @@ struct EmpMaster {
std::string lastName;
long salary;
decltype(DeptMaster::deptId) deptId;

#ifndef SQLITE_ORM_AGGREGATE_NSDMI_SUPPORTED
EmpMaster() = default;
EmpMaster(int empId,
std::string firstName,
std::string lastName,
long salary,
decltype(DeptMaster::deptId) deptId) :
empId{empId},
firstName{move(firstName)}, lastName{move(lastName)}, salary{salary}, deptId{deptId} {}
#endif
};

int main() {
Expand Down
6 changes: 6 additions & 0 deletions examples/generated_column.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ int main() {
int quantity = 0;
float price = 0;
float totalValue = 0;

#ifndef SQLITE_ORM_AGGREGATE_NSDMI_SUPPORTED
Product() {}
Product(int id, std::string name, int quantity, float price, float totalValue = 0.f) :
id{id}, name{move(name)}, quantity{quantity}, price{price}, totalValue{totalValue} {}
#endif
};
auto storage = make_storage({},
make_table("products",
Expand Down
18 changes: 18 additions & 0 deletions examples/prepared_statement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,36 @@ struct Doctor {
int doctor_id = 0;
std::string doctor_name;
std::string degree;

#ifndef SQLITE_ORM_AGGREGATE_NSDMI_SUPPORTED
Doctor() = default;
Doctor(int doctor_id, std::string doctor_name, std::string degree) :
doctor_id{doctor_id}, doctor_name{move(doctor_name)}, degree{move(degree)} {}
#endif
};

struct Speciality {
int spl_id = 0;
std::string spl_descrip;
int doctor_id = 0;

#ifndef SQLITE_ORM_AGGREGATE_NSDMI_SUPPORTED
Speciality() = default;
Speciality(int spl_id, std::string spl_descrip, int doctor_id) :
spl_id{spl_id}, spl_descrip{move(spl_descrip)}, doctor_id{doctor_id} {}
#endif
};

struct Visit {
int doctor_id = 0;
std::string patient_name;
std::string vdate;

#ifndef SQLITE_ORM_AGGREGATE_NSDMI_SUPPORTED
Visit() = default;
Visit(int doctor_id, std::string patient_name, std::string vdate) :
doctor_id{doctor_id}, patient_name{move(patient_name)}, vdate{move(vdate)} {}
#endif
};

int main() {
Expand Down
6 changes: 6 additions & 0 deletions examples/triggers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ struct Lead {
std::string lastName;
std::string email;
std::string phone;

#ifndef SQLITE_ORM_AGGREGATE_NSDMI_SUPPORTED
Lead() = default;
Lead(int id, std::string firstName, std::string lastName, std::string email, std::string phone) :
id{id}, firstName{move(firstName)}, lastName{move(lastName)}, email{move(email)}, phone{move(phone)} {}
#endif
};

struct LeadLog {
Expand Down
5 changes: 5 additions & 0 deletions examples/user_defined_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ int main() {
int a = 0;
int b = 0;
int c = 0;

#ifndef SQLITE_ORM_AGGREGATE_NSDMI_SUPPORTED
Table() = default;
Table(int a, int b, int c) : a{a}, b{b}, c{c} {}
#endif
};

auto storage = make_storage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ TEST_CASE("statement_serializer insert/replace") {
int id = 0;
std::string name;

#if !defined(SQLITE_ORM_AGGREGATE_NSDMI_SUPPORTED) || !defined(SQLITE_ORM_AGGREGATE_BASES_SUPPORTED)
#ifndef SQLITE_ORM_AGGREGATE_NSDMI_SUPPORTED
User() = default;
User(int id, std::string name) : id{id}, name{move(name)} {}
#endif
Expand Down

0 comments on commit a4c4e6b

Please sign in to comment.