Demonstrate use() in the examples on the landing page

While using ints is safe from the point of view of SQL injection, it's
still not a great example, so use parameters instead of building the SQL
query by simple string concatenation.
This commit is contained in:
Vadim Zeitlin
2026-01-15 15:20:37 +01:00
parent dc6afb6f65
commit 82ab3b3245
+3 -3
View File
@@ -15,8 +15,8 @@ int id = ...;
std::string name;
int salary;
sql << "select name, salary from persons where id = " << id,
into(name), into(salary);
sql << "select name, salary from persons where id = :id",
use(id), into(name), into(salary);
```
## Basic ORM
@@ -28,7 +28,7 @@ int id = ...;
Person p;
sql << "select first_name, last_name, date_of_birth "
"from persons where id = " << id, into(p);
"from persons where id = :id", use(id), into(p);
```
## Integrations