mirror of
https://github.com/pocoproject/poco.git
synced 2025-02-21 06:37:42 +01:00
removed ODBCStatementImpl stored procedure hack
renamed TypeInfo::getSafeInfo to tryGetInfo
This commit is contained in:
parent
f7301dac98
commit
93c6bb0725
@ -129,7 +129,7 @@ private:
|
||||
void clear();
|
||||
/// Closes the cursor and resets indicator variables.
|
||||
|
||||
void doBind(bool clear = true, bool reset = false);
|
||||
void doBind();
|
||||
/// Binds parameters.
|
||||
|
||||
void makeInternalExtractors();
|
||||
|
@ -110,9 +110,9 @@ public:
|
||||
DynamicAny getInfo(SQLSMALLINT type, const std::string& param) const;
|
||||
/// Returns information about specified data type as specified by parameter 'type'.
|
||||
/// The requested information is specified by parameter 'param'.
|
||||
/// Will fail with a Poco::NotFoundException if the param is not found
|
||||
/// Will fail with a Poco::NotFoundException thrown if the param is not found
|
||||
|
||||
bool getSafeInfo(SQLSMALLINT type, const std::string& param, DynamicAny& result) const;
|
||||
bool tryGetInfo(SQLSMALLINT type, const std::string& param, DynamicAny& result) const;
|
||||
/// Returns information about specified data type as specified by parameter 'type' in param result.
|
||||
/// The requested information is specified by parameter 'param'.
|
||||
/// Will return false if the param is not found. The value of result will be not changed in this case.
|
||||
|
@ -439,10 +439,9 @@ void Binder::getColSizeAndPrecision(std::size_t pos,
|
||||
bool found(false);
|
||||
if (_pTypeInfo)
|
||||
{
|
||||
found = _pTypeInfo->getSafeInfo(cDataType, "COLUMN_SIZE", tmp);
|
||||
if (found)
|
||||
colSize = tmp;
|
||||
found = _pTypeInfo->getSafeInfo(cDataType, "MINIMUM_SCALE", tmp);
|
||||
found = _pTypeInfo->tryGetInfo(cDataType, "COLUMN_SIZE", tmp);
|
||||
if (found) colSize = tmp;
|
||||
found = _pTypeInfo->tryGetInfo(cDataType, "MINIMUM_SCALE", tmp);
|
||||
if (found)
|
||||
{
|
||||
decDigits = tmp;
|
||||
|
@ -110,13 +110,6 @@ void ODBCStatementImpl::compileImpl()
|
||||
|
||||
_pBinder = new Binder(_stmt, maxFieldSize, bind, pDT);
|
||||
|
||||
// This is a hack to conform to some ODBC drivers behavior (e.g. MS SQLServer) with
|
||||
// stored procedure calls: driver refuses to report the number of columns, unless all
|
||||
// parameters for the stored procedure are bound. Since number of columns is essential
|
||||
// information for the internal extraction creation, in order to allow for querying it,
|
||||
// these calls must occur before.
|
||||
fixupBinding(); doBind(false, true);
|
||||
|
||||
makeInternalExtractors();
|
||||
doPrepare();
|
||||
|
||||
@ -207,9 +200,9 @@ bool ODBCStatementImpl::canBind() const
|
||||
}
|
||||
|
||||
|
||||
void ODBCStatementImpl::doBind(bool clear, bool reset)
|
||||
void ODBCStatementImpl::doBind()
|
||||
{
|
||||
if (clear) this->clear();
|
||||
this->clear();
|
||||
Bindings& binds = bindings();
|
||||
if (!binds.empty())
|
||||
{
|
||||
@ -219,12 +212,6 @@ void ODBCStatementImpl::doBind(bool clear, bool reset)
|
||||
if (it != itEnd && 0 == _affectedRowCount)
|
||||
_affectedRowCount = static_cast<Poco::UInt32>((*it)->numOfRowsHandled());
|
||||
|
||||
if (reset)
|
||||
{
|
||||
it = binds.begin();
|
||||
for (; it != itEnd; ++it) (*it)->reset();
|
||||
}
|
||||
|
||||
for (std::size_t pos = 0; it != itEnd && (*it)->canBind(); ++it)
|
||||
{
|
||||
(*it)->bind(pos);
|
||||
|
@ -202,7 +202,7 @@ DynamicAny TypeInfo::getInfo(SQLSMALLINT type, const std::string& param) const
|
||||
}
|
||||
|
||||
|
||||
bool TypeInfo::getSafeInfo(SQLSMALLINT type, const std::string& param, DynamicAny& result) const
|
||||
bool TypeInfo::tryGetInfo(SQLSMALLINT type, const std::string& param, DynamicAny& result) const
|
||||
{
|
||||
TypeInfoVec::const_iterator it = _typeInfo.begin();
|
||||
TypeInfoVec::const_iterator end = _typeInfo.end();
|
||||
|
Loading…
x
Reference in New Issue
Block a user