mirror of
https://github.com/cuberite/SQLiteCpp.git
synced 2025-08-04 09:46:02 -04:00
Simplifing the README, updating TODO and adding info to the concurrence list
This commit is contained in:
parent
da95147cfa
commit
cc08116ccb
51
README.md
51
README.md
@ -45,41 +45,32 @@ in your project code base (not the main.cpp example file).
|
|||||||
Tot get started, look at the provided examples in main.cpp, starting by :
|
Tot get started, look at the provided examples in main.cpp, starting by :
|
||||||
|
|
||||||
```C++
|
```C++
|
||||||
int main (void)
|
try
|
||||||
{
|
{
|
||||||
try
|
// Open a database file
|
||||||
|
SQLite::Database db("example.db3");
|
||||||
|
|
||||||
|
// Compile a SQL query, containing one parameter (index 1)
|
||||||
|
SQLite::Statement query(db, "SELECT * FROM test WHERE size > ?");
|
||||||
|
|
||||||
|
// Bind the integer value 6 to the first parameter of the SQL query
|
||||||
|
query.bind(1, 6);
|
||||||
|
|
||||||
|
// Loop to execute the query step by step, to get rows of result
|
||||||
|
while (query.executeStep())
|
||||||
{
|
{
|
||||||
// Open a database file
|
// Demonstrate how to get some typed column value
|
||||||
SQLite::Database db("example.db3");
|
int id = query.getColumn(0);
|
||||||
std::cout << "database file opened successfully\n";
|
std::string value = query.getColumn(1);
|
||||||
|
int size = query.getColumn(2);
|
||||||
|
|
||||||
// Compile a SQL query, containing one parameter (index 1)
|
std::cout << "row: " << id << ", " << value << ", " << size << std::endl;
|
||||||
SQLite::Statement query(db, "SELECT * FROM test WHERE size > ?");
|
|
||||||
std::cout << "statement: " << query.getQuery().c_str()
|
|
||||||
<< " compiled (" << query.getColumnCount () << " columns)\n";
|
|
||||||
|
|
||||||
// Bind the integer value 6 to the first parameter of the SQL query
|
|
||||||
query.bind(1, 6);
|
|
||||||
|
|
||||||
// Loop to execute the query step by step, to get rows of result
|
|
||||||
while (query.executeStep())
|
|
||||||
{
|
|
||||||
// Demonstrate how to get some typed column value
|
|
||||||
int id = query.getColumn(0);
|
|
||||||
std::string value = query.getColumn(1);
|
|
||||||
int size = query.getColumn(2);
|
|
||||||
|
|
||||||
std::cout << "row: " << id << ", " << value << ", " << size << "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset the query to use it again later
|
|
||||||
query.reset();
|
|
||||||
}
|
|
||||||
catch (std::exception& e)
|
|
||||||
{
|
|
||||||
std::cout << "exception: " << e.what() << std::endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (std::exception& e)
|
||||||
|
{
|
||||||
|
std::cout << "exception: " << e.what() << std::endl;
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
For other simple C++ SQLite wrappers look also at:
|
For other simple C++ SQLite wrappers look also at:
|
||||||
|
7
TODO.txt
7
TODO.txt
@ -1,15 +1,18 @@
|
|||||||
Add a comparison of others C++ wrappers (code style, C++ design, in code documentation, tests, online documentation, examples, license, UTF-16)
|
Add a comparison of others C++ wrappers (code style, C++ design, in code documentation, tests, online documentation, examples, license, UTF-16)
|
||||||
|
|
||||||
Missing features :
|
Missing features :
|
||||||
- BindNULL
|
- Bind(Name)
|
||||||
- LastInsertId
|
- LastInsertId
|
||||||
- TableExists
|
|
||||||
- SetBusyTimout
|
- SetBusyTimout
|
||||||
- getColumnByName ? std::map getRow() ?
|
- getColumnByName ? std::map getRow() ?
|
||||||
- operator<< binding ?
|
- operator<< binding ?
|
||||||
- execScalar() easy wrapper like CppSqlite
|
- execScalar() easy wrapper like CppSqlite
|
||||||
|
- TableExists
|
||||||
- batch mode managing multiple queries semicolon separated
|
- batch mode managing multiple queries semicolon separated
|
||||||
|
|
||||||
|
- Function ?
|
||||||
|
- Agregate ?
|
||||||
|
|
||||||
Add a full test suite
|
Add a full test suite
|
||||||
|
|
||||||
Add optionnal usage of experimental sqlite3_trace() function to enable statistics
|
Add optionnal usage of experimental sqlite3_trace() function to enable statistics
|
||||||
|
45
wrappers.md
45
wrappers.md
@ -3,13 +3,13 @@ http://stackoverflow.com/questions/120295/what-is-a-good-oo-c-wrapper-for-sqlite
|
|||||||
http://stackoverflow.com/questions/818155/sqlite-alternatives-for-c
|
http://stackoverflow.com/questions/818155/sqlite-alternatives-for-c
|
||||||
|
|
||||||
|
|
||||||
- **sqlite3pp**: uses boost, MIT License (http://code.google.com/p/sqlite3pp/)
|
|
||||||
- **SQLite++**: uses boost build system, Boost License 1.0 (http://sqlitepp.berlios.de/)
|
- **SQLite++**: uses boost build system, Boost License 1.0 (http://sqlitepp.berlios.de/)
|
||||||
- **CppSQLite**: famous Code Project but old design, BSD License (http://www.codeproject.com/Articles/6343/CppSQLite-C-Wrapper-for-SQLite/)
|
- **CppSQLite**: famous Code Project but old design, BSD License (http://www.codeproject.com/Articles/6343/CppSQLite-C-Wrapper-for-SQLite/)
|
||||||
|
|
||||||
|
|
||||||
**sqlite3cc**:
|
**sqlite3cc**: http://ed.am/dev/sqlite3cc/
|
||||||
- http://ed.am/dev/sqlite3cc (and https://launchpad.net/sqlite3cc)
|
- v0.1
|
||||||
|
- Nov 2009, Jan 2012
|
||||||
- (++) modern design, use RAII => can be a source of inspiration for me
|
- (++) modern design, use RAII => can be a source of inspiration for me
|
||||||
- (++) very well documented, in code and with a very good informal presentation
|
- (++) very well documented, in code and with a very good informal presentation
|
||||||
- (+) is maintained (recent), initial release is 0.1.0, January 2012 (started in 2010)
|
- (+) is maintained (recent), initial release is 0.1.0, January 2012 (started in 2010)
|
||||||
@ -18,20 +18,31 @@ http://stackoverflow.com/questions/818155/sqlite-alternatives-for-c
|
|||||||
- (-) a bit complicated : offer many way to do the same thing where I would prefer a clean choice
|
- (-) a bit complicated : offer many way to do the same thing where I would prefer a clean choice
|
||||||
- (-) thus it does not impose RAII, as it is still possible to open or close a database outside constructor/destructor
|
- (-) thus it does not impose RAII, as it is still possible to open or close a database outside constructor/destructor
|
||||||
- (---) LPGPL : for me, this is a stopper as I would like to be able to use it in commercial products
|
- (---) LPGPL : for me, this is a stopper as I would like to be able to use it in commercial products
|
||||||
|
- bazaar: http://bzr.ed.am/sqlite3cc
|
||||||
|
- bugtracker: personal: trac is still to be installed to http://dev.ed.am/sqlite3cc
|
||||||
|
|
||||||
=> inspiration :
|
=> inspiration :
|
||||||
- bind named parameters,
|
- bind named parameters,
|
||||||
- support for different transaction mode
|
- support for different transaction mode
|
||||||
- comment on returning error code instead of exception that shall not be thrown when exepected (!?)
|
- comment on returning error code instead of exception that shall not be thrown when exepected (!?)
|
||||||
- explain the noncopyable property for RAII design
|
- explain the noncopyable property for RAII design
|
||||||
|
|
||||||
**sqdbcpp**:
|
**sqdbcpp**: http://code.google.com/p/sqdbcpp/
|
||||||
- (++) new BSD license (http://code.google.com/p/sqdbcpp/)
|
- Dec 2009 (no more activity)
|
||||||
- (+) CamelCaps
|
- (++) new BSD license
|
||||||
- (+) STL is the only depandancy
|
- (+) CamelCaps
|
||||||
- (+) RAII design, with some good ideas,
|
- (+) STL is the only depandancy
|
||||||
- (-) but with some unnecessary complexity, and some unused code (RefCount...)
|
- (+) RAII design, with some good ideas,
|
||||||
- (-) UTF-8/UTF-16 : the second is not portable
|
- (-) but with some unnecessary complexity, and some unused code (RefCount...)
|
||||||
- (--) Not documented
|
- (-) UTF-8/UTF-16 : the second is not portable
|
||||||
- (---) Not maintained/not finished : contact author !?
|
- (--) Not documented
|
||||||
|
- (---) Not maintained/not finished : contact author !?
|
||||||
|
- SVN: http://sqdbcpp.googlecode.com/svn/trunk/
|
||||||
|
- bugtracker: GoogleCode: http://code.google.com/p/sqdbcpp/issues/list
|
||||||
|
|
||||||
|
**sqlite3pp**: http://code.google.com/p/sqlite3pp/
|
||||||
|
- Sep 2007 to Mar 2009
|
||||||
|
- (++) MIT License
|
||||||
|
- (+/-) uses boost (some more dependancies...)
|
||||||
|
-
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user