Skip to content

Latest commit

 

History

History
172 lines (128 loc) · 2.05 KB

File metadata and controls

172 lines (128 loc) · 2.05 KB

< Differences

Before and after: Clauses

SELECT

sqlpp11sqlpp23

using flags

// Either
select()
    .flags(sqlpp::all)
    .columns(tab.id)
    .from(tab);
// Or
select(tab.id)
    .flags(sqlpp::all)
    .from(tab);
select(sqlpp::all, tab.id)
    .from(tab);

DELETE FROM

sqlpp11sqlpp23

delete from

remove_from(tab).where(tab.id == 11);
delete_from(tab).where(tab.id == 11);

truncate

remove_from(tab).unconditionally();
truncate(tab);

WITH

sqlpp11sqlpp23

with ... select

const auto a = get_my_cte();

for (const auto& row :
     db(with(a)(select(a.intN).from(a)))) {
  // use row.intN
}
const auto a = get_my_cte();

for (const auto& row :
     db(with(a) << select(a.intN).from(a))) {
  // use row.intN
}

Custom queries

Custom queries can be used to construct statements that the library does not support directly.

sqlpp11sqlpp23

select ... into

custom_query(select(all_of(foo)).from(foo),
             into(bar))
    .with_result_type_of(insert_into(bar));
select(all_of(t)).from(t)
    << into(f)
    << with_result_type_of(insert_into(f));

< Differences