few tidy-up fixes

This commit is contained in:
Aleksandar Fabijanic
2009-02-13 14:14:16 +00:00
parent a8c39370be
commit b2454e3b83
4 changed files with 51 additions and 33 deletions

View File

@@ -166,7 +166,7 @@ private:
const SQLHDBC& _rConnection; const SQLHDBC& _rConnection;
const StatementHandle _stmt; const StatementHandle _stmt;
PreparatorVec _preparations; PreparatorVec _preparations;
BinderPtr _pBinder; BinderPtr _pBinder;
ExtractorVec _extractors; ExtractorVec _extractors;
bool _stepCalled; bool _stepCalled;

View File

@@ -369,21 +369,25 @@ public:
const std::string& getStorage() const; const std::string& getStorage() const;
/// Returns the internal storage type for the stamement. /// Returns the internal storage type for the stamement.
std::size_t rowsExtracted(int dataSet = -1) const; Poco::UInt32 columnsExtracted(int dataSet = StatementImpl::USE_CURRENT_DATA_SET) const;
/// Returns the number of rows returned for current data set. /// Returns the number of columns returned for current data set.
/// Default value (-1) indicates current data set (if any). /// Default value indicates current data set (if any).
std::size_t extractionCount() const; Poco::UInt32 rowsExtracted(int dataSet = StatementImpl::USE_CURRENT_DATA_SET) const;
/// Returns the number of rows returned for current data set.
/// Default value indicates current data set (if any).
Poco::UInt32 extractionCount() const;
/// Returns the number of extraction storage buffers associated /// Returns the number of extraction storage buffers associated
/// with the current data set. /// with the current data set.
std::size_t dataSetCount() const; Poco::UInt32 dataSetCount() const;
/// Returns the number of data sets associated with the statement. /// Returns the number of data sets associated with the statement.
std::size_t nextDataSet(); Poco::UInt32 nextDataSet();
/// Returns the index of the next data set. /// Returns the index of the next data set.
std::size_t previousDataSet(); Poco::UInt32 previousDataSet();
/// Returns the index of the previous data set. /// Returns the index of the previous data set.
bool hasMoreDataSets() const; bool hasMoreDataSets() const;
@@ -699,31 +703,37 @@ inline void Statement::setStorage(const std::string& storage)
} }
inline std::size_t Statement::extractionCount() const inline Poco::UInt32 Statement::extractionCount() const
{ {
return _pImpl->extractionCount(); return _pImpl->extractionCount();
} }
inline std::size_t Statement::rowsExtracted(int dataSet) const inline Poco::UInt32 Statement::columnsExtracted(int dataSet) const
{
return _pImpl->columnsExtracted(dataSet);
}
inline Poco::UInt32 Statement::rowsExtracted(int dataSet) const
{ {
return _pImpl->rowsExtracted(dataSet); return _pImpl->rowsExtracted(dataSet);
} }
inline std::size_t Statement::dataSetCount() const inline Poco::UInt32 Statement::dataSetCount() const
{ {
return _pImpl->dataSetCount(); return _pImpl->dataSetCount();
} }
inline std::size_t Statement::nextDataSet() inline Poco::UInt32 Statement::nextDataSet()
{ {
return _pImpl->activateNextDataSet(); return _pImpl->activateNextDataSet();
} }
inline std::size_t Statement::previousDataSet() inline Poco::UInt32 Statement::previousDataSet()
{ {
return _pImpl->activatePreviousDataSet(); return _pImpl->activatePreviousDataSet();
} }

View File

