|
Boost : |
From: Artyom Beilis (artyom.beilis_at_[hidden])
Date: 2024-11-14 13:36:48
> The Boost formal review of the Boost SQLITE library starts *TODAY*, taking
> place
>
> Documentation: https://klemens.dev/sqlite/
Several questions to the author regarding documentation and API (not a
review yet)
1. Transactions.
I noticed that you call explicitly begin/connit
conn.query("begin transaction;");
...
conn.query("commit;");
Both soci [1] and cppdb [2] and most database wrappers I have seen
provide scopes that allow to commit or rollback
in case of failure/exception. It is something very common and
allowshandling translations in an exception safe way.
Do you provide such a feature?
2 Example
boost::sqlite::row r;
boost::sqlite::query q = conn.query(...)
do
{
auto r = q.current();''
std::cout << r.at(0u).get_text() << " authored " <<
r.at(1u).get_text() << std::endl;
}
while (q.read_next());
What happens when the result is empty? I'd rather expect to see
for(;;) or while loop. How do I check if the result is valid?
How do I manually iterate over the result without an automatic "for" loop.
3. What happens if you do not read the entire result? How do you abort
the query?
As far as I remember if you'll execute another statement when you
hadn't finished you'll get SQLITE_BUSY error
4. Both soci and cppdb have some syntactic sugar to query a single row
- for example when querying something by primary key. Can you do it
without a loop?
5. How do you handle locks/collisions when two processes try to update
the same DB. It is a tricky bit in sqlite - sometimes you need to
wait, sometimes to abort.
I noticed the word "error" appears only once in a tutorial... Please
add documentation on error handling
6. Are objects copyable or only moveable? Please state explicitly
Disclosure: I'm the author of cppdb and contributed to/used in past soci.
Artyom Beilis
1) https://soci.sourceforge.net/doc/master/transactions/
2) http://cppcms.com/sql/cppdb/transaction.html
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk