Tag: cws_src680_codecleanup01 User: mt Date: 06/04/09 22:41:30 Modified: /dba/connectivity/source/drivers/odbc/ OConnection.cxx
Log: RESYNC: (1.32-1.35); FILE MERGED File Changes: Directory: /dba/connectivity/source/drivers/odbc/ ================================================= File [changed]: OConnection.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/odbc/OConnection.cxx?r1=1.31.72.2&r2=1.31.72.3 Delta lines: +79 -24 --------------------- --- OConnection.cxx 5 Oct 2005 20:57:17 -0000 1.31.72.2 +++ OConnection.cxx 10 Apr 2006 05:41:28 -0000 1.31.72.3 @@ -44,9 +44,6 @@ #ifndef _CONNECTIVITY_RESOURCE_HRC_ #include "Resource.hrc" #endif -#ifndef _CONNECTIVITY_MODULECONTEXT_HXX_ -#include "ModuleContext.hxx" -#endif #ifndef _CONNECTIVITY_ODBC_OFUNCTIONS_HXX_ #include "odbc/OFunctions.hxx" #endif @@ -71,6 +68,9 @@ #ifndef _DBHELPER_DBCHARSET_HXX_ #include <connectivity/dbcharset.hxx> #endif +#ifndef _CONNECTIVITY_FILE_VALUE_HXX_ +#include <connectivity/FValue.hxx> +#endif #ifndef _COMPHELPER_EXTRACT_HXX_ #include <comphelper/extract.hxx> #endif @@ -96,9 +96,9 @@ ,m_nStatementCount(0) ,m_bParameterSubstitution(sal_False) ,m_bIgnoreDriverPrivileges(sal_False) + ,m_bPreventGetVersionColumns(sal_False) { m_pDriver->acquire(); - ModuleContext::AddRef(); } //----------------------------------------------------------------------------- OConnection::~OConnection() @@ -112,7 +112,6 @@ m_pDriver->release(); m_pDriver = NULL; - ModuleContext::ReleaseRef(); } //----------------------------------------------------------------------------- void SAL_CALL OConnection::release() throw() @@ -230,6 +229,7 @@ const char* pCharSet = "CharSet"; const char* pParaName = "ParameterNameSubstitution"; const char* pPrivName = "IgnoreDriverPrivileges"; + const char* pVerColName = "PreventGetVersionColumns"; // #i60273# const char* pRetrieving = "IsAutoRetrievingEnabled"; const char* pRetriStmt = "AutoRetrievingStatement"; @@ -245,6 +245,8 @@ pBegin->Value >>= bSilent; else if(!pBegin->Name.compareToAscii(pPrivName)) pBegin->Value >>= m_bIgnoreDriverPrivileges; + else if(!pBegin->Name.compareToAscii(pVerColName)) + pBegin->Value >>= m_bPreventGetVersionColumns; else if(!pBegin->Name.compareToAscii(pParaName)) pBegin->Value >>= m_bParameterSubstitution; else if(!pBegin->Name.compareToAscii(pRetrieving)) @@ -535,29 +537,82 @@ Reference< XRow> xRow(xRs,UNO_QUERY); // Information for a single SQL type + ::connectivity::ORowSetValue aValue; + ::std::vector<sal_Int32> aTypes; + Reference<XResultSetMetaData> xResultSetMetaData = Reference<XResultSetMetaDataSupplier>(xRs,UNO_QUERY)->getMetaData(); // Loop on the result set until we reach end of file - while (xRs->next ()) { OTypeInfo aInfo; - aInfo.aTypeName = xRow->getString (1); - aInfo.nType = xRow->getShort (2); - aInfo.nPrecision = xRow->getInt (3); - aInfo.aLiteralPrefix = xRow->getString (4); - aInfo.aLiteralSuffix = xRow->getString (5); - aInfo.aCreateParams = xRow->getString (6); - aInfo.bNullable = xRow->getBoolean (7) == ColumnValue::NULLABLE; - aInfo.bCaseSensitive = xRow->getBoolean (8); - aInfo.nSearchType = xRow->getShort (9); - aInfo.bUnsigned = xRow->getBoolean (10); - aInfo.bCurrency = xRow->getBoolean (11); - aInfo.bAutoIncrement = xRow->getBoolean (12); - aInfo.aLocalTypeName = xRow->getString (13); - aInfo.nMinimumScale = xRow->getShort (14); - aInfo.nMaximumScale = xRow->getShort (15); - aInfo.nNumPrecRadix = (sal_Int16)xRow->getInt(18); - - + sal_Int32 nPos = 1; + if ( aTypes.empty() ) + { + sal_Int32 nCount = xResultSetMetaData->getColumnCount(); + if ( nCount < 1 ) + nCount = 18; + aTypes.reserve(nCount+1); + aTypes.push_back(-1); + for (sal_Int32 j = 1; j <= nCount ; ++j) + aTypes.push_back(xResultSetMetaData->getColumnType(j)); + } + + aValue.fill(nPos,aTypes[nPos],xRow); + aInfo.aTypeName = aValue; + ++nPos; + aValue.fill(nPos,aTypes[nPos],xRow); + aInfo.nType = aValue; + ++nPos; + aValue.fill(nPos,aTypes[nPos],xRow); + aInfo.nPrecision = aValue; + ++nPos; + aValue.fill(nPos,aTypes[nPos],xRow); + aInfo.aLiteralPrefix = aValue; + ++nPos; + aValue.fill(nPos,aTypes[nPos],xRow); + aInfo.aLiteralSuffix = aValue; + ++nPos; + aValue.fill(nPos,aTypes[nPos],xRow); + aInfo.aCreateParams = aValue; + ++nPos; + aValue.fill(nPos,aTypes[nPos],xRow); + aInfo.bNullable = (sal_Int32)aValue == ColumnValue::NULLABLE; + ++nPos; + aValue.fill(nPos,aTypes[nPos],xRow); + aInfo.bCaseSensitive = aValue; + ++nPos; + aValue.fill(nPos,aTypes[nPos],xRow); + aInfo.nSearchType = aValue; + ++nPos; + aValue.fill(nPos,aTypes[nPos],xRow); + aInfo.bUnsigned = aValue; + ++nPos; + aValue.fill(nPos,aTypes[nPos],xRow); + aInfo.bCurrency = aValue; + ++nPos; + aValue.fill(nPos,aTypes[nPos],xRow); + aInfo.bAutoIncrement = aValue; + ++nPos; + aValue.fill(nPos,aTypes[nPos],xRow); + aInfo.aLocalTypeName = aValue; + ++nPos; + aValue.fill(nPos,aTypes[nPos],xRow); + aInfo.nMinimumScale = aValue; + ++nPos; + aValue.fill(nPos,aTypes[nPos],xRow); + aInfo.nMaximumScale = aValue; + nPos = 18; + aValue.fill(nPos,aTypes[nPos],xRow); + aInfo.nNumPrecRadix = aValue; + + // check if values are less than zero like it happens in a oracle jdbc driver + if( aInfo.nPrecision < 0) + aInfo.nPrecision = 0; + if( aInfo.nMinimumScale < 0) + aInfo.nMinimumScale = 0; + if( aInfo.nMaximumScale < 0) + aInfo.nMaximumScale = 0; + if( aInfo.nNumPrecRadix < 0) + aInfo.nNumPrecRadix = 10; // Now that we have the type info, save it // in the Hashtable if we don't already have an --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
