Tag: cws_src680_dba30 User: fs Date: 06/03/21 07:46:41 Modified: /dba/connectivity/source/drivers/odbc/ OConnection.cxx
Log: RESYNC: (1.32-1.34); 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.28.2&r2=1.31.28.3 Delta lines: +79 -19 --------------------- --- OConnection.cxx 28 Sep 2005 12:40:38 -0000 1.31.28.2 +++ OConnection.cxx 21 Mar 2006 15:46:39 -0000 1.31.28.3 @@ -71,6 +71,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,6 +99,7 @@ ,m_nStatementCount(0) ,m_bParameterSubstitution(sal_False) ,m_bIgnoreDriverPrivileges(sal_False) + ,m_bPreventGetVersionColumns(sal_False) { m_pDriver->acquire(); ModuleContext::AddRef(); @@ -232,6 +236,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"; @@ -247,6 +252,8 @@ OSL_VERIFY( pBegin->Value >>= bSilent ); else if(!pBegin->Name.compareToAscii(pPrivName)) OSL_VERIFY( pBegin->Value >>= m_bIgnoreDriverPrivileges ); + else if(!pBegin->Name.compareToAscii(pVerColName)) + OSL_VERIFY( pBegin->Value >>= m_bPreventGetVersionColumnsi ); else if(!pBegin->Name.compareToAscii(pParaName)) OSL_VERIFY( pBegin->Value >>= m_bParameterSubstitution ); else if(!pBegin->Name.compareToAscii(pRetrieving)) @@ -537,29 +544,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]
