mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-29 04:17:55 +01:00
- SQL logging channel and archiving strategy
- row formatting refactored - affected row count for insert, delete and update returned from Statement::execute() - internal SQL string formatting capability using Poco::format()
This commit is contained in:
@@ -36,8 +36,8 @@
|
||||
//
|
||||
|
||||
|
||||
#ifndef DataConnectors_SQLite_Binder_INCLUDED
|
||||
#define DataConnectors_SQLite_Binder_INCLUDED
|
||||
#ifndef Data_SQLite_Binder_INCLUDED
|
||||
#define Data_SQLite_Binder_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/SQLite/SQLite.h"
|
||||
@@ -180,15 +180,6 @@ inline void Binder::bind(std::size_t pos, const Poco::UInt64 &val, Direction dir
|
||||
}
|
||||
|
||||
|
||||
#ifndef POCO_LONG_IS_64_BIT
|
||||
inline void Binder::bind(std::size_t pos, const long &val, Direction dir)
|
||||
{
|
||||
long tmp = static_cast<long>(val);
|
||||
bind(pos, tmp, dir);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
inline void Binder::bind(std::size_t pos, const bool &val, Direction dir)
|
||||
{
|
||||
Poco::Int32 tmp = (val ? 1 : 0);
|
||||
@@ -220,4 +211,4 @@ inline void Binder::bind(std::size_t pos, const char* const &pVal, Direction dir
|
||||
} } } // namespace Poco::Data::SQLite
|
||||
|
||||
|
||||
#endif // DataConnectors_SQLite_Binder_INCLUDED
|
||||
#endif // Data_SQLite_Binder_INCLUDED
|
||||
|
||||
@@ -36,8 +36,8 @@
|
||||
//
|
||||
|
||||
|
||||
#ifndef DataConnectors_SQLite_Connector_INCLUDED
|
||||
#define DataConnectors_SQLite_Connector_INCLUDED
|
||||
#ifndef Data_SQLite_Connector_INCLUDED
|
||||
#define Data_SQLite_Connector_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/SQLite/SQLite.h"
|
||||
@@ -60,7 +60,10 @@ public:
|
||||
/// Creates the Connector.
|
||||
|
||||
~Connector();
|
||||
/// Destroys the Connector.
|
||||
/// Destroys the Connector.
|
||||
|
||||
const std::string& name() const;
|
||||
/// Returns the name associated with this connector.
|
||||
|
||||
Poco::AutoPtr<Poco::Data::SessionImpl> createSession(const std::string& connectionString);
|
||||
/// Creates a SQLite SessionImpl object and initializes it with the given connectionString.
|
||||
@@ -73,7 +76,16 @@ public:
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// inlines
|
||||
///
|
||||
inline const std::string& Connector::name() const
|
||||
{
|
||||
return KEY;
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::SQLite
|
||||
|
||||
|
||||
#endif // DataConnectors_SQLite_Connector_INCLUDED
|
||||
#endif // Data_SQLite_Connector_INCLUDED
|
||||
|
||||
@@ -36,8 +36,8 @@
|
||||
//
|
||||
|
||||
|
||||
#ifndef DataConnectors_SQLite_Extractor_INCLUDED
|
||||
#define DataConnectors_SQLite_Extractor_INCLUDED
|
||||
#ifndef Data_SQLite_Extractor_INCLUDED
|
||||
#define Data_SQLite_Extractor_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/SQLite/SQLite.h"
|
||||
@@ -301,4 +301,4 @@ inline void Extractor::reset()
|
||||
} } } // namespace Poco::Data::SQLite
|
||||
|
||||
|
||||
#endif // DataConnectors_SQLite_Extractor_INCLUDED
|
||||
#endif // Data_SQLite_Extractor_INCLUDED
|
||||
|
||||
@@ -36,8 +36,8 @@
|
||||
//
|
||||
|
||||
|
||||
#ifndef DataConnectors_SQLite_SQLiteStatementImpl_INCLUDED
|
||||
#define DataConnectors_SQLite_SQLiteStatementImpl_INCLUDED
|
||||
#ifndef Data_SQLite_SQLiteStatementImpl_INCLUDED
|
||||
#define Data_SQLite_SQLiteStatementImpl_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/SQLite/SQLite.h"
|
||||
@@ -71,6 +71,17 @@ protected:
|
||||
Poco::UInt32 columnsReturned() const;
|
||||
/// Returns number of columns returned by query.
|
||||
|
||||
Poco::UInt32 affectedRowCount() const;
|
||||
/// Returns the number of affected rows.
|
||||
/// Used to find out the number of rows affected by insert, delete or update.
|
||||
/// All changes are counted, even if they are later undone by a ROLLBACK or ABORT.
|
||||
/// Changes associated with creating and dropping tables are not counted.
|
||||
/// SQLite implements the command "DELETE FROM table" without a WHERE clause by
|
||||
/// dropping and recreating the table. Because of this optimization, the change count
|
||||
/// for "DELETE FROM table" will be zero regardless of the number of elements that
|
||||
/// were originally in the table. To get an accurate count of the number of rows deleted,
|
||||
/// use "DELETE FROM table WHERE 1".
|
||||
|
||||
const MetaColumn& metaColumn(Poco::UInt32 pos) const;
|
||||
/// Returns column meta data.
|
||||
|
||||
@@ -100,16 +111,20 @@ private:
|
||||
void clear();
|
||||
/// Removes the _pStmt
|
||||
|
||||
typedef Poco::Data::AbstractBindingVec Bindings;
|
||||
typedef Poco::Data::AbstractExtractionVec Extractions;
|
||||
typedef Poco::SharedPtr<Binder> BinderPtr;
|
||||
typedef Poco::SharedPtr<Extractor> ExtractorPtr;
|
||||
typedef Poco::Data::AbstractBindingVec Bindings;
|
||||
typedef Poco::Data::AbstractExtractionVec Extractions;
|
||||
typedef std::vector<Poco::Data::MetaColumn> MetaColumnVec;
|
||||
|
||||
sqlite3* _pDB;
|
||||
sqlite3_stmt* _pStmt;
|
||||
bool _stepCalled;
|
||||
int _nextResponse;
|
||||
Poco::SharedPtr<Binder> _pBinder;
|
||||
Poco::SharedPtr<Extractor> _pExtractor;
|
||||
std::vector<Poco::Data::MetaColumn> _columns;
|
||||
BinderPtr _pBinder;
|
||||
ExtractorPtr _pExtractor;
|
||||
MetaColumnVec _columns;
|
||||
Poco::UInt32 _affectedRowCount;
|
||||
};
|
||||
|
||||
|
||||
@@ -131,4 +146,4 @@ inline AbstractBinder& SQLiteStatementImpl::binder()
|
||||
} } } // namespace Poco::Data::SQLite
|
||||
|
||||
|
||||
#endif // DataConnectors_SQLite_SQLiteStatementImpl_INCLUDED
|
||||
#endif // Data_SQLite_SQLiteStatementImpl_INCLUDED
|
||||
|
||||
@@ -36,8 +36,8 @@
|
||||
//
|
||||
|
||||
|
||||
#ifndef DataConnectors_SQLite_SessionImpl_INCLUDED
|
||||
#define DataConnectors_SQLite_SessionImpl_INCLUDED
|
||||
#ifndef Data_SQLite_SessionImpl_INCLUDED
|
||||
#define Data_SQLite_SessionImpl_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/SQLite/SQLite.h"
|
||||
@@ -113,4 +113,4 @@ inline bool SessionImpl::isTransaction()
|
||||
} } } // namespace Poco::Data::SQLite
|
||||
|
||||
|
||||
#endif // DataConnectors_SQLite_SessionImpl_INCLUDED
|
||||
#endif // Data_SQLite_SessionImpl_INCLUDED
|
||||
|
||||
Reference in New Issue
Block a user