MyGit

v1.3

fnc12/sqlite_orm

版本发布时间: 2019-08-12 05:44:44

fnc12/sqlite_orm最新发布版本:v1.9(2024-08-24 10:26:18)

⭐ Complex subqueries
SELECT cust_code, cust_name, cust_city, grade
FROM customer
WHERE grade=2 AND EXISTS
    (SELECT COUNT(*)
    FROM customer
    WHERE grade=2
    GROUP BY grade
    HAVING COUNT(*)>2);

now can be called with this way:

auto rows = storage.select(columns(&Customer::code, &Customer::name, &Customer::city, &Customer::grade),
                                   where(is_equal(&Customer::grade, 2)
                                         and exists(select(count<Customer>(),
                                                           where(is_equal(&Customer::grade, 2)),
                                                           group_by(&Customer::grade),
                                                           having(greater_than(count(), 2))))));
⭐ EXCEPT and INTERSECT

All compound operators now are available:

SELECT dept_id
FROM dept_master
EXCEPT
SELECT dept_id
FROM emp_master

is just

auto rows = storage.select(except(select(&DeptMaster::deptId),
                                          select(&EmpMaster::deptId)));

and

SELECT dept_id
FROM dept_master
INTERSECT
SELECT dept_id
FROM emp_master

is just

auto rows = storage.select(intersect(select(&DeptMaster::deptId),
                                             select(&EmpMaster::deptId)));
🚀 added simple arithmetic types biding to WHERE conditions
bool myFilterIsOn = getMyFilterValue();
auto values = storage.get_all<User>(where(!myFilterIsOn and like(&User::name, "Adele%")));

相关地址:原始地址 下载(tar) 下载(zip)

1、 sqlite_orm.h 358.09KB

查看:2019-08-12发行的版本