@@ -112,6 +112,8 @@ public:
static const std::string LIST; static const std::string LIST;
static const std::string UNKNOWN; static const std::string UNKNOWN;
static const int USE_CURRENT_DATA_SET = -1;
StatementImpl(SessionImpl& rSession); StatementImpl(SessionImpl& rSession);
/// Creates the StatementImpl. /// Creates the StatementImpl.
@@ -162,11 +164,11 @@ public:
Storage getStorage() const; Storage getStorage() const;
/// Returns the storage type for this statement. /// Returns the storage type for this statement.
std::size_t extractionCount() const; Poco::UInt32 extractionCount() const;
/// Returns the number of extraction storage buffers associated /// Returns the number of extraction storage buffers associated
/// with the statement. /// with the statement.
std::size_t dataSetCount() const; Poco::UInt32 dataSetCount() const;
/// Returns the number of data sets associated with the statement. /// Returns the number of data sets associated with the statement.
protected: protected:
@@ -218,12 +220,12 @@ protected:
virtual AbstractBinder& binder() = 0; virtual AbstractBinder& binder() = 0;
/// Returns the concrete binder used by the statement. /// Returns the concrete binder used by the statement.
std::size_t columnsExtracted() const; Poco::UInt32 columnsExtracted(int dataSet = USE_CURRENT_DATA_SET) const;
/// Returns the number of columns that the extractors handle. /// Returns the number of columns that the extractors handle.
std::size_t rowsExtracted(int dataSet = -1) const; Poco::UInt32 rowsExtracted(int dataSet = USE_CURRENT_DATA_SET) const;
/// Returns the number of rows returned for current data set. /// Returns the number of rows extracted for current data set.
/// Default value (-1) indicates current data set (if any). /// Default value (USE_CURRENT_DATA_SET) indicates current data set (if any).
const AbstractBindingVec& bindings() const; const AbstractBindingVec& bindings() const;
/// Returns the bindings. /// Returns the bindings.
@@ -391,7 +393,7 @@ private:
} }
} }
bool isNull(std::size_t col, std::size_t row) const; bool isNull(Poco::UInt32 col, Poco::UInt32 row) const;
/// Returns true if the value in [col, row] is null. /// Returns true if the value in [col, row] is null.
void forbidBulk(); void forbidBulk();
@@ -490,13 +492,6 @@ inline AbstractExtractionVec& StatementImpl::extractions()
} }
inline std::size_t StatementImpl::columnsExtracted() const
{
poco_assert (_curDataSet < _columnsExtracted.size());
return _columnsExtracted[_curDataSet];
}
inline StatementImpl::State StatementImpl::getState() const inline StatementImpl::State StatementImpl::getState() const
{ {
return _state; return _state;
@@ -521,13 +516,13 @@ inline StatementImpl::Storage StatementImpl::getStorage() const
} }
inline std::size_t StatementImpl::extractionCount() const inline Poco::UInt32 StatementImpl::extractionCount() const
{ {
return extractions().size(); return extractions().size();
} }
inline std::size_t StatementImpl::dataSetCount() const inline Poco::UInt32 StatementImpl::dataSetCount() const
{ {
return _extractors.size(); return _extractors.size();
} }
@@ -539,7 +534,7 @@ inline bool StatementImpl::isStoredProcedure() const
} }
inline bool StatementImpl::isNull(std::size_t col, std::size_t row) const inline bool StatementImpl::isNull(Poco::UInt32 col, Poco::UInt32 row) const
{ {
try try
{ {

View File

@@ -394,12 +394,25 @@ void StatementImpl::removeBind(const std::string& name)
} }
std::size_t StatementImpl::rowsExtracted(int dataSet) const Poco::UInt32 StatementImpl::columnsExtracted(int dataSet) const
{ {
if (-1 == dataSet) dataSet = _curDataSet; if (USE_CURRENT_DATA_SET == dataSet) dataSet = _curDataSet;
if (_columnsExtracted.size() > 0)
{
poco_assert (dataSet >= 0 && dataSet < _columnsExtracted.size());
return _columnsExtracted[dataSet];
}
return 0;
}
Poco::UInt32 StatementImpl::rowsExtracted(int dataSet) const
{
if (USE_CURRENT_DATA_SET == dataSet) dataSet = _curDataSet;
if (extractions().size() > 0) if (extractions().size() > 0)
{ {
poco_assert (dataSet >= 0); poco_assert (dataSet >= 0 && dataSet < _extractors.size());
if (_extractors[dataSet].size() > 0) if (_extractors[dataSet].size() > 0)
return _extractors[dataSet][0]->numOfRowsHandled(); return _extractors[dataSet][0]->numOfRowsHandled();
} }