Hello. I am trying to wrap C++ class over sqlite API. The idea is to keep sqlite3* into smart pointer. Unfortunately sqlite3_open function does not guarantee strong error safety. One needs call sqlite3_close even if sqlite3_open has failed.
While exploring sqlite documentation and sources I have got the following discrepancy: In documentation: int sqlite3_close(sqlite3*); Call this function with a pointer to a structure that was previously returned from sqlite3_open() or sqlite3_open16() and the corresponding database will by closed. SQLITE_OK is returned if the close is successful. If there are prepared statements that have not been finalized, then SQLITE_BUSY is returned. SQLITE_ERROR might be returned if the argument is not a valid connection pointer returned by sqlite3_open() or if the connection pointer has been closed previously. In source: int sqlite3_close(sqlite3 *db){ HashElem *i; int j; if( !db ){ return SQLITE_OK; } ... So, It seem that NULL is valid connection pointer or close of NULL pointer is always successful. It would be nice if documentation declares/guarantees sqlite3_close behavior in NULL pointer case. Anton Pak