diff options
Diffstat (limited to 'connectivity/source/drivers')
305 files changed, 3199 insertions, 3585 deletions
diff --git a/connectivity/source/drivers/adabas/BCatalog.cxx b/connectivity/source/drivers/adabas/BCatalog.cxx index 201c55c8ed..bae14af719 100644 --- a/connectivity/source/drivers/adabas/BCatalog.cxx +++ b/connectivity/source/drivers/adabas/BCatalog.cxx @@ -62,7 +62,6 @@ OAdabasCatalog::OAdabasCatalog(SQLHANDLE _aConnectionHdl, OAdabasConnection* _pC if ( sName.getLength() ) sName += OAdabasCatalog::getDot(); sName += _xRow->getString(3); - return sName; } @@ -158,12 +157,12 @@ void OAdabasCatalog::correctColumnProperties(sal_Int32 /*_nPrec*/, sal_Int32& _r } // else if(_nPrec > 15) // { -// static const ::rtl::OUString sReal = ::rtl::OUString::createFromAscii("REAL"); +// static const ::rtl::OUString sReal( RTL_CONSTASCII_USTRINGPARAM( "REAL" )); // _rsTypeName = sReal; // _rnType = DataType::REAL; // } break; - } + } } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/adabas/BColumns.cxx b/connectivity/source/drivers/adabas/BColumns.cxx index 75fc65208f..aa62a6a4d8 100644 --- a/connectivity/source/drivers/adabas/BColumns.cxx +++ b/connectivity/source/drivers/adabas/BColumns.cxx @@ -43,14 +43,11 @@ #include <comphelper/property.hxx> using namespace ::comphelper; - - using namespace connectivity::adabas; using namespace connectivity::sdbcx; using namespace connectivity; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; -// using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; @@ -74,7 +71,7 @@ sdbcx::ObjectType OColumns::createObject(const ::rtl::OUString& _rName) sal_Int32 nPrec = xRow->getInt(7); OAdabasCatalog::correctColumnProperties(nPrec,nType,sTypeName); sal_Bool bAutoIncrement = sal_False; - if ( !_rName.equalsAscii("DEFAULT") && !m_pTable->getSchema().equalsAscii("DOMAIN") && !m_pTable->getTableName().equalsAscii("COLUMNS") ) + if ( !_rName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("DEFAULT")) && !m_pTable->getSchema().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("DOMAIN")) && !m_pTable->getTableName().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("COLUMNS")) ) { Reference< XStatement > xStmt = m_pTable->getMetaData()->getConnection()->createStatement( ); ::rtl::OUString sQuery(RTL_CONSTASCII_USTRINGPARAM("SELECT \"DEFAULT\" FROM DOMAIN.COLUMNS WHERE OWNER = '")); diff --git a/connectivity/source/drivers/adabas/BConnection.cxx b/connectivity/source/drivers/adabas/BConnection.cxx index d0d76dbf54..9aae67312c 100644 --- a/connectivity/source/drivers/adabas/BConnection.cxx +++ b/connectivity/source/drivers/adabas/BConnection.cxx @@ -112,7 +112,7 @@ SQLRETURN OAdabasConnection::Construct( const ::rtl::OUString& url,const Sequenc m_sUser = aUID; if ( sHostName.getLength() ) - aDSN = sHostName + ':' + aDSN; + aDSN = sHostName + rtl::OUString(static_cast<sal_Unicode>(':')) + aDSN; SQLRETURN nSQLRETURN = openConnectionWithAuth(aDSN,nTimeout, aUID,aPWD); return nSQLRETURN; @@ -141,7 +141,7 @@ SQLRETURN OAdabasConnection::openConnectionWithAuth(const ::rtl::OUString& aConn - N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_LOGIN_TIMEOUT,(SQLPOINTER)nTimeOut,SQL_IS_INTEGER); + N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_LOGIN_TIMEOUT,(SQLPOINTER)(sal_IntPtr)nTimeOut,SQL_IS_INTEGER); // Verbindung aufbauen nSQLRETURN = N3SQLConnect(m_aConnectionHandle, diff --git a/connectivity/source/drivers/adabas/BDatabaseMetaData.cxx b/connectivity/source/drivers/adabas/BDatabaseMetaData.cxx index 115d5f0144..d1a9b96e98 100644 --- a/connectivity/source/drivers/adabas/BDatabaseMetaData.cxx +++ b/connectivity/source/drivers/adabas/BDatabaseMetaData.cxx @@ -35,7 +35,6 @@ using namespace connectivity::adabas; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; -// using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; @@ -131,11 +130,7 @@ Reference< XResultSet > OAdabasDatabaseMetaData::impl_getTypeInfo_throw( ) switch((sal_Int32)aRow[2]->getValue()) { case DataType::FLOAT: -// aRow[3] = sal_Int32(15); -// break; case DataType::REAL: -// aRow[3] = sal_Int32(16); -// break; case DataType::DOUBLE: aRow[2]->setValue(DataType::DOUBLE); aRow[3]->setValue(sal_Int32(18)); diff --git a/connectivity/source/drivers/adabas/BDriver.cxx b/connectivity/source/drivers/adabas/BDriver.cxx index 53268cbfc7..22fc9be753 100644 --- a/connectivity/source/drivers/adabas/BDriver.cxx +++ b/connectivity/source/drivers/adabas/BDriver.cxx @@ -28,6 +28,13 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_connectivity.hxx" + +#ifdef SYSTEM_ODBC_HEADERS +#include <sqltypes.h> +#else +#include <odbc/sqltypes.h> +#endif + #include <unotools/tempfile.hxx> #include <sal/macros.h> #include "adabas/BDriver.hxx" @@ -50,9 +57,7 @@ #include <memory> #include <sys/stat.h> -#if defined(MAC) -const char sNewLine = '\015'; -#elif defined(UNX) +#if defined(UNX) const char sNewLine = '\012'; #else const char sNewLine[] = "\015\012"; // \015\012 and not \n @@ -509,23 +514,23 @@ void SAL_CALL ODriver::dropCatalog( const ::rtl::OUString& /*catalogName*/, cons ::dbtools::throwFeatureNotImplementedException( "!XDropCatalog::dropCatalog", *this ); } //----------------------------------------------------------------------------- -// ODBC Environment (gemeinsam fuer alle Connections): +// ODBC Environment (common for all Connections): SQLHANDLE ODriver::EnvironmentHandle(::rtl::OUString &_rPath) { - // Ist (fuer diese Instanz) bereits ein Environment erzeugt worden? + // Has an Environment already been created (for this Instance)? if (!m_pDriverHandle) { SQLHANDLE h = SQL_NULL_HANDLE; - // Environment allozieren + // allocate Environment - // ODBC-DLL jetzt laden: + // load ODBC-DLL now: if (! LoadLibrary_ADABAS(_rPath)) return SQL_NULL_HANDLE; if (N3SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&h) != SQL_SUCCESS) return SQL_NULL_HANDLE; - // In globaler Struktur merken ... + // Save in global Structure... m_pDriverHandle = h; SQLRETURN nError = N3SQLSetEnvAttr(h, SQL_ATTR_ODBC_VERSION,(SQLPOINTER) SQL_OV_ODBC3, SQL_IS_INTEGER); OSL_UNUSED( nError ); @@ -807,7 +812,7 @@ oslGenericFunction ODriver::getOdbcFunction(sal_Int32 _nIndex) const pFunction = (oslGenericFunction)pODBC3SQLNativeSql; break; default: - OSL_ENSURE(0,"Function unknown!"); + OSL_FAIL("Function unknown!"); } return pFunction; } @@ -857,7 +862,7 @@ void ODriver::createNeededDirs(const ::rtl::OUString& sDBName) if(UCBContentHelper::Exists(sTemp)) UCBContentHelper::Kill(sTemp); -#if !(defined(WIN) || defined(WNT)) +#if !(defined(WNT)) sTemp = sDBConfig; sTemp += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("diag")); if(!UCBContentHelper::IsFolder(sTemp)) @@ -879,7 +884,7 @@ void ODriver::createNeededDirs(const ::rtl::OUString& sDBName) void ODriver::clearDatabase(const ::rtl::OUString& sDBName) { // stop the database ::rtl::OUString sCommand; -#if defined(WIN) || defined(WNT) +#if defined(WNT) ::rtl::OUString sStop = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("stop")); const sal_uInt32 nArgsCount = 2; rtl_uString *pArgs[nArgsCount] = { sDBName.pData, sStop.pData }; @@ -928,7 +933,7 @@ void ODriver::createDb( const TDatabaseStruct& _aInfo) PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("KERNELTRACESIZE")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("100"))); PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LOG_QUEUE_PAGES")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("10"))); -#if !(defined(WIN) || defined(WNT)) +#if !defined(WNT) PutParam(_aInfo.sDBName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OPMSG1")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/dev/null"))); #endif @@ -996,7 +1001,7 @@ int ODriver::X_PARAM(const ::rtl::OUString& _DBNAME, ::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(sCommandFile,STREAM_STD_READWRITE)); pFileStream->Seek(STREAM_SEEK_TO_END); (*pFileStream) << "x_param" -#if defined(WIN) || defined(WNT) +#if defined(WNT) << ".exe" #endif << " -d " @@ -1007,7 +1012,7 @@ int ODriver::X_PARAM(const ::rtl::OUString& _DBNAME, << ::rtl::OString(_PWD,_PWD.getLength(),gsl_getSystemTextEncoding()) << " " << ::rtl::OString(_CMD,_CMD.getLength(),gsl_getSystemTextEncoding()) -#if (defined(WIN) || defined(WNT)) +#if defined(WNT) #if (OSL_DEBUG_LEVEL > 1) || defined(DBG_UTIL) << " >> %DBWORK%\\create.log 2>&1" #endif @@ -1063,7 +1068,7 @@ void ODriver::PutParam(const ::rtl::OUString& sDBName, rtl_uString* pArgs[nArgsCount] = { sDBName.pData, rWhat.pData, rHow.pData }; ::rtl::OUString sCommand = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("putparam")); -#if defined(WIN) || defined(WNT) +#if defined(WNT) sCommand += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".exe")); #endif @@ -1130,7 +1135,7 @@ OSL_TRACE("CreateFile %d",_nSize); int ODriver::X_START(const ::rtl::OUString& sDBName) { ::rtl::OUString sCommand; -#if defined(WIN) || defined(WNT) +#if defined(WNT) ::rtl::OUString sArg1 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-d")); ::rtl::OUString sArg3 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-NoDBService")); @@ -1164,6 +1169,7 @@ int ODriver::X_START(const ::rtl::OUString& sDBName) OSL_ASSERT(eError == osl_Process_E_None); oslProcessInfo aInfo; + aInfo.Size = sizeof(oslProcessInfo); if(osl_getProcessInfo(aApp, osl_Process_EXITCODE, &aInfo) == osl_Process_E_None && aInfo.Code) return aInfo.Code; @@ -1174,7 +1180,7 @@ int ODriver::X_START(const ::rtl::OUString& sDBName) int ODriver::X_STOP(const ::rtl::OUString& sDBName) { ::rtl::OUString sCommand; -#if defined(WIN) || defined(WNT) +#if defined(WNT) ::rtl::OUString sArg1 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-d")); ::rtl::OUString sArg2 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-NoDBService")); @@ -1199,6 +1205,7 @@ int ODriver::X_STOP(const ::rtl::OUString& sDBName) return 1; oslProcessInfo aInfo; + aInfo.Size = sizeof(oslProcessInfo); if(osl_getProcessInfo(aApp, osl_Process_EXITCODE, &aInfo) == osl_Process_E_None && aInfo.Code) return aInfo.Code; @@ -1225,7 +1232,7 @@ void ODriver::XUTIL(const ::rtl::OUString& _rParam, ::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(sCommandFile,STREAM_STD_READWRITE)); pFileStream->Seek(STREAM_SEEK_TO_END); (*pFileStream) << -#if defined(WIN) || defined(WNT) +#if defined(WNT) "xutil.exe" #else "utility" @@ -1283,7 +1290,7 @@ void ODriver::LoadBatch(const ::rtl::OUString& sDBName, ::std::auto_ptr<SvStream> pFileStream( UcbStreamHelper::CreateStream(sCommandFile,STREAM_STD_READWRITE)); pFileStream->Seek(STREAM_SEEK_TO_END); (*pFileStream) << "xload" -#if defined(WIN) || defined(WNT) +#if defined(WNT) << ".exe" #endif << " -d " @@ -1357,7 +1364,7 @@ void ODriver::fillEnvironmentVariables() ::rtl::OUString ODriver::generateInitFile() const { String sExt; -#if !(defined(WIN) || defined(WNT)) +#if !defined(WNT) sExt = String::CreateFromAscii(".sh"); #else sExt = String::CreateFromAscii(".bat"); @@ -1365,13 +1372,13 @@ void ODriver::fillEnvironmentVariables() String sWorkUrl(m_sDbWorkURL); ::utl::TempFile aCmdFile(String::CreateFromAscii("Init"),&sExt,&sWorkUrl); -#if !(defined(WIN) || defined(WNT)) +#if !defined(WNT) String sPhysicalPath; LocalFileHelper::ConvertURLToPhysicalName(aCmdFile.GetURL(),sPhysicalPath); chmod(ByteString(sPhysicalPath,gsl_getSystemTextEncoding()).GetBuffer(),S_IRUSR|S_IWUSR|S_IXUSR); #endif -#if !(defined(WIN) || defined(WNT)) +#if !defined(WNT) SvStream* pFileStream = aCmdFile.GetStream(STREAM_WRITE); (*pFileStream) << "#!/bin/sh" << sNewLine @@ -1481,7 +1488,7 @@ void ODriver::X_CONS(const ::rtl::OUString& sDBName,const ::rtl::OString& _ACTIO pFileStream->Seek(STREAM_SEEK_TO_END); (*pFileStream) << "x_cons" -#if defined(WIN) || defined(WNT) +#if defined(WNT) << ".exe" #endif << " " @@ -1568,7 +1575,7 @@ sal_Bool ODriver::isVersion(const ::rtl::OUString& sDBName, const char* _pVersio pFileStream->Seek(STREAM_SEEK_TO_END); (*pFileStream) << "getparam" -#if defined(WIN) || defined(WNT) +#if defined(WNT) << ".exe" #endif << " " @@ -1622,7 +1629,7 @@ void ODriver::checkAndInsertNewDevSpace(const ::rtl::OUString& sDBName, pFileStream->Seek(STREAM_SEEK_TO_END); (*pFileStream) << "getparam" -#if defined(WIN) || defined(WNT) +#if defined(WNT) << ".exe" #endif << " " @@ -1708,7 +1715,7 @@ sal_Bool ODriver::isKernelVersion(const char* _pVersion) // ----------------------------------------------------------------------------- void ODriver::installSystemTables( const TDatabaseStruct& _aInfo) { -#if defined(WIN) || defined(WNT) +#if defined(WNT) // xutil -d %_DBNAME% -u %_CONTROL_USER%,%_CONTROL_PWD% -b %m_sDbRoot%\env\TERMCHAR.ind ::rtl::OUString aBatch = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-b ")); ::rtl::OUString sTemp2 = m_sDbRootURL + m_sDelimit diff --git a/connectivity/source/drivers/adabas/BFunctions.cxx b/connectivity/source/drivers/adabas/BFunctions.cxx index 0bdb2585ab..ab64f99c31 100644 --- a/connectivity/source/drivers/adabas/BFunctions.cxx +++ b/connectivity/source/drivers/adabas/BFunctions.cxx @@ -119,7 +119,7 @@ sal_Bool LoadLibrary_ADABAS(::rtl::OUString &_rPath) #if ( defined(SOLARIS) && defined(SPARC)) || defined(LINUX) || defined(MACOSX) _rPath = ::rtl::OUString(pPath); - _rPath += ::rtl::OUString::createFromAscii("/lib/"); + _rPath += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/lib/")); #endif rtl_uString_release(pPath); } @@ -130,7 +130,7 @@ sal_Bool LoadLibrary_ADABAS(::rtl::OUString &_rPath) } const sal_Char* pLibraryAsciiName = NULL; -#if defined(WIN) || defined(WNT) +#if defined(WNT) pLibraryAsciiName = "SQLOD32.DLL"; #elif ( defined(SOLARIS) && defined(SPARC)) || defined(LINUX) pLibraryAsciiName = "odbclib.so"; @@ -153,119 +153,105 @@ sal_Bool LoadLibrary_ADABAS(::rtl::OUString &_rPath) sal_Bool LoadFunctions(oslModule pODBCso) { - if( ( pODBC3SQLAllocHandle = (T3SQLAllocHandle)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLAllocHandle").pData )) == NULL ) + if( ( pODBC3SQLAllocHandle = (T3SQLAllocHandle)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLAllocHandle")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLConnect = (T3SQLConnect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLConnect").pData )) == NULL ) + if( ( pODBC3SQLConnect = (T3SQLConnect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLConnect")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLDriverConnect = (T3SQLDriverConnect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLDriverConnect").pData )) == NULL ) + if( ( pODBC3SQLDriverConnect = (T3SQLDriverConnect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLDriverConnect")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLBrowseConnect = (T3SQLBrowseConnect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLBrowseConnect").pData )) == NULL ) + if( ( pODBC3SQLBrowseConnect = (T3SQLBrowseConnect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLBrowseConnect")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLGetInfo = (T3SQLGetInfo)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetInfo").pData )) == NULL ) + if( ( pODBC3SQLGetInfo = (T3SQLGetInfo)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetInfo")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLGetTypeInfo = (T3SQLGetTypeInfo)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetTypeInfo").pData )) == NULL ) + if( ( pODBC3SQLGetTypeInfo = (T3SQLGetTypeInfo)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetTypeInfo")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLSetConnectAttr = (T3SQLSetConnectAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLSetConnectAttr").pData )) == NULL ) + if( ( pODBC3SQLSetConnectAttr = (T3SQLSetConnectAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSetConnectAttr")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLGetConnectAttr = (T3SQLGetConnectAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetConnectAttr").pData )) == NULL ) + if( ( pODBC3SQLGetConnectAttr = (T3SQLGetConnectAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetConnectAttr")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLSetEnvAttr = (T3SQLSetEnvAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLSetEnvAttr").pData )) == NULL ) + if( ( pODBC3SQLSetEnvAttr = (T3SQLSetEnvAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSetEnvAttr")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLGetEnvAttr = (T3SQLGetEnvAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetEnvAttr").pData )) == NULL ) + if( ( pODBC3SQLGetEnvAttr = (T3SQLGetEnvAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetEnvAttr")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLSetStmtAttr = (T3SQLSetStmtAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLSetStmtAttr").pData )) == NULL ) + if( ( pODBC3SQLSetStmtAttr = (T3SQLSetStmtAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSetStmtAttr")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLGetStmtAttr = (T3SQLGetStmtAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetStmtAttr").pData )) == NULL ) + if( ( pODBC3SQLGetStmtAttr = (T3SQLGetStmtAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetStmtAttr")).pData )) == NULL ) return sal_False; - /*if( ( pODBC3SQLSetDescField = (T3SQLSetDescField)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLSetDescField").pData )) == NULL ) + if( ( pODBC3SQLPrepare = (T3SQLPrepare)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLPrepare")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLGetDescField = (T3SQLGetDescField)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetDescField").pData )) == NULL ) - return sal_False;*/ - /*if( ( pODBC3SQLGetDescRec = (T3SQLGetDescRec)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetDescRec").pData )) == NULL ) + if( ( pODBC3SQLBindParameter = (T3SQLBindParameter)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLBindParameter")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLSetDescRec = (T3SQLSetDescRec)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLSetDescRec").pData )) == NULL ) - return sal_False;*/ - if( ( pODBC3SQLPrepare = (T3SQLPrepare)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLPrepare").pData )) == NULL ) + if( ( pODBC3SQLSetCursorName = (T3SQLSetCursorName)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSetCursorName")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLBindParameter = (T3SQLBindParameter)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLBindParameter").pData )) == NULL ) + if( ( pODBC3SQLExecute = (T3SQLExecute)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLExecute")).pData )) == NULL ) return sal_False; -// if( ( pODBC3SQLGetCursorName = (T3SQLGetCursorName)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetCursorName").pData )) == NULL ) -// return sal_False; - if( ( pODBC3SQLSetCursorName = (T3SQLSetCursorName)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLSetCursorName").pData )) == NULL ) + if( ( pODBC3SQLExecDirect = (T3SQLExecDirect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLExecDirect")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLExecute = (T3SQLExecute)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLExecute").pData )) == NULL ) + if( ( pODBC3SQLDescribeParam = (T3SQLDescribeParam)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLDescribeParam")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLExecDirect = (T3SQLExecDirect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLExecDirect").pData )) == NULL ) + if( ( pODBC3SQLNumParams = (T3SQLNumParams)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLNumParams")).pData )) == NULL ) return sal_False; - /*if( ( pODBC3SQLNativeSql = (T3SQLNativeSql)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLNativeSql").pData )) == NULL ) - return sal_False;*/ - if( ( pODBC3SQLDescribeParam = (T3SQLDescribeParam)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLDescribeParam").pData )) == NULL ) + if( ( pODBC3SQLParamData = (T3SQLParamData)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLParamData")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLNumParams = (T3SQLNumParams)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLNumParams").pData )) == NULL ) + if( ( pODBC3SQLPutData = (T3SQLPutData)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLPutData")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLParamData = (T3SQLParamData)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLParamData").pData )) == NULL ) + if( ( pODBC3SQLRowCount = (T3SQLRowCount)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLRowCount")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLPutData = (T3SQLPutData)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLPutData").pData )) == NULL ) + if( ( pODBC3SQLNumResultCols = (T3SQLNumResultCols)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLNumResultCols")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLRowCount = (T3SQLRowCount)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLRowCount").pData )) == NULL ) + if( ( pODBC3SQLDescribeCol = (T3SQLDescribeCol)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLDescribeCol")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLNumResultCols = (T3SQLNumResultCols)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLNumResultCols").pData )) == NULL ) + if( ( pODBC3SQLColAttribute = (T3SQLColAttribute)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLColAttribute")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLDescribeCol = (T3SQLDescribeCol)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLDescribeCol").pData )) == NULL ) + if( ( pODBC3SQLBindCol = (T3SQLBindCol)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLBindCol")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLColAttribute = (T3SQLColAttribute)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLColAttribute").pData )) == NULL ) + if( ( pODBC3SQLFetch = (T3SQLFetch)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLFetch")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLBindCol = (T3SQLBindCol)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLBindCol").pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLFetch = (T3SQLFetch)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLFetch").pData )) == NULL ) - return sal_False; - if( ( pODBC3SQLFetchScroll = (T3SQLFetchScroll)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLFetchScroll").pData )) == NULL ) + if( ( pODBC3SQLFetchScroll = (T3SQLFetchScroll)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLFetchScroll")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLGetData = (T3SQLGetData)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetData").pData )) == NULL ) + if( ( pODBC3SQLGetData = (T3SQLGetData)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetData")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLSetPos = (T3SQLSetPos)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLSetPos").pData )) == NULL ) + if( ( pODBC3SQLSetPos = (T3SQLSetPos)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSetPos")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLMoreResults = (T3SQLMoreResults)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLMoreResults").pData )) == NULL ) + if( ( pODBC3SQLMoreResults = (T3SQLMoreResults)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLMoreResults")).pData )) == NULL ) return sal_False; - /*if( ( pODBC3SQLGetDiagField = (T3SQLGetDiagField)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetDiagField").pData )) == NULL ) - return sal_False;*/ - if( ( pODBC3SQLGetDiagRec = (T3SQLGetDiagRec)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetDiagRec").pData )) == NULL ) + if( ( pODBC3SQLGetDiagRec = (T3SQLGetDiagRec)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetDiagRec")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLColumnPrivileges = (T3SQLColumnPrivileges)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLColumnPrivileges").pData )) == NULL ) + if( ( pODBC3SQLColumnPrivileges = (T3SQLColumnPrivileges)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLColumnPrivileges")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLColumns = (T3SQLColumns)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLColumns").pData )) == NULL ) + if( ( pODBC3SQLColumns = (T3SQLColumns)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLColumns")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLForeignKeys = (T3SQLForeignKeys)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLForeignKeys").pData )) == NULL ) + if( ( pODBC3SQLForeignKeys = (T3SQLForeignKeys)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLForeignKeys")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLPrimaryKeys = (T3SQLPrimaryKeys)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLPrimaryKeys").pData )) == NULL ) + if( ( pODBC3SQLPrimaryKeys = (T3SQLPrimaryKeys)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLPrimaryKeys")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLProcedureColumns = (T3SQLProcedureColumns)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLProcedureColumns").pData )) == NULL ) + if( ( pODBC3SQLProcedureColumns = (T3SQLProcedureColumns)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLProcedureColumns")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLProcedures = (T3SQLProcedures)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLProcedures").pData )) == NULL ) + if( ( pODBC3SQLProcedures = (T3SQLProcedures)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLProcedures")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLSpecialColumns = (T3SQLSpecialColumns)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLSpecialColumns").pData )) == NULL ) + if( ( pODBC3SQLSpecialColumns = (T3SQLSpecialColumns)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSpecialColumns")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLStatistics = (T3SQLStatistics)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLStatistics").pData )) == NULL ) + if( ( pODBC3SQLStatistics = (T3SQLStatistics)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLStatistics")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLTablePrivileges = (T3SQLTablePrivileges)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLTablePrivileges").pData )) == NULL ) + if( ( pODBC3SQLTablePrivileges = (T3SQLTablePrivileges)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLTablePrivileges")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLTables = (T3SQLTables)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLTables").pData )) == NULL ) + if( ( pODBC3SQLTables = (T3SQLTables)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLTables")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLFreeStmt = (T3SQLFreeStmt)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLFreeStmt").pData )) == NULL ) + if( ( pODBC3SQLFreeStmt = (T3SQLFreeStmt)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLFreeStmt")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLCloseCursor = (T3SQLCloseCursor)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLCloseCursor").pData )) == NULL ) + if( ( pODBC3SQLCloseCursor = (T3SQLCloseCursor)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLCloseCursor")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLCancel = (T3SQLCancel)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLCancel").pData )) == NULL ) + if( ( pODBC3SQLCancel = (T3SQLCancel)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLCancel")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLEndTran = (T3SQLEndTran)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLEndTran").pData )) == NULL ) + if( ( pODBC3SQLEndTran = (T3SQLEndTran)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLEndTran")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLDisconnect = (T3SQLDisconnect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLDisconnect").pData )) == NULL ) + if( ( pODBC3SQLDisconnect = (T3SQLDisconnect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLDisconnect")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLFreeHandle = (T3SQLFreeHandle)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLFreeHandle").pData )) == NULL ) + if( ( pODBC3SQLFreeHandle = (T3SQLFreeHandle)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLFreeHandle")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLGetCursorName = (T3SQLGetCursorName)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetCursorName").pData )) == NULL ) + if( ( pODBC3SQLGetCursorName = (T3SQLGetCursorName)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetCursorName")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLNativeSql = (T3SQLNativeSql)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLNativeSql").pData )) == NULL ) + if( ( pODBC3SQLNativeSql = (T3SQLNativeSql)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLNativeSql")).pData )) == NULL ) return sal_False; return sal_True; diff --git a/connectivity/source/drivers/adabas/BGroup.cxx b/connectivity/source/drivers/adabas/BGroup.cxx index 0f488b6357..1421771056 100644 --- a/connectivity/source/drivers/adabas/BGroup.cxx +++ b/connectivity/source/drivers/adabas/BGroup.cxx @@ -39,7 +39,6 @@ using namespace connectivity::adabas; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; -// using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; @@ -70,9 +69,9 @@ void OAdabasGroup::refreshUsers() TStringVector aVector; Reference< XStatement > xStmt = m_pConnection->createStatement( ); - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("SELECT DISTINCT USERNAME FROM DOMAIN.USERS WHERE USERNAME IS NOT NULL AND USERNAME <> ' ' AND USERNAME <> 'CONTROL' AND GROUPNAME = '"); + ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "SELECT DISTINCT USERNAME FROM DOMAIN.USERS WHERE USERNAME IS NOT NULL AND USERNAME <> ' ' AND USERNAME <> 'CONTROL' AND GROUPNAME = '" )); aSql += getName( ); - aSql += ::rtl::OUString::createFromAscii("'"); + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'")); Reference< XResultSet > xResult = xStmt->executeQuery(aSql); if(xResult.is()) diff --git a/connectivity/source/drivers/adabas/BGroups.cxx b/connectivity/source/drivers/adabas/BGroups.cxx index acc6751521..46256b20d5 100644 --- a/connectivity/source/drivers/adabas/BGroups.cxx +++ b/connectivity/source/drivers/adabas/BGroups.cxx @@ -40,7 +40,6 @@ using namespace connectivity; using namespace connectivity::adabas; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; -// using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; @@ -65,7 +64,7 @@ Reference< XPropertySet > OGroups::createDescriptor() // XAppend sdbcx::ObjectType OGroups::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& /*descriptor*/ ) { - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("CREATE USERGROUP "); + ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "CREATE USERGROUP " )); ::rtl::OUString aQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( ); aSql = aSql + aQuote + _rForName + aQuote; @@ -80,7 +79,7 @@ sdbcx::ObjectType OGroups::appendObject( const ::rtl::OUString& _rForName, const // XDrop void OGroups::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementName) { - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DROP USERGROUP "); + ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "DROP USERGROUP " )); ::rtl::OUString aQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( ); aSql = aSql + aQuote + _sElementName + aQuote; diff --git a/connectivity/source/drivers/adabas/BIndex.cxx b/connectivity/source/drivers/adabas/BIndex.cxx index f8f574783e..00d61dd1c0 100644 --- a/connectivity/source/drivers/adabas/BIndex.cxx +++ b/connectivity/source/drivers/adabas/BIndex.cxx @@ -38,7 +38,6 @@ using namespace connectivity::adabas; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; -// using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; diff --git a/connectivity/source/drivers/adabas/BIndexColumns.cxx b/connectivity/source/drivers/adabas/BIndexColumns.cxx index 2ca68733d2..059ba4fe47 100644 --- a/connectivity/source/drivers/adabas/BIndexColumns.cxx +++ b/connectivity/source/drivers/adabas/BIndexColumns.cxx @@ -44,7 +44,6 @@ using namespace connectivity::adabas; using namespace connectivity::sdbcx; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; -// using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; @@ -59,7 +58,7 @@ ObjectType OIndexColumns::createObject(const ::rtl::OUString& _rName) if(xResult.is()) { Reference< XRow > xRow(xResult,UNO_QUERY); - ::rtl::OUString aD(::rtl::OUString::createFromAscii("D")); + ::rtl::OUString aD(RTL_CONSTASCII_USTRINGPARAM("D")); while(xResult->next()) { if(xRow->getString(9) == _rName) diff --git a/connectivity/source/drivers/adabas/BIndexes.cxx b/connectivity/source/drivers/adabas/BIndexes.cxx index 19bd0b80c4..62563cbd2b 100644 --- a/connectivity/source/drivers/adabas/BIndexes.cxx +++ b/connectivity/source/drivers/adabas/BIndexes.cxx @@ -77,7 +77,7 @@ sdbcx::ObjectType OIndexes::createObject(const ::rtl::OUString& _rName) if(xRow->getString(6) == aName && (!aQualifier.getLength() || xRow->getString(5) == aQualifier )) { OAdabasIndex* pRet = new OAdabasIndex(m_pTable,aName,aQualifier,!xRow->getBoolean(4), - aName == ::rtl::OUString::createFromAscii("SYSPRIMARYKEYINDEX"), + aName == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SYSPRIMARYKEYINDEX")), xRow->getShort(7) == IndexType::CLUSTERED); xRet = pRet; break; @@ -105,22 +105,22 @@ sdbcx::ObjectType OIndexes::appendObject( const ::rtl::OUString& _rForName, cons if ( m_pTable->isNew() ) ::dbtools::throwFunctionSequenceException(static_cast<XTypeProvider*>(this)); - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("CREATE "); + ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "CREATE " )); ::rtl::OUString aQuote = m_pTable->getMetaData()->getIdentifierQuoteString( ); const ::rtl::OUString& sDot = OAdabasCatalog::getDot(); if(getBOOL(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISUNIQUE)))) - aSql = aSql + ::rtl::OUString::createFromAscii("UNIQUE "); - aSql = aSql + ::rtl::OUString::createFromAscii("INDEX "); + aSql = aSql + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UNIQUE ")); + aSql = aSql + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INDEX ")); if(_rForName.getLength()) { aSql = aSql + aQuote + _rForName + aQuote - + ::rtl::OUString::createFromAscii(" ON ") + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON ")) + aQuote + m_pTable->getSchema() + aQuote + sDot + aQuote + m_pTable->getTableName() + aQuote - + ::rtl::OUString::createFromAscii(" ( "); + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ( ")); Reference<XColumnsSupplier> xColumnSup(descriptor,UNO_QUERY); Reference<XIndexAccess> xColumns(xColumnSup->getColumns(),UNO_QUERY); @@ -132,12 +132,12 @@ sdbcx::ObjectType OIndexes::appendObject( const ::rtl::OUString& _rForName, cons aSql = aSql + aQuote + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote; aSql = aSql + (getBOOL(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISASCENDING))) ? - ::rtl::OUString::createFromAscii(" ASC") + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ASC")) : - ::rtl::OUString::createFromAscii(" DESC")) - + ::rtl::OUString::createFromAscii(","); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" DESC"))) + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); } - aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString::createFromAscii(")")); + aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"))); } else { @@ -171,14 +171,14 @@ void OIndexes::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementNam aSchema = _sElementName.copy(0,nLen); aName = _sElementName.copy(nLen+1); - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DROP INDEX "); + ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "DROP INDEX " )); ::rtl::OUString aQuote = m_pTable->getMetaData()->getIdentifierQuoteString( ); const ::rtl::OUString& sDot = OAdabasCatalog::getDot(); if (aSchema.getLength()) (((aSql += aQuote) += aSchema) += aQuote) += sDot; - (((aSql += aQuote) += aName) += aQuote) += ::rtl::OUString::createFromAscii(" ON "); + (((aSql += aQuote) += aName) += aQuote) += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON ")); (((aSql += aQuote) += m_pTable->getSchema()) += aQuote) += sDot; ((aSql += aQuote) += m_pTable->getTableName()) += aQuote; diff --git a/connectivity/source/drivers/adabas/BKeys.cxx b/connectivity/source/drivers/adabas/BKeys.cxx index 21e4a30295..d6a6586f10 100644 --- a/connectivity/source/drivers/adabas/BKeys.cxx +++ b/connectivity/source/drivers/adabas/BKeys.cxx @@ -65,7 +65,7 @@ sdbcx::ObjectType OKeys::appendObject( const ::rtl::OUString& _rForName, const R sal_Int32 nKeyType = getINT32(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))); - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("ALTER TABLE "); + ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "ALTER TABLE " )); const ::rtl::OUString aQuote = getTable()->getConnection()->getMetaData()->getIdentifierQuoteString( ); const ::rtl::OUString& sDot = OAdabasCatalog::getDot(); @@ -73,11 +73,11 @@ sdbcx::ObjectType OKeys::appendObject( const ::rtl::OUString& _rForName, const R if(nKeyType == KeyType::PRIMARY) { - aSql = aSql + ::rtl::OUString::createFromAscii(" ALTER PRIMARY KEY ("); + aSql = aSql + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ALTER PRIMARY KEY (")); } else if(nKeyType == KeyType::FOREIGN) { - aSql = aSql + ::rtl::OUString::createFromAscii(" FOREIGN KEY ("); + aSql = aSql + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" FOREIGN KEY (")); } else throw SQLException(); @@ -90,9 +90,9 @@ sdbcx::ObjectType OKeys::appendObject( const ::rtl::OUString& _rForName, const R Reference< XPropertySet > xColProp; xColumns->getByIndex(i) >>= xColProp; aSql = aSql + aQuote + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote - + ::rtl::OUString::createFromAscii(","); + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); } - aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString::createFromAscii(")")); + aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"))); sal_Int32 nUpdateRule = 0, nDeleteRule = 0; ::rtl::OUString sReferencedName; @@ -106,32 +106,32 @@ sdbcx::ObjectType OKeys::appendObject( const ::rtl::OUString& _rForName, const R sal_Int32 nLen = sReferencedName.indexOf('.'); aSchema = sReferencedName.copy(0,nLen); aName = sReferencedName.copy(nLen+1); - aSql += ::rtl::OUString::createFromAscii(" REFERENCES ") + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" REFERENCES ")) + aQuote + aSchema + aQuote + sDot + aQuote + aName + aQuote; - aSql += ::rtl::OUString::createFromAscii(" ("); + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" (")); for(sal_Int32 i=0;i<xColumns->getCount();++i) { Reference< XPropertySet > xColProp; xColumns->getByIndex(i) >>= xColProp; aSql = aSql + aQuote + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RELATEDCOLUMN))) + aQuote - + ::rtl::OUString::createFromAscii(","); + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); } - aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString::createFromAscii(")")); + aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"))); switch(nDeleteRule) { case KeyRule::CASCADE: - aSql += ::rtl::OUString::createFromAscii(" ON DELETE CASCADE "); + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON DELETE CASCADE ")); break; case KeyRule::RESTRICT: - aSql += ::rtl::OUString::createFromAscii(" ON DELETE RESTRICT "); + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON DELETE RESTRICT ")); break; case KeyRule::SET_NULL: - aSql += ::rtl::OUString::createFromAscii(" ON DELETE SET NULL "); + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON DELETE SET NULL ")); break; case KeyRule::SET_DEFAULT: - aSql += ::rtl::OUString::createFromAscii(" ON DELETE SET DEFAULT "); + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON DELETE SET DEFAULT ")); break; default: ; diff --git a/connectivity/source/drivers/adabas/BTable.cxx b/connectivity/source/drivers/adabas/BTable.cxx index 323f658fdf..3f9ad2edde 100644 --- a/connectivity/source/drivers/adabas/BTable.cxx +++ b/connectivity/source/drivers/adabas/BTable.cxx @@ -193,10 +193,10 @@ void SAL_CALL OAdabasTable::alterColumnByName( const ::rtl::OUString& colName, c const ::rtl::OUString sQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( ); const ::rtl::OUString& sDot = OAdabasCatalog::getDot(); - ::rtl::OUString sSql = ::rtl::OUString::createFromAscii("RENAME COLUMN ") ; + ::rtl::OUString sSql( RTL_CONSTASCII_USTRINGPARAM( "RENAME COLUMN " )) ; sSql += ::dbtools::quoteName(sQuote,m_SchemaName) + sDot + ::dbtools::quoteName(sQuote,m_Name); sSql += sDot + ::dbtools::quoteName(sQuote,colName); - sSql += ::rtl::OUString::createFromAscii(" TO "); + sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" TO ")); sSql += ::dbtools::quoteName(sQuote,sNewColumnName); Reference< XStatement > xStmt = m_pConnection->createStatement( ); @@ -241,7 +241,7 @@ void SAL_CALL OAdabasTable::alterColumnByName( const ::rtl::OUString& colName, c void OAdabasTable::alterColumnType(const ::rtl::OUString& _rColName, const Reference<XPropertySet>& _xDescriptor) { ::rtl::OUString sSql = getAlterTableColumnPart(_rColName); - sSql += ::rtl::OUString::createFromAscii(" "); + sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ")); sSql += OTables::getColumnSqlType(_xDescriptor); Reference< XStatement > xStmt = m_pConnection->createStatement( ); @@ -258,11 +258,11 @@ void OAdabasTable::alterNotNullValue(sal_Int32 _nNewNullable,const ::rtl::OUStri if(_nNewNullable == ColumnValue::NO_NULLS) { - sSql += ::rtl::OUString::createFromAscii(" NOT NULL"); + sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" NOT NULL")); } else { - sSql += ::rtl::OUString::createFromAscii(" DEFAULT NULL"); + sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" DEFAULT NULL")); } Reference< XStatement > xStmt = m_pConnection->createStatement(); @@ -276,7 +276,7 @@ void OAdabasTable::alterNotNullValue(sal_Int32 _nNewNullable,const ::rtl::OUStri void OAdabasTable::alterDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName) { ::rtl::OUString sSql = getAlterTableColumnPart(_rColName); - sSql += ::rtl::OUString::createFromAscii(" ALTER ") + _sNewDefault; + sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ALTER ")) + _sNewDefault; Reference< XStatement > xStmt = m_pConnection->createStatement(); if(xStmt.is()) @@ -289,7 +289,7 @@ void OAdabasTable::alterDefaultValue(const ::rtl::OUString& _sNewDefault,const : void OAdabasTable::dropDefaultValue(const ::rtl::OUString& _rColName) { ::rtl::OUString sSql = getAlterTableColumnPart(_rColName); - sSql += ::rtl::OUString::createFromAscii(" DROP DEFAULT"); + sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" DROP DEFAULT")); Reference< XStatement > xStmt = m_pConnection->createStatement(); if(xStmt.is()) @@ -302,7 +302,7 @@ void OAdabasTable::dropDefaultValue(const ::rtl::OUString& _rColName) void OAdabasTable::addDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName) { ::rtl::OUString sSql = getAlterTableColumnPart(_rColName); - sSql += ::rtl::OUString::createFromAscii(" ADD ") + _sNewDefault; + sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ADD ")) + _sNewDefault; Reference< XStatement > xStmt = m_pConnection->createStatement(); if(xStmt.is()) @@ -319,7 +319,7 @@ void OAdabasTable::beginTransAction() Reference< XStatement > xStmt = m_pConnection->createStatement(); if(xStmt.is()) { - xStmt->execute(::rtl::OUString::createFromAscii("SUBTRANS BEGIN") ); + xStmt->execute(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SUBTRANS BEGIN")) ); ::comphelper::disposeComponent(xStmt); } } @@ -335,7 +335,7 @@ void OAdabasTable::endTransAction() Reference< XStatement > xStmt = m_pConnection->createStatement(); if(xStmt.is()) { - xStmt->execute(::rtl::OUString::createFromAscii("SUBTRANS END") ); + xStmt->execute(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SUBTRANS END")) ); ::comphelper::disposeComponent(xStmt); } } @@ -351,7 +351,7 @@ void OAdabasTable::rollbackTransAction() Reference< XStatement > xStmt = m_pConnection->createStatement(); if(xStmt.is()) { - xStmt->execute(::rtl::OUString::createFromAscii("SUBTRANS ROLLBACK") ); + xStmt->execute(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SUBTRANS ROLLBACK")) ); ::comphelper::disposeComponent(xStmt); } } @@ -362,12 +362,12 @@ void OAdabasTable::rollbackTransAction() // ----------------------------------------------------------------------------- ::rtl::OUString OAdabasTable::getAlterTableColumnPart(const ::rtl::OUString& _rsColumnName ) { - ::rtl::OUString sSql = ::rtl::OUString::createFromAscii("ALTER TABLE "); + ::rtl::OUString sSql( RTL_CONSTASCII_USTRINGPARAM( "ALTER TABLE " )); const ::rtl::OUString sQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( ); const ::rtl::OUString& sDot = OAdabasCatalog::getDot(); sSql += ::dbtools::quoteName(sQuote,m_SchemaName) + sDot + ::dbtools::quoteName(sQuote,m_Name) - + ::rtl::OUString::createFromAscii(" COLUMN ") + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" COLUMN ")) + ::dbtools::quoteName(sQuote,_rsColumnName); return sSql; } diff --git a/connectivity/source/drivers/adabas/BTables.cxx b/connectivity/source/drivers/adabas/BTables.cxx index 4fb9626cc5..302e9b4e8f 100644 --- a/connectivity/source/drivers/adabas/BTables.cxx +++ b/connectivity/source/drivers/adabas/BTables.cxx @@ -65,9 +65,7 @@ sdbcx::ObjectType OTables::createObject(const ::rtl::OUString& _rName) aName = _rName.copy(nLen+1); Sequence< ::rtl::OUString > aTypes(1); - aTypes[0] = ::rtl::OUString::createFromAscii("%"); - // aTypes[0] = ::rtl::OUString::createFromAscii("TABLE"); - // aTypes[1] = ::rtl::OUString::createFromAscii("SYSTEMTABLE"); + aTypes[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")); Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),aSchema,aName,aTypes); @@ -112,22 +110,22 @@ sdbcx::ObjectType OTables::appendObject( const ::rtl::OUString& _rForName, const // ------------------------------------------------------------------------- void OTables::setComments(const Reference< XPropertySet >& descriptor ) throw(SQLException, RuntimeException) { - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("CREATE TABLE "); + ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "CREATE TABLE " )); ::rtl::OUString aQuote = static_cast<OAdabasCatalog&>(m_rParent).getConnection()->getMetaData()->getIdentifierQuoteString( ); const ::rtl::OUString& sDot = OAdabasCatalog::getDot(); OAdabasConnection* pConnection = static_cast<OAdabasCatalog&>(m_rParent).getConnection(); Reference< XStatement > xStmt = pConnection->createStatement( ); - aSql = ::rtl::OUString::createFromAscii("COMMENT ON TABLE "); + aSql = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("COMMENT ON TABLE ")); ::rtl::OUString sSchema; descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME)) >>= sSchema; if(sSchema.getLength()) aSql += ::dbtools::quoteName(aQuote, sSchema) + sDot; aSql += aQuote + getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote - + ::rtl::OUString::createFromAscii(" '") + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" '")) + getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DESCRIPTION))) - + ::rtl::OUString::createFromAscii("'"); + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'")); xStmt->execute(aSql); // columns @@ -135,7 +133,7 @@ void OTables::setComments(const Reference< XPropertySet >& descriptor ) throw(SQ Reference<XIndexAccess> xColumns(xColumnSup->getColumns(),UNO_QUERY); Reference< XPropertySet > xColProp; - aSql = ::rtl::OUString::createFromAscii("COMMENT ON COLUMN "); + aSql = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("COMMENT ON COLUMN ")); if(sSchema.getLength()) aSql += ::dbtools::quoteName(aQuote, sSchema) + sDot; aSql += aQuote + getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote + sDot @@ -150,9 +148,9 @@ void OTables::setComments(const Reference< XPropertySet >& descriptor ) throw(SQ if(aDescription.getLength()) { ::rtl::OUString aCom = aSql + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote - + ::rtl::OUString::createFromAscii(" '") + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" '")) + aDescription - + ::rtl::OUString::createFromAscii("'"); + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'")); xStmt->execute(aSql); ::comphelper::disposeComponent(xStmt); } @@ -175,15 +173,15 @@ void OTables::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) sal_Int32 nLen = _sElementName.indexOf('.'); aSchema = _sElementName.copy(0,nLen); aName = _sElementName.copy(nLen+1); - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DROP "); + ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "DROP " )); const ::rtl::OUString& sDot = OAdabasCatalog::getDot(); Reference<XPropertySet> xProp(xObject,UNO_QUERY); sal_Bool bIsView; - if((bIsView = (xProp.is() && ::comphelper::getString(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))) == ::rtl::OUString::createFromAscii("VIEW")))) // here we have a view - aSql += ::rtl::OUString::createFromAscii("VIEW "); + if((bIsView = (xProp.is() && ::comphelper::getString(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))) == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VIEW"))))) // here we have a view + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VIEW ")); else - aSql += ::rtl::OUString::createFromAscii("TABLE "); + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE ")); aSql += m_xMetaData->getIdentifierQuoteString( ) + aSchema + m_xMetaData->getIdentifierQuoteString( ); aSql += sDot; @@ -202,7 +200,7 @@ void OTables::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) // ------------------------------------------------------------------------- void OTables::createTable( const Reference< XPropertySet >& descriptor ) { - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("CREATE TABLE "); + ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "CREATE TABLE " )); ::rtl::OUString aQuote = static_cast<OAdabasCatalog&>(m_rParent).getConnection()->getMetaData()->getIdentifierQuoteString( ); const ::rtl::OUString& sDot = OAdabasCatalog::getDot(); ::rtl::OUString sSchema; @@ -216,7 +214,7 @@ void OTables::createTable( const Reference< XPropertySet >& descriptor ) )); aSql += ::dbtools::quoteName(aQuote, getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)))) - + ::rtl::OUString::createFromAscii(" ("); + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" (")); // columns Reference<XColumnsSupplier> xColumnSup(descriptor,UNO_QUERY); @@ -235,10 +233,10 @@ void OTables::createTable( const Reference< XPropertySet >& descriptor ) aSql += aQuote + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote; - aSql += ::rtl::OUString::createFromAscii(" "); + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ")); aSql += OTables::getColumnSqlType(xColProp); aSql += OTables::getColumnSqlNotNullDefault(xColProp); - aSql += ::rtl::OUString::createFromAscii(","); + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); } } @@ -268,15 +266,15 @@ void OTables::createTable( const Reference< XPropertySet >& descriptor ) if(!xColumns->getCount()) throw SQLException(); - aSql += ::rtl::OUString::createFromAscii(" PRIMARY KEY ("); + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" PRIMARY KEY (")); for( sal_Int32 column=0; column<xColumns->getCount(); ++column ) { if(::cppu::extractInterface(xColProp,xColumns->getByIndex(column)) && xColProp.is()) aSql += aQuote + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote - + ::rtl::OUString::createFromAscii(","); + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); } - aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString::createFromAscii(")")); + aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"))); } else if(nKeyType == KeyType::UNIQUE) { @@ -285,15 +283,15 @@ void OTables::createTable( const Reference< XPropertySet >& descriptor ) if(!xColumns->getCount()) throw SQLException(); - aSql += ::rtl::OUString::createFromAscii(" UNIQUE ("); + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" UNIQUE (")); for( sal_Int32 column=0; column<xColumns->getCount(); ++column ) { if(::cppu::extractInterface(xColProp,xColumns->getByIndex(column)) && xColProp.is()) aSql += aQuote + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote - + ::rtl::OUString::createFromAscii(","); + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); } - aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString::createFromAscii(")")); + aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"))); } else if(nKeyType == KeyType::FOREIGN) { @@ -304,7 +302,7 @@ void OTables::createTable( const Reference< XPropertySet >& descriptor ) if(!xColumns->getCount()) throw SQLException(); - aSql += ::rtl::OUString::createFromAscii(" FOREIGN KEY "); + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" FOREIGN KEY ")); ::rtl::OUString aName,aSchema,aRefTable = getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REFERENCEDTABLE))); sal_Int32 nLen = aRefTable.indexOf('.'); aSchema = aRefTable.copy(0,nLen); @@ -312,30 +310,30 @@ void OTables::createTable( const Reference< XPropertySet >& descriptor ) aSql += aQuote + aSchema + aQuote + sDot + aQuote + aName + aQuote - + ::rtl::OUString::createFromAscii(" ("); + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" (")); for ( sal_Int32 column=0; column<xColumns->getCount(); ++column ) { if(::cppu::extractInterface(xColProp,xColumns->getByIndex(column)) && xColProp.is()) aSql += aQuote + getString(xColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME))) + aQuote - + ::rtl::OUString::createFromAscii(","); + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); } - aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString::createFromAscii(")")); + aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"))); switch(nDeleteRule) { case KeyRule::CASCADE: - aSql += ::rtl::OUString::createFromAscii(" ON DELETE CASCADE "); + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON DELETE CASCADE ")); break; case KeyRule::RESTRICT: - aSql += ::rtl::OUString::createFromAscii(" ON DELETE RESTRICT "); + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON DELETE RESTRICT ")); break; case KeyRule::SET_NULL: - aSql += ::rtl::OUString::createFromAscii(" ON DELETE SET NULL "); + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON DELETE SET NULL ")); break; case KeyRule::SET_DEFAULT: - aSql += ::rtl::OUString::createFromAscii(" ON DELETE SET DEFAULT "); + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON DELETE SET DEFAULT ")); break; default: ; @@ -346,9 +344,9 @@ void OTables::createTable( const Reference< XPropertySet >& descriptor ) } if(aSql.lastIndexOf(',') == (aSql.getLength()-1)) - aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString::createFromAscii(")")); + aSql = aSql.replaceAt(aSql.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"))); else - aSql += ::rtl::OUString::createFromAscii(")"); + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")")); OAdabasConnection* pConnection = static_cast<OAdabasCatalog&>(m_rParent).getConnection(); Reference< XStatement > xStmt = pConnection->createStatement( ); @@ -378,10 +376,10 @@ void OTables::appendNew(const ::rtl::OUString& _rsNewTable) switch(nDataType) { case DataType::VARBINARY: - sSql += ::rtl::OUString::createFromAscii("VAR"); + sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VAR")); /* run through*/ case DataType::BINARY: - sSql += ::rtl::OUString::createFromAscii("CHAR"); + sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CHAR")); break; default: { @@ -389,7 +387,7 @@ void OTables::appendNew(const ::rtl::OUString& _rsNewTable) if(aTypeName.hasValue() && getString(aTypeName).getLength()) sSql += getString(aTypeName); else - sSql += OTables::getTypeString(_rxColProp) + ::rtl::OUString::createFromAscii(" "); + sSql += OTables::getTypeString(_rxColProp) + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ")); } } @@ -399,24 +397,24 @@ void OTables::appendNew(const ::rtl::OUString& _rsNewTable) case DataType::VARCHAR: case DataType::FLOAT: case DataType::REAL: - sSql += ::rtl::OUString::createFromAscii("(") + sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("(")) + ::rtl::OUString::valueOf(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)))) - + ::rtl::OUString::createFromAscii(")"); + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")")); break; case DataType::DECIMAL: case DataType::NUMERIC: - sSql += ::rtl::OUString::createFromAscii("(") + sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("(")) + ::rtl::OUString::valueOf(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)))) - + ::rtl::OUString::createFromAscii(",") + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")) + ::rtl::OUString::valueOf(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)))) - + ::rtl::OUString::createFromAscii(")"); + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")")); break; case DataType::BINARY: case DataType::VARBINARY: - sSql += ::rtl::OUString::createFromAscii("(") + sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("(")) + ::rtl::OUString::valueOf(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)))) - + ::rtl::OUString::createFromAscii(") BYTE"); + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(") BYTE")); break; } return sSql; @@ -429,14 +427,14 @@ void OTables::appendNew(const ::rtl::OUString& _rsNewTable) ::rtl::OUString aDefault = getString(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DEFAULTVALUE))); if(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISNULLABLE))) == ColumnValue::NO_NULLS) { - sSql += ::rtl::OUString::createFromAscii(" NOT NULL"); + sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" NOT NULL")); if(aDefault.getLength()) - sSql += ::rtl::OUString::createFromAscii(" WITH DEFAULT"); + sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" WITH DEFAULT")); } else if(aDefault.getLength()) { - sSql +=::rtl::OUString::createFromAscii(" DEFAULT '") + aDefault; - sSql += ::rtl::OUString::createFromAscii("'"); + sSql +=::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" DEFAULT '")) + aDefault; + sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'")); } return sSql; } @@ -447,58 +445,58 @@ void OTables::appendNew(const ::rtl::OUString& _rsNewTable) switch(getINT32(_rxColProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))) { case DataType::BIT: - aValue = ::rtl::OUString::createFromAscii("BOOLEAN"); + aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BOOLEAN")); break; case DataType::TINYINT: - aValue = ::rtl::OUString::createFromAscii("SMALLINT"); + aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SMALLINT")); break; case DataType::SMALLINT: - aValue = ::rtl::OUString::createFromAscii("SMALLINT"); + aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SMALLINT")); break; case DataType::INTEGER: - aValue = ::rtl::OUString::createFromAscii("INT"); + aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INT")); break; case DataType::FLOAT: - aValue = ::rtl::OUString::createFromAscii("FLOAT"); + aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FLOAT")); break; case DataType::REAL: - aValue = ::rtl::OUString::createFromAscii("REAL"); + aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("REAL")); break; case DataType::DOUBLE: - aValue = ::rtl::OUString::createFromAscii("DOUBLE"); + aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DOUBLE")); break; case DataType::NUMERIC: - aValue = ::rtl::OUString::createFromAscii("DECIMAL"); + aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DECIMAL")); break; case DataType::DECIMAL: - aValue = ::rtl::OUString::createFromAscii("DECIMAL"); + aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DECIMAL")); break; case DataType::CHAR: - aValue = ::rtl::OUString::createFromAscii("CHAR"); + aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CHAR")); break; case DataType::VARCHAR: - aValue = ::rtl::OUString::createFromAscii("VARCHAR"); + aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VARCHAR")); break; case DataType::LONGVARCHAR: - aValue = ::rtl::OUString::createFromAscii("LONG VARCHAR"); + aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LONG VARCHAR")); break; case DataType::DATE: - aValue = ::rtl::OUString::createFromAscii("DATE"); + aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DATE")); break; case DataType::TIME: - aValue = ::rtl::OUString::createFromAscii("TIME"); + aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIME")); break; case DataType::TIMESTAMP: - aValue = ::rtl::OUString::createFromAscii("TIMESTAMP"); + aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP")); break; case DataType::BINARY: - aValue = ::rtl::OUString::createFromAscii("CHAR () BYTE"); + aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CHAR () BYTE")); break; case DataType::VARBINARY: - aValue = ::rtl::OUString::createFromAscii("VARCHAR () BYTE"); + aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VARCHAR () BYTE")); break; case DataType::LONGVARBINARY: - aValue = ::rtl::OUString::createFromAscii("LONG BYTE"); + aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LONG BYTE")); break; } return aValue; diff --git a/connectivity/source/drivers/adabas/BUser.cxx b/connectivity/source/drivers/adabas/BUser.cxx index c6bf728799..98d61e4f43 100644 --- a/connectivity/source/drivers/adabas/BUser.cxx +++ b/connectivity/source/drivers/adabas/BUser.cxx @@ -70,9 +70,9 @@ void OAdabasUser::refreshGroups() TStringVector aVector; aVector.reserve(7); // we don't know the excatly count of users but this should fit the normal need Reference< XStatement > xStmt = m_pConnection->createStatement( ); - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("SELECT DISTINCT GROUPNAME FROM DOMAIN.USERS WHERE GROUPNAME IS NOT NULL AND GROUPNAME <> ' ' AND USERNAME = '"); + ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "SELECT DISTINCT GROUPNAME FROM DOMAIN.USERS WHERE GROUPNAME IS NOT NULL AND GROUPNAME <> ' ' AND USERNAME = '" )); aSql += getName( ); - aSql += ::rtl::OUString::createFromAscii("'"); + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'")); Reference< XResultSet > xResult = xStmt->executeQuery(aSql); if(xResult.is()) @@ -136,11 +136,11 @@ void OAdabasUser::getAnyTablePrivileges(const ::rtl::OUString& objName, sal_Int3 ::rtl::OUString sCatalog,sSchema,sTable; ::dbtools::qualifiedNameComponents(xMeta,objName,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation); Reference<XStatement> xStmt = m_pConnection->createStatement(); - ::rtl::OUString sSql = ::rtl::OUString::createFromAscii("SELECT REFTABLENAME,PRIVILEGES FROM DOMAIN.USR_USES_TAB WHERE REFOBJTYPE <> 'SYSTEM' AND DEFUSERNAME = '"); + ::rtl::OUString sSql( RTL_CONSTASCII_USTRINGPARAM( "SELECT REFTABLENAME,PRIVILEGES FROM DOMAIN.USR_USES_TAB WHERE REFOBJTYPE <> 'SYSTEM' AND DEFUSERNAME = '" )); sSql += m_Name; - sSql += ::rtl::OUString::createFromAscii("' AND REFTABLENAME = '"); + sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("' AND REFTABLENAME = '")); sSql += sTable; - sSql += ::rtl::OUString::createFromAscii("'"); + sSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'")); if(xStmt.is()) { Reference<XResultSet> xRes = xStmt->executeQuery(sSql); @@ -171,7 +171,7 @@ void OAdabasUser::getAnyTablePrivileges(const ::rtl::OUString& objName, sal_Int3 continue; nRights |= privileges[i].nNumericValue; - if ( sPrivs.copy( nIndex + 2, 1 ).equalsAscii( "+" ) ) + if ( sPrivs.copy( nIndex + 2, 1 ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "+" ) ) ) nRightsWithGrant |= privileges[i].nNumericValue; } } @@ -203,13 +203,12 @@ void SAL_CALL OAdabasUser::grantPrivileges( const ::rtl::OUString& objName, sal_ ::rtl::OUString sPrivs = getPrivilegeString(objPrivileges); if(sPrivs.getLength()) { - ::rtl::OUString sGrant; - sGrant += ::rtl::OUString::createFromAscii("GRANT "); + ::rtl::OUString sGrant(RTL_CONSTASCII_USTRINGPARAM("GRANT ")); sGrant += sPrivs; - sGrant += ::rtl::OUString::createFromAscii(" ON "); + sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON ")); Reference<XDatabaseMetaData> xMeta = m_pConnection->getMetaData(); sGrant += ::dbtools::quoteTableName(xMeta,objName,::dbtools::eInDataManipulation); - sGrant += ::rtl::OUString::createFromAscii(" TO "); + sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" TO ")); sGrant += m_Name; Reference<XStatement> xStmt = m_pConnection->createStatement(); @@ -229,13 +228,12 @@ void SAL_CALL OAdabasUser::revokePrivileges( const ::rtl::OUString& objName, sal ::rtl::OUString sPrivs = getPrivilegeString(objPrivileges); if(sPrivs.getLength()) { - ::rtl::OUString sGrant; - sGrant += ::rtl::OUString::createFromAscii("REVOKE "); + ::rtl::OUString sGrant(RTL_CONSTASCII_USTRINGPARAM("REVOKE ")); sGrant += sPrivs; - sGrant += ::rtl::OUString::createFromAscii(" ON "); + sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON ")); Reference<XDatabaseMetaData> xMeta = m_pConnection->getMetaData(); sGrant += ::dbtools::quoteTableName(xMeta,objName,::dbtools::eInDataManipulation); - sGrant += ::rtl::OUString::createFromAscii(" FROM "); + sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" FROM ")); sGrant += m_Name; Reference<XStatement> xStmt = m_pConnection->createStatement(); @@ -250,12 +248,11 @@ void SAL_CALL OAdabasUser::changePassword( const ::rtl::OUString& objPassword, c { ::osl::MutexGuard aGuard(m_aMutex); checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed); - ::rtl::OUString sAlterPwd; - sAlterPwd = ::rtl::OUString::createFromAscii("ALTER PASSWORD \""); + ::rtl::OUString sAlterPwd(RTL_CONSTASCII_USTRINGPARAM("ALTER PASSWORD \"")); sAlterPwd += objPassword.toAsciiUpperCase(); - sAlterPwd += ::rtl::OUString::createFromAscii("\" TO \"") ; + sAlterPwd += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\" TO \"")) ; sAlterPwd += newPassword.toAsciiUpperCase(); - sAlterPwd += ::rtl::OUString::createFromAscii("\"") ; + sAlterPwd += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"")) ; sal_Bool bDisposeConnection = sal_False; Reference<XConnection> xConnection = m_pConnection; @@ -266,9 +263,9 @@ void SAL_CALL OAdabasUser::changePassword( const ::rtl::OUString& objPassword, c if(pNewConnection) { Sequence< PropertyValue> aSeq(2); - aSeq.getArray()[0].Name = ::rtl::OUString::createFromAscii("user") ; + aSeq.getArray()[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("user")) ; aSeq.getArray()[0].Value <<= m_Name; - aSeq.getArray()[1].Name = ::rtl::OUString::createFromAscii("password") ; + aSeq.getArray()[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("password")) ; aSeq.getArray()[1].Value <<= objPassword; pNewConnection->Construct(m_pConnection->getMetaData()->getURL(),aSeq); } @@ -291,41 +288,41 @@ void SAL_CALL OAdabasUser::changePassword( const ::rtl::OUString& objPassword, c { ::rtl::OUString sPrivs; if((nRights & Privilege::INSERT) == Privilege::INSERT) - sPrivs += ::rtl::OUString::createFromAscii("INSERT"); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INSERT")); if((nRights & Privilege::DELETE) == Privilege::DELETE) { if(sPrivs.getLength()) - sPrivs += ::rtl::OUString::createFromAscii(","); - sPrivs += ::rtl::OUString::createFromAscii("DELETE"); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DELETE")); } if((nRights & Privilege::UPDATE) == Privilege::UPDATE) { if(sPrivs.getLength()) - sPrivs += ::rtl::OUString::createFromAscii(","); - sPrivs += ::rtl::OUString::createFromAscii("UPDATE"); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UPDATE")); } if((nRights & Privilege::ALTER) == Privilege::ALTER) { if(sPrivs.getLength()) - sPrivs += ::rtl::OUString::createFromAscii(","); - sPrivs += ::rtl::OUString::createFromAscii("ALTER"); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ALTER")); } if((nRights & Privilege::SELECT) == Privilege::SELECT) { if(sPrivs.getLength()) - sPrivs += ::rtl::OUString::createFromAscii(","); - sPrivs += ::rtl::OUString::createFromAscii("SELECT"); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SELECT")); } if((nRights & Privilege::REFERENCE) == Privilege::REFERENCE) { if(sPrivs.getLength()) - sPrivs += ::rtl::OUString::createFromAscii(","); - sPrivs += ::rtl::OUString::createFromAscii("REFERENCES"); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("REFERENCES")); } return sPrivs; diff --git a/connectivity/source/drivers/adabas/BUsers.cxx b/connectivity/source/drivers/adabas/BUsers.cxx index a0e8fc1ca0..995a4f8739 100644 --- a/connectivity/source/drivers/adabas/BUsers.cxx +++ b/connectivity/source/drivers/adabas/BUsers.cxx @@ -44,7 +44,6 @@ using namespace connectivity; using namespace connectivity::adabas; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; -// using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; @@ -69,16 +68,16 @@ Reference< XPropertySet > OUsers::createDescriptor() // XAppend sdbcx::ObjectType OUsers::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor ) { - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("CREATE USER "); + ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "CREATE USER " )); ::rtl::OUString aQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( ); ::rtl::OUString sUserName( _rForName ); sUserName = sUserName.toAsciiUpperCase(); descriptor->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(sUserName)); aSql += ::dbtools::quoteName(aQuote,sUserName) - + ::rtl::OUString::createFromAscii(" PASSWORD ") + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" PASSWORD ")) + getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD))); - aSql += ::rtl::OUString::createFromAscii(" RESOURCE NOT EXCLUSIVE"); + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" RESOURCE NOT EXCLUSIVE")); Reference< XStatement > xStmt = m_pConnection->createStatement( ); if(xStmt.is()) @@ -94,8 +93,8 @@ void OUsers::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementName) { // first we have to check if this user is live relevaant for the database // which means with out these users the database will miss more than one important system table - ::rtl::OUString sUsers = ::rtl::OUString::createFromAscii("SELECT USERMODE,USERNAME FROM DOMAIN.USERS WHERE USERNAME = '"); - sUsers += _sElementName + ::rtl::OUString::createFromAscii("'"); + ::rtl::OUString sUsers( RTL_CONSTASCII_USTRINGPARAM( "SELECT USERMODE,USERNAME FROM DOMAIN.USERS WHERE USERNAME = '" )); + sUsers += _sElementName + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'")); Reference< XStatement > xStmt = m_pConnection->createStatement(); if(xStmt.is()) { @@ -103,7 +102,7 @@ void OUsers::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementName) Reference<XRow> xRow(xRes,UNO_QUERY); if(xRes.is() && xRow.is() && xRes->next()) // there can only be one user with this name { - static const ::rtl::OUString sDbaUser = ::rtl::OUString::createFromAscii("DBA"); + static const ::rtl::OUString sDbaUser( RTL_CONSTASCII_USTRINGPARAM( "DBA" )); if(xRow->getString(1) == sDbaUser) { ::comphelper::disposeComponent(xStmt); @@ -115,7 +114,7 @@ void OUsers::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementName) } { - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DROP USER "); + ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "DROP USER " )); ::rtl::OUString aQuote = m_pConnection->getMetaData()->getIdentifierQuoteString( ); aSql += ::dbtools::quoteName(aQuote,_sElementName); diff --git a/connectivity/source/drivers/adabas/BViews.cxx b/connectivity/source/drivers/adabas/BViews.cxx index a2321c0422..f15ff861be 100644 --- a/connectivity/source/drivers/adabas/BViews.cxx +++ b/connectivity/source/drivers/adabas/BViews.cxx @@ -66,16 +66,16 @@ sdbcx::ObjectType OViews::createObject(const ::rtl::OUString& _rName) aSchema = _rName.copy(0,nLen); aName = _rName.copy(nLen+1); - ::rtl::OUString sStmt = ::rtl::OUString::createFromAscii("SELECT DISTINCT * FROM DOMAIN.SHOW_VIEW WHERE "); + ::rtl::OUString sStmt( RTL_CONSTASCII_USTRINGPARAM( "SELECT DISTINCT * FROM DOMAIN.SHOW_VIEW WHERE " )); if(aSchema.getLength()) { - sStmt += ::rtl::OUString::createFromAscii("OWNER = '"); + sStmt += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OWNER = '")); sStmt += aSchema; - sStmt += ::rtl::OUString::createFromAscii("' AND "); + sStmt += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("' AND ")); } - sStmt += ::rtl::OUString::createFromAscii("VIEWNAME = '"); + sStmt += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VIEWNAME = '")); sStmt += aName; - sStmt += ::rtl::OUString::createFromAscii("'"); + sStmt += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'")); Reference<XConnection> xConnection = static_cast<OAdabasCatalog&>(m_rParent).getConnection(); Reference< XStatement > xStmt = xConnection->createStatement( ); Reference< XResultSet > xResult = xStmt->executeQuery(sStmt); @@ -142,7 +142,7 @@ void OViews::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) sal_Int32 nLen = _sElementName.indexOf('.'); aSchema = _sElementName.copy(0,nLen); aName = _sElementName.copy(nLen+1); - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DROP VIEW"); + ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "DROP VIEW" )); const ::rtl::OUString& sDot = OAdabasCatalog::getDot(); aSql = aSql + m_xMetaData->getIdentifierQuoteString( ) + aSchema + m_xMetaData->getIdentifierQuoteString( ); @@ -162,7 +162,7 @@ void OViews::dropByNameImpl(const ::rtl::OUString& elementName) // ----------------------------------------------------------------------------- void OViews::createView( const Reference< XPropertySet >& descriptor ) { - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("CREATE VIEW "); + ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "CREATE VIEW " )); ::rtl::OUString aQuote = static_cast<OAdabasCatalog&>(m_rParent).getConnection()->getMetaData()->getIdentifierQuoteString( ); const ::rtl::OUString& sDot = OAdabasCatalog::getDot(); ::rtl::OUString sSchema,sCommand; @@ -174,7 +174,7 @@ void OViews::createView( const Reference< XPropertySet >& descriptor ) descriptor->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCHEMANAME),makeAny(sSchema = static_cast<OAdabasCatalog&>(m_rParent).getConnection()->getMetaData()->getUserName())); aSql += ::dbtools::quoteName(aQuote, getString(descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)))) - + ::rtl::OUString::createFromAscii(" AS "); + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" AS ")); descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND)) >>= sCommand; aSql += sCommand; diff --git a/connectivity/source/drivers/adabas/Bservices.cxx b/connectivity/source/drivers/adabas/Bservices.cxx index a1f26ca242..5b4e3be456 100644 --- a/connectivity/source/drivers/adabas/Bservices.cxx +++ b/connectivity/source/drivers/adabas/Bservices.cxx @@ -30,13 +30,11 @@ #include "precompiled_connectivity.hxx" #include "adabas/BDriver.hxx" #include <cppuhelper/factory.hxx> -#include <osl/diagnose.h> using namespace connectivity::adabas; using ::rtl::OUString; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; -using ::com::sun::star::registry::XRegistryKey; using ::com::sun::star::lang::XSingleServiceFactory; using ::com::sun::star::lang::XMultiServiceFactory; @@ -49,31 +47,6 @@ typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc) rtl_ModuleCount* _pT ); -//*************************************************************************************** -// -// Die vorgeschriebene C-Api muss erfuellt werden! -// Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen. -// - -//--------------------------------------------------------------------------------------- -void REGISTER_PROVIDER( - const OUString& aServiceImplName, - const Sequence< OUString>& Services, - const Reference< ::com::sun::star::registry::XRegistryKey > & xKey) -{ - OUString aMainKeyName; - aMainKeyName = OUString::createFromAscii("/"); - aMainKeyName += aServiceImplName; - aMainKeyName += OUString::createFromAscii("/UNO/SERVICES"); - - Reference< ::com::sun::star::registry::XRegistryKey > xNewKey( xKey->createKey(aMainKeyName) ); - OSL_ENSURE(xNewKey.is(), "ADABAS::component_writeInfo : could not create a registry key !"); - - for (sal_Int32 i=0; i<Services.getLength(); ++i) - xNewKey->createKey(Services[i]); -} - - //--------------------------------------------------------------------------------------- struct ProviderRequest { @@ -113,7 +86,6 @@ struct ProviderRequest }; //--------------------------------------------------------------------------------------- - extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char **ppEnvTypeName, @@ -124,31 +96,6 @@ component_getImplementationEnvironment( } //--------------------------------------------------------------------------------------- -extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( - void* /*pServiceManager*/, - void* pRegistryKey - ) -{ - if (pRegistryKey) - try - { - Reference< ::com::sun::star::registry::XRegistryKey > xKey(reinterpret_cast< ::com::sun::star::registry::XRegistryKey*>(pRegistryKey)); - - REGISTER_PROVIDER( - ODriver::getImplementationName_Static(), - ODriver::getSupportedServiceNames_Static(), xKey); - - return sal_True; - } - catch (::com::sun::star::registry::InvalidRegistryException& ) - { - OSL_ENSURE(sal_False, "ODBC::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !"); - } - - return sal_False; -} - -//--------------------------------------------------------------------------------------- extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplementationName, void* pServiceManager, diff --git a/connectivity/source/drivers/adabas/adabas.component b/connectivity/source/drivers/adabas/adabas.component new file mode 100755 index 0000000000..3c359c3d02 --- /dev/null +++ b/connectivity/source/drivers/adabas/adabas.component @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.sdbcx.adabas.ODriver"> + <service name="com.sun.star.sdbc.Driver"/> + <service name="com.sun.star.sdbcx.Driver"/> + </implementation> +</component> diff --git a/connectivity/source/drivers/adabas/adabas.mxp.map b/connectivity/source/drivers/adabas/adabas.mxp.map index 2ce9f11141..f64c44c13f 100644..100755 --- a/connectivity/source/drivers/adabas/adabas.mxp.map +++ b/connectivity/source/drivers/adabas/adabas.mxp.map @@ -1,5 +1,4 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory __mh_dylib_header ___builtin_delete diff --git a/connectivity/source/drivers/adabas/adabas.xcu b/connectivity/source/drivers/adabas/adabas.xcu index fa7defad35..fa7defad35 100755..100644 --- a/connectivity/source/drivers/adabas/adabas.xcu +++ b/connectivity/source/drivers/adabas/adabas.xcu diff --git a/connectivity/source/drivers/adabas/adabas.xml b/connectivity/source/drivers/adabas/adabas.xml index bc6e1348bd..a4736d0dfd 100644..100755 --- a/connectivity/source/drivers/adabas/adabas.xml +++ b/connectivity/source/drivers/adabas/adabas.xml @@ -3,7 +3,7 @@ <module-description xmlns:xlink="http://www.w3.org/1999/xlink"> <module-name>adabas</module-name> <component-description> - <author>Ocke Janssen</Author> + <author>Ocke Janssen</author> <name>com.sun.star.comp.sdbcx.adabas.ODriver</name> <description> This is the implementation of the sdbc-adabas bridge. diff --git a/connectivity/source/drivers/adabas/exports.dxp b/connectivity/source/drivers/adabas/exports.dxp index 9630d7e067..f0e1c69934 100644..100755 --- a/connectivity/source/drivers/adabas/exports.dxp +++ b/connectivity/source/drivers/adabas/exports.dxp @@ -1,3 +1,2 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory diff --git a/connectivity/source/drivers/adabas/makefile.mk b/connectivity/source/drivers/adabas/makefile.mk index b5d9903f27..bfc6a3dcfa 100644..100755 --- a/connectivity/source/drivers/adabas/makefile.mk +++ b/connectivity/source/drivers/adabas/makefile.mk @@ -104,3 +104,11 @@ DEF1EXPORTFILE= exports.dxp .INCLUDE : $(PRJ)$/target.pmk + +ALLTAR : $(MISC)/adabas.component + +$(MISC)/adabas.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + adabas.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt adabas.component diff --git a/connectivity/source/drivers/ado/ACatalog.cxx b/connectivity/source/drivers/ado/ACatalog.cxx index f6390431b6..0f3e70c0f1 100644 --- a/connectivity/source/drivers/ado/ACatalog.cxx +++ b/connectivity/source/drivers/ado/ACatalog.cxx @@ -80,7 +80,7 @@ void OCatalog::refreshTables() if(m_pTables) m_pTables->reFill(aVector); else - m_pTables = new OTables(this,m_aMutex,aVector,aTables,m_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers()); + m_pTables = new OTables(this,m_aMutex,aVector,aTables,m_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers()); } // ------------------------------------------------------------------------- void OCatalog::refreshViews() @@ -93,7 +93,7 @@ void OCatalog::refreshViews() if(m_pViews) m_pViews->reFill(aVector); else - m_pViews = new OViews(this,m_aMutex,aVector,aViews,m_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers()); + m_pViews = new OViews(this,m_aMutex,aVector,aViews,m_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers()); } // ------------------------------------------------------------------------- void OCatalog::refreshGroups() @@ -106,7 +106,7 @@ void OCatalog::refreshGroups() if(m_pGroups) m_pGroups->reFill(aVector); else - m_pGroups = new OGroups(this,m_aMutex,aVector,aGroups,m_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers()); + m_pGroups = new OGroups(this,m_aMutex,aVector,aGroups,m_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers()); } // ------------------------------------------------------------------------- void OCatalog::refreshUsers() @@ -119,7 +119,7 @@ void OCatalog::refreshUsers() if(m_pUsers) m_pUsers->reFill(aVector); else - m_pUsers = new OUsers(this,m_aMutex,aVector,aUsers,m_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers()); + m_pUsers = new OUsers(this,m_aMutex,aVector,aUsers,m_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers()); } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/ado/AColumn.cxx b/connectivity/source/drivers/ado/AColumn.cxx index cfa5597d6d..d2b7b1dfee 100644 --- a/connectivity/source/drivers/ado/AColumn.cxx +++ b/connectivity/source/drivers/ado/AColumn.cxx @@ -38,6 +38,8 @@ #include <comphelper/types.hxx> #include "ado/ACatalog.hxx" +#include <o3tl/compat_functional.hxx> + using namespace ::comphelper; using namespace connectivity::ado; @@ -181,7 +183,7 @@ void OAdoColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& r break; case PROPERTY_ID_ISAUTOINCREMENT: - OTools::putValue( m_aColumn.get_Properties(), ::rtl::OUString::createFromAscii( "Autoincrement" ), getBOOL( rValue ) ); + OTools::putValue( m_aColumn.get_Properties(), ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Autoincrement" )), getBOOL( rValue ) ); break; case PROPERTY_ID_IM001: @@ -225,11 +227,11 @@ void OAdoColumn::fillPropertyValues() ::comphelper::TStringMixEqualFunctor aCase(sal_False); OTypeInfoMap::const_iterator aFind = ::std::find_if(pTypeInfoMap->begin(), pTypeInfoMap->end(), - ::std::compose1( + ::o3tl::compose1( ::std::bind2nd(aCase, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VarBinary"))), - ::std::compose1( + ::o3tl::compose1( ::std::mem_fun(&OExtendedTypeInfo::getDBName), - ::std::select2nd<OTypeInfoMap::value_type>()) + ::o3tl::select2nd<OTypeInfoMap::value_type>()) ) ); diff --git a/connectivity/source/drivers/ado/AColumns.cxx b/connectivity/source/drivers/ado/AColumns.cxx index 9b2c82f052..c3187fd196 100644 --- a/connectivity/source/drivers/ado/AColumns.cxx +++ b/connectivity/source/drivers/ado/AColumns.cxx @@ -39,11 +39,11 @@ #include <comphelper/property.hxx> #include <comphelper/types.hxx> #include <connectivity/dbexception.hxx> -#ifdef __MINGW32__ #include <algorithm> -#endif #include "resource/ado_res.hrc" +#include <o3tl/compat_functional.hxx> + using namespace connectivity::ado; using namespace connectivity; using namespace comphelper; @@ -73,8 +73,14 @@ Reference< XPropertySet > OColumns::createDescriptor() sdbcx::ObjectType OColumns::appendObject( const ::rtl::OUString&, const Reference< XPropertySet >& descriptor ) { OAdoColumn* pColumn = NULL; + Reference< XPropertySet > xColumn; if ( !getImplementation( pColumn, descriptor ) || pColumn == NULL ) - m_pConnection->throwGenericSQLException( STR_INVALID_COLUMN_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) ); + { + // m_pConnection->throwGenericSQLException( STR_INVALID_COLUMN_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) ); + pColumn = new OAdoColumn(isCaseSensitive(),m_pConnection); + xColumn = pColumn; + ::comphelper::copyProperties(descriptor,xColumn); + } WpADOColumn aColumn = pColumn->getColumnImpl(); @@ -95,11 +101,11 @@ sdbcx::ObjectType OColumns::appendObject( const ::rtl::OUString&, const Referenc // search for typeinfo where the typename is equal sTypeName OTypeInfoMap::const_iterator aFind = ::std::find_if(pTypeInfoMap->begin(), pTypeInfoMap->end(), - ::std::compose1( + ::o3tl::compose1( ::std::bind2nd(aCase, sTypeName), - ::std::compose1( + ::o3tl::compose1( ::std::mem_fun(&OExtendedTypeInfo::getDBName), - ::std::select2nd<OTypeInfoMap::value_type>()) + ::o3tl::select2nd<OTypeInfoMap::value_type>()) ) ); diff --git a/connectivity/source/drivers/ado/AConnection.cxx b/connectivity/source/drivers/ado/AConnection.cxx index 6f42c36413..c9e076d9f8 100644 --- a/connectivity/source/drivers/ado/AConnection.cxx +++ b/connectivity/source/drivers/ado/AConnection.cxx @@ -44,6 +44,8 @@ #include <osl/file.hxx> #include "resource/ado_res.hrc" +#include <o3tl/compat_functional.hxx> + using namespace dbtools; using namespace connectivity::ado; using namespace com::sun::star::uno; @@ -159,7 +161,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV ::dbtools::throwFunctionSequenceException(*this); } - catch(const Exception ) + catch(const Exception& ) { osl_decrementInterlockedCount( &m_refCount ); throw; @@ -353,7 +355,7 @@ void SAL_CALL OConnection::setTransactionIsolation( sal_Int32 level ) throw(SQLE eIso = adXactSerializable; break; default: - OSL_ENSURE(0,"OConnection::setTransactionIsolation invalid level"); + OSL_FAIL("OConnection::setTransactionIsolation invalid level"); return; } m_pAdoConnection->put_IsolationLevel(eIso); @@ -385,7 +387,7 @@ sal_Int32 SAL_CALL OConnection::getTransactionIsolation( ) throw(SQLException, nRet = TransactionIsolation::SERIALIZABLE; break; default: - OSL_ENSURE(0,"OConnection::setTransactionIsolation invalid level"); + OSL_FAIL("OConnection::setTransactionIsolation invalid level"); } ADOS::ThrowException(*m_pAdoConnection,*this); return nRet; @@ -575,8 +577,7 @@ const OExtendedTypeInfo* OConnection::getTypeInfoFromType(const OTypeInfoMap& _r { // we can not assert here because we could be in d&d /* - OSL_ENSURE(sal_False, - ( ::rtl::OString("getTypeInfoFromType: assuming column type ") + OSL_FAIL(( ::rtl::OString("getTypeInfoFromType: assuming column type ") += ::rtl::OString(aIter->second->aTypeName.getStr(), aIter->second->aTypeName.getLength(), gsl_getSystemTextEncoding()) += ::rtl::OString("\" (expected type name ") += ::rtl::OString(_sTypeName.getStr(), _sTypeName.getLength(), gsl_getSystemTextEncoding()) @@ -605,11 +606,11 @@ const OExtendedTypeInfo* OConnection::getTypeInfoFromType(const OTypeInfoMap& _r // search for typeinfo where the typename is equal _sTypeName OTypeInfoMap::const_iterator aFind = ::std::find_if(_rTypeInfo.begin(), _rTypeInfo.end(), - ::std::compose1( + ::o3tl::compose1( ::std::bind2nd(aCase, _sTypeName), - ::std::compose1( + ::o3tl::compose1( ::std::mem_fun(&OExtendedTypeInfo::getDBName), - ::std::select2nd<OTypeInfoMap::value_type>()) + ::o3tl::select2nd<OTypeInfoMap::value_type>()) ) ); if(aFind != _rTypeInfo.end()) diff --git a/connectivity/source/drivers/ado/ADatabaseMetaData.cxx b/connectivity/source/drivers/ado/ADatabaseMetaData.cxx index f1af30168e..c714660c97 100644 --- a/connectivity/source/drivers/ado/ADatabaseMetaData.cxx +++ b/connectivity/source/drivers/ado/ADatabaseMetaData.cxx @@ -50,8 +50,6 @@ using namespace com::sun::star::beans; using namespace com::sun::star::sdbc; -// using namespace connectivity; - ODatabaseMetaData::ODatabaseMetaData(OConnection* _pCon) : ::connectivity::ODatabaseMetaDataBase(_pCon,_pCon->getConnectionInfo()) ,m_pADOConnection(_pCon->getConnection()) @@ -98,7 +96,6 @@ sal_Bool ODatabaseMetaData::getBoolProperty(const ::rtl::OUString& _aProperty) Reference< XResultSet > ODatabaseMetaData::impl_getTypeInfo_throw( ) { ADORecordset *pRecordset = m_pADOConnection->getTypeInfo(); - // ADOS::ThrowException(*m_pADOConnection,*this); ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset); pResult->setTypeInfoMap(ADOS::isJetEngine(m_pConnection->getEngineType())); @@ -233,7 +230,7 @@ sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLExc // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException) { - return getInt32Property(::rtl::OUString::createFromAscii("Maximum Row Size")); + return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Maximum Row Size"))); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException) @@ -253,7 +250,6 @@ sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength( ) throw(SQLExcept // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException) { - // return getInt32Property(::rtl::OUString::createFromAscii("Max Columns in Index")); return 0; } // ------------------------------------------------------------------------- @@ -264,12 +260,12 @@ sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength( ) throw(SQLExcept // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException) { - return getInt32Property(::rtl::OUString::createFromAscii("Active Sessions")); + return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Active Sessions"))); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException) { - return getInt32Property(::rtl::OUString::createFromAscii("Max Columns in Table")); + return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Max Columns in Table"))); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException) @@ -284,7 +280,7 @@ sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength( ) throw(SQLExcepti // ------------------------------------------------------------------------- sal_Int32 ODatabaseMetaData::impl_getMaxTablesInSelect_throw( ) { - return getInt32Property(::rtl::OUString::createFromAscii("Maximum Tables in SELECT")); + return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Maximum Tables in SELECT"))); } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys( @@ -377,7 +373,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges( aRow[4] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue(); aRow[5] = new ::connectivity::ORowSetValueDecorator(getUserName()); aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getSelectValue(); - aRow[7] = new ::connectivity::ORowSetValueDecorator(::rtl::OUString::createFromAscii("NO")); + aRow[7] = new ::connectivity::ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NO"))); aRows.push_back(aRow); aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getInsertValue(); @@ -419,37 +415,37 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference( // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException) { - return getBoolProperty(::rtl::OUString::createFromAscii("Maximum Row Size Includes BLOB")); + return getBoolProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Maximum Row Size Includes BLOB"))); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) { - return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_LOWER) == DBPROPVAL_IC_LOWER ; + return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Identifier Case Sensitivity"))) & DBPROPVAL_IC_LOWER) == DBPROPVAL_IC_LOWER ; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException) { - return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_LOWER) == DBPROPVAL_IC_LOWER ; + return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Identifier Case Sensitivity"))) & DBPROPVAL_IC_LOWER) == DBPROPVAL_IC_LOWER ; } // ------------------------------------------------------------------------- sal_Bool ODatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw( ) { - return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED ; + return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Identifier Case Sensitivity"))) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED ; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException) { - return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED ; + return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Identifier Case Sensitivity"))) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED ; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) { - return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_UPPER) == DBPROPVAL_IC_UPPER ; + return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Identifier Case Sensitivity"))) & DBPROPVAL_IC_UPPER) == DBPROPVAL_IC_UPPER ; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException) { - return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_UPPER) == DBPROPVAL_IC_UPPER ; + return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Identifier Case Sensitivity"))) & DBPROPVAL_IC_UPPER) == DBPROPVAL_IC_UPPER ; } // ------------------------------------------------------------------------- sal_Bool ODatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw( ) @@ -464,17 +460,17 @@ sal_Bool ODatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw( ) // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException) { - return getInt32Property(::rtl::OUString::createFromAscii("Maximum Index Size")); + return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Maximum Index Size"))); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException) { - return getInt32Property(::rtl::OUString::createFromAscii("NULL Concatenation Behavior")) == DBPROPVAL_CB_NON_NULL; + return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NULL Concatenation Behavior"))) == DBPROPVAL_CB_NON_NULL; } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException) { - return getStringProperty(::rtl::OUString::createFromAscii("Catalog Term")); + return getStringProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Catalog Term"))); } // ------------------------------------------------------------------------- ::rtl::OUString ODatabaseMetaData::impl_getIdentifierQuoteString_throw( ) @@ -485,7 +481,6 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLExc // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException) { - // return getStringProperty(::rtl::OUString::createFromAscii("Special Characters")); return ::rtl::OUString(); } // ------------------------------------------------------------------------- @@ -496,27 +491,27 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( ) // ------------------------------------------------------------------------- sal_Bool ODatabaseMetaData::impl_isCatalogAtStart_throw( ) { - return getInt32Property(::rtl::OUString::createFromAscii("Catalog Location")) == DBPROPVAL_CL_START; + return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Catalog Location"))) == DBPROPVAL_CL_START; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException) { - return getInt32Property(::rtl::OUString::createFromAscii("Transaction DDL")) == DBPROPVAL_TC_DDL_IGNORE; + return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Transaction DDL"))) == DBPROPVAL_TC_DDL_IGNORE; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException) { - return getInt32Property(::rtl::OUString::createFromAscii("Transaction DDL")) == DBPROPVAL_TC_DDL_COMMIT; + return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Transaction DDL"))) == DBPROPVAL_TC_DDL_COMMIT; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException) { - return getInt32Property(::rtl::OUString::createFromAscii("Transaction DDL")) == DBPROPVAL_TC_DML; + return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Transaction DDL"))) == DBPROPVAL_TC_DML; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException) { - return getInt32Property(::rtl::OUString::createFromAscii("Transaction DDL")) == DBPROPVAL_TC_ALL; + return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Transaction DDL"))) == DBPROPVAL_TC_ALL; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException) @@ -531,29 +526,29 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate( ) throw(SQLExcep // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException) { - return getInt32Property(::rtl::OUString::createFromAscii("Prepare Abort Behavior")) == DBPROPVAL_CB_PRESERVE; + return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Prepare Abort Behavior"))) == DBPROPVAL_CB_PRESERVE; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException) { - return getInt32Property(::rtl::OUString::createFromAscii("Prepare Commit Behavior")) == DBPROPVAL_CB_PRESERVE; + return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Prepare Commit Behavior"))) == DBPROPVAL_CB_PRESERVE; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException) { - return (getInt32Property(::rtl::OUString::createFromAscii("Isolation Retention")) & DBPROPVAL_TR_COMMIT) == DBPROPVAL_TR_COMMIT; + return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Isolation Retention"))) & DBPROPVAL_TR_COMMIT) == DBPROPVAL_TR_COMMIT; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException) { - return (getInt32Property(::rtl::OUString::createFromAscii("Isolation Retention")) & DBPROPVAL_TR_ABORT) == DBPROPVAL_TR_ABORT; + return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Isolation Retention"))) & DBPROPVAL_TR_ABORT) == DBPROPVAL_TR_ABORT; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 level ) throw(SQLException, RuntimeException) { sal_Bool bValue(sal_False); - sal_Int32 nTxn = getInt32Property(::rtl::OUString::createFromAscii("Isolation Levels")); + sal_Int32 nTxn = getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Isolation Levels"))); if(level == TransactionIsolation::NONE) bValue = sal_True; else if(level == TransactionIsolation::READ_UNCOMMITTED) @@ -570,52 +565,49 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int3 // ------------------------------------------------------------------------- sal_Bool ODatabaseMetaData::impl_supportsSchemasInDataManipulation_throw( ) { - return (getInt32Property(::rtl::OUString::createFromAscii("Schema Usage")) & DBPROPVAL_SU_DML_STATEMENTS) == DBPROPVAL_SU_DML_STATEMENTS; + return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Schema Usage"))) & DBPROPVAL_SU_DML_STATEMENTS) == DBPROPVAL_SU_DML_STATEMENTS; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException) { - sal_Int32 nProp = getInt32Property(::rtl::OUString::createFromAscii("SQL Support")); + sal_Int32 nProp = getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQL Support"))); return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ANSI92_FULL) == DBPROPVAL_SQL_ANSI92_FULL); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException) { - sal_Int32 nProp = getInt32Property(::rtl::OUString::createFromAscii("SQL Support")); + sal_Int32 nProp = getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQL Support"))); return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ANSI92_ENTRY) == DBPROPVAL_SQL_ANSI92_ENTRY); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException) { - sal_Int32 nProp = getInt32Property(::rtl::OUString::createFromAscii("SQL Support")); + sal_Int32 nProp = getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQL Support"))); return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ANSI89_IEF) == DBPROPVAL_SQL_ANSI89_IEF); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException) { - return (getInt32Property(::rtl::OUString::createFromAscii("Schema Usage")) & DBPROPVAL_SU_INDEX_DEFINITION) == DBPROPVAL_SU_INDEX_DEFINITION; + return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Schema Usage"))) & DBPROPVAL_SU_INDEX_DEFINITION) == DBPROPVAL_SU_INDEX_DEFINITION; } // ------------------------------------------------------------------------- sal_Bool ODatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw( ) { - return (getInt32Property(::rtl::OUString::createFromAscii("Schema Usage")) & DBPROPVAL_SU_TABLE_DEFINITION) == DBPROPVAL_SU_TABLE_DEFINITION; + return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Schema Usage"))) & DBPROPVAL_SU_TABLE_DEFINITION) == DBPROPVAL_SU_TABLE_DEFINITION; } // ------------------------------------------------------------------------- sal_Bool ODatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw( ) { - // return (getInt32Property(::rtl::OUString::createFromAscii("Catalog Usage")) & DBPROPVAL_CU_TABLE_DEFINITION) == DBPROPVAL_CU_TABLE_DEFINITION; return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException) { - // return (getInt32Property(::rtl::OUString::createFromAscii("Catalog Usage")) & DBPROPVAL_CU_INDEX_DEFINITION) == DBPROPVAL_CU_INDEX_DEFINITION; return sal_False; } // ------------------------------------------------------------------------- sal_Bool ODatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw( ) { - // return (getInt32Property(::rtl::OUString::createFromAscii("Catalog Usage")) & DBPROPVAL_CU_DML_STATEMENTS) == DBPROPVAL_CU_DML_STATEMENTS; return sal_False; } // ------------------------------------------------------------------------- @@ -623,7 +615,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( ) throw(SQLException, { if ( ADOS::isJetEngine(m_pConnection->getEngineType()) ) return sal_True; - return getBoolProperty(::rtl::OUString::createFromAscii("Outer Join Capabilities")); + return getBoolProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Outer Join Capabilities"))); } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException) @@ -648,7 +640,7 @@ sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLExcept // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException) { - return getInt32Property(::rtl::OUString::createFromAscii("Transaction DDL")) == DBPROPVAL_TC_NONE; + return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Transaction DDL"))) == DBPROPVAL_TC_NONE; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException) @@ -673,7 +665,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable( ) throw(SQLExcepti // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException) { - return getBoolProperty(::rtl::OUString::createFromAscii("Read-Only Data Source")); + return getBoolProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Read-Only Data Source"))); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException) @@ -693,7 +685,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion( ) throw(SQLExcepti // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException) { - return getInt32Property(::rtl::OUString::createFromAscii("NULL Concatenation Behavior")) == DBPROPVAL_CB_NULL; + return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NULL Concatenation Behavior"))) == DBPROPVAL_CB_NULL; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException) @@ -708,27 +700,27 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames( ) throw(SQL // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 /*fromType*/, sal_Int32 /*toType*/ ) throw(SQLException, RuntimeException) { - return getBoolProperty(::rtl::OUString::createFromAscii("Rowset Conversions on Command")); + return getBoolProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Rowset Conversions on Command"))); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException) { - return getBoolProperty(::rtl::OUString::createFromAscii("ORDER BY Columns in Select List")); + return getBoolProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ORDER BY Columns in Select List"))); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException) { - return getInt32Property(::rtl::OUString::createFromAscii("GROUP BY Support")) != DBPROPVAL_GB_NOT_SUPPORTED; + return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GROUP BY Support"))) != DBPROPVAL_GB_NOT_SUPPORTED; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException) { - return getInt32Property(::rtl::OUString::createFromAscii("GROUP BY Support")) != DBPROPVAL_GB_CONTAINS_SELECT; + return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GROUP BY Support"))) != DBPROPVAL_GB_CONTAINS_SELECT; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException) { - return getInt32Property(::rtl::OUString::createFromAscii("GROUP BY Support")) == DBPROPVAL_GB_NO_RELATION; + return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GROUP BY Support"))) == DBPROPVAL_GB_NO_RELATION; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException) @@ -748,7 +740,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLExcep // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException) { - return getBoolProperty(::rtl::OUString::createFromAscii("ORDER BY Columns in Select List")); + return getBoolProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ORDER BY Columns in Select List"))); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException) @@ -763,32 +755,32 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll( ) throw(SQLException, Ru // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException) { - return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED; + return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Identifier Case Sensitivity"))) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED; } // ------------------------------------------------------------------------- sal_Bool ODatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw( ) { - return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED; + return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Identifier Case Sensitivity"))) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException) { - return (getInt32Property(::rtl::OUString::createFromAscii("NULL Collation Order")) & DBPROPVAL_NC_END) == DBPROPVAL_NC_END; + return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NULL Collation Order"))) & DBPROPVAL_NC_END) == DBPROPVAL_NC_END; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException) { - return (getInt32Property(::rtl::OUString::createFromAscii("NULL Collation Order")) & DBPROPVAL_NC_START) == DBPROPVAL_NC_START; + return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NULL Collation Order"))) & DBPROPVAL_NC_START) == DBPROPVAL_NC_START; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException) { - return (getInt32Property(::rtl::OUString::createFromAscii("NULL Collation Order")) & DBPROPVAL_NC_HIGH) == DBPROPVAL_NC_HIGH; + return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NULL Collation Order"))) & DBPROPVAL_NC_HIGH) == DBPROPVAL_NC_HIGH; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException) { - return (getInt32Property(::rtl::OUString::createFromAscii("NULL Collation Order")) & DBPROPVAL_NC_LOW) == DBPROPVAL_NC_LOW; + return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NULL Collation Order"))) & DBPROPVAL_NC_LOW) == DBPROPVAL_NC_LOW; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException) @@ -798,7 +790,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(S // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) { - return (getInt32Property(::rtl::OUString::createFromAscii("Schema Usage")) & DBPROPVAL_SU_PRIVILEGE_DEFINITION) == DBPROPVAL_SU_PRIVILEGE_DEFINITION; + return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Schema Usage"))) & DBPROPVAL_SU_PRIVILEGE_DEFINITION) == DBPROPVAL_SU_PRIVILEGE_DEFINITION; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException) @@ -808,79 +800,78 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw( // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) { - // return (getInt32Property(::rtl::OUString::createFromAscii("Catalog Usage")) & DBPROPVAL_CU_PRIVILEGE_DEFINITION) == DBPROPVAL_CU_PRIVILEGE_DEFINITION; return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException) { - return (getInt32Property(::rtl::OUString::createFromAscii("Subquery Support")) & DBPROPVAL_SQ_CORRELATEDSUBQUERIES) == DBPROPVAL_SQ_CORRELATEDSUBQUERIES; + return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Subquery Support"))) & DBPROPVAL_SQ_CORRELATEDSUBQUERIES) == DBPROPVAL_SQ_CORRELATEDSUBQUERIES; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException) { - return (getInt32Property(::rtl::OUString::createFromAscii("Subquery Support")) & DBPROPVAL_SQ_COMPARISON) == DBPROPVAL_SQ_COMPARISON; + return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Subquery Support"))) & DBPROPVAL_SQ_COMPARISON) == DBPROPVAL_SQ_COMPARISON; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException) { - return (getInt32Property(::rtl::OUString::createFromAscii("Subquery Support")) & DBPROPVAL_SQ_EXISTS) == DBPROPVAL_SQ_EXISTS; + return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Subquery Support"))) & DBPROPVAL_SQ_EXISTS) == DBPROPVAL_SQ_EXISTS; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException) { - return (getInt32Property(::rtl::OUString::createFromAscii("Subquery Support")) & DBPROPVAL_SQ_IN) == DBPROPVAL_SQ_IN; + return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Subquery Support"))) & DBPROPVAL_SQ_IN) == DBPROPVAL_SQ_IN; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException) { - return (getInt32Property(::rtl::OUString::createFromAscii("Subquery Support")) & DBPROPVAL_SQ_QUANTIFIED) == DBPROPVAL_SQ_QUANTIFIED; + return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Subquery Support"))) & DBPROPVAL_SQ_QUANTIFIED) == DBPROPVAL_SQ_QUANTIFIED; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException) { - sal_Int32 nProp = getInt32Property(::rtl::OUString::createFromAscii("SQL Support")); + sal_Int32 nProp = getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQL Support"))); return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ANSI92_INTERMEDIATE) == DBPROPVAL_SQL_ANSI92_INTERMEDIATE); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getURL( ) throw(SQLException, RuntimeException) { - return ::rtl::OUString::createFromAscii("sdbc:ado:")+ m_pADOConnection->GetConnectionString(); + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:ado:"))+ m_pADOConnection->GetConnectionString(); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException) { - return getStringProperty(::rtl::OUString::createFromAscii("User Name")); + return getStringProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("User Name"))); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException) { - return getStringProperty(::rtl::OUString::createFromAscii("Provider Friendly Name")); + return getStringProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Provider Friendly Name"))); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverVersion( ) throw(SQLException, RuntimeException) { - return getStringProperty(::rtl::OUString::createFromAscii("Provider Version")); + return getStringProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Provider Version"))); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException) { - return getStringProperty(::rtl::OUString::createFromAscii("DBMS Version")); + return getStringProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DBMS Version"))); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException) { - return getStringProperty(::rtl::OUString::createFromAscii("DBMS Name")); + return getStringProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DBMS Name"))); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException) { - return getStringProperty(::rtl::OUString::createFromAscii("Procedure Term")); + return getStringProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Procedure Term"))); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException) { - return getStringProperty(::rtl::OUString::createFromAscii("Schema Term")); + return getStringProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Schema Term"))); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException) @@ -930,7 +921,7 @@ sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeExc aRecordset.MoveFirst(); OLEVariant aValue; - ::rtl::OUString aRet,aComma = ::rtl::OUString::createFromAscii(","); + ::rtl::OUString aRet, aComma(RTL_CONSTASCII_USTRINGPARAM(",")); while(!aRecordset.IsAtEOF()) { WpOLEAppendCollection<ADOFields, ADOField, WpADOField> aFields(aRecordset.GetFields()); @@ -977,19 +968,19 @@ sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeExc // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException) { - sal_Int32 nProp = getInt32Property(::rtl::OUString::createFromAscii("SQL Support")); + sal_Int32 nProp = getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQL Support"))); return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ODBC_EXTENDED) == DBPROPVAL_SQL_ODBC_EXTENDED); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException) { - sal_Int32 nProp = getInt32Property(::rtl::OUString::createFromAscii("SQL Support")); + sal_Int32 nProp = getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQL Support"))); return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ODBC_CORE) == DBPROPVAL_SQL_ODBC_CORE); } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException) { - sal_Int32 nProp = getInt32Property(::rtl::OUString::createFromAscii("SQL Support")); + sal_Int32 nProp = getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQL Support"))); return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ODBC_MINIMUM) == DBPROPVAL_SQL_ODBC_MINIMUM); } // ------------------------------------------------------------------------- @@ -997,7 +988,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins( ) throw(SQLExcepti { if ( ADOS::isJetEngine(m_pConnection->getEngineType()) ) return sal_True; - return (getInt32Property(::rtl::OUString::createFromAscii("Outer Join Capabilities")) & 0x00000004L) == 0x00000004L; + return (getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Outer Join Capabilities"))) & 0x00000004L) == 0x00000004L; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException) @@ -1007,17 +998,17 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLExce // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException) { - return getInt32Property(::rtl::OUString::createFromAscii("Max Columns in GROUP BY")); + return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Max Columns in GROUP BY"))); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException) { - return getInt32Property(::rtl::OUString::createFromAscii("Max Columns in ORDER BY")); + return getInt32Property(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Max Columns in ORDER BY"))); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException) { - return 0; // getInt32Property(::rtl::OUString::createFromAscii("Max Columns in Select")); + return 0; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx b/connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx index 4b92827483..e6ac9c9030 100644 --- a/connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx +++ b/connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx @@ -128,7 +128,7 @@ sal_Bool ODatabaseMetaData::isCapable(sal_uInt32 _nId) // ------------------------------------------------------------------------- void ODatabaseMetaDataResultSetMetaData::setColumnPrivilegesMap() { - m_mColumns[8] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("IS_GRANTABLE"), + m_mColumns[8] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IS_GRANTABLE")), ColumnValue::NULLABLE, 3,3,0, DataType::VARCHAR); @@ -136,31 +136,31 @@ void ODatabaseMetaDataResultSetMetaData::setColumnPrivilegesMap() // ------------------------------------------------------------------------- void ODatabaseMetaDataResultSetMetaData::setColumnsMap() { - m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("TYPE_NAME"), + m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TYPE_NAME")), ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR); - m_mColumns[11] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("NULLABLE"), + m_mColumns[11] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NULLABLE")), ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER); - m_mColumns[12] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("REMARKS"), + m_mColumns[12] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("REMARKS")), ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR); - m_mColumns[13] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("COLUMN_DEF"), + m_mColumns[13] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("COLUMN_DEF")), ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR); - m_mColumns[14] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("SQL_DATA_TYPE"), + m_mColumns[14] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQL_DATA_TYPE")), ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER); - m_mColumns[15] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("SQL_DATETIME_SUB"), + m_mColumns[15] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQL_DATETIME_SUB")), ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER); - m_mColumns[16] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("CHAR_OCTET_LENGTH"), + m_mColumns[16] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CHAR_OCTET_LENGTH")), ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER); @@ -168,7 +168,7 @@ void ODatabaseMetaDataResultSetMetaData::setColumnsMap() // ------------------------------------------------------------------------- void ODatabaseMetaDataResultSetMetaData::setTablesMap() { - m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("REMARKS"), + m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("REMARKS")), ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR); @@ -176,7 +176,7 @@ void ODatabaseMetaDataResultSetMetaData::setTablesMap() // ------------------------------------------------------------------------- void ODatabaseMetaDataResultSetMetaData::setProcedureColumnsMap() { - m_mColumns[12] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("NULLABLE"), + m_mColumns[12] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NULLABLE")), ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER); @@ -184,11 +184,11 @@ void ODatabaseMetaDataResultSetMetaData::setProcedureColumnsMap() // ------------------------------------------------------------------------- void ODatabaseMetaDataResultSetMetaData::setPrimaryKeysMap() { - m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("KEY_SEQ"), + m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("KEY_SEQ")), ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER); - m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PK_NAME"), + m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PK_NAME")), ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR); @@ -196,15 +196,15 @@ void ODatabaseMetaDataResultSetMetaData::setPrimaryKeysMap() // ------------------------------------------------------------------------- void ODatabaseMetaDataResultSetMetaData::setIndexInfoMap() { - m_mColumns[4] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("NON_UNIQUE"), + m_mColumns[4] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NON_UNIQUE")), ColumnValue::NO_NULLS, 1,1,0, DataType::BIT); - m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("INDEX_QUALIFIER"), + m_mColumns[5] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INDEX_QUALIFIER")), ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR); - m_mColumns[10] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("ASC_OR_DESC"), + m_mColumns[10] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ASC_OR_DESC")), ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR); @@ -212,11 +212,11 @@ void ODatabaseMetaDataResultSetMetaData::setIndexInfoMap() // ------------------------------------------------------------------------- void ODatabaseMetaDataResultSetMetaData::setTablePrivilegesMap() { - m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PRIVILEGE"), + m_mColumns[6] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PRIVILEGE")), ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR); - m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("IS_GRANTABLE"), + m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IS_GRANTABLE")), ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR); @@ -224,7 +224,7 @@ void ODatabaseMetaDataResultSetMetaData::setTablePrivilegesMap() // ------------------------------------------------------------------------- void ODatabaseMetaDataResultSetMetaData::setCrossReferenceMap() { - m_mColumns[9] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("KEY_SEQ"), + m_mColumns[9] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("KEY_SEQ")), ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER); @@ -232,27 +232,27 @@ void ODatabaseMetaDataResultSetMetaData::setCrossReferenceMap() // ------------------------------------------------------------------------- void ODatabaseMetaDataResultSetMetaData::setTypeInfoMap() { - m_mColumns[3] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("PRECISION"), + m_mColumns[3] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PRECISION")), ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER); - m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("NULLABLE"), + m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NULLABLE")), ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER); - m_mColumns[12] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("AUTO_INCREMENT"), + m_mColumns[12] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AUTO_INCREMENT")), ColumnValue::NO_NULLS, 1,1,0, DataType::BIT); - m_mColumns[16] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("SQL_DATA_TYPE"), + m_mColumns[16] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQL_DATA_TYPE")), ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER); - m_mColumns[17] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("SQL_DATETIME_SUB"), + m_mColumns[17] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQL_DATETIME_SUB")), ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER); - m_mColumns[18] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("NUM_PREC_RADIX"), + m_mColumns[18] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NUM_PREC_RADIX")), ColumnValue::NO_NULLS, 1,1,0, DataType::INTEGER); @@ -260,7 +260,7 @@ void ODatabaseMetaDataResultSetMetaData::setTypeInfoMap() // ------------------------------------------------------------------------- void ODatabaseMetaDataResultSetMetaData::setProceduresMap() { - m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString::createFromAscii("REMARKS"), + m_mColumns[7] = OColumn(::rtl::OUString(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("REMARKS")), ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR); @@ -535,7 +535,7 @@ KeyTypeEnum OAdoKey::Map2KeyRule(const sal_Int32& _eNum) eNum = adKeyUnique; break; default: - OSL_ENSURE( false, "OAdoKey::Map2KeyRule: invalid key type!" ); + OSL_FAIL( "OAdoKey::Map2KeyRule: invalid key type!" ); } return eNum; } diff --git a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx index 9ae90363f9..845575eaf3 100644 --- a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx +++ b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx @@ -763,7 +763,7 @@ void ODatabaseMetaDataResultSet::setFastPropertyValue_NoBroadcast( throw Exception(); break; default: - OSL_ENSURE(0,"setFastPropertyValue_NoBroadcast: Illegal handle value!"); + OSL_FAIL("setFastPropertyValue_NoBroadcast: Illegal handle value!"); } } // ------------------------------------------------------------------------- @@ -908,13 +908,12 @@ void ODatabaseMetaDataResultSet::setColumnsMap() aMap[adFileTime] = ADOS::MapADOType2Jdbc(adFileTime); aMap[adPropVariant] = ADOS::MapADOType2Jdbc(adPropVariant); aMap[adVarNumeric] = ADOS::MapADOType2Jdbc(adVarNumeric); -// aMap[adArray] = ADOS::MapADOType2Jdbc(adArray); m_aValueRange[12] = aMap; ::std::map< sal_Int32,::rtl::OUString> aMap2; - aMap2[0] = ::rtl::OUString::createFromAscii("YES"); - aMap2[1] = ::rtl::OUString::createFromAscii("NO"); + aMap2[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("YES")); + aMap2[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NO")); m_aIntValueRange[18] = aMap2; ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this); @@ -1047,8 +1046,8 @@ void ODatabaseMetaDataResultSet::setIndexInfoMap() ::std::map< sal_Int32,::rtl::OUString> aMap3; aMap3[0] = ::rtl::OUString(); - aMap3[DB_COLLATION_ASC] = ::rtl::OUString::createFromAscii("A"); - aMap3[DB_COLLATION_DESC] = ::rtl::OUString::createFromAscii("D"); + aMap3[DB_COLLATION_ASC] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("A")); + aMap3[DB_COLLATION_DESC] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("D")); m_aIntValueRange[21] = aMap3; @@ -1069,8 +1068,8 @@ void ODatabaseMetaDataResultSet::setTablePrivilegesMap() m_aColMapping.push_back(7); ::std::map< sal_Int32,::rtl::OUString> aMap; - aMap[0] = ::rtl::OUString::createFromAscii("YES"); - aMap[1] = ::rtl::OUString::createFromAscii("NO"); + aMap[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("YES")); + aMap[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NO")); m_aIntValueRange[7] = aMap; @@ -1096,11 +1095,11 @@ void ODatabaseMetaDataResultSet::setCrossReferenceMap() m_aColMapping.push_back(18); ::std::map< ::rtl::OUString,sal_Int32> aMap; - aMap[ ::rtl::OUString::createFromAscii("CASCADE")] = KeyRule::CASCADE; - aMap[ ::rtl::OUString::createFromAscii("RESTRICT")] = KeyRule::RESTRICT; - aMap[ ::rtl::OUString::createFromAscii("SET NULL")] = KeyRule::SET_NULL; - aMap[ ::rtl::OUString::createFromAscii("SET DEFAULT")] = KeyRule::SET_DEFAULT; - aMap[ ::rtl::OUString::createFromAscii("NO ACTION")] = KeyRule::NO_ACTION; + aMap[ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CASCADE"))] = KeyRule::CASCADE; + aMap[ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RESTRICT"))] = KeyRule::RESTRICT; + aMap[ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SET NULL"))] = KeyRule::SET_NULL; + aMap[ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SET DEFAULT"))] = KeyRule::SET_DEFAULT; + aMap[ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NO ACTION"))] = KeyRule::NO_ACTION; m_aStrValueRange[14] = aMap; m_aStrValueRange[15] = aMap; diff --git a/connectivity/source/drivers/ado/ADriver.cxx b/connectivity/source/drivers/ado/ADriver.cxx index 5fd1e3d179..83a2bcdee1 100644 --- a/connectivity/source/drivers/ado/ADriver.cxx +++ b/connectivity/source/drivers/ado/ADriver.cxx @@ -93,14 +93,14 @@ void ODriver::disposing() //------------------------------------------------------------------------------ rtl::OUString ODriver::getImplementationName_Static( ) throw(RuntimeException) { - return rtl::OUString::createFromAscii("com.sun.star.comp.sdbc.ado.ODriver"); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sdbc.ado.ODriver")); } //------------------------------------------------------------------------------ Sequence< ::rtl::OUString > ODriver::getSupportedServiceNames_Static( ) throw (RuntimeException) { Sequence< ::rtl::OUString > aSNS( 2 ); - aSNS[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.Driver"); - aSNS[1] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.Driver"); + aSNS[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.Driver")); + aSNS[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.Driver")); return aSNS; } //------------------------------------------------------------------ @@ -150,7 +150,7 @@ Reference< XConnection > SAL_CALL ODriver::connect( const ::rtl::OUString& url, sal_Bool SAL_CALL ODriver::acceptsURL( const ::rtl::OUString& url ) throw(SQLException, RuntimeException) { - return (!url.compareTo(::rtl::OUString::createFromAscii("sdbc:ado:"),9)); + return (!url.compareTo(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:ado:")),9)); } // ----------------------------------------------------------------------------- void ODriver::impl_checkURL_throw(const ::rtl::OUString& _sUrl) @@ -166,6 +166,37 @@ void ODriver::impl_checkURL_throw(const ::rtl::OUString& _sUrl) Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException) { impl_checkURL_throw(url); + if ( acceptsURL(url) ) + { + ::std::vector< DriverPropertyInfo > aDriverInfo; + + Sequence< ::rtl::OUString > aBooleanValues(2); + aBooleanValues[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) ); + aBooleanValues[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) ); + + aDriverInfo.push_back(DriverPropertyInfo( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IgnoreDriverPrivileges")) + ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Ignore the privileges from the database driver.")) + ,sal_False + ,::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) ) + ,aBooleanValues) + ); + aDriverInfo.push_back(DriverPropertyInfo( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EscapeDateTime")) + ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Escape date time format.")) + ,sal_False + ,::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) ) + ,aBooleanValues) + ); + aDriverInfo.push_back(DriverPropertyInfo( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TypeInfoSettings")) + ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Defines how the type info of the database metadata should be manipulated.")) + ,sal_False + ,::rtl::OUString( ) + ,Sequence< ::rtl::OUString > ()) + ); + return Sequence< DriverPropertyInfo >(&aDriverInfo[0],aDriverInfo.size()); + } return Sequence< DriverPropertyInfo >(); } // -------------------------------------------------------------------------------- @@ -236,7 +267,7 @@ void ADOS::ThrowException(ADOConnection* _pAdoCon,const Reference< XInterface >& pErrors->AddRef( ); - // alle aufgelaufenen Fehler auslesen und ausgeben + // read all noted errors and issue them sal_Int32 nLen; pErrors->get_Count(&nLen); if (nLen) diff --git a/connectivity/source/drivers/ado/AKeys.cxx b/connectivity/source/drivers/ado/AKeys.cxx index 2966f55b55..cfdd4a82d8 100644 --- a/connectivity/source/drivers/ado/AKeys.cxx +++ b/connectivity/source/drivers/ado/AKeys.cxx @@ -88,7 +88,7 @@ sdbcx::ObjectType OKeys::appendObject( const ::rtl::OUString&, const Reference< WpADOKey aKey = pKey->getImpl(); ::rtl::OUString sName = aKey.get_Name(); if(!sName.getLength()) - aKey.put_Name(::rtl::OUString::createFromAscii("PrimaryKey") ); + aKey.put_Name(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PrimaryKey")) ); ADOKeys* pKeys = m_aCollection; if ( FAILED(pKeys->Append(OLEVariant((ADOKey*)aKey), diff --git a/connectivity/source/drivers/ado/APreparedStatement.cxx b/connectivity/source/drivers/ado/APreparedStatement.cxx index 11a15656dd..eabdef9430 100644 --- a/connectivity/source/drivers/ado/APreparedStatement.cxx +++ b/connectivity/source/drivers/ado/APreparedStatement.cxx @@ -76,9 +76,9 @@ OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const OTypeInf OSQLParseNode* pNode = aParser.parseTree(sErrorMessage,sql); if(pNode) { // special handling for parameters - /* we recusive replace all occurences of ? in the statement and replace them with name like "æ¬å" */ + /* we recusive replace all occurrences of ? in the statement and replace them with name like "æ¬å" */ sal_Int32 nParameterCount = 0; - ::rtl::OUString sDefaultName = ::rtl::OUString::createFromAscii("parame"); + ::rtl::OUString sDefaultName( RTL_CONSTASCII_USTRINGPARAM( "parame" )); replaceParameterNodeName(pNode,sDefaultName,nParameterCount); pNode->parseNodeToStr( sNewSql, _pConnection ); delete pNode; @@ -99,7 +99,7 @@ OPreparedStatement::~OPreparedStatement() { if (m_pParameters) { - OSL_ENSURE( sal_False, "OPreparedStatement::~OPreparedStatement: not disposed!" ); + OSL_FAIL( "OPreparedStatement::~OPreparedStatement: not disposed!" ); m_pParameters->Release(); m_pParameters = NULL; } @@ -225,7 +225,7 @@ void OPreparedStatement::setParameter(sal_Int32 parameterIndex, const DataTypeEn m_pParameters->get_Count(&nCount); if(nCount < (parameterIndex-1)) { - ::rtl::OUString sDefaultName = ::rtl::OUString::createFromAscii("parame"); + ::rtl::OUString sDefaultName( RTL_CONSTASCII_USTRINGPARAM( "parame" )); sDefaultName += ::rtl::OUString::valueOf(parameterIndex); ADOParameter* pParam = m_Command.CreateParameter(sDefaultName,_eType,adParamInput,_nSize,_Val); if(pParam) @@ -548,7 +548,7 @@ void OPreparedStatement::replaceParameterNodeName(OSQLParseNode* _pNode, OSQLParseNode* pChildNode = _pNode->getChild(i); if(SQL_ISRULE(pChildNode,parameter) && pChildNode->count() == 1) { - OSQLParseNode* pNewNode = new OSQLParseNode(::rtl::OUString::createFromAscii(":") ,SQL_NODE_PUNCTUATION,0); + OSQLParseNode* pNewNode = new OSQLParseNode(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(":")) ,SQL_NODE_PUNCTUATION,0); delete pChildNode->replace(pChildNode->getChild(0),pNewNode); ::rtl::OUString sParameterName = _sDefaultName; sParameterName += ::rtl::OUString::valueOf(++_rParameterCount); diff --git a/connectivity/source/drivers/ado/AResultSet.cxx b/connectivity/source/drivers/ado/AResultSet.cxx index 3a1f484bf0..e787831794 100644 --- a/connectivity/source/drivers/ado/AResultSet.cxx +++ b/connectivity/source/drivers/ado/AResultSet.cxx @@ -65,14 +65,14 @@ using namespace com::sun::star::sdbc; // IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.AResultSet","com.sun.star.sdbc.ResultSet"); ::rtl::OUString SAL_CALL OResultSet::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) \ { - return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.ado.ResultSet"); + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.ado.ResultSet")); } // ------------------------------------------------------------------------- ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL OResultSet::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) { ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(2); - aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.ResultSet"); - aSupported[1] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.ResultSet"); + aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.ResultSet")); + aSupported[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.ResultSet")); return aSupported; } // ------------------------------------------------------------------------- @@ -112,7 +112,7 @@ void OResultSet::construct() osl_incrementInterlockedCount( &m_refCount ); if (!m_pRecordSet) { - OSL_ENSURE( sal_False, "OResultSet::construct: no RecordSet!" ); + OSL_FAIL( "OResultSet::construct: no RecordSet!" ); Reference< XInterface > xInt( *this ); osl_decrementInterlockedCount( &m_refCount ); ::dbtools::throwFunctionSequenceException( xInt ); @@ -279,7 +279,7 @@ sal_Int32 SAL_CALL OResultSet::getRow( ) throw(SQLException, RuntimeException) checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - PositionEnum aPos; + PositionEnum_Param aPos; m_pRecordSet->get_AbsolutePosition(&aPos); return (aPos > 0) ? aPos : m_nRowPos; // return the rowcount from driver if the driver doesn't support this return our count @@ -906,7 +906,7 @@ sal_Bool SAL_CALL OResultSet::hasOrderedBookmarks( ) throw(SQLException, Runtim ADOS::ThrowException(*((OConnection*)m_pStmt->getConnection().get())->getConnection(),*this); OSL_ENSURE(aProps.IsValid(),"There are no properties at the connection"); - WpADOProperty aProp(aProps.GetItem(::rtl::OUString::createFromAscii("Bookmarks Ordered"))); + WpADOProperty aProp(aProps.GetItem(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Bookmarks Ordered")))); OLEVariant aVar; if(aProp.IsValid()) aVar = aProp.GetValue(); diff --git a/connectivity/source/drivers/ado/AStatement.cxx b/connectivity/source/drivers/ado/AStatement.cxx index 7e06678a26..fb7daaedcf 100644 --- a/connectivity/source/drivers/ado/AStatement.cxx +++ b/connectivity/source/drivers/ado/AStatement.cxx @@ -365,7 +365,7 @@ Sequence< sal_Int32 > SAL_CALL OStatement::executeBatch( ) throw(SQLException, ::rtl::OUString aBatchSql; sal_Int32 nLen = 0; for(::std::list< ::rtl::OUString>::const_iterator i=m_aBatchList.begin();i != m_aBatchList.end();++i,++nLen) - aBatchSql = aBatchSql + *i + ::rtl::OUString::createFromAscii(";"); + aBatchSql = aBatchSql + *i + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(";")); if ( m_RecordSet.IsValid() ) @@ -390,7 +390,7 @@ Sequence< sal_Int32 > SAL_CALL OStatement::executeBatch( ) throw(SQLException, { assignRecordSet( pSet ); - sal_Int32 nValue; + ADO_LONGPTR nValue; if(m_RecordSet.get_RecordCount(nValue)) pArray[j] = nValue; } @@ -443,7 +443,7 @@ sal_Int32 SAL_CALL OStatement_Base::getUpdateCount( ) throw(SQLException, Runti checkDisposed(OStatement_BASE::rBHelper.bDisposed); - sal_Int32 nRet; + ADO_LONGPTR nRet; if(m_RecordSet.IsValid() && m_RecordSet.get_RecordCount(nRet)) return nRet; return -1; @@ -512,7 +512,7 @@ sal_Int32 OStatement_Base::getQueryTimeOut() const throw(SQLException, RuntimeE //------------------------------------------------------------------------------ sal_Int32 OStatement_Base::getMaxRows() const throw(SQLException, RuntimeException) { - sal_Int32 nRet=-1; + ADO_LONGPTR nRet=-1; if(!(m_RecordSet.IsValid() && m_RecordSet.get_MaxRecords(nRet))) ::dbtools::throwFunctionSequenceException(NULL); return nRet; @@ -735,7 +735,7 @@ sal_Bool OStatement_Base::convertFastPropertyValue( catch( const Exception& e ) { bModified = sal_True; // will ensure that the property is set - OSL_ENSURE( sal_False, "OStatement_Base::convertFastPropertyValue: caught something strange!" ); + OSL_FAIL( "OStatement_Base::convertFastPropertyValue: caught something strange!" ); (void)e; } return bModified; diff --git a/connectivity/source/drivers/ado/Aolevariant.cxx b/connectivity/source/drivers/ado/Aolevariant.cxx index 136c81b923..c22e7e2c90 100644 --- a/connectivity/source/drivers/ado/Aolevariant.cxx +++ b/connectivity/source/drivers/ado/Aolevariant.cxx @@ -451,7 +451,7 @@ void OLEVariant::ChangeType(VARTYPE vartype, const OLEVariant* pSrc) throw ::com::sun::star::sdbc::SQLException( sError, NULL, - ::rtl::OUString::createFromAscii( "S1000" ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "S1000" )), 1000, ::com::sun::star::uno::Any() ); diff --git a/connectivity/source/drivers/ado/Aservices.cxx b/connectivity/source/drivers/ado/Aservices.cxx index b182b93277..68600ba2d7 100644 --- a/connectivity/source/drivers/ado/Aservices.cxx +++ b/connectivity/source/drivers/ado/Aservices.cxx @@ -30,13 +30,11 @@ #include "precompiled_connectivity.hxx" #include "ado/ADriver.hxx" #include <cppuhelper/factory.hxx> -#include <osl/diagnose.h> using namespace connectivity::ado; using ::rtl::OUString; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; -using ::com::sun::star::registry::XRegistryKey; using ::com::sun::star::lang::XSingleServiceFactory; using ::com::sun::star::lang::XMultiServiceFactory; @@ -49,31 +47,6 @@ typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc) rtl_ModuleCount* _pT ); -//*************************************************************************************** -// -// Die vorgeschriebene C-Api muss erfuellt werden! -// Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen. -// - -//--------------------------------------------------------------------------------------- -void REGISTER_PROVIDER( - const OUString& aServiceImplName, - const Sequence< OUString>& Services, - const Reference< ::com::sun::star::registry::XRegistryKey > & xKey) -{ - OUString aMainKeyName; - aMainKeyName = OUString::createFromAscii("/"); - aMainKeyName += aServiceImplName; - aMainKeyName += OUString::createFromAscii("/UNO/SERVICES"); - - Reference< ::com::sun::star::registry::XRegistryKey > xNewKey( xKey->createKey(aMainKeyName) ); - OSL_ENSURE(xNewKey.is(), "ADO::component_writeInfo : could not create a registry key !"); - - for (sal_Int32 i=0; i<Services.getLength(); ++i) - xNewKey->createKey(Services[i]); -} - - //--------------------------------------------------------------------------------------- struct ProviderRequest { @@ -86,7 +59,7 @@ struct ProviderRequest sal_Char const* pImplementationName ) : xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager)) - , sImplementationName(OUString::createFromAscii(pImplementationName)) + , sImplementationName(OUString(RTL_CONSTASCII_USTRINGPARAM(pImplementationName))) { } @@ -113,7 +86,6 @@ struct ProviderRequest }; //--------------------------------------------------------------------------------------- - extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char **ppEnvTypeName, uno_Environment ** /*ppEnv*/ @@ -123,31 +95,6 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( } //--------------------------------------------------------------------------------------- -extern "C" sal_Bool SAL_CALL component_writeInfo( - void* /*pServiceManager*/, - void* pRegistryKey - ) -{ - if (pRegistryKey) - try - { - Reference< ::com::sun::star::registry::XRegistryKey > xKey(reinterpret_cast< ::com::sun::star::registry::XRegistryKey*>(pRegistryKey)); - - REGISTER_PROVIDER( - ODriver::getImplementationName_Static(), - ODriver::getSupportedServiceNames_Static(), xKey); - - return sal_True; - } - catch (::com::sun::star::registry::InvalidRegistryException& ) - { - OSL_ENSURE(sal_False, "ADO::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !"); - } - - return sal_False; -} - -//--------------------------------------------------------------------------------------- extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplementationName, void* pServiceManager, diff --git a/connectivity/source/drivers/ado/Awrapado.cxx b/connectivity/source/drivers/ado/Awrapado.cxx index 37a64258cb..47886990a6 100644 --- a/connectivity/source/drivers/ado/Awrapado.cxx +++ b/connectivity/source/drivers/ado/Awrapado.cxx @@ -409,7 +409,7 @@ CommandTypeEnum WpADOCommand::get_CommandType( ) const return eNum; } -// gibt den Namen des Feldes zur"ueck +// returns the name of the field ::rtl::OUString WpADOCommand::GetName() const { OSL_ENSURE(pInterface,"Interface is null!"); @@ -485,7 +485,7 @@ WpADOProperties WpADOField::get_Properties() sal_Int32 WpADOField::GetActualSize() const { OSL_ENSURE(pInterface,"Interface is null!"); - sal_Int32 nActualSize=0; + ADO_LONGPTR nActualSize=0; pInterface->get_ActualSize(&nActualSize); return nActualSize; } @@ -509,12 +509,12 @@ sal_Int32 WpADOField::GetStatus() const sal_Int32 WpADOField::GetDefinedSize() const { OSL_ENSURE(pInterface,"Interface is null!"); - sal_Int32 nDefinedSize=0; + ADO_LONGPTR nDefinedSize=0; pInterface->get_DefinedSize(&nDefinedSize); return nDefinedSize; } -// gibt den Namen des Feldes zur"ueck +// returns the name of the field ::rtl::OUString WpADOField::GetName() const { OSL_ENSURE(pInterface,"Interface is null!"); @@ -776,10 +776,10 @@ void WpADORecordset::Close() return bSupports == VARIANT_TRUE; } -PositionEnum WpADORecordset::get_AbsolutePosition() +PositionEnum_Param WpADORecordset::get_AbsolutePosition() { OSL_ENSURE(pInterface,"Interface is null!"); - PositionEnum aTemp=adPosUnknown; + PositionEnum_Param aTemp=adPosUnknown; pInterface->get_AbsolutePosition(&aTemp); return aTemp; } @@ -898,19 +898,19 @@ WpADOProperties WpADORecordset::get_Properties() const return SUCCEEDED(pInterface->NextRecordset(&RecordsAffected,ppiRset)); } - sal_Bool WpADORecordset::get_RecordCount(sal_Int32 &_nRet) const + sal_Bool WpADORecordset::get_RecordCount(ADO_LONGPTR &_nRet) const { OSL_ENSURE(pInterface,"Interface is null!"); return SUCCEEDED(pInterface->get_RecordCount(&_nRet)); } - sal_Bool WpADORecordset::get_MaxRecords(sal_Int32 &_nRet) const + sal_Bool WpADORecordset::get_MaxRecords(ADO_LONGPTR &_nRet) const { OSL_ENSURE(pInterface,"Interface is null!"); return SUCCEEDED(pInterface->get_MaxRecords(&_nRet)); } - sal_Bool WpADORecordset::put_MaxRecords(sal_Int32 _nRet) + sal_Bool WpADORecordset::put_MaxRecords(ADO_LONGPTR _nRet) { OSL_ENSURE(pInterface,"Interface is null!"); return SUCCEEDED(pInterface->put_MaxRecords(_nRet)); @@ -2006,7 +2006,7 @@ ADORecordset* WpADOConnection::getTables( const ::com::sun::star::uno::Any& cata ++nPos; ::rtl::OUStringBuffer aTypes; - ::rtl::OUString aComma = ::rtl::OUString::createFromAscii(","); + ::rtl::OUString aComma( RTL_CONSTASCII_USTRINGPARAM( "," )); const ::rtl::OUString* pIter = types.getConstArray(); const ::rtl::OUString* pEnd = pIter + types.getLength(); for( ; pIter != pEnd ; ++pIter) diff --git a/connectivity/source/drivers/ado/ado.component b/connectivity/source/drivers/ado/ado.component new file mode 100755 index 0000000000..1962a6b710 --- /dev/null +++ b/connectivity/source/drivers/ado/ado.component @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.sdbc.ado.ODriver"> + <service name="com.sun.star.sdbc.Driver"/> + <service name="com.sun.star.sdbcx.Driver"/> + </implementation> +</component> diff --git a/connectivity/source/drivers/ado/ado.xcu b/connectivity/source/drivers/ado/ado.xcu index 3f822de5f7..d7ea2c4d78 100755..100644 --- a/connectivity/source/drivers/ado/ado.xcu +++ b/connectivity/source/drivers/ado/ado.xcu @@ -164,6 +164,11 @@ <value>false</value> </prop> </node> + <node oor:name="TypeInfoSettings" oor:op="replace"> + <prop oor:name="Value" oor:type="oor:string-list"> + <value oor:separator=",">Column(2) = 16,Column(3) = 1</value> + </prop> + </node> </node> <node oor:name="Features"> <node oor:name="UseSQL92NamingConstraints" oor:op="replace"> diff --git a/connectivity/source/drivers/ado/ado.xml b/connectivity/source/drivers/ado/ado.xml index 2be460df8f..2be460df8f 100644..100755 --- a/connectivity/source/drivers/ado/ado.xml +++ b/connectivity/source/drivers/ado/ado.xml diff --git a/connectivity/source/drivers/ado/ado_post_sys_include.h b/connectivity/source/drivers/ado/ado_post_sys_include.h index 459fa29489..459fa29489 100644..100755 --- a/connectivity/source/drivers/ado/ado_post_sys_include.h +++ b/connectivity/source/drivers/ado/ado_post_sys_include.h diff --git a/connectivity/source/drivers/ado/ado_pre_sys_include.h b/connectivity/source/drivers/ado/ado_pre_sys_include.h index b1ac0e3e51..b1ac0e3e51 100644..100755 --- a/connectivity/source/drivers/ado/ado_pre_sys_include.h +++ b/connectivity/source/drivers/ado/ado_pre_sys_include.h diff --git a/connectivity/source/drivers/ado/adoimp.cxx b/connectivity/source/drivers/ado/adoimp.cxx index ad6c2e915e..b1075a2f0f 100644 --- a/connectivity/source/drivers/ado/adoimp.cxx +++ b/connectivity/source/drivers/ado/adoimp.cxx @@ -106,7 +106,7 @@ sal_Int32 ADOS::MapADOType2Jdbc(DataTypeEnum eType) case adDBTime: nType = DataType::TIME; break; case adDate: case adDBTimeStamp: nType = DataType::TIMESTAMP; break; - case adBoolean: nType = DataType::BIT; break; + case adBoolean: nType = DataType::BOOLEAN; break; // case adArray: nType = DataType::ARRAY; break; case adBinary: nType = DataType::BINARY; break; case adGUID: nType = DataType::OBJECT; break; @@ -132,7 +132,7 @@ sal_Int32 ADOS::MapADOType2Jdbc(DataTypeEnum eType) case adVariant: nType = DataType::OTHER; break; default: - OSL_ENSURE(0,"MapADOType2Jdbc: Unknown Type!"); + OSL_FAIL("MapADOType2Jdbc: Unknown Type!"); ; } return nType; @@ -152,6 +152,7 @@ DataTypeEnum ADOS::MapJdbc2ADOType(sal_Int32 _nType,sal_Int32 _nJetEngine) case DataType::DATE: return isJetEngine(_nJetEngine) ? adDate : adDBDate; break; case DataType::TIME: return adDBTime; break; case DataType::TIMESTAMP: return isJetEngine(_nJetEngine) ? adDate : adDBTimeStamp; break; + case DataType::BOOLEAN: case DataType::BIT: return adBoolean; break; case DataType::BINARY: return adBinary; break; case DataType::VARCHAR: return adVarWChar; break; @@ -164,7 +165,7 @@ DataTypeEnum ADOS::MapJdbc2ADOType(sal_Int32 _nType,sal_Int32 _nJetEngine) case DataType::TINYINT: return isJetEngine(_nJetEngine) ? adUnsignedTinyInt : adTinyInt;break; case DataType::OBJECT: return adGUID; break; default: - OSL_ENSURE(0,"MapJdbc2ADOType: Unknown Type!"); + OSL_FAIL("MapJdbc2ADOType: Unknown Type!"); ; } return adEmpty; @@ -263,7 +264,7 @@ sal_Int32 ADOS::mapAdoType2Object(ObjectTypeEnum objType) nType = PrivilegeObject::COLUMN; break; default: - OSL_ENSURE( false, "ADOS::mapAdoType2Object: privilege type cannot be translated!" ); + OSL_FAIL( "ADOS::mapAdoType2Object: privilege type cannot be translated!" ); break; } return nType; diff --git a/connectivity/source/drivers/ado/exports.dxp b/connectivity/source/drivers/ado/exports.dxp index 9630d7e067..f0e1c69934 100644..100755 --- a/connectivity/source/drivers/ado/exports.dxp +++ b/connectivity/source/drivers/ado/exports.dxp @@ -1,3 +1,2 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory diff --git a/connectivity/source/drivers/ado/makefile.mk b/connectivity/source/drivers/ado/makefile.mk index 54bebe6a28..02b72a7e7a 100644..100755 --- a/connectivity/source/drivers/ado/makefile.mk +++ b/connectivity/source/drivers/ado/makefile.mk @@ -31,9 +31,8 @@ PRJNAME=connectivity TARGET=ado VISIBILITY_HIDDEN=TRUE -# ENABLE_EXCEPTIONS=TRUE - # --- Settings ---------------------------------- + .IF "$(DBGUTIL_OJ)"!="" ENVCFLAGS+=/FR$(SLO)$/ .ENDIF @@ -97,7 +96,6 @@ SHL1STDLIBS=\ SHL1STDLIBS+= icomphelp2.lib .ENDIF -#SHL1DEPN= SHL1IMPLIB= i$(SHL1TARGET) SHL1DEF= $(MISC)$/$(SHL1TARGET).def @@ -112,3 +110,11 @@ dummy: # --- Targets ---------------------------------- .INCLUDE : $(PRJ)$/target.pmk + +ALLTAR : $(MISC)/ado.component + +$(MISC)/ado.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + ado.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt ado.component diff --git a/connectivity/source/drivers/calc/CCatalog.cxx b/connectivity/source/drivers/calc/CCatalog.cxx index 43142bc18e..985a3b21df 100644 --- a/connectivity/source/drivers/calc/CCatalog.cxx +++ b/connectivity/source/drivers/calc/CCatalog.cxx @@ -58,7 +58,7 @@ void OCalcCatalog::refreshTables() Sequence< ::rtl::OUString > aTypes; OCalcConnection::ODocHolder aDocHodler(((OCalcConnection*)m_pConnection)); Reference< XResultSet > xResult = m_xMetaData->getTables(Any(), - ::rtl::OUString::createFromAscii("%"),::rtl::OUString::createFromAscii("%"),aTypes); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),aTypes); if(xResult.is()) { diff --git a/connectivity/source/drivers/calc/CConnection.cxx b/connectivity/source/drivers/calc/CConnection.cxx index bbe3990afb..44f6f89928 100644 --- a/connectivity/source/drivers/calc/CConnection.cxx +++ b/connectivity/source/drivers/calc/CConnection.cxx @@ -124,24 +124,24 @@ Reference< XSpreadsheetDocument> OCalcConnection::acquireDoc() } // open read-only as long as updating isn't implemented Sequence<PropertyValue> aArgs(2); - aArgs[0].Name = ::rtl::OUString::createFromAscii("Hidden"); + aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Hidden")); aArgs[0].Value <<= (sal_Bool) sal_True; - aArgs[1].Name = ::rtl::OUString::createFromAscii("ReadOnly"); + aArgs[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly")); aArgs[1].Value <<= (sal_Bool) sal_True; if ( m_sPassword.getLength() ) { const sal_Int32 nPos = aArgs.getLength(); aArgs.realloc(nPos+1); - aArgs[nPos].Name = ::rtl::OUString::createFromAscii("Password"); + aArgs[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Password")); aArgs[nPos].Value <<= m_sPassword; } Reference< XComponentLoader > xDesktop( getDriver()->getFactory()->createInstance( - ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop")), UNO_QUERY ); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))), UNO_QUERY ); if (!xDesktop.is()) { - OSL_ASSERT("no desktop"); + OSL_FAIL("no desktop"); throw SQLException(); } Reference< XComponent > xComponent; @@ -149,7 +149,7 @@ Reference< XSpreadsheetDocument> OCalcConnection::acquireDoc() try { xComponent = xDesktop->loadComponentFromURL( - m_aFileName, ::rtl::OUString::createFromAscii("_blank"), 0, aArgs ); + m_aFileName, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_blank")), 0, aArgs ); } catch( const Exception& ) { diff --git a/connectivity/source/drivers/calc/CDatabaseMetaData.cxx b/connectivity/source/drivers/calc/CDatabaseMetaData.cxx index 80f22f5f59..c25d533d57 100644 --- a/connectivity/source/drivers/calc/CDatabaseMetaData.cxx +++ b/connectivity/source/drivers/calc/CDatabaseMetaData.cxx @@ -92,7 +92,7 @@ Reference< XResultSet > OCalcDatabaseMetaData::impl_getTypeInfo_throw( ) aRow.reserve(18); aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(new ORowSetValueDecorator(::rtl::OUString::createFromAscii("VARCHAR"))); + aRow.push_back(new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VARCHAR")))); aRow.push_back(new ORowSetValueDecorator(DataType::VARCHAR)); aRow.push_back(new ORowSetValueDecorator((sal_Int32)65535)); aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue()); @@ -114,35 +114,35 @@ Reference< XResultSet > OCalcDatabaseMetaData::impl_getTypeInfo_throw( ) aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DECIMAL")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DECIMAL"))); aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL); aRow[3] = ODatabaseMetaDataResultSet::get0Value(); aRow[9] = ODatabaseMetaDataResultSet::getBasicValue(); aRow[15] = ODatabaseMetaDataResultSet::get0Value(); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("BOOL")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BOOL"))); aRow[2] = new ORowSetValueDecorator(DataType::BIT); aRow[3] = new ORowSetValueDecorator((sal_Int32)20); aRow[9] = ODatabaseMetaDataResultSet::getBasicValue(); aRow[15] = new ORowSetValueDecorator((sal_Int32)15); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DATE")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DATE"))); aRow[2] = new ORowSetValueDecorator(DataType::DATE); aRow[3] = ODatabaseMetaDataResultSet::get0Value(); aRow[9] = ODatabaseMetaDataResultSet::getBasicValue(); aRow[15] = ODatabaseMetaDataResultSet::get0Value(); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIME")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIME"))); aRow[2] = new ORowSetValueDecorator(DataType::TIME); aRow[3] = ODatabaseMetaDataResultSet::get0Value(); aRow[9] = ODatabaseMetaDataResultSet::getBasicValue(); aRow[15] = ODatabaseMetaDataResultSet::get0Value(); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIMESTAMP")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP"))); aRow[2] = new ORowSetValueDecorator(DataType::TIMESTAMP); aRow[3] = ODatabaseMetaDataResultSet::get0Value(); aRow[9] = ODatabaseMetaDataResultSet::getBasicValue(); @@ -231,10 +231,10 @@ Reference< XResultSet > SAL_CALL OCalcDatabaseMetaData::getColumns( switch(sal_Int32(aRow[11]->getValue())) { case ColumnValue::NO_NULLS: - aRow[18] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("NO")); + aRow[18] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NO"))); break; case ColumnValue::NULLABLE: - aRow[18] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("YES")); + aRow[18] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("YES"))); break; default: aRow[18] = new ORowSetValueDecorator(::rtl::OUString()); @@ -310,7 +310,7 @@ sal_Bool lcl_IsEmptyOrHidden( const Reference<XSpreadsheets>& xSheets, const ::r if (xProp.is()) { sal_Bool bVisible = sal_Bool(); - Any aVisAny = xProp->getPropertyValue( ::rtl::OUString::createFromAscii("IsVisible") ); + Any aVisAny = xProp->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsVisible")) ); if ( aVisAny >>= bVisible ) if (!bVisible) return sal_True; // hidden @@ -353,7 +353,7 @@ sal_Bool lcl_IsUnnamed( const Reference<XDatabaseRanges>& xRanges, const ::rtl:: { try { - Any aUserAny = xRangeProp->getPropertyValue( ::rtl::OUString::createFromAscii("IsUserDefined") ); + Any aUserAny = xRangeProp->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsUserDefined")) ); sal_Bool bUserDefined = sal_Bool(); if ( aUserAny >>= bUserDefined ) bUnnamed = !bUserDefined; @@ -384,7 +384,7 @@ Reference< XResultSet > SAL_CALL OCalcDatabaseMetaData::getTables( // check if ORowSetValue type is given // when no types are given then we have to return all tables e.g. TABLE - ::rtl::OUString aTable(::rtl::OUString::createFromAscii("TABLE")); + ::rtl::OUString aTable(RTL_CONSTASCII_USTRINGPARAM("TABLE")); sal_Bool bTableFound = sal_True; sal_Int32 nLength = types.getLength(); @@ -438,7 +438,7 @@ Reference< XResultSet > SAL_CALL OCalcDatabaseMetaData::getTables( Reference<XPropertySet> xDocProp( xDoc, UNO_QUERY ); if ( xDocProp.is() ) { - Any aRangesAny = xDocProp->getPropertyValue( ::rtl::OUString::createFromAscii("DatabaseRanges") ); + Any aRangesAny = xDocProp->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DatabaseRanges")) ); Reference<XDatabaseRanges> xRanges; if ( aRangesAny >>= xRanges ) { diff --git a/connectivity/source/drivers/calc/CDriver.cxx b/connectivity/source/drivers/calc/CDriver.cxx index 4f3cb57ef4..4317829cf9 100644 --- a/connectivity/source/drivers/calc/CDriver.cxx +++ b/connectivity/source/drivers/calc/CDriver.cxx @@ -49,7 +49,7 @@ using namespace ::com::sun::star::lang; rtl::OUString ODriver::getImplementationName_Static( ) throw(RuntimeException) { - return rtl::OUString::createFromAscii("com.sun.star.comp.sdbc.calc.ODriver"); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sdbc.calc.ODriver")); } ::rtl::OUString SAL_CALL ODriver::getImplementationName( ) throw(RuntimeException) @@ -89,7 +89,7 @@ Reference< XConnection > SAL_CALL ODriver::connect( const ::rtl::OUString& url, sal_Bool SAL_CALL ODriver::acceptsURL( const ::rtl::OUString& url ) throw(SQLException, RuntimeException) { - return url.compareTo(::rtl::OUString::createFromAscii("sdbc:calc:"),10) == 0; + return url.compareTo(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:calc:")),10) == 0; } Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/calc/CResultSet.cxx b/connectivity/source/drivers/calc/CResultSet.cxx index e218ce7f00..4429ec9950 100644 --- a/connectivity/source/drivers/calc/CResultSet.cxx +++ b/connectivity/source/drivers/calc/CResultSet.cxx @@ -44,8 +44,7 @@ using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace com::sun::star::sdbc; using namespace com::sun::star::sdbcx; -// using namespace com::sun::star::container; -// using namespace com::sun::star::util; + //------------------------------------------------------------------------------ OCalcResultSet::OCalcResultSet( OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator) : file::OResultSet(pStmt,_aSQLIterator) @@ -56,14 +55,14 @@ OCalcResultSet::OCalcResultSet( OStatement_Base* pStmt,connectivity::OSQLParseTr // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OCalcResultSet::getImplementationName( ) throw ( RuntimeException) { - return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.calc.ResultSet"); + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.calc.ResultSet")); } // ------------------------------------------------------------------------- Sequence< ::rtl::OUString > SAL_CALL OCalcResultSet::getSupportedServiceNames( ) throw( RuntimeException) { Sequence< ::rtl::OUString > aSupported(2); - aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.ResultSet"); - aSupported[1] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.ResultSet"); + aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.ResultSet")); + aSupported[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.ResultSet")); return aSupported; } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx index 5a005d22d3..64efd5f09e 100644 --- a/connectivity/source/drivers/calc/CTable.cxx +++ b/connectivity/source/drivers/calc/CTable.cxx @@ -467,8 +467,8 @@ void OCalcTable::fillColumns() String aStrFieldName; aStrFieldName.AssignAscii("Column"); ::rtl::OUString aTypeName; - ::comphelper::UStringMixEqual aCase(m_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers()); - const sal_Bool bStoresMixedCaseQuotedIdentifiers = getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers(); + ::comphelper::UStringMixEqual aCase(m_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers()); + const sal_Bool bStoresMixedCaseQuotedIdentifiers = getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers(); for (sal_Int32 i = 0; i < m_nDataCols; i++) { @@ -494,22 +494,22 @@ void OCalcTable::fillColumns() } break; case DataType::DECIMAL: - aTypeName = ::rtl::OUString::createFromAscii("DECIMAL"); + aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DECIMAL")); break; case DataType::BIT: - aTypeName = ::rtl::OUString::createFromAscii("BOOL"); + aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BOOL")); break; case DataType::DATE: - aTypeName = ::rtl::OUString::createFromAscii("DATE"); + aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DATE")); break; case DataType::TIME: - aTypeName = ::rtl::OUString::createFromAscii("TIME"); + aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIME")); break; case DataType::TIMESTAMP: - aTypeName = ::rtl::OUString::createFromAscii("TIMESTAMP"); + aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP")); break; default: - OSL_ASSERT("missing type name"); + OSL_FAIL("missing type name"); aTypeName = ::rtl::OUString(); } @@ -826,12 +826,12 @@ sal_Bool OCalcTable::fetchRow( OValueRefRow& _rRow, const OSQLColumns & _rCols, RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTable::fetchRow" ); // read the bookmark - BOOL bIsCurRecordDeleted = sal_False; + sal_Bool bIsCurRecordDeleted = sal_False; _rRow->setDeleted(bIsCurRecordDeleted); *(_rRow->get())[0] = m_nFilePos; if (!bRetrieveData) - return TRUE; + return sal_True; // fields diff --git a/connectivity/source/drivers/calc/CTables.cxx b/connectivity/source/drivers/calc/CTables.cxx index 1652523459..2cee66ace7 100644 --- a/connectivity/source/drivers/calc/CTables.cxx +++ b/connectivity/source/drivers/calc/CTables.cxx @@ -52,7 +52,7 @@ sdbcx::ObjectType OCalcTables::createObject(const ::rtl::OUString& _rName) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "calc", "Ocke.Janssen@sun.com", "OCalcTables::createObject" ); OCalcTable* pTable = new OCalcTable(this,(OCalcConnection*)static_cast<OFileCatalog&>(m_rParent).getConnection(), - _rName,::rtl::OUString::createFromAscii("TABLE")); + _rName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE"))); sdbcx::ObjectType xRet = pTable; pTable->construct(); return xRet; diff --git a/connectivity/source/drivers/calc/CalcDriver.xml b/connectivity/source/drivers/calc/CalcDriver.xml index 31a73e8bdd..31a73e8bdd 100644..100755 --- a/connectivity/source/drivers/calc/CalcDriver.xml +++ b/connectivity/source/drivers/calc/CalcDriver.xml diff --git a/connectivity/source/drivers/calc/Cservices.cxx b/connectivity/source/drivers/calc/Cservices.cxx index 4af845930d..25a285d5bd 100644 --- a/connectivity/source/drivers/calc/Cservices.cxx +++ b/connectivity/source/drivers/calc/Cservices.cxx @@ -30,13 +30,11 @@ #include "precompiled_connectivity.hxx" #include "calc/CDriver.hxx" #include <cppuhelper/factory.hxx> -#include <osl/diagnose.h> using namespace connectivity::calc; using ::rtl::OUString; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; -using ::com::sun::star::registry::XRegistryKey; using ::com::sun::star::lang::XSingleServiceFactory; using ::com::sun::star::lang::XMultiServiceFactory; @@ -49,31 +47,6 @@ typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc) rtl_ModuleCount* _pT ); -//*************************************************************************************** -// -// Die vorgeschriebene C-Api muss erfuellt werden! -// Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen. -// - -//--------------------------------------------------------------------------------------- -void REGISTER_PROVIDER( - const OUString& aServiceImplName, - const Sequence< OUString>& Services, - const Reference< ::com::sun::star::registry::XRegistryKey > & xKey) -{ - OUString aMainKeyName; - aMainKeyName = OUString::createFromAscii("/"); - aMainKeyName += aServiceImplName; - aMainKeyName += OUString::createFromAscii("/UNO/SERVICES"); - - Reference< ::com::sun::star::registry::XRegistryKey > xNewKey( xKey->createKey(aMainKeyName) ); - OSL_ENSURE(xNewKey.is(), "FILE::component_writeInfo : could not create a registry key !"); - - for (sal_Int32 i=0; i<Services.getLength(); ++i) - xNewKey->createKey(Services[i]); -} - - //--------------------------------------------------------------------------------------- struct ProviderRequest { @@ -113,7 +86,6 @@ struct ProviderRequest }; //--------------------------------------------------------------------------------------- - extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char **ppEnvTypeName, @@ -124,31 +96,6 @@ component_getImplementationEnvironment( } //--------------------------------------------------------------------------------------- -extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( - void* /*pServiceManager*/, - void* pRegistryKey - ) -{ - if (pRegistryKey) - try - { - Reference< ::com::sun::star::registry::XRegistryKey > xKey(reinterpret_cast< ::com::sun::star::registry::XRegistryKey*>(pRegistryKey)); - - REGISTER_PROVIDER( - ODriver::getImplementationName_Static(), - ODriver::getSupportedServiceNames_Static(), xKey); - - return sal_True; - } - catch (::com::sun::star::registry::InvalidRegistryException& ) - { - OSL_ENSURE(sal_False, "FILE::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !"); - } - - return sal_False; -} - -//--------------------------------------------------------------------------------------- extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplementationName, void* pServiceManager, diff --git a/connectivity/source/drivers/calc/calc.component b/connectivity/source/drivers/calc/calc.component new file mode 100755 index 0000000000..be949f70de --- /dev/null +++ b/connectivity/source/drivers/calc/calc.component @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.sdbc.calc.ODriver"> + <service name="com.sun.star.sdbc.Driver"/> + <service name="com.sun.star.sdbcx.Driver"/> + </implementation> +</component> diff --git a/connectivity/source/drivers/calc/calc.xcu b/connectivity/source/drivers/calc/calc.xcu index ec71ed3caf..ec71ed3caf 100755..100644 --- a/connectivity/source/drivers/calc/calc.xcu +++ b/connectivity/source/drivers/calc/calc.xcu diff --git a/connectivity/source/drivers/calc/exports.dxp b/connectivity/source/drivers/calc/exports.dxp index 9630d7e067..f0e1c69934 100644..100755 --- a/connectivity/source/drivers/calc/exports.dxp +++ b/connectivity/source/drivers/calc/exports.dxp @@ -1,3 +1,2 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory diff --git a/connectivity/source/drivers/calc/makefile.mk b/connectivity/source/drivers/calc/makefile.mk index c42d52285f..d36438a277 100644..100755 --- a/connectivity/source/drivers/calc/makefile.mk +++ b/connectivity/source/drivers/calc/makefile.mk @@ -34,6 +34,7 @@ ENABLE_EXCEPTIONS=TRUE VISIBILITY_HIDDEN=TRUE # --- Settings ---------------------------------- + .IF "$(DBGUTIL_OJ)"!="" ENVCFLAGS+=/FR$(SLO)$/ .ENDIF @@ -41,7 +42,6 @@ ENVCFLAGS+=/FR$(SLO)$/ .INCLUDE : $(PRJ)$/makefile.pmk .INCLUDE : $(PRJ)$/version.mk - # --- Files ------------------------------------- SLOFILES=\ @@ -76,10 +76,6 @@ SHL1STDLIBS=\ $(COMPHELPERLIB) -#.IF "$(DBFILELIB)" == "" -#SHL1STDLIBS+= ifile.lib -#.ENDIF - SHL1DEPN= SHL1IMPLIB= i$(TARGET) @@ -88,9 +84,16 @@ SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME= $(SHL1TARGET) DEF1EXPORTFILE= exports.dxp - # --- Targets ---------------------------------- .INCLUDE : $(PRJ)$/target.pmk + +ALLTAR : $(MISC)/calc.component + +$(MISC)/calc.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + calc.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt calc.component diff --git a/connectivity/source/drivers/dbase/DCatalog.cxx b/connectivity/source/drivers/dbase/DCatalog.cxx index 5663835343..3e5f2b8bde 100644 --- a/connectivity/source/drivers/dbase/DCatalog.cxx +++ b/connectivity/source/drivers/dbase/DCatalog.cxx @@ -54,7 +54,7 @@ void ODbaseCatalog::refreshTables() TStringVector aVector; Sequence< ::rtl::OUString > aTypes; Reference< XResultSet > xResult = m_xMetaData->getTables(Any(), - ::rtl::OUString::createFromAscii("%"),::rtl::OUString::createFromAscii("%"),aTypes); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),aTypes); if(xResult.is()) { diff --git a/connectivity/source/drivers/dbase/DCode.cxx b/connectivity/source/drivers/dbase/DCode.cxx index 5ac5414163..9a21d955ae 100644 --- a/connectivity/source/drivers/dbase/DCode.cxx +++ b/connectivity/source/drivers/dbase/DCode.cxx @@ -115,7 +115,7 @@ OEvaluateSet* OFILEOperandAttr::preProcess(OBoolOperator* pOp, OOperand* pRight) if (pIter) { pEvaluateSet = new OEvaluateSet(); - ULONG nRec = pIter->First(); + sal_uIntPtr nRec = pIter->First(); while (nRec != NODE_NOTFOUND) { (*pEvaluateSet)[nRec] = nRec; diff --git a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx index 85288e86f2..004875c606 100644 --- a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx +++ b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx @@ -83,12 +83,12 @@ Reference< XResultSet > ODbaseDatabaseMetaData::impl_getTypeInfo_throw( ) aRow.reserve(18); aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(new ORowSetValueDecorator(::rtl::OUString::createFromAscii("VARCHAR"))); + aRow.push_back(new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VARCHAR")))); aRow.push_back(new ORowSetValueDecorator(DataType::VARCHAR)); aRow.push_back(new ORowSetValueDecorator((sal_Int32)254)); aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue()); aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue()); - aRow.push_back(new ORowSetValueDecorator(::rtl::OUString::createFromAscii("length"))); + aRow.push_back(new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("length")))); aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnValue::NULLABLE)); aRow.push_back(ODatabaseMetaDataResultSet::get1Value()); aRow.push_back(new ORowSetValueDecorator((sal_Int32)ColumnSearch::FULL)); @@ -104,20 +104,20 @@ Reference< XResultSet > ODbaseDatabaseMetaData::impl_getTypeInfo_throw( ) aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("LONGVARCHAR")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LONGVARCHAR"))); aRow[2] = new ORowSetValueDecorator(DataType::LONGVARCHAR); aRow[3] = new ORowSetValueDecorator((sal_Int32)2147483647); aRow[6] = new ORowSetValueDecorator(); aRow[13] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("M"))); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DATE")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DATE"))); aRow[2] = new ORowSetValueDecorator(DataType::DATE); aRow[3] = new ORowSetValueDecorator((sal_Int32)10); aRow[13] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("D"))); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("BOOLEAN")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BOOLEAN"))); aRow[2] = new ORowSetValueDecorator(DataType::BIT); aRow[3] = ODatabaseMetaDataResultSet::get1Value(); aRow[4] = ODatabaseMetaDataResultSet::getEmptyValue(); @@ -127,36 +127,36 @@ Reference< XResultSet > ODbaseDatabaseMetaData::impl_getTypeInfo_throw( ) aRow[13] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("L"))); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DOUBLE")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DOUBLE"))); aRow[2] = new ORowSetValueDecorator(DataType::DOUBLE); aRow[3] = new ORowSetValueDecorator((sal_Int32)8); aRow[13] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("B"))); aRows.push_back(aRow); aRow[11] = new ORowSetValueDecorator(sal_True); - aRow[13] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("Y")); + aRow[13] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Y"))); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIMESTAMP")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP"))); aRow[2] = new ORowSetValueDecorator(DataType::TIMESTAMP); aRow[11] = new ORowSetValueDecorator(sal_False); aRow[13] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("T"))); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("INTEGER")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INTEGER"))); aRow[2] = new ORowSetValueDecorator(DataType::INTEGER); aRow[3] = new ORowSetValueDecorator((sal_Int32)10); aRow[13] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("I"))); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DECIMAL")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DECIMAL"))); aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL); aRow[3] = new ORowSetValueDecorator((sal_Int32)20); - aRow[6] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("length,scale")); + aRow[6] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("length,scale"))); aRow[13] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("F"))); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("NUMERIC")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NUMERIC"))); aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL); aRow[3] = new ORowSetValueDecorator((sal_Int32)16); aRow[13] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("N"))); @@ -239,10 +239,10 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getColumns( switch(sal_Int32(aRow[11]->getValue())) { case ColumnValue::NO_NULLS: - aRow[18] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("NO")); + aRow[18] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NO"))); break; case ColumnValue::NULLABLE: - aRow[18] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("YES")); + aRow[18] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("YES"))); break; default: aRow[18] = new ORowSetValueDecorator(::rtl::OUString()); @@ -278,7 +278,7 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getIndexInfo( ODatabaseMetaDataResultSet::ORow aRow(14); aRow[5] = new ORowSetValueDecorator(::rtl::OUString()); - aRow[10] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("A")); + aRow[10] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("A"))); Reference< XIndexesSupplier> xTable; ::cppu::extractInterface(xTable,xNames->getByName(table)); @@ -391,7 +391,7 @@ sal_Bool SAL_CALL ODbaseDatabaseMetaData::isReadOnly( ) throw(SQLException, Run ::osl::MutexGuard aGuard( m_aMutex ); sal_Bool bReadOnly = sal_False; - static ::rtl::OUString sReadOnly = ::rtl::OUString::createFromAscii("IsReadOnly"); + static ::rtl::OUString sReadOnly( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" )); ::ucbhelper::Content aFile(m_pConnection->getContent(),Reference< XCommandEnvironment >()); aFile.getPropertyValue(sReadOnly) >>= bReadOnly; diff --git a/connectivity/source/drivers/dbase/DDriver.cxx b/connectivity/source/drivers/dbase/DDriver.cxx index 1920166416..27b802c53f 100644 --- a/connectivity/source/drivers/dbase/DDriver.cxx +++ b/connectivity/source/drivers/dbase/DDriver.cxx @@ -47,7 +47,7 @@ using namespace ::com::sun::star::lang; //------------------------------------------------------------------------------ rtl::OUString ODriver::getImplementationName_Static( ) throw(RuntimeException) { - return rtl::OUString::createFromAscii("com.sun.star.comp.sdbc.dbase.ODriver"); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sdbc.dbase.ODriver")); } //------------------------------------------------------------------ @@ -81,7 +81,7 @@ Reference< XConnection > SAL_CALL ODriver::connect( const ::rtl::OUString& url, // -------------------------------------------------------------------------------- sal_Bool SAL_CALL ODriver::acceptsURL( const ::rtl::OUString& url ) throw(SQLException, RuntimeException) { - return !url.compareTo(::rtl::OUString::createFromAscii("sdbc:dbase:"),11); + return !url.compareTo(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:dbase:")),11); } // ----------------------------------------------------------------------------- Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/dbase/DIndex.cxx b/connectivity/source/drivers/dbase/DIndex.cxx index 09103a277f..600a712b01 100644 --- a/connectivity/source/drivers/dbase/DIndex.cxx +++ b/connectivity/source/drivers/dbase/DIndex.cxx @@ -68,7 +68,7 @@ using namespace com::sun::star::lang; IMPLEMENT_SERVICE_INFO(ODbaseIndex,"com.sun.star.sdbcx.driver.dbase.Index","com.sun.star.sdbcx.Index"); // ------------------------------------------------------------------------- -ODbaseIndex::ODbaseIndex(ODbaseTable* _pTable) : OIndex(sal_True/*_pTable->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()*/) +ODbaseIndex::ODbaseIndex(ODbaseTable* _pTable) : OIndex(sal_True/*_pTable->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers()*/) ,m_pFileStream(NULL) ,m_nCurNode(NODE_NOTFOUND) ,m_pTable(_pTable) @@ -144,7 +144,7 @@ ONDXPagePtr ODbaseIndex::getRoot() { m_nRootPage = m_aHeader.db_rootpage; m_nPageCount = m_aHeader.db_pagecount; - m_aRoot = CreatePage(m_nRootPage,NULL,TRUE); + m_aRoot = CreatePage(m_nRootPage,NULL,sal_True); } return m_aRoot; } @@ -186,11 +186,11 @@ OIndexIterator* ODbaseIndex::createIterator(OBoolOperator* pOp, return new OIndexIterator(this, pOp, pOperand); } //------------------------------------------------------------------ -BOOL ODbaseIndex::ConvertToKey(ONDXKey* rKey, sal_uInt32 nRec, const ORowSetValue& rValue) +sal_Bool ODbaseIndex::ConvertToKey(ONDXKey* rKey, sal_uInt32 nRec, const ORowSetValue& rValue) { OSL_ENSURE(m_pFileStream,"FileStream is not opened!"); - // Sucht ein bestimmten Wert im Index - // Wenn der Index Unique ist, interssiert der Key nicht, sonst ja + // Search a specific value in Index + // If the Index is unique, the key doesn't matter try { if (m_aHeader.db_keytype == 0) @@ -208,75 +208,75 @@ BOOL ODbaseIndex::ConvertToKey(ONDXKey* rKey, sal_uInt32 nRec, const ORowSetValu catch (Exception&) { OSL_ASSERT(0); - return FALSE; + return sal_False; } - return TRUE; + return sal_True; } //------------------------------------------------------------------ -BOOL ODbaseIndex::Find(sal_uInt32 nRec, const ORowSetValue& rValue) +sal_Bool ODbaseIndex::Find(sal_uInt32 nRec, const ORowSetValue& rValue) { openIndexFile(); OSL_ENSURE(m_pFileStream,"FileStream is not opened!"); - // Sucht ein bestimmten Wert im Index - // Wenn der Index Unique ist, interssiert der Key nicht, sonst ja + // Search a specific value in Index + // If the Index is unique, the key doesn't matter ONDXKey aKey; return ConvertToKey(&aKey, nRec, rValue) && getRoot()->Find(aKey); } //------------------------------------------------------------------ -BOOL ODbaseIndex::Insert(sal_uInt32 nRec, const ORowSetValue& rValue) +sal_Bool ODbaseIndex::Insert(sal_uInt32 nRec, const ORowSetValue& rValue) { openIndexFile(); OSL_ENSURE(m_pFileStream,"FileStream is not opened!"); ONDXKey aKey; - // Existiert der Wert bereits - // Find immer verwenden um das aktuelle Blatt zu bestimmen + // Does the value already exist + // Use Find() always to determine the actual leaf if (!ConvertToKey(&aKey, nRec, rValue) || (getRoot()->Find(aKey) && isUnique())) - return FALSE; + return sal_False; ONDXNode aNewNode(aKey); - // einfuegen in das aktuelle Blatt + // insert in the current leaf if (!m_aCurLeaf.Is()) - return FALSE; + return sal_False; - BOOL bResult = m_aCurLeaf->Insert(aNewNode); + sal_Bool bResult = m_aCurLeaf->Insert(aNewNode); Release(bResult); return bResult; } //------------------------------------------------------------------ -BOOL ODbaseIndex::Update(sal_uInt32 nRec, const ORowSetValue& rOldValue, +sal_Bool ODbaseIndex::Update(sal_uInt32 nRec, const ORowSetValue& rOldValue, const ORowSetValue& rNewValue) { openIndexFile(); OSL_ENSURE(m_pFileStream,"FileStream is not opened!"); ONDXKey aKey; if (!ConvertToKey(&aKey, nRec, rNewValue) || (isUnique() && getRoot()->Find(aKey))) - return FALSE; + return sal_False; else return Delete(nRec, rOldValue) && Insert(nRec,rNewValue); } //------------------------------------------------------------------ -BOOL ODbaseIndex::Delete(sal_uInt32 nRec, const ORowSetValue& rValue) +sal_Bool ODbaseIndex::Delete(sal_uInt32 nRec, const ORowSetValue& rValue) { openIndexFile(); OSL_ENSURE(m_pFileStream,"FileStream is not opened!"); - // Existiert der Wert bereits - // Find immer verwenden um das aktuelle Blatt zu bestimmen + // Does the value already exist + // Always use Find() to determine the actual leaf ONDXKey aKey; if (!ConvertToKey(&aKey, nRec, rValue) || !getRoot()->Find(aKey)) - return FALSE; + return sal_False; ONDXNode aNewNode(aKey); - // einfuegen in das aktuelle Blatt + // insert in the current leaf if (!m_aCurLeaf.Is()) - return FALSE; + return sal_False; #if OSL_DEBUG_LEVEL > 1 m_aRoot->PrintPage(); #endif @@ -290,10 +290,10 @@ void ODbaseIndex::Collect(ONDXPage* pPage) m_aCollector.push_back(pPage); } //------------------------------------------------------------------ -void ODbaseIndex::Release(BOOL bSave) +void ODbaseIndex::Release(sal_Bool bSave) { - // Freigeben der Indexressourcen - m_bUseCollector = FALSE; + // Release the Index-recources + m_bUseCollector = sal_False; if (m_aCurLeaf.Is()) { @@ -301,19 +301,19 @@ void ODbaseIndex::Release(BOOL bSave) m_aCurLeaf.Clear(); } - // Wurzel freigeben + // Release the root if (m_aRoot.Is()) { m_aRoot->Release(bSave); m_aRoot.Clear(); } - // alle Referenzen freigeben, bevor der FileStream geschlossen wird - for (ULONG i = 0; i < m_aCollector.size(); i++) + // Release all references, before the FileStream will be closed + for (sal_uIntPtr i = 0; i < m_aCollector.size(); i++) m_aCollector[i]->QueryDelete(); m_aCollector.clear(); - // Header modifiziert ? + // Header modified? if (bSave && (m_aHeader.db_rootpage != m_nRootPage || m_aHeader.db_pagecount != m_nPageCount)) { @@ -336,7 +336,7 @@ void ODbaseIndex::closeImpl() } } //------------------------------------------------------------------ -ONDXPage* ODbaseIndex::CreatePage(sal_uInt32 nPagePos, ONDXPage* pParent, BOOL bLoad) +ONDXPage* ODbaseIndex::CreatePage(sal_uInt32 nPagePos, ONDXPage* pParent, sal_Bool bLoad) { OSL_ENSURE(m_pFileStream,"FileStream is not opened!"); @@ -380,20 +380,20 @@ SvStream& connectivity::dbase::operator << (SvStream &rStream, ODbaseIndex& rInd ::rtl::OUString sDir = m_pTable->getConnection()->getURL(); sDir += OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DELIMITER); sDir += m_Name; - sDir += ::rtl::OUString::createFromAscii(".ndx"); + sDir += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".ndx")); return sDir; } //------------------------------------------------------------------ void ODbaseIndex::createINFEntry() { - // inf Datei abgleichen + // synchronize inf-file String sEntry = m_Name; sEntry += String::CreateFromAscii(".ndx"); ::rtl::OUString sCfgFile(m_pTable->getConnection()->getURL()); sCfgFile += OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DELIMITER); sCfgFile += m_pTable->getName(); - sCfgFile += ::rtl::OUString::createFromAscii(".inf"); + sCfgFile += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".inf")); String sPhysicalPath; LocalFileHelper::ConvertURLToPhysicalName(sCfgFile,sPhysicalPath); @@ -401,14 +401,14 @@ void ODbaseIndex::createINFEntry() Config aInfFile(sPhysicalPath); aInfFile.SetGroup(dBASE_III_GROUP); - USHORT nSuffix = aInfFile.GetKeyCount(); + sal_uInt16 nSuffix = aInfFile.GetKeyCount(); ByteString aNewEntry,aKeyName; - BOOL bCase = isCaseSensitive(); + sal_Bool bCase = isCaseSensitive(); while (!aNewEntry.Len()) { aNewEntry = "NDX"; aNewEntry += ByteString::CreateFromInt32(++nSuffix); - for (USHORT i = 0; i < aInfFile.GetKeyCount(); i++) + for (sal_uInt16 i = 0; i < aInfFile.GetKeyCount(); i++) { aKeyName = aInfFile.GetKeyName(i); if (bCase ? aKeyName == aNewEntry : aKeyName.EqualsIgnoreCaseAscii(aNewEntry)) @@ -421,7 +421,7 @@ void ODbaseIndex::createINFEntry() aInfFile.WriteKey(aNewEntry,ByteString(sEntry,m_pTable->getConnection()->getTextEncoding())); } // ------------------------------------------------------------------------- -BOOL ODbaseIndex::DropImpl() +sal_Bool ODbaseIndex::DropImpl() { closeImpl(); @@ -432,12 +432,11 @@ BOOL ODbaseIndex::DropImpl() m_pTable->getConnection()->throwGenericSQLException(STR_COULD_NOT_DELETE_INDEX,*m_pTable); } - // InfDatei abgleichen - + // synchronize inf-file ::rtl::OUString sCfgFile(m_pTable->getConnection()->getURL()); sCfgFile += OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DELIMITER); sCfgFile += m_pTable->getName(); - sCfgFile += ::rtl::OUString::createFromAscii(".inf"); + sCfgFile += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".inf")); String sPhysicalPath; String sNDX(sCfgFile); @@ -445,15 +444,15 @@ BOOL ODbaseIndex::DropImpl() Config aInfFile(sPhysicalPath); aInfFile.SetGroup(dBASE_III_GROUP); - USHORT nKeyCnt = aInfFile.GetKeyCount(); + sal_uInt16 nKeyCnt = aInfFile.GetKeyCount(); ByteString aKeyName; String sEntry = m_Name; sEntry += String::CreateFromAscii(".ndx"); // delete entries from the inf file - for (USHORT nKey = 0; nKey < nKeyCnt; nKey++) + for (sal_uInt16 nKey = 0; nKey < nKeyCnt; nKey++) { - // Verweist der Key auf ein Indexfile?... + // References the Key to an Index-file? aKeyName = aInfFile.GetKeyName( nKey ); if (aKeyName.Copy(0,3) == "NDX") { @@ -464,7 +463,7 @@ BOOL ODbaseIndex::DropImpl() } } } - return TRUE; + return sal_True; } // ------------------------------------------------------------------------- void ODbaseIndex::impl_killFileAndthrowError_throw(sal_uInt16 _nErrorId,const ::rtl::OUString& _sFile) @@ -475,9 +474,9 @@ void ODbaseIndex::impl_killFileAndthrowError_throw(sal_uInt16 _nErrorId,const :: m_pTable->getConnection()->throwGenericSQLException(_nErrorId,*this); } //------------------------------------------------------------------ -BOOL ODbaseIndex::CreateImpl() +sal_Bool ODbaseIndex::CreateImpl() { - // Anlegen des Index + // Create the Index const ::rtl::OUString sFile = getCompletePath(); if(UCBContentHelper::Exists(sFile)) { @@ -487,13 +486,13 @@ BOOL ODbaseIndex::CreateImpl() ) ); ::dbtools::throwGenericSQLException( sError, *this ); } - // Index ist nur einstufig + // Index comprises only one column if (m_pColumns->getCount() > 1) m_pTable->getConnection()->throwGenericSQLException(STR_ONL_ONE_COLUMN_PER_INDEX,*this); Reference<XFastPropertySet> xCol(m_pColumns->getByIndex(0),UNO_QUERY); - // ist die Spalte schon indiziert ? + // Is the column already indexed? if ( !xCol.is() ) ::dbtools::throwFunctionSequenceException(*this); @@ -512,7 +511,7 @@ BOOL ODbaseIndex::CreateImpl() m_pFileStream->SetBufferSize(PAGE_SIZE); m_pFileStream->SetFiller('\0'); - // Zunaechst muss das Ergebnis sortiert sein + // firstly the result must be sorted utl::SharedUNOComponent<XStatement> xStmt; utl::SharedUNOComponent<XResultSet> xSet; String aName; @@ -548,7 +547,7 @@ BOOL ODbaseIndex::CreateImpl() impl_killFileAndthrowError_throw(STR_COULD_NOT_CREATE_INDEX,sFile); } - // Setzen der Headerinfo + // Set the header info memset(&m_aHeader,0,sizeof(m_aHeader)); sal_Int32 nType = 0; ::rtl::Reference<OSQLColumns> aCols = m_pTable->getTableColumns(); @@ -557,7 +556,7 @@ BOOL ODbaseIndex::CreateImpl() xTableCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= nType; m_aHeader.db_keytype = (nType == DataType::VARCHAR || nType == DataType::CHAR) ? 0 : 1; - m_aHeader.db_keylen = (m_aHeader.db_keytype) ? 8 : (USHORT)getINT32(xTableCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))); + m_aHeader.db_keylen = (m_aHeader.db_keytype) ? 8 : (sal_uInt16)getINT32(xTableCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))); m_aHeader.db_keylen = (( m_aHeader.db_keylen - 1) / 4 + 1) * 4; m_aHeader.db_maxkeys = (PAGE_SIZE - 4) / (8 + m_aHeader.db_keylen); if ( m_aHeader.db_maxkeys < 3 ) @@ -568,20 +567,19 @@ BOOL ODbaseIndex::CreateImpl() m_pFileStream->SetStreamSize(PAGE_SIZE); ByteString aCol(aName,m_pTable->getConnection()->getTextEncoding()); - strncpy(m_aHeader.db_name,aCol.GetBuffer(),std::min((USHORT)sizeof(m_aHeader.db_name), aCol.Len())); + strncpy(m_aHeader.db_name,aCol.GetBuffer(),std::min((sal_uInt16)sizeof(m_aHeader.db_name), aCol.Len())); m_aHeader.db_unique = m_IsUnique ? 1: 0; m_aHeader.db_keyrec = m_aHeader.db_keylen + 8; - // modifizierung am Header werden ueber Unterschiede zw. HeaderInfo und nRootPage - // bzw. nPageCout erkannt - + // modifications of the header are detected by differences between + // the HeaderInfo and nRootPage or nPageCount respectively m_nRootPage = 1; m_nPageCount = 2; m_aCurLeaf = m_aRoot = CreatePage(m_nRootPage); - m_aRoot->SetModified(TRUE); + m_aRoot->SetModified(sal_True); - m_bUseCollector = TRUE; + m_bUseCollector = sal_True; sal_Int32 nRowsLeft = 0; Reference<XRow> xRow(xSet,UNO_QUERY); @@ -600,11 +598,11 @@ BOOL ODbaseIndex::CreateImpl() ORowSetValue atmpValue=ORowSetValue(); ONDXKey aKey(atmpValue, nType, 0); ONDXKey aInsertKey(atmpValue, nType, 0); - // Erzeugen der Indexstruktur + // Create the index structure while (xSet->next()) { ORowSetValue aValue(m_aHeader.db_keytype ? ORowSetValue(xRow->getDouble(1)) : ORowSetValue(xRow->getString(1))); - // ueberpruefen auf doppelten eintrag + // checking for duplicate entries if (m_IsUnique && m_nCurNode != NODE_NOTFOUND) { aKey.setValue(aValue); diff --git a/connectivity/source/drivers/dbase/DIndexColumns.cxx b/connectivity/source/drivers/dbase/DIndexColumns.cxx index b10780bfc6..b2f22c7e96 100644 --- a/connectivity/source/drivers/dbase/DIndexColumns.cxx +++ b/connectivity/source/drivers/dbase/DIndexColumns.cxx @@ -70,7 +70,7 @@ sdbcx::ObjectType ODbaseIndexColumns::createObject(const ::rtl::OUString& _rName ,sal_False ,sal_False ,sal_False - ,pTable->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); + ,pTable->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers()); return xRet; } @@ -83,7 +83,7 @@ void ODbaseIndexColumns::impl_refresh() throw(RuntimeException) // ------------------------------------------------------------------------- Reference< XPropertySet > ODbaseIndexColumns::createDescriptor() { - return new sdbcx::OIndexColumn(m_pIndex->getTable()->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); + return new sdbcx::OIndexColumn(m_pIndex->getTable()->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers()); } // ------------------------------------------------------------------------- sdbcx::ObjectType ODbaseIndexColumns::appendObject( const ::rtl::OUString& /*_rForName*/, const Reference< XPropertySet >& descriptor ) diff --git a/connectivity/source/drivers/dbase/DIndexIter.cxx b/connectivity/source/drivers/dbase/DIndexIter.cxx index 965196f7de..ed3020ba12 100644 --- a/connectivity/source/drivers/dbase/DIndexIter.cxx +++ b/connectivity/source/drivers/dbase/DIndexIter.cxx @@ -46,20 +46,20 @@ OIndexIterator::~OIndexIterator() } //------------------------------------------------------------------ -ULONG OIndexIterator::First() +sal_uIntPtr OIndexIterator::First() { - return Find(TRUE); + return Find(sal_True); } //------------------------------------------------------------------ -ULONG OIndexIterator::Next() +sal_uIntPtr OIndexIterator::Next() { - return Find(FALSE); + return Find(sal_False); } //------------------------------------------------------------------ -ULONG OIndexIterator::Find(BOOL bFirst) +sal_uIntPtr OIndexIterator::Find(sal_Bool bFirst) { - ULONG nRes = STRING_NOTFOUND; + sal_uIntPtr nRes = STRING_NOTFOUND; if (bFirst) { @@ -69,7 +69,7 @@ ULONG OIndexIterator::Find(BOOL bFirst) if (!m_pOperator) { - // Vorbereitung , auf kleinstes Element positionieren + // Preparation, position on the smallest element if (bFirst) { ONDXPage* pPage = m_aRoot; @@ -97,18 +97,17 @@ ULONG OIndexIterator::Find(BOOL bFirst) //------------------------------------------------------------------ ONDXKey* OIndexIterator::GetFirstKey(ONDXPage* pPage, const OOperand& rKey) { - // sucht den vorgegeben key - // Besonderheit: gelangt der Algorithmus ans Ende - // wird immer die aktuelle Seite und die Knotenposition vermerkt - // auf die die Bedingung <= zutrifft - // dieses findet beim Insert besondere Beachtung + // searches a given key + // Speciality: At the end of the algorithm + // the actual page and the position of the node which fulfil the + // '<='-condition are saved. this is considered for inserts. // ONDXIndex* m_pIndex = GetNDXIndex(); OOp_COMPARE aTempOp(SQLFilterOperator::GREATER); - USHORT i = 0; + sal_uInt16 i = 0; if (pPage->IsLeaf()) { - // im blatt wird die eigentliche Operation ausgefuehrt, sonst die temp. (>) + // in the leaf the actual operation is run, otherwise temp. (>) while (i < pPage->Count() && !m_pOperator->operate(&((*pPage)[i]).GetKey(),&rKey)) i++; } @@ -120,7 +119,7 @@ ONDXKey* OIndexIterator::GetFirstKey(ONDXPage* pPage, const OOperand& rKey) ONDXKey* pFoundKey = NULL; if (!pPage->IsLeaf()) { - // weiter absteigen + // descend further ONDXPagePtr aPage = (i==0) ? pPage->GetChild(m_pIndex) : ((*pPage)[i-1]).GetChild(m_pIndex, pPage); pFoundKey = aPage.Is() ? GetFirstKey(aPage, rKey) : NULL; @@ -142,14 +141,14 @@ ONDXKey* OIndexIterator::GetFirstKey(ONDXPage* pPage, const OOperand& rKey) } //------------------------------------------------------------------ -ULONG OIndexIterator::GetCompare(BOOL bFirst) +sal_uIntPtr OIndexIterator::GetCompare(sal_Bool bFirst) { ONDXKey* pKey = NULL; sal_Int32 ePredicateType = PTR_CAST(file::OOp_COMPARE,m_pOperator)->getPredicateType(); if (bFirst) { - // Vorbereitung , auf kleinstes Element positionieren + // Preparation, position on the smallest element ONDXPage* pPage = m_aRoot; switch (ePredicateType) { @@ -212,7 +211,7 @@ ULONG OIndexIterator::GetCompare(BOOL bFirst) } //------------------------------------------------------------------ -ULONG OIndexIterator::GetLike(BOOL bFirst) +sal_uIntPtr OIndexIterator::GetLike(sal_Bool bFirst) { if (bFirst) { @@ -232,7 +231,7 @@ ULONG OIndexIterator::GetLike(BOOL bFirst) } //------------------------------------------------------------------ -ULONG OIndexIterator::GetNull(BOOL bFirst) +sal_uIntPtr OIndexIterator::GetNull(sal_Bool bFirst) { if (bFirst) { @@ -254,15 +253,15 @@ ULONG OIndexIterator::GetNull(BOOL bFirst) } //------------------------------------------------------------------ -ULONG OIndexIterator::GetNotNull(BOOL bFirst) +sal_uIntPtr OIndexIterator::GetNotNull(sal_Bool bFirst) { ONDXKey* pKey; if (bFirst) { // erst alle NULL werte abklappern - for (ULONG nRec = GetNull(bFirst); + for (sal_uIntPtr nRec = GetNull(bFirst); nRec != STRING_NOTFOUND; - nRec = GetNull(FALSE)) + nRec = GetNull(sal_False)) ; pKey = m_aCurLeaf.Is() ? &(*m_aCurLeaf)[m_nCurNode].GetKey() : NULL; } @@ -278,15 +277,15 @@ ONDXKey* OIndexIterator::GetNextKey() if (m_aCurLeaf.Is() && ((++m_nCurNode) >= m_aCurLeaf->Count())) { ONDXPage* pPage = m_aCurLeaf; - // naechste Seite suchen + // search next page while (pPage) { ONDXPage* pParentPage = pPage->GetParent(); if (pParentPage) { - USHORT nPos = pParentPage->Search(pPage); + sal_uInt16 nPos = pParentPage->Search(pPage); if (nPos != pParentPage->Count() - 1) - { // Seite gefunden + { // page found pPage = (*pParentPage)[nPos+1].GetChild(m_pIndex,pParentPage); break; } @@ -294,7 +293,7 @@ ONDXKey* OIndexIterator::GetNextKey() pPage = pParentPage; } - // jetzt wieder zum Blatt + // now go on with leaf while (pPage && !pPage->IsLeaf()) pPage = pPage->GetChild(m_pIndex); diff --git a/connectivity/source/drivers/dbase/DIndexes.cxx b/connectivity/source/drivers/dbase/DIndexes.cxx index cd2090de7f..b5be60ff22 100644 --- a/connectivity/source/drivers/dbase/DIndexes.cxx +++ b/connectivity/source/drivers/dbase/DIndexes.cxx @@ -55,7 +55,7 @@ sdbcx::ObjectType ODbaseIndexes::createObject(const ::rtl::OUString& _rName) ::rtl::OUString sFile = m_pTable->getConnection()->getURL(); sFile += OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_DELIMITER); sFile += _rName; - sFile += ::rtl::OUString::createFromAscii(".ndx"); + sFile += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".ndx")); if ( !UCBContentHelper::Exists(sFile) ) { const ::rtl::OUString sError( m_pTable->getConnection()->getResources().getResourceStringWithSubstitution( diff --git a/connectivity/source/drivers/dbase/DNoException.cxx b/connectivity/source/drivers/dbase/DNoException.cxx index 55c06f2018..b18e20b5d1 100644 --- a/connectivity/source/drivers/dbase/DNoException.cxx +++ b/connectivity/source/drivers/dbase/DNoException.cxx @@ -47,7 +47,7 @@ sal_Bool ODbaseTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_In { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::seekRow" ); // ---------------------------------------------------------- - // Positionierung vorbereiten: + // Prepare positioning: OSL_ENSURE(m_pFileStream,"ODbaseTable::seekRow: FileStream is NULL!"); sal_uInt32 nNumberOfRecords = (sal_uInt32)m_aHeader.db_anz; @@ -91,7 +91,7 @@ sal_Bool ODbaseTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_In OSL_ENSURE(m_nFilePos >= 1,"SdbDBFCursor::FileFetchRow: ungueltige Record-Position"); sal_Int32 nPos = m_aHeader.db_kopf + (sal_Int32)(m_nFilePos-1) * nEntryLen; - ULONG nLen = m_pFileStream->Seek(nPos); + sal_uIntPtr nLen = m_pFileStream->Seek(nPos); if (m_pFileStream->GetError() != ERRCODE_NONE) goto Error; @@ -118,7 +118,7 @@ Error: m_nFilePos = 0; break; case IResultSetHelper::BOOKMARK: - m_nFilePos = nTempPos; // vorherige Position + m_nFilePos = nTempPos; // last position } return sal_False; @@ -127,27 +127,27 @@ End: return sal_True; } // ----------------------------------------------------------------------------- -BOOL ODbaseTable::ReadMemo(ULONG nBlockNo, ORowSetValue& aVariable) +sal_Bool ODbaseTable::ReadMemo(sal_uIntPtr nBlockNo, ORowSetValue& aVariable) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::ReadMemo" ); - BOOL bIsText = TRUE; + bool bIsText = true; m_pMemoStream->Seek(nBlockNo * m_aMemoHeader.db_size); switch (m_aMemoHeader.db_typ) { - case MemodBaseIII: // dBase III-Memofeld, endet mit Ctrl-Z + case MemodBaseIII: // dBase III-Memofeld, ends with Ctrl-Z { const char cEOF = (char) 0x1a; ByteString aBStr; static char aBuf[514]; - aBuf[512] = 0; // sonst kann der Zufall uebel mitspielen - BOOL bReady = sal_False; + aBuf[512] = 0; // to prevent a random value + bool bReady = false; do { m_pMemoStream->Read(&aBuf,512); - USHORT i = 0; + sal_uInt16 i = 0; while (aBuf[i] != cEOF && ++i < 512) ; bReady = aBuf[i] == cEOF; @@ -162,21 +162,21 @@ BOOL ODbaseTable::ReadMemo(ULONG nBlockNo, ORowSetValue& aVariable) } break; case MemoFoxPro: - case MemodBaseIV: // dBase IV-Memofeld mit Laengenangabe + case MemodBaseIV: // dBase IV-Memofeld with the length specification { char sHeader[4]; m_pMemoStream->Read(sHeader,4); // Foxpro stores text and binary data if (m_aMemoHeader.db_typ == MemoFoxPro) { - if (((BYTE)sHeader[0]) != 0 || ((BYTE)sHeader[1]) != 0 || ((BYTE)sHeader[2]) != 0) + if (((sal_uInt8)sHeader[0]) != 0 || ((sal_uInt8)sHeader[1]) != 0 || ((sal_uInt8)sHeader[2]) != 0) { return sal_False; } bIsText = sHeader[3] != 0; } - else if (((BYTE)sHeader[0]) != 0xFF || ((BYTE)sHeader[1]) != 0xFF || ((BYTE)sHeader[2]) != 0x08) + else if (((sal_uInt8)sHeader[0]) != 0xFF || ((sal_uInt8)sHeader[1]) != 0xFF || ((sal_uInt8)sHeader[2]) != 0x08) { return sal_False; } @@ -215,7 +215,7 @@ BOOL ODbaseTable::ReadMemo(ULONG nBlockNo, ORowSetValue& aVariable) void ODbaseTable::AllocBuffer() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::AllocBuffer" ); - UINT16 nSize = m_aHeader.db_slng; + sal_uInt16 nSize = m_aHeader.db_slng; OSL_ENSURE(nSize > 0, "Size too small"); if (m_nBufferSize != nSize) @@ -224,20 +224,20 @@ void ODbaseTable::AllocBuffer() m_pBuffer = NULL; } - // Falls noch kein Puffer vorhanden: allozieren: + // If no buffer available: allocate if (m_pBuffer == NULL && nSize) { m_nBufferSize = nSize; - m_pBuffer = new BYTE[m_nBufferSize+1]; + m_pBuffer = new sal_uInt8[m_nBufferSize+1]; } } // ----------------------------------------------------------------------------- -BOOL ODbaseTable::WriteBuffer() +sal_Bool ODbaseTable::WriteBuffer() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::WriteBuffer" ); OSL_ENSURE(m_nFilePos >= 1,"SdbDBFCursor::FileFetchRow: ungueltige Record-Position"); - // Auf gewuenschten Record positionieren: + // Position on the desired record: long nPos = m_aHeader.db_kopf + (long)(m_nFilePos-1) * m_aHeader.db_slng; m_pFileStream->Seek(nPos); return m_pFileStream->Write((char*) m_pBuffer, m_aHeader.db_slng) > 0; @@ -257,7 +257,7 @@ sal_Int32 ODbaseTable::getCurrentLastPos() const void ONDXNode::Read(SvStream &rStream, ODbaseIndex& rIndex) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXNode::Read" ); - rStream >> aKey.nRecord; // schluessel + rStream >> aKey.nRecord; // key if (rIndex.getHeader().db_keytype) { @@ -268,7 +268,7 @@ void ONDXNode::Read(SvStream &rStream, ODbaseIndex& rIndex) else { ByteString aBuf; - USHORT nLen = rIndex.getHeader().db_keylen; + sal_uInt16 nLen = rIndex.getHeader().db_keylen; char* pStr = aBuf.AllocBuffer(nLen+1); rStream.Read(pStr,nLen); @@ -292,16 +292,16 @@ void ONDXNode::Write(SvStream &rStream, const ONDXPage& rPage) const RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXNode::Write" ); const ODbaseIndex& rIndex = rPage.GetIndex(); if (!rIndex.isUnique() || rPage.IsLeaf()) - rStream << (sal_uInt32)aKey.nRecord; // schluessel + rStream << (sal_uInt32)aKey.nRecord; // key else - rStream << (sal_uInt32)0; // schluessel + rStream << (sal_uInt32)0; // key if (rIndex.getHeader().db_keytype) // double { if (aKey.getValue().isNull()) { memset(aNodeData.aData,0,rIndex.getHeader().db_keylen); - rStream.Write((BYTE*)aNodeData.aData,rIndex.getHeader().db_keylen); + rStream.Write((sal_uInt8*)aNodeData.aData,rIndex.getHeader().db_keylen); } else rStream << (double) aKey.getValue(); @@ -315,7 +315,7 @@ void ONDXNode::Write(SvStream &rStream, const ONDXPage& rPage) const ByteString aText(sValue.getStr(), rIndex.m_pTable->getConnection()->getTextEncoding()); strncpy(aNodeData.aData,aText.GetBuffer(),std::min(rIndex.getHeader().db_keylen, aText.Len())); } - rStream.Write((BYTE*)aNodeData.aData,rIndex.getHeader().db_keylen); + rStream.Write((sal_uInt8*)aNodeData.aData,rIndex.getHeader().db_keylen); } rStream << aChild; } @@ -336,7 +336,7 @@ ONDXPagePtr& ONDXNode::GetChild(ODbaseIndex* pIndex, ONDXPage* pParent) // ONDXKey //================================================================== //------------------------------------------------------------------ -BOOL ONDXKey::IsText(sal_Int32 eType) +sal_Bool ONDXKey::IsText(sal_Int32 eType) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXKey::IsText" ); return eType == DataType::VARCHAR || eType == DataType::CHAR; @@ -364,7 +364,7 @@ StringCompare ONDXKey::Compare(const ONDXKey& rKey) const } else if (IsText(getDBType())) { - INT32 nRes = getValue().getString().compareTo(rKey.getValue()); + sal_Int32 nRes = getValue().getString().compareTo(rKey.getValue()); eResult = (nRes > 0) ? COMPARE_GREATER : (nRes == 0) ? COMPARE_EQUAL : COMPARE_LESS; } else @@ -373,7 +373,7 @@ StringCompare ONDXKey::Compare(const ONDXKey& rKey) const eResult = (m > n) ? COMPARE_GREATER : (n == m) ? COMPARE_EQUAL : COMPARE_LESS; } - // Record vergleich, wenn Index !Unique + // Record comparison, if index !Unique if (eResult == COMPARE_EQUAL && nRecord && rKey.nRecord) eResult = (nRecord > rKey.nRecord) ? COMPARE_GREATER : (nRecord == rKey.nRecord) ? COMPARE_EQUAL : COMPARE_LESS; @@ -441,15 +441,15 @@ ONDXPagePtr& ONDXPagePtr::operator= (ONDXPage* pRef) return *this; } // ----------------------------------------------------------------------------- -static UINT32 nValue; +static sal_uInt32 nValue; //------------------------------------------------------------------ SvStream& connectivity::dbase::operator >> (SvStream &rStream, ONDXPage& rPage) { rStream.Seek(rPage.GetPagePos() * 512); rStream >> nValue >> rPage.aChild; - rPage.nCount = USHORT(nValue); + rPage.nCount = sal_uInt16(nValue); - for (USHORT i = 0; i < rPage.nCount; i++) + for (sal_uInt16 i = 0; i < rPage.nCount; i++) rPage[i].Read(rStream, rPage.GetIndex()); return rStream; } @@ -457,8 +457,8 @@ SvStream& connectivity::dbase::operator >> (SvStream &rStream, ONDXPage& rPage) //------------------------------------------------------------------ SvStream& connectivity::dbase::operator << (SvStream &rStream, const ONDXPage& rPage) { - // Seite existiert noch nicht - ULONG nSize = (rPage.GetPagePos() + 1) * 512; + // Page does not yet exist + sal_uIntPtr nSize = (rPage.GetPagePos() + 1) * 512; if (nSize > rStream.Seek(STREAM_SEEK_TO_END)) { rStream.SetStreamSize(nSize); @@ -466,27 +466,27 @@ SvStream& connectivity::dbase::operator << (SvStream &rStream, const ONDXPage& r char aEmptyData[512]; memset(aEmptyData,0x00,512); - rStream.Write((BYTE*)aEmptyData,512); + rStream.Write((sal_uInt8*)aEmptyData,512); } - ULONG nCurrentPos = rStream.Seek(rPage.GetPagePos() * 512); + sal_uIntPtr nCurrentPos = rStream.Seek(rPage.GetPagePos() * 512); OSL_UNUSED( nCurrentPos ); nValue = rPage.nCount; rStream << nValue << rPage.aChild; - USHORT i = 0; + sal_uInt16 i = 0; for (; i < rPage.nCount; i++) rPage[i].Write(rStream, rPage); // check if we have to fill the stream with '\0' if(i < rPage.rIndex.getHeader().db_maxkeys) { - ULONG nTell = rStream.Tell() % 512; - USHORT nBufferSize = rStream.GetBufferSize(); - ULONG nSize = nBufferSize - nTell; + sal_uIntPtr nTell = rStream.Tell() % 512; + sal_uInt16 nBufferSize = rStream.GetBufferSize(); + sal_uIntPtr nSize = nBufferSize - nTell; char* pEmptyData = new char[nSize]; memset(pEmptyData,0x00,nSize); - rStream.Write((BYTE*)pEmptyData,nSize); + rStream.Write((sal_uInt8*)pEmptyData,nSize); rStream.Seek(nTell); delete [] pEmptyData; } @@ -498,10 +498,10 @@ SvStream& connectivity::dbase::operator << (SvStream &rStream, const ONDXPage& r void ONDXPage::PrintPage() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXPage::PrintPage" ); - DBG_TRACE4("\nSDB: -----------Page: %d Parent: %d Count: %d Child: %d-----", + OSL_TRACE("\nSDB: -----------Page: %d Parent: %d Count: %d Child: %d-----", nPagePos, HasParent() ? aParent->GetPagePos() : 0 ,nCount, aChild.GetPagePos()); - for (USHORT i = 0; i < nCount; i++) + for (sal_uInt16 i = 0; i < nCount; i++) { ONDXNode rNode = (*this)[i]; ONDXKey& rKey = rNode.GetKey(); @@ -510,45 +510,45 @@ void ONDXPage::PrintPage() if (rKey.getValue().isNull()) { - DBG_TRACE2("SDB: [%d,NULL,%d]",rKey.GetRecord(), rNode.GetChild().GetPagePos()); + OSL_TRACE("SDB: [%d,NULL,%d]",rKey.GetRecord(), rNode.GetChild().GetPagePos()); } else if (rIndex.getHeader().db_keytype) { - DBG_TRACE3("SDB: [%d,%f,%d]",rKey.GetRecord(), rKey.getValue().getDouble(),rNode.GetChild().GetPagePos()); + OSL_TRACE("SDB: [%d,%f,%d]",rKey.GetRecord(), rKey.getValue().getDouble(),rNode.GetChild().GetPagePos()); } else { - DBG_TRACE3("SDB: [%d,%s,%d]",rKey.GetRecord(), (const char* )ByteString(rKey.getValue().getString().getStr(), rIndex.m_pTable->getConnection()->getTextEncoding()).GetBuffer(),rNode.GetChild().GetPagePos()); + OSL_TRACE("SDB: [%d,%s,%d]",rKey.GetRecord(), (const char* )ByteString(rKey.getValue().getString().getStr(), rIndex.m_pTable->getConnection()->getTextEncoding()).GetBuffer(),rNode.GetChild().GetPagePos()); } } - DBG_TRACE("SDB: -----------------------------------------------\n"); + OSL_TRACE("SDB: -----------------------------------------------\n"); if (!IsLeaf()) { #if OSL_DEBUG_LEVEL > 1 GetChild(&rIndex)->PrintPage(); - for (USHORT i = 0; i < nCount; i++) + for (sal_uInt16 i = 0; i < nCount; i++) { ONDXNode rNode = (*this)[i]; rNode.GetChild(&rIndex,this)->PrintPage(); } #endif } - DBG_TRACE("SDB: ===============================================\n"); + OSL_TRACE("SDB: ===============================================\n"); } #endif // ----------------------------------------------------------------------------- -BOOL ONDXPage::IsFull() const +sal_Bool ONDXPage::IsFull() const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXPage::IsFull" ); return Count() == rIndex.getHeader().db_maxkeys; } // ----------------------------------------------------------------------------- //------------------------------------------------------------------ -USHORT ONDXPage::Search(const ONDXKey& rSearch) +sal_uInt16 ONDXPage::Search(const ONDXKey& rSearch) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXPage::Search" ); - // binare Suche spaeter - USHORT i = 0xFFFF; + // binary search afterwards + sal_uInt16 i = 0xFFFF; while (++i < Count()) if ((*this)[i].GetKey() == rSearch) break; @@ -557,20 +557,19 @@ USHORT ONDXPage::Search(const ONDXKey& rSearch) } //------------------------------------------------------------------ -USHORT ONDXPage::Search(const ONDXPage* pPage) +sal_uInt16 ONDXPage::Search(const ONDXPage* pPage) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXPage::Search" ); - USHORT i = 0xFFFF; + sal_uInt16 i = 0xFFFF; while (++i < Count()) if (((*this)[i]).GetChild() == pPage) break; - // wenn nicht gefunden, dann wird davon ausgegangen, dass die Seite selbst - // auf die Page zeigt + // if not found, then we assume, that the page points to the page (???) return (i < Count()) ? i : NODE_NOTFOUND; } // ----------------------------------------------------------------------------- -// laeuft rekursiv +// runs recursively void ONDXPage::SearchAndReplace(const ONDXKey& rSearch, ONDXKey& rReplace) { @@ -578,7 +577,7 @@ void ONDXPage::SearchAndReplace(const ONDXKey& rSearch, OSL_ENSURE(rSearch != rReplace,"Invalid here:rSearch == rReplace"); if (rSearch != rReplace) { - USHORT nPos = NODE_NOTFOUND; + sal_uInt16 nPos = NODE_NOTFOUND; ONDXPage* pPage = this; while (pPage && (nPos = pPage->Search(rSearch)) == NODE_NOTFOUND) @@ -587,34 +586,34 @@ void ONDXPage::SearchAndReplace(const ONDXKey& rSearch, if (pPage) { (*pPage)[nPos].GetKey() = rReplace; - pPage->SetModified(TRUE); + pPage->SetModified(sal_True); } } } // ----------------------------------------------------------------------------- -ONDXNode& ONDXPage::operator[] (USHORT nPos) +ONDXNode& ONDXPage::operator[] (sal_uInt16 nPos) { DBG_ASSERT(nCount > nPos, "falscher Indexzugriff"); return ppNodes[nPos]; } //------------------------------------------------------------------ -const ONDXNode& ONDXPage::operator[] (USHORT nPos) const +const ONDXNode& ONDXPage::operator[] (sal_uInt16 nPos) const { DBG_ASSERT(nCount > nPos, "falscher Indexzugriff"); return ppNodes[nPos]; } // ----------------------------------------------------------------------------- -void ONDXPage::Remove(USHORT nPos) +void ONDXPage::Remove(sal_uInt16 nPos) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ONDXPage::Remove" ); DBG_ASSERT(nCount > nPos, "falscher Indexzugriff"); - for (USHORT i = nPos; i < (nCount-1); i++) + for (sal_uInt16 i = nPos; i < (nCount-1); i++) (*this)[i] = (*this)[i+1]; nCount--; - bModified = TRUE; + bModified = sal_True; } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/dbase/DResultSet.cxx b/connectivity/source/drivers/dbase/DResultSet.cxx index 6b93961a52..d055bdb6b3 100644 --- a/connectivity/source/drivers/dbase/DResultSet.cxx +++ b/connectivity/source/drivers/dbase/DResultSet.cxx @@ -59,14 +59,14 @@ ODbaseResultSet::ODbaseResultSet( OStatement_Base* pStmt,connectivity::OSQLParse // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODbaseResultSet::getImplementationName( ) throw ( RuntimeException) { - return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.dbase.ResultSet"); + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.dbase.ResultSet")); } // ------------------------------------------------------------------------- Sequence< ::rtl::OUString > SAL_CALL ODbaseResultSet::getSupportedServiceNames( ) throw( RuntimeException) { Sequence< ::rtl::OUString > aSupported(2); - aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.ResultSet"); - aSupported[1] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.ResultSet"); + aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.ResultSet")); + aSupported[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.ResultSet")); return aSupported; } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index fa286f3456..f309944c07 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -205,15 +205,15 @@ void ODbaseTable::readHeader() OSL_ENSURE(m_pFileStream,"No Stream available!"); if(!m_pFileStream) return; - m_pFileStream->RefreshBuffer(); // sicherstellen, dass die Kopfinformationen tatsaechlich neu gelesen werden + m_pFileStream->RefreshBuffer(); // Make sure, that the header information actually is read again m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN); - BYTE nType=0; + sal_uInt8 nType=0; (*m_pFileStream) >> nType; if(ERRCODE_NONE != m_pFileStream->GetErrorCode()) throwInvalidDbaseFormat(); - m_pFileStream->Read((char*)(&m_aHeader.db_aedat), 3*sizeof(BYTE)); + m_pFileStream->Read((char*)(&m_aHeader.db_aedat), 3*sizeof(sal_uInt8)); if(ERRCODE_NONE != m_pFileStream->GetErrorCode()) throwInvalidDbaseFormat(); (*m_pFileStream) >> m_aHeader.db_anz; @@ -225,18 +225,18 @@ void ODbaseTable::readHeader() (*m_pFileStream) >> m_aHeader.db_slng; if(ERRCODE_NONE != m_pFileStream->GetErrorCode()) throwInvalidDbaseFormat(); - m_pFileStream->Read((char*)(&m_aHeader.db_frei), 20*sizeof(BYTE)); + m_pFileStream->Read((char*)(&m_aHeader.db_frei), 20*sizeof(sal_uInt8)); if(ERRCODE_NONE != m_pFileStream->GetErrorCode()) throwInvalidDbaseFormat(); - if ( ( ( m_aHeader.db_kopf - 1 ) / 32 - 1 ) <= 0 ) // anzahl felder + if ( ( ( m_aHeader.db_kopf - 1 ) / 32 - 1 ) <= 0 ) // number of fields { // no dbase file throwInvalidDbaseFormat(); } else { - // Konsistenzpruefung des Header: + // Consistency check of the header: m_aHeader.db_typ = (DBFType)nType; switch (m_aHeader.db_typ) { @@ -306,7 +306,7 @@ void ODbaseTable::fillColumns() m_aPrecisions.clear(); m_aScales.clear(); - // Anzahl Felder: + // Number of fields: const sal_Int32 nFieldCount = (m_aHeader.db_kopf - 1) / 32 - 1; OSL_ENSURE(nFieldCount,"No columns in table!"); @@ -319,7 +319,7 @@ void ODbaseTable::fillColumns() aStrFieldName.AssignAscii("Column"); ::rtl::OUString aTypeName; static const ::rtl::OUString sVARCHAR(RTL_CONSTASCII_USTRINGPARAM("VARCHAR")); - const sal_Bool bCase = getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers(); + const sal_Bool bCase = getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers(); const bool bFoxPro = m_aHeader.db_typ == VisualFoxPro || m_aHeader.db_typ == VisualFoxProAuto || m_aHeader.db_typ == FoxProMemo; sal_Int32 i = 0; @@ -357,10 +357,10 @@ OSL_TRACE("column type: %c",aDBFColumn.db_typ); aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NUMERIC")); eType = DataType::DECIMAL; - // Bei numerischen Feldern werden zwei Zeichen mehr geschrieben, als die Precision der Spaltenbeschreibung eigentlich - // angibt, um Platz fuer das eventuelle Vorzeichen und das Komma zu haben. Das muss ich jetzt aber wieder rausrechnen. + // for numeric fields two characters more are written, than the precision of the column description predescribes, + // to keep room for the possible sign and the comma. This has to be considered... nPrecision = SvDbaseConverter::ConvertPrecisionToOdbc(nPrecision,aDBFColumn.db_dez); - // leider gilt das eben Gesagte nicht fuer aeltere Versionen .... + // This is not true for older versions .... break; case 'L': eType = DataType::BIT; @@ -506,17 +506,17 @@ void ODbaseTable::construct() readHeader(); if (HasMemoFields()) { - // Memo-Dateinamen bilden (.DBT): - // nyi: Unschoen fuer Unix und Mac! + // Create Memo-Filename (.DBT): + // nyi: Ugly for Unix and Mac! if ( m_aHeader.db_typ == FoxProMemo || VisualFoxPro == m_aHeader.db_typ || VisualFoxProAuto == m_aHeader.db_typ ) // foxpro uses another extension aURL.SetExtension(String::CreateFromAscii("fpt")); else aURL.SetExtension(String::CreateFromAscii("dbt")); - // Wenn die Memodatei nicht gefunden wird, werden die Daten trotzdem angezeigt - // allerdings koennen keine Updates durchgefuehrt werden - // jedoch die Operation wird ausgefuehrt + // If the memo file isn't found, the data will be displayed anyhow. + // However, updates can't be done + // but the operation is executed m_pMemoStream = createStream_simpleError( aURL.GetMainURL(INetURLObject::NO_DECODE), STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYWRITE); if ( !m_pMemoStream ) { @@ -528,24 +528,24 @@ void ODbaseTable::construct() } fillColumns(); - UINT32 nFileSize = lcl_getFileSize(*m_pFileStream); + sal_uInt32 nFileSize = lcl_getFileSize(*m_pFileStream); m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN); if ( m_aHeader.db_anz == 0 && ((nFileSize-m_aHeader.db_kopf)/m_aHeader.db_slng) > 0) // seems to be empty or someone wrote bullshit into the dbase file m_aHeader.db_anz = ((nFileSize-m_aHeader.db_kopf)/m_aHeader.db_slng); - // Buffersize abhaengig von der Filegroesse + // Buffersize dependent on the file size m_pFileStream->SetBufferSize(nFileSize > 1000000 ? 32768 : nFileSize > 100000 ? 16384 : nFileSize > 10000 ? 4096 : 1024); if (m_pMemoStream) { - // Puffer genau auf Laenge eines Satzes stellen + // set the buffer extactly to the length of a record m_pMemoStream->Seek(STREAM_SEEK_TO_END); nFileSize = m_pMemoStream->Tell(); m_pMemoStream->Seek(STREAM_SEEK_TO_BEGIN); - // Buffersize abhaengig von der Filegroesse + // Buffersize dependent on the file size m_pMemoStream->SetBufferSize(nFileSize > 1000000 ? 32768 : nFileSize > 100000 ? 16384 : nFileSize > 10000 ? 4096 : @@ -556,32 +556,31 @@ void ODbaseTable::construct() } } //------------------------------------------------------------------ -BOOL ODbaseTable::ReadMemoHeader() +sal_Bool ODbaseTable::ReadMemoHeader() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::ReadMemoHeader" ); m_pMemoStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN); - m_pMemoStream->RefreshBuffer(); // sicherstellen das die Kopfinformationen tatsaechlich neu gelesen werden + m_pMemoStream->RefreshBuffer(); // make sure that the header information is actually read again m_pMemoStream->Seek(0L); (*m_pMemoStream) >> m_aMemoHeader.db_next; switch (m_aHeader.db_typ) { - case dBaseIIIMemo: // dBase III: feste Blockgroesse + case dBaseIIIMemo: // dBase III: fixed block size case dBaseIVMemo: - // manchmal wird aber auch dBase3 dBase4 Memo zugeordnet + // sometimes dBase3 is attached to dBase4 memo m_pMemoStream->Seek(20L); (*m_pMemoStream) >> m_aMemoHeader.db_size; - if (m_aMemoHeader.db_size > 1 && m_aMemoHeader.db_size != 512) // 1 steht auch fuer dBase 3 + if (m_aMemoHeader.db_size > 1 && m_aMemoHeader.db_size != 512) // 1 is also for dBase 3 m_aMemoHeader.db_typ = MemodBaseIV; else if (m_aMemoHeader.db_size > 1 && m_aMemoHeader.db_size == 512) { - // nun gibt es noch manche Dateien, die verwenden eine Groessenangabe, - // sind aber dennoch dBase Dateien + // There are files using size specification, though they are dBase-files char sHeader[4]; m_pMemoStream->Seek(m_aMemoHeader.db_size); m_pMemoStream->Read(sHeader,4); - if ((m_pMemoStream->GetErrorCode() != ERRCODE_NONE) || ((BYTE)sHeader[0]) != 0xFF || ((BYTE)sHeader[1]) != 0xFF || ((BYTE)sHeader[2]) != 0x08) + if ((m_pMemoStream->GetErrorCode() != ERRCODE_NONE) || ((sal_uInt8)sHeader[0]) != 0xFF || ((sal_uInt8)sHeader[1]) != 0xFF || ((sal_uInt8)sHeader[2]) != 0x08) m_aMemoHeader.db_typ = MemodBaseIII; else m_aMemoHeader.db_typ = MemodBaseIV; @@ -601,10 +600,10 @@ BOOL ODbaseTable::ReadMemoHeader() (*m_pMemoStream) >> m_aMemoHeader.db_size; break; default: - OSL_ENSURE( false, "ODbaseTable::ReadMemoHeader: unsupported memo type!" ); + OSL_FAIL( "ODbaseTable::ReadMemoHeader: unsupported memo type!" ); break; } - return TRUE; + return sal_True; } // ------------------------------------------------------------------------- String ODbaseTable::getEntry(OConnection* _pConnection,const ::rtl::OUString& _sName ) @@ -680,15 +679,15 @@ void ODbaseTable::refreshIndexes() aURL.setExtension(String::CreateFromAscii("inf")); Config aInfFile(aURL.getFSysPath(INetURLObject::FSYS_DETECT)); aInfFile.SetGroup(dBASE_III_GROUP); - USHORT nKeyCnt = aInfFile.GetKeyCount(); + sal_uInt16 nKeyCnt = aInfFile.GetKeyCount(); ByteString aKeyName; ByteString aIndexName; - for (USHORT nKey = 0; nKey < nKeyCnt; nKey++) + for (sal_uInt16 nKey = 0; nKey < nKeyCnt; nKey++) { - // Verweist der Key auf ein Indexfile?... + // Refences the key an index-file? aKeyName = aInfFile.GetKeyName( nKey ); - //...wenn ja, Indexliste der Tabelle hinzufuegen + //...if yes, add the index list of the table if (aKeyName.Copy(0,3) == ByteString("NDX") ) { aIndexName = aInfFile.ReadKey(aKeyName); @@ -786,26 +785,26 @@ sal_Int64 ODbaseTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (R sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, sal_Bool _bUseTableDefs,sal_Bool bRetrieveData) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::fetchRow" ); - // Einlesen der Daten - BOOL bIsCurRecordDeleted = ((char)m_pBuffer[0] == '*') ? TRUE : sal_False; + // Read the data + bool bIsCurRecordDeleted = (char)m_pBuffer[0] == '*'; // only read the bookmark - // Satz als geloescht markieren + // Mark record as deleted _rRow->setDeleted(bIsCurRecordDeleted); *(_rRow->get())[0] = m_nFilePos; if (!bRetrieveData) - return TRUE; + return sal_True; sal_Size nByteOffset = 1; - // Felder: + // Fields: OSQLColumns::Vector::const_iterator aIter = _rCols.get().begin(); OSQLColumns::Vector::const_iterator aEnd = _rCols.get().end(); const sal_Size nCount = _rRow->get().size(); for (sal_Size i = 1; aIter != aEnd && nByteOffset <= m_nBufferSize && i < nCount;++aIter, i++) { - // Laengen je nach Datentyp: + // Lengths depending on data type: sal_Int32 nLen = 0; sal_Int32 nType = 0; if(_bUseTableDefs) @@ -834,7 +833,7 @@ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, s nLen = SvDbaseConverter::ConvertPrecisionToDbase(nLen,m_aScales[i-1]); else nLen = SvDbaseConverter::ConvertPrecisionToDbase(nLen,getINT32((*aIter)->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)))); - break; // das Vorzeichen und das Komma + break; // the sign and the comma case DataType::BINARY: case DataType::OTHER: @@ -842,10 +841,10 @@ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, s continue; } - // Ist die Variable ueberhaupt gebunden? + // Is the variable bound? if ( !(_rRow->get())[i]->isBound() ) { - // Nein - naechstes Feld. + // No - next field. nByteOffset += nLen; OSL_ENSURE( nByteOffset <= m_nBufferSize ,"ByteOffset > m_nBufferSize!"); continue; @@ -900,7 +899,7 @@ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, s else if ( DataType::DOUBLE == nType ) { double d = 0.0; - if (getBOOL((*aIter)->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency wird gesondert behandelt + if (getBOOL((*aIter)->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency is treated separately { sal_Int64 nValue = 0; memcpy(&nValue, pData, nLen); @@ -920,7 +919,7 @@ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, s else { sal_Int32 nPos1 = -1, nPos2 = -1; - // Falls Nul-Zeichen im String enthalten sind, in Blanks umwandeln! + // If the string contains Nul-characters, then convert them to blanks! for (sal_Int32 k = 0; k < nLen; k++) { if (pData[k] == '\0') @@ -941,7 +940,7 @@ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, s { // Empty string. Skip it. nByteOffset += nLen; - (_rRow->get())[i]->setNull(); // keine Werte -> fertig + (_rRow->get())[i]->setNull(); // no values -> done continue; } @@ -969,13 +968,13 @@ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, s break; case DataType::BIT: { - BOOL b; + sal_Bool b; switch (* ((const char *)pData)) { case 'T': case 'Y': - case 'J': b = TRUE; break; - default: b = FALSE; break; + case 'J': b = sal_True; break; + default: b = sal_False; break; } *(_rRow->get())[i] = b; } @@ -984,8 +983,8 @@ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, s case DataType::BINARY: case DataType::LONGVARCHAR: { - const long nBlockNo = aStr.toInt32(); // Blocknummer lesen - if (nBlockNo > 0 && m_pMemoStream) // Daten aus Memo-Datei lesen, nur wenn + const long nBlockNo = aStr.toInt32(); // read blocknumber + if (nBlockNo > 0 && m_pMemoStream) // Read data from memo-file, only if { if ( !ReadMemo(nBlockNo, (_rRow->get())[i]->get()) ) break; @@ -994,7 +993,7 @@ sal_Bool ODbaseTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols, s (_rRow->get())[i]->setNull(); } break; default: - OSL_ASSERT("Falscher Type"); + OSL_FAIL("Falscher Type"); } (_rRow->get())[i]->setTypeKind(nType); } @@ -1010,7 +1009,7 @@ void ODbaseTable::FileClose() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::FileClose" ); ::osl::MutexGuard aGuard(m_aMutex); - // falls noch nicht alles geschrieben wurde + // if not everything has been written yet if (m_pMemoStream && m_pMemoStream->IsWritable()) m_pMemoStream->Flush(); @@ -1020,7 +1019,7 @@ void ODbaseTable::FileClose() ODbaseTable_BASE::FileClose(); } // ------------------------------------------------------------------------- -BOOL ODbaseTable::CreateImpl() +sal_Bool ODbaseTable::CreateImpl() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::CreateImpl" ); OSL_ENSURE(!m_pFileStream, "SequenceError"); @@ -1041,7 +1040,7 @@ BOOL ODbaseTable::CreateImpl() { ::rtl::OUString aIdent = m_pConnection->getContent()->getIdentifier()->getContentIdentifier(); if ( aIdent.lastIndexOf('/') != (aIdent.getLength()-1) ) - aIdent += ::rtl::OUString::createFromAscii("/"); + aIdent += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); aIdent += m_Name; aName = aIdent.getStr(); } @@ -1055,7 +1054,7 @@ BOOL ODbaseTable::CreateImpl() Content aContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>()); if (aContent.isDocument()) { - // Hack fuer Bug #30609 , nur wenn das File existiert und die Laenge > 0 gibt es einen Fehler + // Only if the file exists with length > 0 raise an error SvStream* pFileStream = createStream_simpleError( aURL.GetMainURL(INetURLObject::NO_DECODE),STREAM_READ); if (pFileStream && pFileStream->Seek(STREAM_SEEK_TO_END)) @@ -1069,7 +1068,7 @@ BOOL ODbaseTable::CreateImpl() { } - BOOL bMemoFile = sal_False; + sal_Bool bMemoFile = sal_False; sal_Bool bOk = CreateFile(aURL, bMemoFile); @@ -1080,7 +1079,7 @@ BOOL ODbaseTable::CreateImpl() try { Content aContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>()); - aContent.executeCommand( rtl::OUString::createFromAscii( "delete" ),bool2any( sal_True ) ); + aContent.executeCommand( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")),bool2any( sal_True ) ); } catch(Exception&) // an exception is thrown when no file exists { @@ -1108,7 +1107,7 @@ BOOL ODbaseTable::CreateImpl() try { Content aMemoContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>()); - aMemoContent.executeCommand( rtl::OUString::createFromAscii( "delete" ),bool2any( sal_True ) ); + aMemoContent.executeCommand( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")),bool2any( sal_True ) ); } catch(const Exception&) { @@ -1124,7 +1123,7 @@ BOOL ODbaseTable::CreateImpl() { aURL.setExtension(aExt); // kill dbf file Content aMemoContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>()); - aMemoContent.executeCommand( rtl::OUString::createFromAscii( "delete" ),bool2any( sal_True ) ); + aMemoContent.executeCommand( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")),bool2any( sal_True ) ); return sal_False; } m_aHeader.db_typ = dBaseIIIMemo; @@ -1132,7 +1131,7 @@ BOOL ODbaseTable::CreateImpl() else m_aHeader.db_typ = dBaseIII; - return TRUE; + return sal_True; } // ----------------------------------------------------------------------------- void ODbaseTable::throwInvalidColumnType(const sal_uInt16 _nErrorId,const ::rtl::OUString& _sColumnName) @@ -1154,19 +1153,19 @@ void ODbaseTable::throwInvalidColumnType(const sal_uInt16 _nErrorId,const ::rtl: ::dbtools::throwGenericSQLException( sError, *this ); } //------------------------------------------------------------------ -// erzeugt grundsaetzlich dBase IV Datei Format -BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) +// creates in principle dBase IV file format +sal_Bool ODbaseTable::CreateFile(const INetURLObject& aFile, sal_Bool& bCreateMemo) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::CreateFile" ); bCreateMemo = sal_False; - Date aDate; // aktuelles Datum + Date aDate; // current date m_pFileStream = createStream_simpleError( aFile.GetMainURL(INetURLObject::NO_DECODE),STREAM_READWRITE | STREAM_SHARE_DENYWRITE | STREAM_TRUNC ); if (!m_pFileStream) return sal_False; - BYTE nDbaseType = dBaseIII; + sal_uInt8 nDbaseType = dBaseIII; Reference<XIndexAccess> xColumns(getColumns(),UNO_QUERY); Reference<XPropertySet> xCol; const ::rtl::OUString sPropType = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE); @@ -1208,19 +1207,19 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) memset(aBuffer,0,sizeof(aBuffer)); m_pFileStream->Seek(0L); - (*m_pFileStream) << (BYTE) nDbaseType; // dBase format - (*m_pFileStream) << (BYTE) (aDate.GetYear() % 100); // aktuelles Datum + (*m_pFileStream) << (sal_uInt8) nDbaseType; // dBase format + (*m_pFileStream) << (sal_uInt8) (aDate.GetYear() % 100); // current date - (*m_pFileStream) << (BYTE) aDate.GetMonth(); - (*m_pFileStream) << (BYTE) aDate.GetDay(); - (*m_pFileStream) << 0L; // Anzahl der Datensaetze - (*m_pFileStream) << (USHORT)((m_pColumns->getCount()+1) * 32 + 1); // Kopfinformationen, - // pColumns erhaelt immer eine Spalte mehr - (*m_pFileStream) << (USHORT) 0; // Satzlaenge wird spaeter bestimmt + (*m_pFileStream) << (sal_uInt8) aDate.GetMonth(); + (*m_pFileStream) << (sal_uInt8) aDate.GetDay(); + (*m_pFileStream) << 0L; // number of data records + (*m_pFileStream) << (sal_uInt16)((m_pColumns->getCount()+1) * 32 + 1); // header information, + // pColumns contains always an additional column + (*m_pFileStream) << (sal_uInt16) 0; // record length will be determined later m_pFileStream->Write(aBuffer, 20); - USHORT nRecLength = 1; // Laenge 1 fuer deleted flag + sal_uInt16 nRecLength = 1; // Length 1 for deleted flag sal_Int32 nMaxFieldLength = m_pConnection->getMetaData()->getMaxColumnNameLength(); ::rtl::OUString aName; const ::rtl::OUString sPropName = OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME); @@ -1262,7 +1261,7 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) cTyp = 'C'; break; case DataType::DOUBLE: - if (getBOOL(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency wird gesondert behandelt + if (getBOOL(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency will be treated separately cTyp = 'Y'; else cTyp = 'B'; @@ -1276,7 +1275,7 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) case DataType::DECIMAL: case DataType::NUMERIC: case DataType::REAL: - cTyp = 'N'; // nur dBase 3 format + cTyp = 'N'; // only dBase 3 format break; case DataType::TIMESTAMP: cTyp = 'T'; @@ -1313,9 +1312,9 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) { throwInvalidColumnType(STR_INVALID_COLUMN_PRECISION, aName); } - (*m_pFileStream) << (BYTE) Min((ULONG)nPrecision, 255UL); //Feldlaenge - nRecLength = nRecLength + (USHORT)::std::min((USHORT)nPrecision, (USHORT)255UL); - (*m_pFileStream) << (BYTE)0; //Nachkommastellen + (*m_pFileStream) << (sal_uInt8) Min((unsigned)nPrecision, 255U); // field length + nRecLength = nRecLength + (sal_uInt16)::std::min((sal_uInt16)nPrecision, (sal_uInt16)255UL); + (*m_pFileStream) << (sal_uInt8)0; // decimals break; case 'F': case 'N': @@ -1325,43 +1324,43 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) { throwInvalidColumnType(STR_INVALID_PRECISION_SCALE, aName); } - if (getBOOL(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency wird gesondert behandelt + if (getBOOL(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency will be treated separately { - (*m_pFileStream) << (BYTE)10; // Standard Laenge - (*m_pFileStream) << (BYTE)4; + (*m_pFileStream) << (sal_uInt8)10; // standard length + (*m_pFileStream) << (sal_uInt8)4; nRecLength += 10; } else { sal_Int32 nPrec = SvDbaseConverter::ConvertPrecisionToDbase(nPrecision,nScale); - (*m_pFileStream) << (BYTE)( nPrec); - (*m_pFileStream) << (BYTE)nScale; - nRecLength += (USHORT)nPrec; + (*m_pFileStream) << (sal_uInt8)( nPrec); + (*m_pFileStream) << (sal_uInt8)nScale; + nRecLength += (sal_uInt16)nPrec; } break; case 'L': - (*m_pFileStream) << (BYTE)1; - (*m_pFileStream) << (BYTE)0; + (*m_pFileStream) << (sal_uInt8)1; + (*m_pFileStream) << (sal_uInt8)0; ++nRecLength; break; case 'I': - (*m_pFileStream) << (BYTE)4; - (*m_pFileStream) << (BYTE)0; + (*m_pFileStream) << (sal_uInt8)4; + (*m_pFileStream) << (sal_uInt8)0; nRecLength += 4; break; case 'Y': case 'B': case 'T': case 'D': - (*m_pFileStream) << (BYTE)8; - (*m_pFileStream) << (BYTE)0; + (*m_pFileStream) << (sal_uInt8)8; + (*m_pFileStream) << (sal_uInt8)0; nRecLength += 8; break; case 'M': - bCreateMemo = TRUE; - (*m_pFileStream) << (BYTE)10; - (*m_pFileStream) << (BYTE)0; + bCreateMemo = sal_True; + (*m_pFileStream) << (sal_uInt8)10; + (*m_pFileStream) << (sal_uInt8)0; nRecLength += 10; if ( bBinary ) aBuffer[0] = 0x06; @@ -1373,18 +1372,18 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) aBuffer[0] = 0x00; } - (*m_pFileStream) << (BYTE)FIELD_DESCRIPTOR_TERMINATOR; // kopf ende + (*m_pFileStream) << (sal_uInt8)FIELD_DESCRIPTOR_TERMINATOR; // end of header (*m_pFileStream) << (char)DBF_EOL; m_pFileStream->Seek(10L); - (*m_pFileStream) << nRecLength; // Satzlaenge nachtraeglich eintragen + (*m_pFileStream) << nRecLength; // set record length afterwards if (bCreateMemo) { m_pFileStream->Seek(0L); if (nDbaseType == VisualFoxPro) - (*m_pFileStream) << (BYTE) FoxProMemo; + (*m_pFileStream) << (sal_uInt8) FoxProMemo; else - (*m_pFileStream) << (BYTE) dBaseIIIMemo; + (*m_pFileStream) << (sal_uInt8) dBaseIIIMemo; } // if (bCreateMemo) } catch ( const Exception& e ) @@ -1399,15 +1398,15 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo) catch(const Exception&) { } throw; } - return TRUE; + return sal_True; } //------------------------------------------------------------------ -// erzeugt grundsaetzlich dBase III Datei Format -BOOL ODbaseTable::CreateMemoFile(const INetURLObject& aFile) +// creates in principle dBase III file format +sal_Bool ODbaseTable::CreateMemoFile(const INetURLObject& aFile) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::CreateMemoFile" ); - // Makro zum Filehandling fuers Erzeugen von Tabellen + // filehandling macro for table creation m_pMemoStream = createStream_simpleError( aFile.GetMainURL(INetURLObject::NO_DECODE),STREAM_READWRITE | STREAM_SHARE_DENYWRITE); if (!m_pMemoStream) @@ -1416,33 +1415,25 @@ BOOL ODbaseTable::CreateMemoFile(const INetURLObject& aFile) char aBuffer[512]; // write buffer memset(aBuffer,0,sizeof(aBuffer)); -#ifdef WIN - m_pMemoStream->Seek(0L); - for (UINT16 i = 0; i < 512; i++) - { - (*m_pMemoStream) << BYTE(0); - } -#else m_pMemoStream->SetFiller('\0'); m_pMemoStream->SetStreamSize(512); -#endif m_pMemoStream->Seek(0L); - (*m_pMemoStream) << long(1); // Zeiger auf ersten freien Block + (*m_pMemoStream) << long(1); // pointer to the first free block m_pMemoStream->Flush(); delete m_pMemoStream; m_pMemoStream = NULL; - return TRUE; + return sal_True; } //------------------------------------------------------------------ -BOOL ODbaseTable::Drop_Static(const ::rtl::OUString& _sUrl,sal_Bool _bHasMemoFields,OCollection* _pIndexes ) +sal_Bool ODbaseTable::Drop_Static(const ::rtl::OUString& _sUrl,sal_Bool _bHasMemoFields,OCollection* _pIndexes ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::Drop_Static" ); INetURLObject aURL; aURL.SetURL(_sUrl); - BOOL bDropped = ::utl::UCBContentHelper::Kill(aURL.GetMainURL(INetURLObject::NO_DECODE)); + sal_Bool bDropped = ::utl::UCBContentHelper::Kill(aURL.GetMainURL(INetURLObject::NO_DECODE)); if(bDropped) { @@ -1471,11 +1462,10 @@ BOOL ODbaseTable::Drop_Static(const ::rtl::OUString& _sUrl,sal_Bool _bHasMemoFie aURL.setExtension(String::CreateFromAscii("inf")); // as the inf file does not necessarily exist, we aren't allowed to use UCBContentHelper::Kill - // 89711 - 16.07.2001 - frank.schoenheit@sun.com try { ::ucbhelper::Content aDeleteContent( aURL.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment > () ); - aDeleteContent.executeCommand( ::rtl::OUString::createFromAscii( "delete" ), makeAny( sal_Bool( sal_True ) ) ); + aDeleteContent.executeCommand( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")), makeAny( sal_Bool( sal_True ) ) ); } catch(Exception&) { @@ -1486,7 +1476,7 @@ BOOL ODbaseTable::Drop_Static(const ::rtl::OUString& _sUrl,sal_Bool _bHasMemoFie return bDropped; } // ----------------------------------------------------------------------------- -BOOL ODbaseTable::DropImpl() +sal_Bool ODbaseTable::DropImpl() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::DropImpl" ); FileClose(); @@ -1494,7 +1484,7 @@ BOOL ODbaseTable::DropImpl() if(!m_pIndexes) refreshIndexes(); // look for indexes which must be deleted as well - BOOL bDropped = Drop_Static(getEntry(m_pConnection,m_Name),HasMemoFields(),m_pIndexes); + sal_Bool bDropped = Drop_Static(getEntry(m_pConnection,m_Name),HasMemoFields(),m_pIndexes); if(!bDropped) {// we couldn't drop the table so we have to reopen it construct(); @@ -1505,24 +1495,24 @@ BOOL ODbaseTable::DropImpl() } //------------------------------------------------------------------ -BOOL ODbaseTable::InsertRow(OValueRefVector& rRow, BOOL bFlush,const Reference<XIndexAccess>& _xCols) +sal_Bool ODbaseTable::InsertRow(OValueRefVector& rRow, sal_Bool bFlush,const Reference<XIndexAccess>& _xCols) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::InsertRow" ); - // Buffer mit Leerzeichen fuellen + // fill buffer with blanks AllocBuffer(); memset(m_pBuffer, 0, m_aHeader.db_slng); m_pBuffer[0] = ' '; - // Gesamte neue Row uebernehmen: - // ... und am Ende als neuen Record hinzufuegen: - UINT32 nTempPos = m_nFilePos, - nFileSize = 0, - nMemoFileSize = 0; + // Copy new row completely: + // ... and add at the end as new Record: + sal_uInt32 nTempPos = m_nFilePos; - m_nFilePos = (ULONG)m_aHeader.db_anz + 1; - BOOL bInsertRow = UpdateBuffer( rRow, NULL, _xCols ); + m_nFilePos = (sal_uIntPtr)m_aHeader.db_anz + 1; + sal_Bool bInsertRow = UpdateBuffer( rRow, NULL, _xCols ); if ( bInsertRow ) { + sal_uInt32 nFileSize = 0, nMemoFileSize = 0; + nFileSize = lcl_getFileSize(*m_pFileStream); if (HasMemoFields() && m_pMemoStream) @@ -1533,26 +1523,26 @@ BOOL ODbaseTable::InsertRow(OValueRefVector& rRow, BOOL bFlush,const Reference<X if (!WriteBuffer()) { - m_pFileStream->SetStreamSize(nFileSize); // alte Groesse restaurieren + m_pFileStream->SetStreamSize(nFileSize); // restore old size if (HasMemoFields() && m_pMemoStream) - m_pMemoStream->SetStreamSize(nMemoFileSize); // alte Groesse restaurieren - m_nFilePos = nTempPos; // Fileposition restaurieren + m_pMemoStream->SetStreamSize(nMemoFileSize); // restore old size + m_nFilePos = nTempPos; // restore file position } else { (*m_pFileStream) << (char)DBF_EOL; // write EOL - // Anzahl Datensaetze im Header erhoehen: + // raise number of datasets in the header: m_pFileStream->Seek( 4L ); (*m_pFileStream) << (m_aHeader.db_anz + 1); - // beim AppendOnly kein Flush! + // if AppendOnly no flush! if (bFlush) m_pFileStream->Flush(); - // bei Erfolg # erhoehen + // raise number if successfully m_aHeader.db_anz++; - *rRow.get()[0] = m_nFilePos; // BOOKmark setzen + *rRow.get()[0] = m_nFilePos; // set bookmark m_nFilePos = nTempPos; } } @@ -1563,18 +1553,18 @@ BOOL ODbaseTable::InsertRow(OValueRefVector& rRow, BOOL bFlush,const Reference<X } //------------------------------------------------------------------ -BOOL ODbaseTable::UpdateRow(OValueRefVector& rRow, OValueRefRow& pOrgRow,const Reference<XIndexAccess>& _xCols) +sal_Bool ODbaseTable::UpdateRow(OValueRefVector& rRow, OValueRefRow& pOrgRow,const Reference<XIndexAccess>& _xCols) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::UpdateRow" ); - // Buffer mit Leerzeichen fuellen + // fill buffer with blanks AllocBuffer(); - // Auf gewuenschten Record positionieren: + // position on desired record: long nPos = m_aHeader.db_kopf + (long)(m_nFilePos-1) * m_aHeader.db_slng; m_pFileStream->Seek(nPos); m_pFileStream->Read((char*)m_pBuffer, m_aHeader.db_slng); - UINT32 nMemoFileSize( 0 ); + sal_uInt32 nMemoFileSize( 0 ); if (HasMemoFields() && m_pMemoStream) { m_pMemoStream->Seek(STREAM_SEEK_TO_END); @@ -1583,7 +1573,7 @@ BOOL ODbaseTable::UpdateRow(OValueRefVector& rRow, OValueRefRow& pOrgRow,const R if (!UpdateBuffer(rRow, pOrgRow,_xCols) || !WriteBuffer()) { if (HasMemoFields() && m_pMemoStream) - m_pMemoStream->SetStreamSize(nMemoFileSize); // alte Groesse restaurieren + m_pMemoStream->SetStreamSize(nMemoFileSize); // restore old size } else { @@ -1593,24 +1583,23 @@ BOOL ODbaseTable::UpdateRow(OValueRefVector& rRow, OValueRefRow& pOrgRow,const R } //------------------------------------------------------------------ -BOOL ODbaseTable::DeleteRow(const OSQLColumns& _rCols) +sal_Bool ODbaseTable::DeleteRow(const OSQLColumns& _rCols) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::DeleteRow" ); - // Einfach das Loesch-Flag setzen (egal, ob es schon gesetzt war - // oder nicht): - // Auf gewuenschten Record positionieren: + // Set the Delete-Flag (be it set or not): + // Position on desired record: long nFilePos = m_aHeader.db_kopf + (long)(m_nFilePos-1) * m_aHeader.db_slng; m_pFileStream->Seek(nFilePos); OValueRefRow aRow = new OValueRefVector(_rCols.get().size()); - if (!fetchRow(aRow,_rCols,TRUE,TRUE)) + if (!fetchRow(aRow,_rCols,sal_True,sal_True)) return sal_False; Reference<XPropertySet> xCol; ::rtl::OUString aColName; ::comphelper::UStringMixEqual aCase(isCaseSensitive()); - for (USHORT i = 0; i < m_pColumns->getCount(); i++) + for (sal_uInt16 i = 0; i < m_pColumns->getCount(); i++) { Reference<XPropertySet> xIndex = isUniqueByColumnName(i); if (xIndex.is()) @@ -1642,7 +1631,7 @@ BOOL ODbaseTable::DeleteRow(const OSQLColumns& _rCols) } m_pFileStream->Seek(nFilePos); - (*m_pFileStream) << (BYTE)'*'; // mark the row in the table as deleted + (*m_pFileStream) << (sal_uInt8)'*'; // mark the row in the table as deleted m_pFileStream->Flush(); return sal_True; } @@ -1682,18 +1671,18 @@ double toDouble(const ByteString& rString) } //------------------------------------------------------------------ -BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const Reference<XIndexAccess>& _xCols) +sal_Bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const Reference<XIndexAccess>& _xCols) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::UpdateBuffer" ); OSL_ENSURE(m_pBuffer,"Buffer is NULL!"); if ( !m_pBuffer ) - return FALSE; + return sal_False; sal_Int32 nByteOffset = 1; - // Felder aktualisieren: + // Update fields: Reference<XPropertySet> xCol; Reference<XPropertySet> xIndex; - USHORT i; + sal_uInt16 i; ::rtl::OUString aColName; const sal_Int32 nColumnCount = m_pColumns->getCount(); ::std::vector< Reference<XPropertySet> > aIndexedCols(nColumnCount); @@ -1740,7 +1729,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const if (pIndex->Find(0,*rRow.get()[nPos])) { - // es existiert kein eindeutiger Wert + // There is no unique value if ( !aColName.getLength() ) { m_pColumns->getByIndex(i) >>= xCol; @@ -1902,7 +1891,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const const double d = rRow.get()[nPos]->getValue(); m_pColumns->getByIndex(i) >>= xCol; - if (getBOOL(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency wird gesondert behandelt + if (getBOOL(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency is treated separately { sal_Int64 nValue = 0; if ( m_aScales[i] ) @@ -1910,7 +1899,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const else nValue = (sal_Int64)(d); memcpy(pData,&nValue,nLen); - } // if (getBOOL(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency wird gesondert behandelt + } // if (getBOOL(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISCURRENCY)))) // Currency is treated separately else memcpy(pData,&d,nLen); } @@ -1959,7 +1948,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const char cNext = pData[nLen]; // Mark's scratch and replaced by 0 pData[nLen] = '\0'; // This is because the buffer is always a sign of greater ... - ULONG nBlockNo = strtol((const char *)pData,NULL,10); // Block number read + sal_uIntPtr nBlockNo = strtol((const char *)pData,NULL,10); // Block number read // Next initial character restore again: pData[nLen] = cNext; @@ -2015,14 +2004,14 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const } // ----------------------------------------------------------------------------- -BOOL ODbaseTable::WriteMemo(ORowSetValue& aVariable, ULONG& rBlockNr) +sal_Bool ODbaseTable::WriteMemo(ORowSetValue& aVariable, sal_uIntPtr& rBlockNr) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::WriteMemo" ); - // wird die BlockNr 0 vorgegeben, wird der block ans Ende gehaengt - ULONG nSize = 0; + // if the BlockNo 0 is given, the block will be appended at the end + sal_uIntPtr nSize = 0; ::rtl::OString aStr; ::com::sun::star::uno::Sequence<sal_Int8> aValue; - BYTE nHeader[4]; + sal_uInt8 nHeader[4]; const bool bBinary = aVariable.getTypeKind() == DataType::LONGVARBINARY && m_aMemoHeader.db_typ == MemoFoxPro; if ( bBinary ) { @@ -2034,25 +2023,25 @@ BOOL ODbaseTable::WriteMemo(ORowSetValue& aVariable, ULONG& rBlockNr) nSize = DBTypeConversion::convertUnicodeString( aVariable.getString(), aStr, m_eEncoding ); } - // Anhaengen oder ueberschreiben - BOOL bAppend = rBlockNr == 0; + // append or overwrite + sal_Bool bAppend = rBlockNr == 0; if (!bAppend) { switch (m_aMemoHeader.db_typ) { - case MemodBaseIII: // dBase III-Memofeld, endet mit 2 * Ctrl-Z + case MemodBaseIII: // dBase III-Memofield, ends with 2 * Ctrl-Z bAppend = nSize > (512 - 2); break; case MemoFoxPro: - case MemodBaseIV: // dBase IV-Memofeld mit Laengenangabe + case MemodBaseIV: // dBase IV-Memofield with length { char sHeader[4]; m_pMemoStream->Seek(rBlockNr * m_aMemoHeader.db_size); m_pMemoStream->SeekRel(4L); m_pMemoStream->Read(sHeader,4); - ULONG nOldSize; + sal_uIntPtr nOldSize; if (m_aMemoHeader.db_typ == MemoFoxPro) nOldSize = ((((unsigned char)sHeader[0]) * 256 + (unsigned char)sHeader[1]) * 256 + @@ -2064,8 +2053,8 @@ BOOL ODbaseTable::WriteMemo(ORowSetValue& aVariable, ULONG& rBlockNr) (unsigned char)sHeader[1]) * 256 + (unsigned char)sHeader[0] - 8; - // passt die neue Laenge in die belegten Bloecke - ULONG nUsedBlocks = ((nSize + 8) / m_aMemoHeader.db_size) + (((nSize + 8) % m_aMemoHeader.db_size > 0) ? 1 : 0), + // fits the new length in the used blocks + sal_uIntPtr nUsedBlocks = ((nSize + 8) / m_aMemoHeader.db_size) + (((nSize + 8) % m_aMemoHeader.db_size > 0) ? 1 : 0), nOldUsedBlocks = ((nOldSize + 8) / m_aMemoHeader.db_size) + (((nOldSize + 8) % m_aMemoHeader.db_size > 0) ? 1 : 0); bAppend = nUsedBlocks > nOldUsedBlocks; } @@ -2074,8 +2063,8 @@ BOOL ODbaseTable::WriteMemo(ORowSetValue& aVariable, ULONG& rBlockNr) if (bAppend) { - ULONG nStreamSize = m_pMemoStream->Seek(STREAM_SEEK_TO_END); - // letzten block auffuellen + sal_uIntPtr nStreamSize = m_pMemoStream->Seek(STREAM_SEEK_TO_END); + // fill last block rBlockNr = (nStreamSize / m_aMemoHeader.db_size) + ((nStreamSize % m_aMemoHeader.db_size) > 0 ? 1 : 0); m_pMemoStream->SetStreamSize(rBlockNr * m_aMemoHeader.db_size); @@ -2088,7 +2077,7 @@ BOOL ODbaseTable::WriteMemo(ORowSetValue& aVariable, ULONG& rBlockNr) switch (m_aMemoHeader.db_typ) { - case MemodBaseIII: // dBase III-Memofeld, endet mit Ctrl-Z + case MemodBaseIII: // dBase III-Memofield, ends with Ctrl-Z { const char cEOF = (char) DBF_EOL; nSize++; @@ -2096,33 +2085,33 @@ BOOL ODbaseTable::WriteMemo(ORowSetValue& aVariable, ULONG& rBlockNr) (*m_pMemoStream) << cEOF << cEOF; } break; case MemoFoxPro: - case MemodBaseIV: // dBase IV-Memofeld mit Laengenangabe + case MemodBaseIV: // dBase IV-Memofeld with length { if ( MemodBaseIV == m_aMemoHeader.db_typ ) - (*m_pMemoStream) << (BYTE)0xFF - << (BYTE)0xFF - << (BYTE)0x08; + (*m_pMemoStream) << (sal_uInt8)0xFF + << (sal_uInt8)0xFF + << (sal_uInt8)0x08; else - (*m_pMemoStream) << (BYTE)0x00 - << (BYTE)0x00 - << (BYTE)0x00; + (*m_pMemoStream) << (sal_uInt8)0x00 + << (sal_uInt8)0x00 + << (sal_uInt8)0x00; - UINT32 nWriteSize = nSize; + sal_uInt32 nWriteSize = nSize; if (m_aMemoHeader.db_typ == MemoFoxPro) { if ( bBinary ) - (*m_pMemoStream) << (BYTE) 0x00; // Picture + (*m_pMemoStream) << (sal_uInt8) 0x00; // Picture else - (*m_pMemoStream) << (BYTE) 0x01; // Memo + (*m_pMemoStream) << (sal_uInt8) 0x01; // Memo for (int i = 4; i > 0; nWriteSize >>= 8) - nHeader[--i] = (BYTE) (nWriteSize % 256); + nHeader[--i] = (sal_uInt8) (nWriteSize % 256); } else { - (*m_pMemoStream) << (BYTE) 0x00; + (*m_pMemoStream) << (sal_uInt8) 0x00; nWriteSize += 8; for (int i = 0; i < 4; nWriteSize >>= 8) - nHeader[i++] = (BYTE) (nWriteSize % 256); + nHeader[i++] = (sal_uInt8) (nWriteSize % 256); } m_pMemoStream->Write(nHeader,4); @@ -2135,13 +2124,13 @@ BOOL ODbaseTable::WriteMemo(ORowSetValue& aVariable, ULONG& rBlockNr) } - // Schreiben der neuen Blocknummer + // Write the new block number if (bAppend) { - ULONG nStreamSize = m_pMemoStream->Seek(STREAM_SEEK_TO_END); + sal_uIntPtr nStreamSize = m_pMemoStream->Seek(STREAM_SEEK_TO_END); m_aMemoHeader.db_next = (nStreamSize / m_aMemoHeader.db_size) + ((nStreamSize % m_aMemoHeader.db_size) > 0 ? 1 : 0); - // Schreiben der neuen Blocknummer + // Write the new block number m_pMemoStream->Seek(0L); (*m_pMemoStream) << m_aMemoHeader.db_next; m_pMemoStream->Flush(); @@ -2195,7 +2184,7 @@ void ODbaseTable::alterColumn(sal_Int32 index, if(xOldColumn.is()) xCopyColumn = xOldColumn->createDataDescriptor(); else - xCopyColumn = new OColumn(getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); + xCopyColumn = new OColumn(getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers()); ::comphelper::copyProperties(descriptor,xCopyColumn); @@ -2220,7 +2209,7 @@ void ODbaseTable::alterColumn(sal_Int32 index, if(xColumn.is()) xCpy = xColumn->createDataDescriptor(); else - xCpy = new OColumn(getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); + xCpy = new OColumn(getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers()); ::comphelper::copyProperties(xProp,xCpy); xAppend->appendByDescriptor(xCpy); } @@ -2236,7 +2225,7 @@ void ODbaseTable::alterColumn(sal_Int32 index, if(xColumn.is()) xCpy = xColumn->createDataDescriptor(); else - xCpy = new OColumn(getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); + xCpy = new OColumn(getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers()); ::comphelper::copyProperties(xProp,xCpy); xAppend->appendByDescriptor(xCpy); } @@ -2281,7 +2270,7 @@ void ODbaseTable::alterColumn(sal_Int32 index, } catch(const Exception&) { - OSL_ENSURE(0,"ODbaseTable::alterColumn: Exception occured!"); + OSL_FAIL("ODbaseTable::alterColumn: Exception occurred!"); throw; } } @@ -2319,7 +2308,7 @@ namespace { ::rtl::OUString aIdent = _pConenction->getContent()->getIdentifier()->getContentIdentifier(); if ( aIdent.lastIndexOf('/') != (aIdent.getLength()-1) ) - aIdent += ::rtl::OUString::createFromAscii("/"); + aIdent += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); aIdent += oldName; aName = aIdent; } @@ -2336,11 +2325,11 @@ namespace Content aContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>()); Sequence< PropertyValue > aProps( 1 ); - aProps[0].Name = ::rtl::OUString::createFromAscii("Title"); + aProps[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Title")); aProps[0].Handle = -1; // n/a aProps[0].Value = makeAny( ::rtl::OUString(sNewName) ); Sequence< Any > aValues; - aContent.executeCommand( rtl::OUString::createFromAscii( "setPropertyValues" ),makeAny(aProps) ) >>= aValues; + aContent.executeCommand( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("setPropertyValues")),makeAny(aProps) ) >>= aValues; if(aValues.getLength() && aValues[0].hasValue()) throw Exception(); } @@ -2377,7 +2366,7 @@ void ODbaseTable::addColumn(const Reference< XPropertySet >& _xNewColumn) pNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(::rtl::OUString(sTempName))); { Reference<XAppend> xAppend(pNewTable->getColumns(),UNO_QUERY); - sal_Bool bCase = getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers(); + sal_Bool bCase = getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers(); // copy the structure for(sal_Int32 i=0;i < m_pColumns->getCount();++i) { @@ -2410,7 +2399,7 @@ void ODbaseTable::addColumn(const Reference< XPropertySet >& _xNewColumn) ::dbtools::throwGenericSQLException( sError, *this ); } - BOOL bAlreadyDroped = FALSE; + sal_Bool bAlreadyDroped = sal_False; try { pNewTable->construct(); @@ -2419,7 +2408,7 @@ void ODbaseTable::addColumn(const Reference< XPropertySet >& _xNewColumn) // drop the old table if(DropImpl()) { - bAlreadyDroped = TRUE; + bAlreadyDroped = sal_True; pNewTable->renameImpl(m_Name); // release the temp file } @@ -2450,7 +2439,7 @@ void ODbaseTable::dropColumn(sal_Int32 _nPos) pNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),makeAny(::rtl::OUString(sTempName))); { Reference<XAppend> xAppend(pNewTable->getColumns(),UNO_QUERY); - sal_Bool bCase = getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers(); + sal_Bool bCase = getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers(); // copy the structure for(sal_Int32 i=0;i < m_pColumns->getCount();++i) { @@ -2501,7 +2490,7 @@ String ODbaseTable::createTempFile() RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::createTempFile" ); ::rtl::OUString aIdent = m_pConnection->getContent()->getIdentifier()->getContentIdentifier(); if ( aIdent.lastIndexOf('/') != (aIdent.getLength()-1) ) - aIdent += ::rtl::OUString::createFromAscii("/"); + aIdent += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); String sTempName(aIdent); String sExt; sExt.AssignAscii("."); @@ -2603,7 +2592,7 @@ sal_Bool ODbaseTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_In { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::seekRow" ); // ---------------------------------------------------------- - // Positionierung vorbereiten: + // prepare positioning: OSL_ENSURE(m_pFileStream,"ODbaseTable::seekRow: FileStream is NULL!"); sal_uInt32 nNumberOfRecords = (sal_uInt32)m_aHeader.db_anz; @@ -2647,11 +2636,11 @@ sal_Bool ODbaseTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_In OSL_ENSURE(m_nFilePos >= 1,"SdbDBFCursor::FileFetchRow: ungueltige Record-Position"); sal_Int32 nPos = m_aHeader.db_kopf + (sal_Int32)(m_nFilePos-1) * nEntryLen; - ULONG nLen = m_pFileStream->Seek(nPos); + m_pFileStream->Seek(nPos); if (m_pFileStream->GetError() != ERRCODE_NONE) goto Error; - nLen = m_pFileStream->Read((char*)m_pBuffer, nEntryLen); + m_pFileStream->Read((char*)m_pBuffer, nEntryLen); if (m_pFileStream->GetError() != ERRCODE_NONE) goto Error; } @@ -2674,7 +2663,7 @@ Error: m_nFilePos = 0; break; case IResultSetHelper::BOOKMARK: - m_nFilePos = nTempPos; // vorherige Position + m_nFilePos = nTempPos; // last position } return sal_False; @@ -2683,27 +2672,27 @@ End: return sal_True; } // ----------------------------------------------------------------------------- -BOOL ODbaseTable::ReadMemo(ULONG nBlockNo, ORowSetValue& aVariable) +sal_Bool ODbaseTable::ReadMemo(sal_uIntPtr nBlockNo, ORowSetValue& aVariable) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::ReadMemo" ); - BOOL bIsText = TRUE; + bool bIsText = true; m_pMemoStream->Seek(nBlockNo * m_aMemoHeader.db_size); switch (m_aMemoHeader.db_typ) { - case MemodBaseIII: // dBase III-Memofeld, endet mit Ctrl-Z + case MemodBaseIII: // dBase III-Memofield, ends with Ctrl-Z { const char cEOF = (char) DBF_EOL; ByteString aBStr; static char aBuf[514]; - aBuf[512] = 0; // sonst kann der Zufall uebel mitspielen - BOOL bReady = sal_False; + aBuf[512] = 0; // avoid random value + sal_Bool bReady = sal_False; do { m_pMemoStream->Read(&aBuf,512); - USHORT i = 0; + sal_uInt16 i = 0; while (aBuf[i] != cEOF && ++i < 512) ; bReady = aBuf[i] == cEOF; @@ -2718,7 +2707,7 @@ BOOL ODbaseTable::ReadMemo(ULONG nBlockNo, ORowSetValue& aVariable) } break; case MemoFoxPro: - case MemodBaseIV: // dBase IV-Memofeld mit Laengenangabe + case MemodBaseIV: // dBase IV-Memofield with length { char sHeader[4]; m_pMemoStream->Read(sHeader,4); @@ -2727,7 +2716,7 @@ BOOL ODbaseTable::ReadMemo(ULONG nBlockNo, ORowSetValue& aVariable) { bIsText = sHeader[3] != 0; } - else if (((BYTE)sHeader[0]) != 0xFF || ((BYTE)sHeader[1]) != 0xFF || ((BYTE)sHeader[2]) != 0x08) + else if (((sal_uInt8)sHeader[0]) != 0xFF || ((sal_uInt8)sHeader[1]) != 0xFF || ((sal_uInt8)sHeader[2]) != 0x08) { return sal_False; } @@ -2776,7 +2765,7 @@ BOOL ODbaseTable::ReadMemo(ULONG nBlockNo, ORowSetValue& aVariable) void ODbaseTable::AllocBuffer() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::AllocBuffer" ); - UINT16 nSize = m_aHeader.db_slng; + sal_uInt16 nSize = m_aHeader.db_slng; OSL_ENSURE(nSize > 0, "Size too small"); if (m_nBufferSize != nSize) @@ -2785,20 +2774,20 @@ void ODbaseTable::AllocBuffer() m_pBuffer = NULL; } - // Falls noch kein Puffer vorhanden: allozieren: + // if there is no buffer available: allocate: if (m_pBuffer == NULL && nSize) { m_nBufferSize = nSize; - m_pBuffer = new BYTE[m_nBufferSize+1]; + m_pBuffer = new sal_uInt8[m_nBufferSize+1]; } } // ----------------------------------------------------------------------------- -BOOL ODbaseTable::WriteBuffer() +sal_Bool ODbaseTable::WriteBuffer() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbase", "Ocke.Janssen@sun.com", "ODbaseTable::WriteBuffer" ); OSL_ENSURE(m_nFilePos >= 1,"SdbDBFCursor::FileFetchRow: ungueltige Record-Position"); - // Auf gewuenschten Record positionieren: + // postion on desired record: long nPos = m_aHeader.db_kopf + (long)(m_nFilePos-1) * m_aHeader.db_slng; m_pFileStream->Seek(nPos); return m_pFileStream->Write((char*) m_pBuffer, m_aHeader.db_slng) > 0; diff --git a/connectivity/source/drivers/dbase/DTables.cxx b/connectivity/source/drivers/dbase/DTables.cxx index 507d91fb3e..7c4b452e87 100644 --- a/connectivity/source/drivers/dbase/DTables.cxx +++ b/connectivity/source/drivers/dbase/DTables.cxx @@ -59,7 +59,7 @@ sdbcx::ObjectType ODbaseTables::createObject(const ::rtl::OUString& _rName) { ::rtl::OUString aName,aSchema; ODbaseTable* pRet = new ODbaseTable(this,(ODbaseConnection*)static_cast<OFileCatalog&>(m_rParent).getConnection(), - _rName,::rtl::OUString::createFromAscii("TABLE")); + _rName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE"))); sdbcx::ObjectType xRet = pRet; pRet->construct(); diff --git a/connectivity/source/drivers/dbase/Dservices.cxx b/connectivity/source/drivers/dbase/Dservices.cxx index 69bd7ffec0..fc2076b14e 100644 --- a/connectivity/source/drivers/dbase/Dservices.cxx +++ b/connectivity/source/drivers/dbase/Dservices.cxx @@ -30,13 +30,11 @@ #include "precompiled_connectivity.hxx" #include "dbase/DDriver.hxx" #include <cppuhelper/factory.hxx> -#include <osl/diagnose.h> using namespace connectivity::dbase; using ::rtl::OUString; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; -using ::com::sun::star::registry::XRegistryKey; using ::com::sun::star::lang::XSingleServiceFactory; using ::com::sun::star::lang::XMultiServiceFactory; @@ -49,31 +47,6 @@ typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc) rtl_ModuleCount* _pT ); -//*************************************************************************************** -// -// Die vorgeschriebene C-Api muss erfuellt werden! -// Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen. -// - -//--------------------------------------------------------------------------------------- -void REGISTER_PROVIDER( - const OUString& aServiceImplName, - const Sequence< OUString>& Services, - const Reference< ::com::sun::star::registry::XRegistryKey > & xKey) -{ - OUString aMainKeyName; - aMainKeyName = OUString::createFromAscii("/"); - aMainKeyName += aServiceImplName; - aMainKeyName += OUString::createFromAscii("/UNO/SERVICES"); - - Reference< ::com::sun::star::registry::XRegistryKey > xNewKey( xKey->createKey(aMainKeyName) ); - OSL_ENSURE(xNewKey.is(), "FILE::component_writeInfo : could not create a registry key !"); - - for (sal_Int32 i=0; i<Services.getLength(); ++i) - xNewKey->createKey(Services[i]); -} - - //--------------------------------------------------------------------------------------- struct ProviderRequest { @@ -113,7 +86,6 @@ struct ProviderRequest }; //--------------------------------------------------------------------------------------- - extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char **ppEnvTypeName, @@ -124,31 +96,6 @@ component_getImplementationEnvironment( } //--------------------------------------------------------------------------------------- -extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( - void* /*pServiceManager*/, - void* pRegistryKey - ) -{ - if (pRegistryKey) - try - { - Reference< ::com::sun::star::registry::XRegistryKey > xKey(reinterpret_cast< ::com::sun::star::registry::XRegistryKey*>(pRegistryKey)); - - REGISTER_PROVIDER( - ODriver::getImplementationName_Static(), - ODriver::getSupportedServiceNames_Static(), xKey); - - return sal_True; - } - catch (::com::sun::star::registry::InvalidRegistryException& ) - { - OSL_ENSURE(sal_False, "FILE::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !"); - } - - return sal_False; -} - -//--------------------------------------------------------------------------------------- extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplementationName, void* pServiceManager, diff --git a/connectivity/source/drivers/dbase/dbase.component b/connectivity/source/drivers/dbase/dbase.component new file mode 100755 index 0000000000..7f913f0836 --- /dev/null +++ b/connectivity/source/drivers/dbase/dbase.component @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.sdbc.dbase.ODriver"> + <service name="com.sun.star.sdbc.Driver"/> + <service name="com.sun.star.sdbcx.Driver"/> + </implementation> +</component> diff --git a/connectivity/source/drivers/dbase/dbase.mxp.map b/connectivity/source/drivers/dbase/dbase.mxp.map index c5b4377b04..87eccc45b6 100644..100755 --- a/connectivity/source/drivers/dbase/dbase.mxp.map +++ b/connectivity/source/drivers/dbase/dbase.mxp.map @@ -1,5 +1,4 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory __mh_dylib_header ___builtin_delete diff --git a/connectivity/source/drivers/dbase/dbase.xcu b/connectivity/source/drivers/dbase/dbase.xcu index 319b8d79a9..319b8d79a9 100755..100644 --- a/connectivity/source/drivers/dbase/dbase.xcu +++ b/connectivity/source/drivers/dbase/dbase.xcu diff --git a/connectivity/source/drivers/dbase/dbase.xml b/connectivity/source/drivers/dbase/dbase.xml index e378fcd5fd..e378fcd5fd 100644..100755 --- a/connectivity/source/drivers/dbase/dbase.xml +++ b/connectivity/source/drivers/dbase/dbase.xml diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx index f769980ed2..f928d6e708 100644 --- a/connectivity/source/drivers/dbase/dindexnode.cxx +++ b/connectivity/source/drivers/dbase/dindexnode.cxx @@ -43,19 +43,19 @@ using namespace connectivity::dbase; using namespace connectivity::file; using namespace com::sun::star::sdbc; // ----------------------------------------------------------------------------- -ONDXKey::ONDXKey(UINT32 nRec) +ONDXKey::ONDXKey(sal_uInt32 nRec) :nRecord(nRec) { } // ----------------------------------------------------------------------------- -ONDXKey::ONDXKey(const ORowSetValue& rVal, sal_Int32 eType, UINT32 nRec) +ONDXKey::ONDXKey(const ORowSetValue& rVal, sal_Int32 eType, sal_uInt32 nRec) : ONDXKey_BASE(eType) , nRecord(nRec) , xValue(rVal) { } // ----------------------------------------------------------------------------- -ONDXKey::ONDXKey(const rtl::OUString& aStr, UINT32 nRec) +ONDXKey::ONDXKey(const rtl::OUString& aStr, sal_uInt32 nRec) : ONDXKey_BASE(::com::sun::star::sdbc::DataType::VARCHAR) ,nRecord(nRec) { @@ -67,7 +67,7 @@ ONDXKey::ONDXKey(const rtl::OUString& aStr, UINT32 nRec) } // ----------------------------------------------------------------------------- -ONDXKey::ONDXKey(double aVal, UINT32 nRec) +ONDXKey::ONDXKey(double aVal, sal_uInt32 nRec) : ONDXKey_BASE(::com::sun::star::sdbc::DataType::DOUBLE) ,nRecord(nRec) ,xValue(aVal) @@ -80,7 +80,7 @@ ONDXKey::ONDXKey(double aVal, UINT32 nRec) //================================================================== ONDXPage::ONDXPage(ODbaseIndex& rInd, sal_uInt32 nPos, ONDXPage* pParent) :nPagePos(nPos) - ,bModified(FALSE) + ,bModified(sal_False) ,nCount(0) ,aParent(pParent) ,rIndex(rInd) @@ -98,20 +98,20 @@ ONDXPage::~ONDXPage() //------------------------------------------------------------------ void ONDXPage::QueryDelete() { - // Ablegen im GarbageCollector + // Store in GarbageCollector if (IsModified() && rIndex.m_pFileStream) (*rIndex.m_pFileStream) << *this; - bModified = FALSE; + bModified = sal_False; if (rIndex.UseCollector()) { if (aChild.Is()) - aChild->Release(FALSE); + aChild->Release(sal_False); - for (USHORT i = 0; i < rIndex.getHeader().db_maxkeys;i++) + for (sal_uInt16 i = 0; i < rIndex.getHeader().db_maxkeys;i++) { if (ppNodes[i].GetChild().Is()) - ppNodes[i].GetChild()->Release(FALSE); + ppNodes[i].GetChild()->Release(sal_False); ppNodes[i] = ONDXNode(); } @@ -135,10 +135,10 @@ ONDXPagePtr& ONDXPage::GetChild(ODbaseIndex* pIndex) } //------------------------------------------------------------------ -USHORT ONDXPage::FindPos(const ONDXKey& rKey) const +sal_uInt16 ONDXPage::FindPos(const ONDXKey& rKey) const { - // sucht nach Platz fuer den vorgegeben key auf einer Seite - USHORT i = 0; + // searches the position for the given key in a page + sal_uInt16 i = 0; while (i < nCount && rKey > ((*this)[i]).GetKey()) i++; @@ -146,22 +146,21 @@ USHORT ONDXPage::FindPos(const ONDXKey& rKey) const } //------------------------------------------------------------------ -BOOL ONDXPage::Find(const ONDXKey& rKey) -{ - // sucht den vorgegeben key - // Besonderheit: gelangt der Algorithmus ans Ende - // wird immer die aktuelle Seite und die Knotenposition vermerkt - // auf die die Bedingung <= zutrifft - // dieses findet beim Insert besondere Beachtung - USHORT i = 0; +sal_Bool ONDXPage::Find(const ONDXKey& rKey) +{ + // searches the given key + // Speciality: At the end of the method + // the actual page and the position of the node, fulfilling the '<=' condition, are saved + // This is considered at insert. + sal_uInt16 i = 0; while (i < nCount && rKey > ((*this)[i]).GetKey()) i++; - BOOL bResult = FALSE; + sal_Bool bResult = sal_False; if (!IsLeaf()) { - // weiter absteigen + // descend further ONDXPagePtr aPage = (i==0) ? GetChild(&rIndex) : ((*this)[i-1]).GetChild(&rIndex, this); bResult = aPage.Is() && aPage->Find(rKey); } @@ -169,7 +168,7 @@ BOOL ONDXPage::Find(const ONDXKey& rKey) { rIndex.m_aCurLeaf = this; rIndex.m_nCurNode = i - 1; - bResult = FALSE; + bResult = sal_False; } else { @@ -181,42 +180,41 @@ BOOL ONDXPage::Find(const ONDXKey& rKey) } //------------------------------------------------------------------ -BOOL ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft) +sal_Bool ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft) { - // beim Erzeugen eines Index koennen auch mehrere Knoten eingefuegt werden - // diese sin dann aufsteigend sortiert - BOOL bAppend = nRowsLeft > 0; + // When creating an index there can be multiple nodes added, + // these are sorted ascending + sal_Bool bAppend = nRowsLeft > 0; if (IsFull()) { - BOOL bResult = TRUE; + sal_Bool bResult = sal_True; ONDXNode aSplitNode; if (bAppend) aSplitNode = rNode; else { - // merken des letzten Knotens + // Save the last node aSplitNode = (*this)[nCount-1]; if(rNode.GetKey() <= aSplitNode.GetKey()) { - // und damit habe ich im folgenden praktisch eine Node weniger + // this practically reduces the number of nodes by 1 if (IsLeaf() && this == &rIndex.m_aCurLeaf) { - // geht davon aus, dass der Knoten, auf dem die Bedingung (<=) - // zutrifft, als m_nCurNode gesetzt ist - --nCount; // (sonst bekomme ich u.U. Assertions und GPFs - 60593) + // assumes, that the node, for which the condition (<=) holds, is stored in m_nCurNode + --nCount; // (otherwise we might get Assertions and GPFs - 60593) bResult = Insert(rIndex.m_nCurNode + 1, rNode); } else // Position unbekannt { - USHORT nPos = NODE_NOTFOUND; + sal_uInt16 nPos = NODE_NOTFOUND; while (++nPos < nCount && rNode.GetKey() > ((*this)[nPos]).GetKey()) ; - --nCount; // (sonst bekomme ich u.U. Assertions und GPFs - 60593) + --nCount; // (otherwise we might get Assertions and GPFs - 60593) bResult = Insert(nPos, rNode); } - // konnte der neue Knoten eingefuegt werden + // can the new node be inserted if (!bResult) { nCount++; @@ -230,10 +228,10 @@ BOOL ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft) sal_uInt32 nNewPagePos = rIndex.GetPageCount(); sal_uInt32 nNewPageCount = nNewPagePos + 1; - // Herausgeloesten Knoten beim Vater einfuegen + // insert extracted node into parent node if (!HasParent()) { - // Kein Vater, dann neue Wurzel + // No parent, then new root ONDXPagePtr aNewRoot = rIndex.CreatePage(nNewPagePos + 1); aNewRoot->SetChild(this); @@ -242,13 +240,12 @@ BOOL ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft) rIndex.SetPageCount(++nNewPageCount); } - // neues blatt erzeugen und Seite aufteilen + // create new leaf and divide page ONDXPagePtr aNewPage = rIndex.CreatePage(nNewPagePos,aParent); rIndex.SetPageCount(nNewPageCount); - // wieviele Knoten weren noch eingefuegt - // kommen noch ausreichend, dann koennen die Seiten bis zum Rand vollgestopft werden - + // How many nodes are being inserted? + // Enough, then we can fill the page to the brim ONDXNode aInnerNode; if (!IsLeaf() || nRowsLeft < (sal_uInt32)(rIndex.GetMaxNodes() / 2)) aInnerNode = Split(*aNewPage); @@ -256,14 +253,14 @@ BOOL ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft) { aInnerNode = (*this)[nCount - 1]; - // Knoten zeigt auf neue Seite + // Node points to the new page aInnerNode.SetChild(aNewPage); - // innere Knoten haben keine Recordnummer + // Inner nodes have no record number if (rIndex.isUnique()) aInnerNode.GetKey().ResetRecord(); - // neue Seite zeigt nun auf Seite des herausgeloesten Knoten + // new page points to the page of the extracted node if (!IsLeaf()) aNewPage->SetChild(aInnerNode.GetChild()); } @@ -275,15 +272,15 @@ BOOL ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft) rIndex.m_aCurLeaf = aNewPage; rIndex.m_nCurNode = rIndex.m_aCurLeaf->Count() - 1; - // Freigeben nicht benoetigter Seiten, danach besteht keine Referenz - // mehr auf die Seite, danach kann 'this' nicht mehr gueltig sein!!! + // free not needed pages, there are no references to those on the page + // afterwards 'this' can't be valid anymore!!! ReleaseFull(); } - // Einfuegen des herausgeloesten Knotens + // Insert extracted node return aTempParent->Insert(aInnerNode); } - else // Seite einfach weiter auffuellen + else // Fill the page up { if (bAppend) { @@ -293,7 +290,7 @@ BOOL ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft) } else { - USHORT nNodePos = FindPos(rNode.GetKey()); + sal_uInt16 nNodePos = FindPos(rNode.GetKey()); if (IsLeaf()) rIndex.m_nCurNode = nNodePos; @@ -303,24 +300,24 @@ BOOL ONDXPage::Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft) } //------------------------------------------------------------------ -BOOL ONDXPage::Insert(USHORT nPos, ONDXNode& rNode) +sal_Bool ONDXPage::Insert(sal_uInt16 nPos, ONDXNode& rNode) { - USHORT nMaxCount = rIndex.getHeader().db_maxkeys; + sal_uInt16 nMaxCount = rIndex.getHeader().db_maxkeys; if (nPos >= nMaxCount) - return FALSE; + return sal_False; if (nCount) { ++nCount; - // nach rechts verschieben - for (USHORT i = std::min((USHORT)(nMaxCount-1), (USHORT)(nCount-1)); nPos < i; --i) + // shift right + for (sal_uInt16 i = std::min((sal_uInt16)(nMaxCount-1), (sal_uInt16)(nCount-1)); nPos < i; --i) (*this)[i] = (*this)[i-1]; } else if (nCount < nMaxCount) nCount++; - // einfuegen an der Position + // insert at the position ONDXNode& rInsertNode = (*this)[nPos]; rInsertNode = rNode; if (rInsertNode.GetChild().Is()) @@ -329,28 +326,28 @@ BOOL ONDXPage::Insert(USHORT nPos, ONDXNode& rNode) rNode.GetChild()->SetParent(this); } - bModified = TRUE; + bModified = sal_True; - return TRUE; + return sal_True; } //------------------------------------------------------------------ -BOOL ONDXPage::Append(ONDXNode& rNode) +sal_Bool ONDXPage::Append(ONDXNode& rNode) { DBG_ASSERT(!IsFull(), "kein Append moeglich"); return Insert(nCount, rNode); } //------------------------------------------------------------------ -void ONDXPage::Release(BOOL bSave) +void ONDXPage::Release(sal_Bool bSave) { - // freigeben der Pages + // free pages if (aChild.Is()) aChild->Release(bSave); - // Pointer freigeben + // free pointer aChild.Clear(); - for (USHORT i = 0; i < rIndex.getHeader().db_maxkeys;i++) + for (sal_uInt16 i = 0; i < rIndex.getHeader().db_maxkeys;i++) { if (ppNodes[i].GetChild()) ppNodes[i].GetChild()->Release(bSave); @@ -360,16 +357,16 @@ void ONDXPage::Release(BOOL bSave) aParent = NULL; } //------------------------------------------------------------------ -void ONDXPage::ReleaseFull(BOOL bSave) +void ONDXPage::ReleaseFull(sal_Bool bSave) { ONDXPagePtr aTempParent = aParent; Release(bSave); if (aTempParent.Is()) { - // Freigeben nicht benoetigter Seiten, danach besteht keine Referenz - // mehr auf die Seite, danach kann 'this' nicht mehr gueltig sein!!! - USHORT nParentPos = aTempParent->Search(this); + // Free pages not needed, there will be no reference anymore to the pages + // afterwards 'this' can't be valid anymore!!! + sal_uInt16 nParentPos = aTempParent->Search(this); if (nParentPos != NODE_NOTFOUND) (*aTempParent)[nParentPos].GetChild().Clear(); else @@ -377,44 +374,43 @@ void ONDXPage::ReleaseFull(BOOL bSave) } } //------------------------------------------------------------------ -BOOL ONDXPage::Delete(USHORT nNodePos) +sal_Bool ONDXPage::Delete(sal_uInt16 nNodePos) { if (IsLeaf()) { - // Letztes Element wird geloescht + // The last element will not be deleted if (nNodePos == (nCount - 1)) { ONDXNode aNode = (*this)[nNodePos]; - // beim Parent muss nun der KeyValue ausgetauscht werden + // parent's KeyValue has to be replaced if (HasParent()) aParent->SearchAndReplace(aNode.GetKey(), (*this)[nNodePos-1].GetKey()); } } - // Loeschen des Knoten + // Delete the node Remove(nNodePos); - // Unterlauf + // Underflow if (HasParent() && nCount < (rIndex.GetMaxNodes() / 2)) { - // Feststellen, welcher Knoten auf die Seite zeigt - USHORT nParentNodePos = aParent->Search(this); - // letzte Element auf Vaterseite - // -> zusammenlegen mit vorletzter Seite + // determine, which node points to the page + sal_uInt16 nParentNodePos = aParent->Search(this); + // last element on parent-page -> merge with secondlast page if (nParentNodePos == (aParent->Count() - 1)) { if (!nParentNodePos) - // zusammenlegen mit linken nachbarn + // merge with left neighbour Merge(nParentNodePos,aParent->GetChild(&rIndex)); else Merge(nParentNodePos,(*aParent)[nParentNodePos-1].GetChild(&rIndex,aParent)); } - // sonst Seite mit naechster Seite zusammenlegen + // otherwise merge page with next page else { - // zusammenlegen mit rechten nachbarn + // merge with right neighbour Merge(nParentNodePos + 1,((*aParent)[nParentNodePos + 1].GetChild(&rIndex,aParent))); nParentNodePos++; } @@ -422,9 +418,9 @@ BOOL ONDXPage::Delete(USHORT nNodePos) aParent->Delete(nParentNodePos); } else if (IsRoot()) - // Sicherstellen das die Position der Wurzel festgehalten wird + // make sure that the position of the root is kept rIndex.SetRootPos(nPagePos); - return TRUE; + return sal_True; } @@ -432,24 +428,23 @@ BOOL ONDXPage::Delete(USHORT nNodePos) ONDXNode ONDXPage::Split(ONDXPage& rPage) { DBG_ASSERT(IsFull(), "Falsches Splitting"); - /* Aufteilen einer Seite auf zwei - Blatt: - Seite 1 behaelt (n - (n/2)) - Seite 2 erhaelt (n/2) - Knoten n/2 wird dupliziert - Innerer Knoten: - Seite 1 behaelt (n+1)/2 - Seite 2 erhaelt (n/2-1) - Knoten ((n+1)/2 + 1) : wird herausgenommen + /* devide one page into two + leaf: + Page 1 is (n - (n/2)) + Page 2 is (n/2) + Node n/2 will be duplicated + inner node: + Page 1 is (n+1)/2 + Page 2 is (n/2-1) + Node ((n+1)/2 + 1) : will be taken out */ ONDXNode aResultNode; if (IsLeaf()) { - for (USHORT i = (nCount - (nCount / 2)), j = 0 ; i < nCount; i++) + for (sal_uInt16 i = (nCount - (nCount / 2)), j = 0 ; i < nCount; i++) rPage.Insert(j++,(*this)[i]); - // dieser Knoten enthaelt einen Schluessel der noch einmal im Tree vorkommt - // und ersetzt werden muss + // this node contains a key that already exists in the tree and must be replaced ONDXNode aLastNode = (*this)[nCount - 1]; nCount = nCount - (nCount / 2); aResultNode = (*this)[nCount - 1]; @@ -460,50 +455,50 @@ ONDXNode ONDXPage::Split(ONDXPage& rPage) } else { - for (USHORT i = (nCount + 1) / 2 + 1, j = 0 ; i < nCount; i++) + for (sal_uInt16 i = (nCount + 1) / 2 + 1, j = 0 ; i < nCount; i++) rPage.Insert(j++,(*this)[i]); aResultNode = (*this)[(nCount + 1) / 2]; nCount = (nCount + 1) / 2; - // neue Seite zeigt nun auf Seite des herausgeloesten Knoten + // new page points to page with extraced node rPage.SetChild(aResultNode.GetChild()); } - // Knoten zeigt auf neue Seite + // node points to new page aResultNode.SetChild(&rPage); - // innere Knoten haben keine Recordnummer + // inner nodes have no record number if (rIndex.isUnique()) aResultNode.GetKey().ResetRecord(); - bModified = TRUE; + bModified = sal_True; return aResultNode; } //------------------------------------------------------------------ -void ONDXPage::Merge(USHORT nParentNodePos, ONDXPagePtr xPage) +void ONDXPage::Merge(sal_uInt16 nParentNodePos, ONDXPagePtr xPage) { DBG_ASSERT(HasParent(), "kein Vater vorhanden"); DBG_ASSERT(nParentNodePos != NODE_NOTFOUND, "Falscher Indexaufbau"); - /* Zusammenlegen zweier Seiten */ + /* Merge 2 pages */ ONDXNode aResultNode; - USHORT nMaxNodes = rIndex.GetMaxNodes(), + sal_uInt16 nMaxNodes = rIndex.GetMaxNodes(), nMaxNodes_2 = nMaxNodes / 2; - // Feststellen ob Seite rechter oder linker Nachbar - BOOL bRight = ((*xPage)[0].GetKey() > (*this)[0].GetKey()); // TRUE, wenn xPage die rechte Seite ist - USHORT nNewCount = (*xPage).Count() + Count(); + // Determine if page is right or left neighbour + sal_Bool bRight = ((*xPage)[0].GetKey() > (*this)[0].GetKey()); // sal_True, whenn xPage the right side is + sal_uInt16 nNewCount = (*xPage).Count() + Count(); if (IsLeaf()) { - // Bedingung fuers zusammenlegen + // Condition for merge if (nNewCount < (nMaxNodes_2 * 2)) { - USHORT nLastNode = bRight ? Count() - 1 : xPage->Count() - 1; + sal_uInt16 nLastNode = bRight ? Count() - 1 : xPage->Count() - 1; if (bRight) { DBG_ASSERT(&xPage != this,"xPage und THIS duerfen nicht gleich sein: Endlosschleife"); - // alle Knoten aus xPage auf den linken Knoten verschieben (anhaengen) + // shift all nodes from xPage to the left node (append) while (xPage->Count()) { Append((*xPage)[0]); @@ -513,26 +508,24 @@ void ONDXPage::Merge(USHORT nParentNodePos, ONDXPagePtr xPage) else { DBG_ASSERT(&xPage != this,"xPage und THIS duerfen nicht gleich sein: Endlosschleife"); - // xPage ist die linke Page und THIS die rechte + // xPage is the left page and THIS the right one while (xPage->Count()) { Insert(0,(*xPage)[xPage->Count()-1]); xPage->Remove(xPage->Count()-1); } - // alte Position von xPage beim Parent mit this ersetzen + // replace old position of xPage in parent with this if (nParentNodePos) (*aParent)[nParentNodePos-1].SetChild(this,aParent); - else // oder als rechten Knoten setzen + else // or set as right node aParent->SetChild(this); - aParent->SetModified(TRUE); + aParent->SetModified(sal_True); } - // Child beziehung beim Vaterknoten aufheben + // cancel Child-relationship at parent node (*aParent)[nParentNodePos].SetChild(); - // Austauschen des KnotenWertes, nur wenn geaenderte Page - // die linke ist, ansonsten werde - + // replace the Node-value, only if changed page is the left one, otherwise become if(aParent->IsRoot() && aParent->Count() == 1) { (*aParent)[0].SetChild(); @@ -540,65 +533,63 @@ void ONDXPage::Merge(USHORT nParentNodePos, ONDXPagePtr xPage) aParent = NULL; rIndex.SetRootPos(nPagePos); rIndex.m_aRoot = this; - SetModified(TRUE); + SetModified(sal_True); } else aParent->SearchAndReplace((*this)[nLastNode].GetKey(),(*this)[nCount-1].GetKey()); - xPage->SetModified(FALSE); - xPage->ReleaseFull(); // wird nicht mehr benoetigt + xPage->SetModified(sal_False); + xPage->ReleaseFull(); // is not needed anymore } - // Ausgleichen der Elemente nNewCount >= (nMaxNodes_2 * 2) + // balance the elements nNewCount >= (nMaxNodes_2 * 2) else { if (bRight) { - // alle Knoten aus xPage auf den linken Knoten verschieben (anhaengen) + // shift all nodes from xPage to the left node (append) ONDXNode aReplaceNode = (*this)[nCount - 1]; while (nCount < nMaxNodes_2) { Append((*xPage)[0]); xPage->Remove(0); } - // Austauschen des KnotenWertes: Setzt alten letzten Wert durch den letzten von xPage + // Replace the node values: replace old last value by the last of xPage aParent->SearchAndReplace(aReplaceNode.GetKey(),(*this)[nCount-1].GetKey()); } else { - // alle Knoten aus this vor die xPage Knoten einfuegen + // insert all nodes from this in front of the xPage nodes ONDXNode aReplaceNode = (*this)[nCount - 1]; while (xPage->Count() < nMaxNodes_2) { xPage->Insert(0,(*this)[nCount-1]); Remove(nCount-1); } - // Austauschen des KnotenWertes + // Replace the node value aParent->SearchAndReplace(aReplaceNode.GetKey(),(*this)[Count()-1].GetKey()); } } } else // !IsLeaf() { - // Bedingung fuers zusammenlegen + // Condition for merge if (nNewCount < nMaxNodes_2 * 2) { if (bRight) { DBG_ASSERT(&xPage != this,"xPage und THIS duerfen nicht gleich sein: Endlosschleife"); - // Vaterknoten wird mit integriert - // erhaelt zunaechst Child von xPage + // Parent node will be integrated; is initialized with Child from xPage (*aParent)[nParentNodePos].SetChild(xPage->GetChild(),aParent); Append((*aParent)[nParentNodePos]); - for (USHORT i = 0 ; i < xPage->Count(); i++) + for (sal_uInt16 i = 0 ; i < xPage->Count(); i++) Append((*xPage)[i]); } else { DBG_ASSERT(&xPage != this,"xPage und THIS duerfen nicht gleich sein: Endlosschleife"); - // Vaterknoten wird mit integriert - // erhaelt zunaechst Child - (*aParent)[nParentNodePos].SetChild(GetChild(),aParent); // Parent merkt sich mein Child - Insert(0,(*aParent)[nParentNodePos]); // Node vom Parent bei mir einfuegen + // Parent-node will be integrated; is initialized with child + (*aParent)[nParentNodePos].SetChild(GetChild(),aParent); // Parent memorizes my child + Insert(0,(*aParent)[nParentNodePos]); // insert parent node into myself while (xPage->Count()) { Insert(0,(*xPage)[xPage->Count()-1]); @@ -612,9 +603,9 @@ void ONDXPage::Merge(USHORT nParentNodePos, ONDXPagePtr xPage) aParent->SetChild(this); } - // danach wird der Vaterknoten zurueckgesetzt + // afterwards parent node will be reset (*aParent)[nParentNodePos].SetChild(); - aParent->SetModified(TRUE); + aParent->SetModified(sal_True); if(aParent->IsRoot() && aParent->Count() == 1) { @@ -623,18 +614,18 @@ void ONDXPage::Merge(USHORT nParentNodePos, ONDXPagePtr xPage) aParent = NULL; rIndex.SetRootPos(nPagePos); rIndex.m_aRoot = this; - SetModified(TRUE); + SetModified(sal_True); } else if(nParentNodePos) - // Austauschen des KnotenWertes - // beim Append wird der Bereich erweitert, beim INsert verweist der alte Knoten von xPage auf this - // deshalb muss der Knoten auch hier aktualisiert werden + // replace the node value + // for Append the range will be enlarged, for Insert the old node from xPage will reference to this + // thats why the node must be updated here aParent->SearchAndReplace((*aParent)[nParentNodePos-1].GetKey(),(*aParent)[nParentNodePos].GetKey()); - xPage->SetModified(FALSE); + xPage->SetModified(sal_False); xPage->ReleaseFull(); } - // Ausgleichen der Elemente + // balance the elements else { if (bRight) @@ -662,7 +653,7 @@ void ONDXPage::Merge(USHORT nParentNodePos, ONDXPagePtr xPage) (*aParent)[nParentNodePos].SetChild(this,aParent); } - aParent->SetModified(TRUE); + aParent->SetModified(sal_True); } } } @@ -673,7 +664,7 @@ void ONDXPage::Merge(USHORT nParentNodePos, ONDXPagePtr xPage) //------------------------------------------------------------------ void ONDXNode::Read(SvStream &rStream, ODbaseIndex& rIndex) { - rStream >> aKey.nRecord; // schluessel + rStream >> aKey.nRecord; // key if (rIndex.getHeader().db_keytype) { @@ -684,7 +675,7 @@ void ONDXNode::Read(SvStream &rStream, ODbaseIndex& rIndex) else { ByteString aBuf; - USHORT nLen = rIndex.getHeader().db_keylen; + sal_uInt16 nLen = rIndex.getHeader().db_keylen; char* pStr = aBuf.AllocBuffer(nLen+1); rStream.Read(pStr,nLen); @@ -707,16 +698,16 @@ void ONDXNode::Write(SvStream &rStream, const ONDXPage& rPage) const { const ODbaseIndex& rIndex = rPage.GetIndex(); if (!rIndex.isUnique() || rPage.IsLeaf()) - rStream << (sal_uInt32)aKey.nRecord; // schluessel + rStream << (sal_uInt32)aKey.nRecord; // key else - rStream << (sal_uInt32)0; // schluessel + rStream << (sal_uInt32)0; // key if (rIndex.getHeader().db_keytype) // double { if (aKey.getValue().isNull()) { memset(aNodeData.aData,0,rIndex.getHeader().db_keylen); - rStream.Write((BYTE*)aNodeData.aData,rIndex.getHeader().db_keylen); + rStream.Write((sal_uInt8*)aNodeData.aData,rIndex.getHeader().db_keylen); } else rStream << (double) aKey.getValue(); @@ -730,7 +721,7 @@ void ONDXNode::Write(SvStream &rStream, const ONDXPage& rPage) const ByteString aText(sValue.getStr(), rIndex.m_pTable->getConnection()->getTextEncoding()); strncpy(aNodeData.aData,aText.GetBuffer(),std::min(rIndex.getHeader().db_keylen, aText.Len())); } - rStream.Write((BYTE*)aNodeData.aData,rIndex.getHeader().db_keylen); + rStream.Write((sal_uInt8*)aNodeData.aData,rIndex.getHeader().db_keylen); } rStream << aChild; } @@ -750,7 +741,7 @@ ONDXPagePtr& ONDXNode::GetChild(ODbaseIndex* pIndex, ONDXPage* pParent) // ONDXKey //================================================================== //------------------------------------------------------------------ -BOOL ONDXKey::IsText(sal_Int32 eType) +sal_Bool ONDXKey::IsText(sal_Int32 eType) { return eType == DataType::VARCHAR || eType == DataType::CHAR; } @@ -776,7 +767,7 @@ StringCompare ONDXKey::Compare(const ONDXKey& rKey) const } else if (IsText(getDBType())) { - INT32 nRes = getValue().getString().compareTo(rKey.getValue()); + sal_Int32 nRes = getValue().getString().compareTo(rKey.getValue()); eResult = (nRes > 0) ? COMPARE_GREATER : (nRes == 0) ? COMPARE_EQUAL : COMPARE_LESS; } else @@ -785,7 +776,7 @@ StringCompare ONDXKey::Compare(const ONDXKey& rKey) const eResult = (m > n) ? COMPARE_GREATER : (n == m) ? COMPARE_EQUAL : COMPARE_LESS; } - // Record vergleich, wenn Index !Unique + // compare record, if index !Unique if (eResult == COMPARE_EQUAL && nRecord && rKey.nRecord) eResult = (nRecord > rKey.nRecord) ? COMPARE_GREATER : (nRecord == rKey.nRecord) ? COMPARE_EQUAL : COMPARE_LESS; @@ -849,15 +840,15 @@ ONDXPagePtr& ONDXPagePtr::operator= (ONDXPage* pRef) return *this; } // ----------------------------------------------------------------------------- -static UINT32 nValue; +static sal_uInt32 nValue; //------------------------------------------------------------------ SvStream& connectivity::dbase::operator >> (SvStream &rStream, ONDXPage& rPage) { rStream.Seek(rPage.GetPagePos() * PAGE_SIZE); rStream >> nValue >> rPage.aChild; - rPage.nCount = USHORT(nValue); + rPage.nCount = sal_uInt16(nValue); - for (USHORT i = 0; i < rPage.nCount; i++) + for (sal_uInt16 i = 0; i < rPage.nCount; i++) rPage[i].Read(rStream, rPage.GetIndex()); return rStream; } @@ -865,8 +856,8 @@ SvStream& connectivity::dbase::operator >> (SvStream &rStream, ONDXPage& rPage) //------------------------------------------------------------------ SvStream& connectivity::dbase::operator << (SvStream &rStream, const ONDXPage& rPage) { - // Seite existiert noch nicht - ULONG nSize = (rPage.GetPagePos() + 1) * PAGE_SIZE; + // Page doesn't exist yet + sal_uIntPtr nSize = (rPage.GetPagePos() + 1) * PAGE_SIZE; if (nSize > rStream.Seek(STREAM_SEEK_TO_END)) { rStream.SetStreamSize(nSize); @@ -874,27 +865,27 @@ SvStream& connectivity::dbase::operator << (SvStream &rStream, const ONDXPage& r char aEmptyData[PAGE_SIZE]; memset(aEmptyData,0x00,PAGE_SIZE); - rStream.Write((BYTE*)aEmptyData,PAGE_SIZE); + rStream.Write((sal_uInt8*)aEmptyData,PAGE_SIZE); } - ULONG nCurrentPos = rStream.Seek(rPage.GetPagePos() * PAGE_SIZE); + sal_uIntPtr nCurrentPos = rStream.Seek(rPage.GetPagePos() * PAGE_SIZE); OSL_UNUSED( nCurrentPos ); nValue = rPage.nCount; rStream << nValue << rPage.aChild; - USHORT i = 0; + sal_uInt16 i = 0; for (; i < rPage.nCount; i++) rPage[i].Write(rStream, rPage); // check if we have to fill the stream with '\0' if(i < rPage.rIndex.getHeader().db_maxkeys) { - ULONG nTell = rStream.Tell() % PAGE_SIZE; - USHORT nBufferSize = rStream.GetBufferSize(); - ULONG nRemainSize = nBufferSize - nTell; + sal_uIntPtr nTell = rStream.Tell() % PAGE_SIZE; + sal_uInt16 nBufferSize = rStream.GetBufferSize(); + sal_uIntPtr nRemainSize = nBufferSize - nTell; char* pEmptyData = new char[nRemainSize]; memset(pEmptyData,0x00,nRemainSize); - rStream.Write((BYTE*)pEmptyData,nRemainSize); + rStream.Write((sal_uInt8*)pEmptyData,nRemainSize); rStream.Seek(nTell); delete [] pEmptyData; } @@ -905,10 +896,10 @@ SvStream& connectivity::dbase::operator << (SvStream &rStream, const ONDXPage& r //------------------------------------------------------------------ void ONDXPage::PrintPage() { - DBG_TRACE4("\nSDB: -----------Page: %d Parent: %d Count: %d Child: %d-----", + OSL_TRACE("\nSDB: -----------Page: %d Parent: %d Count: %d Child: %d-----", nPagePos, HasParent() ? aParent->GetPagePos() : 0 ,nCount, aChild.GetPagePos()); - for (USHORT i = 0; i < nCount; i++) + for (sal_uInt16 i = 0; i < nCount; i++) { ONDXNode rNode = (*this)[i]; ONDXKey& rKey = rNode.GetKey(); @@ -917,43 +908,43 @@ void ONDXPage::PrintPage() if (rKey.getValue().isNull()) { - DBG_TRACE2("SDB: [%d,NULL,%d]",rKey.GetRecord(), rNode.GetChild().GetPagePos()); + OSL_TRACE("SDB: [%d,NULL,%d]",rKey.GetRecord(), rNode.GetChild().GetPagePos()); } else if (rIndex.getHeader().db_keytype) { - DBG_TRACE3("SDB: [%d,%f,%d]",rKey.GetRecord(), rKey.getValue().getDouble(),rNode.GetChild().GetPagePos()); + OSL_TRACE("SDB: [%d,%f,%d]",rKey.GetRecord(), rKey.getValue().getDouble(),rNode.GetChild().GetPagePos()); } else { - DBG_TRACE3("SDB: [%d,%s,%d]",rKey.GetRecord(), (const char* )ByteString(rKey.getValue().getString().getStr(), rIndex.m_pTable->getConnection()->getTextEncoding()).GetBuffer(),rNode.GetChild().GetPagePos()); + OSL_TRACE("SDB: [%d,%s,%d]",rKey.GetRecord(), (const char* )ByteString(rKey.getValue().getString().getStr(), rIndex.m_pTable->getConnection()->getTextEncoding()).GetBuffer(),rNode.GetChild().GetPagePos()); } } - DBG_TRACE("SDB: -----------------------------------------------\n"); + OSL_TRACE("SDB: -----------------------------------------------\n"); if (!IsLeaf()) { #if OSL_DEBUG_LEVEL > 1 GetChild(&rIndex)->PrintPage(); - for (USHORT i = 0; i < nCount; i++) + for (sal_uInt16 i = 0; i < nCount; i++) { ONDXNode rNode = (*this)[i]; rNode.GetChild(&rIndex,this)->PrintPage(); } #endif } - DBG_TRACE("SDB: ===============================================\n"); + OSL_TRACE("SDB: ===============================================\n"); } #endif // ----------------------------------------------------------------------------- -BOOL ONDXPage::IsFull() const +sal_Bool ONDXPage::IsFull() const { return Count() == rIndex.getHeader().db_maxkeys; } // ----------------------------------------------------------------------------- //------------------------------------------------------------------ -USHORT ONDXPage::Search(const ONDXKey& rSearch) +sal_uInt16 ONDXPage::Search(const ONDXKey& rSearch) { - // binare Suche spaeter - USHORT i = NODE_NOTFOUND; + // binary search later + sal_uInt16 i = NODE_NOTFOUND; while (++i < Count()) if ((*this)[i].GetKey() == rSearch) break; @@ -962,26 +953,25 @@ USHORT ONDXPage::Search(const ONDXKey& rSearch) } //------------------------------------------------------------------ -USHORT ONDXPage::Search(const ONDXPage* pPage) +sal_uInt16 ONDXPage::Search(const ONDXPage* pPage) { - USHORT i = NODE_NOTFOUND; + sal_uInt16 i = NODE_NOTFOUND; while (++i < Count()) if (((*this)[i]).GetChild() == pPage) break; - // wenn nicht gefunden, dann wird davon ausgegangen, dass die Seite selbst - // auf die Page zeigt + // if not found, then we assume, that the page itself points to the page return (i < Count()) ? i : NODE_NOTFOUND; } // ----------------------------------------------------------------------------- -// laeuft rekursiv +// runs recursively void ONDXPage::SearchAndReplace(const ONDXKey& rSearch, ONDXKey& rReplace) { OSL_ENSURE(rSearch != rReplace,"Invalid here:rSearch == rReplace"); if (rSearch != rReplace) { - USHORT nPos = NODE_NOTFOUND; + sal_uInt16 nPos = NODE_NOTFOUND; ONDXPage* pPage = this; while (pPage && (nPos = pPage->Search(rSearch)) == NODE_NOTFOUND) @@ -990,33 +980,33 @@ void ONDXPage::SearchAndReplace(const ONDXKey& rSearch, if (pPage) { (*pPage)[nPos].GetKey() = rReplace; - pPage->SetModified(TRUE); + pPage->SetModified(sal_True); } } } // ----------------------------------------------------------------------------- -ONDXNode& ONDXPage::operator[] (USHORT nPos) +ONDXNode& ONDXPage::operator[] (sal_uInt16 nPos) { DBG_ASSERT(nCount > nPos, "falscher Indexzugriff"); return ppNodes[nPos]; } //------------------------------------------------------------------ -const ONDXNode& ONDXPage::operator[] (USHORT nPos) const +const ONDXNode& ONDXPage::operator[] (sal_uInt16 nPos) const { DBG_ASSERT(nCount > nPos, "falscher Indexzugriff"); return ppNodes[nPos]; } // ----------------------------------------------------------------------------- -void ONDXPage::Remove(USHORT nPos) +void ONDXPage::Remove(sal_uInt16 nPos) { DBG_ASSERT(nCount > nPos, "falscher Indexzugriff"); - for (USHORT i = nPos; i < (nCount-1); i++) + for (sal_uInt16 i = nPos; i < (nCount-1); i++) (*this)[i] = (*this)[i+1]; nCount--; - bModified = TRUE; + bModified = sal_True; } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/dbase/exports.dxp b/connectivity/source/drivers/dbase/exports.dxp index 9630d7e067..f0e1c69934 100644..100755 --- a/connectivity/source/drivers/dbase/exports.dxp +++ b/connectivity/source/drivers/dbase/exports.dxp @@ -1,3 +1,2 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory diff --git a/connectivity/source/drivers/dbase/makefile.mk b/connectivity/source/drivers/dbase/makefile.mk index 1aac0b0b1e..5c3344b1da 100644..100755 --- a/connectivity/source/drivers/dbase/makefile.mk +++ b/connectivity/source/drivers/dbase/makefile.mk @@ -127,3 +127,11 @@ DEF1EXPORTFILE= exports.dxp .INCLUDE : $(PRJ)$/target.pmk + +ALLTAR : $(MISC)/dbase.component + +$(MISC)/dbase.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + dbase.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt dbase.component diff --git a/connectivity/source/drivers/evoab/LCatalog.cxx b/connectivity/source/drivers/evoab/LCatalog.cxx index 55ff6ca510..638b359a89 100644 --- a/connectivity/source/drivers/evoab/LCatalog.cxx +++ b/connectivity/source/drivers/evoab/LCatalog.cxx @@ -54,7 +54,7 @@ void OEvoabCatalog::refreshTables() TStringVector aVector; Sequence< ::rtl::OUString > aTypes; Reference< XResultSet > xResult = m_xMetaData->getTables(Any(), - ::rtl::OUString::createFromAscii("%"),::rtl::OUString::createFromAscii("%"),aTypes); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),aTypes); if(xResult.is()) { diff --git a/connectivity/source/drivers/evoab/LColumnAlias.cxx b/connectivity/source/drivers/evoab/LColumnAlias.cxx index 24dd9d6b30..ea5a4a6369 100644 --- a/connectivity/source/drivers/evoab/LColumnAlias.cxx +++ b/connectivity/source/drivers/evoab/LColumnAlias.cxx @@ -43,39 +43,39 @@ using namespace ::com::sun::star::container; static const ::rtl::OUString sProgrammaticNames[] = { - ::rtl::OUString::createFromAscii("FirstName"), - ::rtl::OUString::createFromAscii("LastName"), - ::rtl::OUString::createFromAscii("DisplayName"), - ::rtl::OUString::createFromAscii("NickName"), - ::rtl::OUString::createFromAscii("PrimaryEmail"), - ::rtl::OUString::createFromAscii("SecondEmail"), - ::rtl::OUString::createFromAscii("PreferMailFormat"), - ::rtl::OUString::createFromAscii("WorkPhone"), - ::rtl::OUString::createFromAscii("HomePhone"), - ::rtl::OUString::createFromAscii("FaxNumber"), - ::rtl::OUString::createFromAscii("PagerNumber"), - ::rtl::OUString::createFromAscii("CellularNumber"), - ::rtl::OUString::createFromAscii("HomeAddress"), - ::rtl::OUString::createFromAscii("HomeAddress2"), - ::rtl::OUString::createFromAscii("HomeCity"), - ::rtl::OUString::createFromAscii("HomeState"), - ::rtl::OUString::createFromAscii("HomeZipCode"), - ::rtl::OUString::createFromAscii("HomeCountry"), - ::rtl::OUString::createFromAscii("WorkAddress"), - ::rtl::OUString::createFromAscii("WorkAddress2"), - ::rtl::OUString::createFromAscii("WorkCity"), - ::rtl::OUString::createFromAscii("WorkState"), - ::rtl::OUString::createFromAscii("WorkZipCode"), - ::rtl::OUString::createFromAscii("WorkCountry"), - ::rtl::OUString::createFromAscii("JobTitle"), - ::rtl::OUString::createFromAscii("Department"), - ::rtl::OUString::createFromAscii("Company"), - ::rtl::OUString::createFromAscii("WebPage1"), - ::rtl::OUString::createFromAscii("WebPage2"), - ::rtl::OUString::createFromAscii("BirthYear"), - ::rtl::OUString::createFromAscii("BirthMonth"), - ::rtl::OUString::createFromAscii("BirthDay"), - ::rtl::OUString::createFromAscii("Notes") + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FirstName")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LastName")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DisplayName")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NickName")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PrimaryEmail")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SecondEmail")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PreferMailFormat")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WorkPhone")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HomePhone")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FaxNumber")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PagerNumber")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CellularNumber")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HomeAddress")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HomeAddress2")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HomeCity")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HomeState")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HomeZipCode")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HomeCountry")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WorkAddress")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WorkAddress2")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WorkCity")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WorkState")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WorkZipCode")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WorkCountry")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("JobTitle")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Department")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Company")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WebPage1")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WebPage2")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BirthYear")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BirthMonth")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BirthDay")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Notes")) }; //------------------------------------------------------------------------------ OColumnAlias::OColumnAlias() @@ -113,7 +113,7 @@ void OColumnAlias::setAlias(const ::com::sun::star::uno::Reference< // the config path for our own driver's settings Reference< XPropertySet > xEvoDriverNode = createDriverConfigNode( _rxORB, OEvoabDriver::getImplementationName_Static() ); //Reference< XPropertySet > xMozDriverNode = createDriverConfigNode( _rxORB, mozab::OConnection::getDriverImplementationName() ); - Reference< XPropertySet > xMozDriverNode = createDriverConfigNode( _rxORB, ::rtl::OUString::createFromAscii ("com.sun.star.comp.sdbc.MozabDriver") ); + Reference< XPropertySet > xMozDriverNode = createDriverConfigNode( _rxORB, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.comp.sdbc.MozabDriver")) ); if ( xEvoDriverNode.is() && xMozDriverNode.is() ) { try @@ -121,8 +121,8 @@ void OColumnAlias::setAlias(const ::com::sun::star::uno::Reference< //============================================================= Reference< XNameAccess > xEvoAliasesNode; Reference< XNameAccess > xMozAliasesNode; - xEvoDriverNode->getPropertyValue( ::rtl::OUString::createFromAscii("ColumnAliases") ) >>= xEvoAliasesNode; - xMozDriverNode->getPropertyValue( ::rtl::OUString::createFromAscii("ColumnAliases") ) >>= xMozAliasesNode; + xEvoDriverNode->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ColumnAliases")) ) >>= xEvoAliasesNode; + xMozDriverNode->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ColumnAliases")) ) >>= xMozAliasesNode; OSL_ENSURE( xEvoAliasesNode.is(), "OColumnAlias::setAlias: missing the evolution aliases node!" ); OSL_ENSURE( xMozAliasesNode.is(), "OColumnAlias::setAlias: missing the mozilla aliases node!" ); @@ -198,7 +198,7 @@ void OColumnAlias::setAlias(const ::com::sun::star::uno::Reference< } catch( const Exception& ) { - OSL_ENSURE( sal_False, "OColumnAlias::setAlias: could not read my driver's configuration data!" ); + OSL_FAIL( "OColumnAlias::setAlias: could not read my driver's configuration data!" ); } } diff --git a/connectivity/source/drivers/evoab/LColumns.cxx b/connectivity/source/drivers/evoab/LColumns.cxx index 5d69f28290..d7a103fd6d 100644 --- a/connectivity/source/drivers/evoab/LColumns.cxx +++ b/connectivity/source/drivers/evoab/LColumns.cxx @@ -28,7 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_connectivity.hxx" - + #include "LColumns.hxx" #include "LTable.hxx" #include "connectivity/sdbcx/VColumn.hxx" diff --git a/connectivity/source/drivers/evoab/LConfigAccess.cxx b/connectivity/source/drivers/evoab/LConfigAccess.cxx index 3b5da2ebc0..e7e465204b 100644 --- a/connectivity/source/drivers/evoab/LConfigAccess.cxx +++ b/connectivity/source/drivers/evoab/LConfigAccess.cxx @@ -52,17 +52,17 @@ namespace connectivity //============================================================= // create the config provider Reference< XMultiServiceFactory > xConfigProvider( - _rxORB->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationProvider" ) ), + _rxORB->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationProvider")) ), UNO_QUERY ); OSL_ENSURE( xConfigProvider.is(), "createDriverConfigNode: could not create the config provider!" ); if ( xConfigProvider.is() ) { - ::rtl::OUString sCompleteNodePath = ::rtl::OUString::createFromAscii ("/org.openoffice.Office.DataAccess/DriverSettings/" ); + ::rtl::OUString sCompleteNodePath(RTL_CONSTASCII_USTRINGPARAM ("/org.openoffice.Office.DataAccess/DriverSettings/" )); sCompleteNodePath += _sDriverImplementationName; //sCompleteNodePath += OEvoabConnection::getDriverImplementationName(); - //sCompleteNodePath += ::rtl::OUString::createFromAscii ("com.sun.star.comp.sdbc.MozabDriver"); + //sCompleteNodePath += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.comp.sdbc.MozabDriver")); EVO_TRACE_STRING("createDriverConfigNode()::sCompleteNodePath = %s\n", sCompleteNodePath ); //========================================================= @@ -70,14 +70,14 @@ namespace connectivity Sequence< Any > aArguments(2); // the path to the node to open aArguments[0] <<= PropertyValue( - ::rtl::OUString::createFromAscii( "nodepath"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")), 0, makeAny( sCompleteNodePath ), PropertyState_DIRECT_VALUE ); // the depth: -1 means unlimited aArguments[1] <<= PropertyValue( - ::rtl::OUString::createFromAscii( "depth"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("depth")), 0, makeAny( (sal_Int32)-1 ), PropertyState_DIRECT_VALUE @@ -86,7 +86,7 @@ namespace connectivity //========================================================= // create the access Reference< XInterface > xAccess = xConfigProvider->createInstanceWithArguments( - ::rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationAccess" ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess")), aArguments ); OSL_ENSURE( xAccess.is(), "createDriverConfigNode: invalid access returned (should throw an exception instead)!" ); @@ -96,7 +96,7 @@ namespace connectivity } catch( const Exception& ) { - OSL_ENSURE( sal_False, "createDriverConfigNode: caught an exception while accessing the driver's config node!" ); + OSL_FAIL( "createDriverConfigNode: caught an exception while accessing the driver's config node!" ); } // outta here @@ -142,14 +142,14 @@ namespace connectivity Reference< XPropertySet > xDriverNode = createDriverConfigNode( _rxORB, OEvoabDriver::getImplementationName_Static() ); Reference< XPropertySet > xEvoPrefsNode; if ( xDriverNode.is() ) - xDriverNode->getPropertyValue( ::rtl::OUString::createFromAscii( "EvolutionPreferences" ) ) >>= xEvoPrefsNode; + xDriverNode->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EvolutionPreferences")) ) >>= xEvoPrefsNode; OSL_ENSURE( xEvoPrefsNode.is(), "getFullPathExportingCommand: could not access the node for the evolution preferences!" ); if ( xEvoPrefsNode.is() ) - xEvoPrefsNode->getPropertyValue( ::rtl::OUString::createFromAscii( "FullPathExportingCommand" ) ) >>= sFullPathExportingCommand; + xEvoPrefsNode->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FullPathExportingCommand")) ) >>= sFullPathExportingCommand; } catch( const Exception& ) { - OSL_ENSURE( sal_False, "getFullPathExportingCommand: caught an exception!" ); + OSL_FAIL( "getFullPathExportingCommand: caught an exception!" ); } } return sFullPathExportingCommand; diff --git a/connectivity/source/drivers/evoab/LConnection.cxx b/connectivity/source/drivers/evoab/LConnection.cxx index ba047b4e7d..cee8b601aa 100644 --- a/connectivity/source/drivers/evoab/LConnection.cxx +++ b/connectivity/source/drivers/evoab/LConnection.cxx @@ -63,12 +63,12 @@ using namespace ::com::sun::star::lang; { ::rtl::OUString aExceptionType = aExceptionType_; if( aExceptionType.getLength() == 0 ) - aExceptionType = ::rtl::OUString( ::rtl::OUString::createFromAscii("Unknown" ) ); + aExceptionType = ::rtl::OUString( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown")) ); - ::rtl::OUString aTypeLine( ::rtl::OUString::createFromAscii("\nType: " ) ); + ::rtl::OUString aTypeLine( RTL_CONSTASCII_USTRINGPARAM("\nType: ") ); aTypeLine += aExceptionType; - ::rtl::OUString aMessageLine( ::rtl::OUString::createFromAscii("\nMessage: " ) ); + ::rtl::OUString aMessageLine( RTL_CONSTASCII_USTRINGPARAM("\nMessage: ") ); aMessageLine += ::rtl::OUString( e.Message ); ::rtl::OUString aMsg(aTypeLine); @@ -138,23 +138,23 @@ void OEvoabConnection::construct(const ::rtl::OUString& url,const Sequence< Prop { OSL_TRACE("Error at execute evolution-addressbook-export to get VCards"); ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("Error at execute evolution-addressbook-export to get VCards"),NULL); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Error at execute evolution-addressbook-export to get VCards")),NULL); } Sequence<PropertyValue> aDriverParam; ::std::vector<PropertyValue> aParam; - aParam.push_back(PropertyValue(::rtl::OUString::createFromAscii("EnableSQL92Check"), 0, Any(), PropertyState_DIRECT_VALUE)); + aParam.push_back(PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EnableSQL92Check")), 0, Any(), PropertyState_DIRECT_VALUE)); ::dbtools::OCharsetMap aLookupIanaName; ::dbtools::OCharsetMap::const_iterator aLookup = aLookupIanaName.find(RTL_TEXTENCODING_UTF8); - aParam.push_back(PropertyValue(::rtl::OUString::createFromAscii("CharSet"), 0, + aParam.push_back(PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharSet")), 0, makeAny((*aLookup).getIanaName()), PropertyState_DIRECT_VALUE)); - aParam.push_back(PropertyValue(::rtl::OUString::createFromAscii("Extension"), 0, makeAny(getDriver()->getFileExt()), PropertyState_DIRECT_VALUE)); - aParam.push_back(PropertyValue(::rtl::OUString::createFromAscii("HeaderLine"), 0, makeAny(m_bHeaderLine), PropertyState_DIRECT_VALUE)); - aParam.push_back(PropertyValue(::rtl::OUString::createFromAscii("FieldDelimiter"), 0, makeAny(::rtl::OUString(&m_cFieldDelimiter,1)), PropertyState_DIRECT_VALUE)); - aParam.push_back(PropertyValue(::rtl::OUString::createFromAscii("StringDelimiter"), 0, makeAny(::rtl::OUString(&m_cStringDelimiter,1)), PropertyState_DIRECT_VALUE)); - aParam.push_back(PropertyValue(::rtl::OUString::createFromAscii("DecimalDelimiter"), 0, makeAny(::rtl::OUString(&m_cDecimalDelimiter,1)), PropertyState_DIRECT_VALUE)); - aParam.push_back(PropertyValue(::rtl::OUString::createFromAscii("ThousandDelimiter"), 0, makeAny(::rtl::OUString(&m_cThousandDelimiter,1)), PropertyState_DIRECT_VALUE)); + aParam.push_back(PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Extension")), 0, makeAny(getDriver()->getFileExt()), PropertyState_DIRECT_VALUE)); + aParam.push_back(PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderLine")), 0, makeAny(m_bHeaderLine), PropertyState_DIRECT_VALUE)); + aParam.push_back(PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FieldDelimiter")), 0, makeAny(::rtl::OUString(&m_cFieldDelimiter,1)), PropertyState_DIRECT_VALUE)); + aParam.push_back(PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StringDelimiter")), 0, makeAny(::rtl::OUString(&m_cStringDelimiter,1)), PropertyState_DIRECT_VALUE)); + aParam.push_back(PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DecimalDelimiter")), 0, makeAny(::rtl::OUString(&m_cDecimalDelimiter,1)), PropertyState_DIRECT_VALUE)); + aParam.push_back(PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ThousandDelimiter")), 0, makeAny(::rtl::OUString(&m_cThousandDelimiter,1)), PropertyState_DIRECT_VALUE)); // build a new parameter sequence from the original parameters, appended by the new parameters from above PropertyValue *pParams = aParam.empty() ? 0 : &aParam[0]; diff --git a/connectivity/source/drivers/evoab/LDatabaseMetaData.cxx b/connectivity/source/drivers/evoab/LDatabaseMetaData.cxx index d1a15429a5..0bcc612ad7 100644 --- a/connectivity/source/drivers/evoab/LDatabaseMetaData.cxx +++ b/connectivity/source/drivers/evoab/LDatabaseMetaData.cxx @@ -96,7 +96,7 @@ Reference< XResultSet > OEvoabDatabaseMetaData::impl_getTypeInfo_throw( ) ODatabaseMetaDataResultSet::ORow aRow; aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(new ORowSetValueDecorator(::rtl::OUString::createFromAscii("CHAR"))); + aRow.push_back(new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CHAR")))); aRow.push_back(new ORowSetValueDecorator(DataType::CHAR)); aRow.push_back(new ORowSetValueDecorator((sal_Int32)254)); aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue()); @@ -117,60 +117,60 @@ Reference< XResultSet > OEvoabDatabaseMetaData::impl_getTypeInfo_throw( ) aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("VARCHAR")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VARCHAR"))); aRow[2] = new ORowSetValueDecorator(DataType::VARCHAR); aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue(); aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue(); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("LONGVARCHAR")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LONGVARCHAR"))); aRow[2] = new ORowSetValueDecorator(DataType::LONGVARCHAR); aRow[3] = new ORowSetValueDecorator((sal_Int32)65535); aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue(); aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue(); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DATE")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DATE"))); aRow[2] = new ORowSetValueDecorator(DataType::DATE); aRow[3] = new ORowSetValueDecorator((sal_Int32)10); aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue(); aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue(); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIME")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIME"))); aRow[2] = new ORowSetValueDecorator(DataType::TIME); aRow[3] = new ORowSetValueDecorator((sal_Int32)8); aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue(); aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue(); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIMESTAMP")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP"))); aRow[2] = new ORowSetValueDecorator(DataType::TIMESTAMP); aRow[3] = new ORowSetValueDecorator((sal_Int32)19); aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue(); aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue(); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("BOOL")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BOOL"))); aRow[2] = new ORowSetValueDecorator(DataType::BIT); aRow[3] = ODatabaseMetaDataResultSet::get1Value(); aRow[9] = ODatabaseMetaDataResultSet::getBasicValue(); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DECIMAL")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DECIMAL"))); aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL); aRow[3] = new ORowSetValueDecorator((sal_Int32)20); aRow[15] = new ORowSetValueDecorator((sal_Int32)15); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DOUBLE")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DOUBLE"))); aRow[2] = new ORowSetValueDecorator(DataType::DOUBLE); aRow[3] = new ORowSetValueDecorator((sal_Int32)20); aRow[15] = ODatabaseMetaDataResultSet::get0Value(); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("NUMERIC")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NUMERIC"))); aRow[2] = new ORowSetValueDecorator(DataType::NUMERIC); aRow[3] = new ORowSetValueDecorator((sal_Int32)20); aRow[15] = new ORowSetValueDecorator((sal_Int32)20); @@ -254,10 +254,10 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getColumns( switch(sal_Int32(aRow[11]->getValue())) { case ColumnValue::NO_NULLS: - aRow[18] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("NO")); + aRow[18] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NO"))); break; case ColumnValue::NULLABLE: - aRow[18] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("YES")); + aRow[18] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("YES"))); break; default: aRow[18] = new ORowSetValueDecorator(::rtl::OUString()); @@ -294,7 +294,7 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables( // check if any type is given // when no types are given then we have to return all tables e.g. TABLE - static const ::rtl::OUString aTable(::rtl::OUString::createFromAscii("TABLE")); + static const ::rtl::OUString aTable(RTL_CONSTASCII_USTRINGPARAM("TABLE")); sal_Bool bTableFound = sal_True; sal_Int32 nLength = types.getLength(); @@ -354,7 +354,7 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables( ::rtl::OUString aArg2 = ::rtl::OUString::createFromAscii(pOEvoabConnection->getDriver()->getEVOAB_CLI_ARG_OUTPUT_FILE_PREFIX()); aArg2 += aWorkingDir; aArg2 += aName; - aArg2 += ::rtl::OUString::createFromAscii("."); + aArg2 += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".")); aArg2 += ::rtl::OUString(pOEvoabConnection->getExtension()); ::rtl::OUString aArg3 = ::rtl::OUString::createFromAscii(pOEvoabConnection->getDriver()->getEVOAB_CLI_ARG_OUTPUT_FORMAT()); diff --git a/connectivity/source/drivers/evoab/LDriver.cxx b/connectivity/source/drivers/evoab/LDriver.cxx index 689ba848ed..23d11e4321 100644 --- a/connectivity/source/drivers/evoab/LDriver.cxx +++ b/connectivity/source/drivers/evoab/LDriver.cxx @@ -66,8 +66,8 @@ OEvoabDriver::OEvoabDriver(const Reference< XMultiServiceFactory >& _rxFactory) if ( m_aEvoab_CLI_FullPathCommand.getLength() == 0 ) m_aEvoab_CLI_FullPathCommand = ::rtl::OUString::createFromAscii(getEVOAB_CLI_FULLPATHCOMMAND()); - if ( m_aEvoab_CLI_FullPathCommand.copy(0,7) != ::rtl::OUString::createFromAscii("file://") && m_aEvoab_CLI_FullPathCommand.copy(0,1) == ::rtl::OUString::createFromAscii("/")) - m_aEvoab_CLI_FullPathCommand = ::rtl::OUString::createFromAscii("file://") + m_aEvoab_CLI_FullPathCommand; + if ( m_aEvoab_CLI_FullPathCommand.copy(0,7) != ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file://")) && m_aEvoab_CLI_FullPathCommand.copy(0,1) == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"))) + m_aEvoab_CLI_FullPathCommand = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file://")) + m_aEvoab_CLI_FullPathCommand; m_aEvoab_CLI_EffectiveCommand = m_aEvoab_CLI_FullPathCommand; m_aTempDir.EnableKillingFile(); @@ -77,7 +77,7 @@ OEvoabDriver::OEvoabDriver(const Reference< XMultiServiceFactory >& _rxFactory) //------------------------------------------------------------------------------ rtl::OUString OEvoabDriver::getImplementationName_Static( ) throw(RuntimeException) { - return rtl::OUString::createFromAscii(EVOAB_DRIVER_IMPL_NAME); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(EVOAB_DRIVER_IMPL_NAME)); } //------------------------------------------------------------------ @@ -233,7 +233,7 @@ sal_Bool SAL_CALL OEvoabDriver::acceptsURL( const ::rtl::OUString& url ) if ( nFileErr != osl_File_E_None ) { ::rtl::OUString sErr = translateFileErrorMessage( nFileErr); - OSL_ENSURE(false, ::rtl::OUStringToOString( sErr, RTL_TEXTENCODING_ASCII_US ).getStr()); + OSL_FAIL(::rtl::OUStringToOString( sErr, RTL_TEXTENCODING_ASCII_US ).getStr()); } ::rtl::OUString aVersionInfo; if ( nFileErr == osl_File_E_None && nBytesRead > 0 && nBytesRead <= 256) @@ -310,7 +310,7 @@ sal_Bool OEvoabDriver::acceptsURL_Stat( const ::rtl::OUString& url ) // There isn't any subschema: - but could be just subschema if ( aAddrbookURI.getLength() > 0 ) aAddrbookScheme= aAddrbookURI; - else if(url == ::rtl::OUString::createFromAscii("sdbc:address:") ) + else if(url == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:address:")) ) return sal_True; // special case here else return sal_False; diff --git a/connectivity/source/drivers/evoab/LDriver.hxx b/connectivity/source/drivers/evoab/LDriver.hxx index 598880fc27..aebacca7d2 100644 --- a/connectivity/source/drivers/evoab/LDriver.hxx +++ b/connectivity/source/drivers/evoab/LDriver.hxx @@ -73,8 +73,8 @@ namespace connectivity inline rtl::OUString getEvoFolderListName() const { return m_aFolderListName;} inline rtl::OUString getFileExt() const { return m_aFileExt;} - inline rtl::OUString getEvoFolderListFileName() const { return m_aFolderListName + ::rtl::OUString::createFromAscii(".") + m_aFileExt;} - inline rtl::OUString getEvoVersionFileName() const { return m_aVersionName + ::rtl::OUString::createFromAscii(".") + m_aFileExt;} + inline rtl::OUString getEvoFolderListFileName() const { return m_aFolderListName + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".")) + m_aFileExt;} + inline rtl::OUString getEvoVersionFileName() const { return m_aVersionName + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".")) + m_aFileExt;} inline rtl::OUString getWorkingDirURL() const { return m_aWorkingDirURL;} inline rtl::OUString getEvoab_CLI_FullPathCommand() const { return m_aEvoab_CLI_FullPathCommand;} inline rtl::OUString getEvoab_CLI_EffectiveCommand() const { return m_aEvoab_CLI_EffectiveCommand;} diff --git a/connectivity/source/drivers/evoab/LFolderList.cxx b/connectivity/source/drivers/evoab/LFolderList.cxx index e7833f25ed..0e545969a9 100644 --- a/connectivity/source/drivers/evoab/LFolderList.cxx +++ b/connectivity/source/drivers/evoab/LFolderList.cxx @@ -73,7 +73,7 @@ using namespace ::com::sun::star::lang; // ------------------------------------------------------------------------- void OEvoabFolderList::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) { - BOOL bRead = TRUE; + sal_Bool bRead = sal_True; QuotedTokenizedString aHeaderLine; OEvoabConnection* pConnection = (OEvoabConnection*)m_pConnection; @@ -106,7 +106,7 @@ void OEvoabFolderList::fillColumns(const ::com::sun::star::lang::Locale& _aLocal m_aPrecisions.reserve(nFieldCount); m_aScales.reserve(nFieldCount); - sal_Bool bCase = getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers(); + sal_Bool bCase = getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers(); CharClass aCharClass(pConnection->getDriver()->getFactory(),_aLocale); // read description sal_Unicode cDecimalDelimiter = pConnection->getDecimalDelimiter(); @@ -124,11 +124,11 @@ void OEvoabFolderList::fillColumns(const ::com::sun::star::lang::Locale& _aLocal aColumnName += String::CreateFromInt32(i+1); sal_Int32 eType; - UINT16 nPrecision = 0; - UINT16 nScale = 0; + sal_uInt16 nPrecision = 0; + sal_uInt16 nScale = 0; - BOOL bNumeric = FALSE; - ULONG nIndex = 0; + sal_Bool bNumeric = sal_False; + sal_uIntPtr nIndex = 0; // first without fielddelimiter String aField; @@ -136,7 +136,7 @@ void OEvoabFolderList::fillColumns(const ::com::sun::star::lang::Locale& _aLocal if (aField.Len() == 0 || (pConnection->getStringDelimiter() && pConnection->getStringDelimiter() == aField.GetChar(0))) { - bNumeric = FALSE; + bNumeric = sal_False; } else { @@ -148,21 +148,21 @@ void OEvoabFolderList::fillColumns(const ::com::sun::star::lang::Locale& _aLocal if (aField2.Len() == 0) { - bNumeric = FALSE; + bNumeric = sal_False; } else { - bNumeric = TRUE; + bNumeric = sal_True; xub_StrLen nDot = 0; for (xub_StrLen j = 0; j < aField2.Len(); j++) { sal_Unicode c = aField2.GetChar(j); - // nur Ziffern und Dezimalpunkt und Tausender-Trennzeichen? + // Only digits and decimalpoint and thousands delimiter? if ((!cDecimalDelimiter || c != cDecimalDelimiter) && (!cThousandDelimiter || c != cThousandDelimiter) && !aCharClass.isDigit(aField2,j)) { - bNumeric = FALSE; + bNumeric = sal_False; break; } if (cDecimalDelimiter && c == cDecimalDelimiter) @@ -174,26 +174,26 @@ void OEvoabFolderList::fillColumns(const ::com::sun::star::lang::Locale& _aLocal } if (nDot > 1) // if there is more than one dot it isn't a number - bNumeric = FALSE; + bNumeric = sal_False; if (bNumeric && cThousandDelimiter) { - // Ist der Trenner richtig angegeben? + // Is the delimiter given correctly? String aValue = aField2.GetToken(0,cDecimalDelimiter); for (sal_Int32 j = aValue.Len() - 4; j >= 0; j -= 4) { sal_Unicode c = aValue.GetChar(j); - // nur Ziffern und Dezimalpunkt und Tausender-Trennzeichen? + // Only digits, decimalpoint and thousands delimiter? if (c == cThousandDelimiter && j) continue; else { - bNumeric = FALSE; + bNumeric = sal_False; break; } } } - // jetzt koennte es noch ein Datumsfeld sein + // now it might still be a date-field if (!bNumeric) { try @@ -215,12 +215,12 @@ void OEvoabFolderList::fillColumns(const ::com::sun::star::lang::Locale& _aLocal if(nPrecision) { eType = DataType::DECIMAL; - aTypeName = ::rtl::OUString::createFromAscii("DECIMAL"); + aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DECIMAL")); } else { eType = DataType::DOUBLE; - aTypeName = ::rtl::OUString::createFromAscii("DOUBLE"); + aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DOUBLE")); } } else @@ -234,21 +234,21 @@ void OEvoabFolderList::fillColumns(const ::com::sun::star::lang::Locale& _aLocal { case NUMBERFORMAT_DATE: eType = DataType::DATE; - aTypeName = ::rtl::OUString::createFromAscii("DATE"); + aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DATE")); break; case NUMBERFORMAT_DATETIME: eType = DataType::TIMESTAMP; - aTypeName = ::rtl::OUString::createFromAscii("TIMESTAMP"); + aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP")); break; case NUMBERFORMAT_TIME: eType = DataType::TIME; - aTypeName = ::rtl::OUString::createFromAscii("TIME"); + aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIME")); break; default: eType = DataType::VARCHAR; - nPrecision = 0; // nyi: Daten koennen aber laenger sein! + nPrecision = 0; // nyi: Data can be longer! nScale = 0; - aTypeName = ::rtl::OUString::createFromAscii("VARCHAR"); + aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VARCHAR")); }; nFlags |= ColumnSearch::CHAR; } @@ -301,8 +301,8 @@ void OEvoabFolderList::construct() Sequence< ::com::sun::star::uno::Any > aArg(1); aArg[0] <<= aAppLocale; - Reference< ::com::sun::star::util::XNumberFormatsSupplier > xSupplier(m_pConnection->getDriver()->getFactory()->createInstanceWithArguments(::rtl::OUString::createFromAscii("com.sun.star.util.NumberFormatsSupplier"),aArg),UNO_QUERY); - m_xNumberFormatter = Reference< ::com::sun::star::util::XNumberFormatter >(m_pConnection->getDriver()->getFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.util.NumberFormatter")),UNO_QUERY); + Reference< ::com::sun::star::util::XNumberFormatsSupplier > xSupplier(m_pConnection->getDriver()->getFactory()->createInstanceWithArguments(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.NumberFormatsSupplier")),aArg),UNO_QUERY); + m_xNumberFormatter = Reference< ::com::sun::star::util::XNumberFormatter >(m_pConnection->getDriver()->getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.NumberFormatter"))),UNO_QUERY); m_xNumberFormatter->attachNumberFormatsSupplier(xSupplier); INetURLObject aURL; @@ -322,7 +322,7 @@ void OEvoabFolderList::construct() sal_Int32 nSize = m_pFileStream->Tell(); m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN); - // Buffersize abhaengig von der Filegroesse + // Buffersize dependent on the file-size m_pFileStream->SetBufferSize(nSize > 1000000 ? 32768 : nSize > 100000 ? 16384 : nSize > 10000 ? 4096 : 1024); @@ -339,7 +339,7 @@ sal_Bool OEvoabFolderList::fetchRow(OValueRow _rRow,const OSQLColumns & _rCols) (_rRow->get())[0] = m_nFilePos; // the "bookmark" OEvoabConnection* pConnection = (OEvoabConnection*)m_pConnection; - // Felder: + // Fields: xub_StrLen nStartPos = 0; String aStr; OSQLColumns::Vector::const_iterator aIter = _rCols.get().begin(); @@ -366,7 +366,7 @@ sal_Bool OEvoabFolderList::fetchRow(OValueRow _rRow,const OSQLColumns & _rCols) nRes = m_xNumberFormatter->convertStringToNumber(::com::sun::star::util::NumberFormat::ALL,aStr); Reference<XPropertySet> xProp(m_xNumberFormatter->getNumberFormatsSupplier()->getNumberFormatSettings(),UNO_QUERY); com::sun::star::util::Date aDate; - xProp->getPropertyValue(::rtl::OUString::createFromAscii("NullDate")) >>= aDate; + xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NullDate"))) >>= aDate; switch(nType) { @@ -387,7 +387,7 @@ sal_Bool OEvoabFolderList::fetchRow(OValueRow _rRow,const OSQLColumns & _rCols) } break; case DataType::DOUBLE: case DataType::INTEGER: - case DataType::DECIMAL: // #99178# OJ + case DataType::DECIMAL: case DataType::NUMERIC: { sal_Unicode cDecimalDelimiter = pConnection->getDecimalDelimiter(); @@ -398,23 +398,22 @@ sal_Bool OEvoabFolderList::fetchRow(OValueRow _rRow,const OSQLColumns & _rCols) !cDecimalDelimiter && nType == DataType::INTEGER, "FalscherTyp"); - // In Standard-Notation (DezimalPUNKT ohne Tausender-Komma) umwandeln: + // Convert to standard notation (DecimalPOINT without Thousands-comma): for (xub_StrLen j = 0; j < aStr.Len(); ++j) { if (cDecimalDelimiter && aStr.GetChar(j) == cDecimalDelimiter) aStrConverted += '.'; else if ( aStr.GetChar(j) == '.' ) // special case, if decimal seperator isn't '.' we have to vut the string after it - break; // #99189# OJ + break; else if (cThousandDelimiter && aStr.GetChar(j) == cThousandDelimiter) { - // weglassen + // leave out } else aStrConverted += aStr.GetChar(j) ; } double nVal = ::rtl::math::stringToDouble(aStrConverted.GetBuffer(),',','.',NULL,NULL); - // #99178# OJ if ( DataType::DECIMAL == nType || DataType::NUMERIC == nType ) (_rRow->get())[i+1] = String::CreateFromDouble(nVal); else @@ -423,7 +422,7 @@ sal_Bool OEvoabFolderList::fetchRow(OValueRow _rRow,const OSQLColumns & _rCols) default: { - // Wert als String in Variable der Row uebernehmen + // put value as string in Row variable (_rRow->get())[i+1] = aStr; } break; @@ -443,7 +442,7 @@ sal_Bool OEvoabFolderList::seekRow(IResultSetHelper::Movement eCursorPosition) return sal_False; OEvoabConnection* pConnection = (OEvoabConnection*)m_pConnection; // ---------------------------------------------------------- - // Positionierung vorbereiten: + // Prepare positioning: //OSL_TRACE("OEvoabFolderList::seekRow()::(before SeekRow,m_pFileStriam Exist)m_aCurrentLine = %d\n", ((OUtoCStr(::rtl::OUString(m_aCurrentLine))) ? (OUtoCStr(::rtl::OUString(m_aCurrentLine))):("NULL")) ); switch(eCursorPosition) @@ -475,7 +474,7 @@ sal_Bool OEvoabFolderList::seekRow(IResultSetHelper::Movement eCursorPosition) break; default: - OSL_ENSURE( sal_False, "OEvoabFolderList::seekRow: unsupported positioning!" ); + OSL_FAIL( "OEvoabFolderList::seekRow: unsupported positioning!" ); break; } diff --git a/connectivity/source/drivers/evoab/LFolderList.hxx b/connectivity/source/drivers/evoab/LFolderList.hxx index a7eb508d67..73d952b638 100644 --- a/connectivity/source/drivers/evoab/LFolderList.hxx +++ b/connectivity/source/drivers/evoab/LFolderList.hxx @@ -41,8 +41,8 @@ namespace connectivity namespace evoab { //================================================================== - // Ableitung von String mit ueberladenen GetToken/GetTokenCount-Methoden - // Speziell fuer FLAT FILE-Format: Strings koennen gequotet sein + // Derivation of String with overloaded GetToken/GetTokenCount methods + // Especially for FLAT FILE-Format: Strings can be quoted //================================================================== class OEvoabConnection; @@ -55,7 +55,7 @@ namespace connectivity ::std::vector<sal_Int32> m_aScales; QuotedTokenizedString m_aCurrentLine; ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xNumberFormatter; - sal_Int32 m_nFilePos; // aktuelle IResultSetHelper::Movement + sal_Int32 m_nFilePos; // current IResultSetHelper::Movement SvStream* m_pFileStream; OEvoabConnection* m_pConnection; ::rtl::Reference<OSQLColumns> m_aColumns; @@ -64,7 +64,7 @@ namespace connectivity private: void fillColumns(const ::com::sun::star::lang::Locale& _aLocale); - BOOL CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo); + sal_Bool CreateFile(const INetURLObject& aFile, sal_Bool& bCreateMemo); sal_Bool fetchRow(OValueRow _rRow,const OSQLColumns& _rCols); sal_Bool seekRow(IResultSetHelper::Movement eCursorPosition); diff --git a/connectivity/source/drivers/evoab/LNoException.cxx b/connectivity/source/drivers/evoab/LNoException.cxx index c8578fedb0..120d6bfd98 100644 --- a/connectivity/source/drivers/evoab/LNoException.cxx +++ b/connectivity/source/drivers/evoab/LNoException.cxx @@ -41,44 +41,44 @@ xub_StrLen OEvoabString::GetTokenCount( sal_Unicode cTok, sal_Unicode cStrDel ) return 0; xub_StrLen nTokCount = 1; - BOOL bStart = TRUE; // Stehen wir auf dem ersten Zeichen im Token? - BOOL bInString = FALSE; // Befinden wir uns INNERHALB eines (cStrDel delimited) String? + sal_Bool bStart = sal_True; // Are we on the fist character of the token? + sal_Bool bInString = sal_False; // Are we within a (cStrDel delimited) string? - // Suche bis Stringende nach dem ersten nicht uebereinstimmenden Zeichen + // Search for the first not-matching character (search ends at the end of string) for( xub_StrLen i = 0; i < Len(); i++ ) { if (bStart) { - bStart = FALSE; - // Erstes Zeichen ein String-Delimiter? + bStart = sal_False; + // First character a string delimiter? if ((*this).GetChar(i) == cStrDel) { - bInString = TRUE; // dann sind wir jetzt INNERHALB des Strings! - continue; // dieses Zeichen ueberlesen! + bInString = sal_True; // then we are within a string! + continue; // read next character! } } if (bInString) { - // Wenn jetzt das String-Delimiter-Zeichen auftritt ... + // If we see the string delimiter ... if ( (*this).GetChar(i) == cStrDel ) { if ((i+1 < Len()) && ((*this).GetChar(i+1) == cStrDel)) { - // Verdoppeltes String-Delimiter-Zeichen: - i++; // kein String-Ende, naechstes Zeichen ueberlesen. + // doubled string-delimiter: + i++; // no end of string, skip next character. } else { - // String-Ende - bInString = FALSE; + // end of String + bInString = sal_False; } } } else { - // Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount + // if the token character matches, then raise TokCount if ( (*this).GetChar(i) == cTok ) { nTokCount++; - bStart = TRUE; + bStart = sal_True; } } } @@ -94,51 +94,49 @@ void OEvoabString::GetTokenSpecial( String& _rStr,xub_StrLen& nStartPos, sal_Uni xub_StrLen nLen = Len(); if ( nLen ) { - BOOL bInString = (nStartPos < nLen) && ((*this).GetChar(nStartPos) == cStrDel); // Befinden wir uns INNERHALB eines (cStrDel delimited) String? + sal_Bool bInString = (nStartPos < nLen) && ((*this).GetChar(nStartPos) == cStrDel); // are we within a (cStrDel delimited) String? - // Erstes Zeichen ein String-Delimiter? + // Is the first character a String-Delimiter? if (bInString ) - ++nStartPos; // dieses Zeichen ueberlesen! - // Suche bis Stringende nach dem ersten nicht uebereinstimmenden Zeichen + ++nStartPos; // skip the character! + // Search until end of string for the first not-matching character for( xub_StrLen i = nStartPos; i < nLen; ++i ) { if (bInString) { - // Wenn jetzt das String-Delimiter-Zeichen auftritt ... + // If we see the String-Delimiter ... if ( (*this).GetChar(i) == cStrDel ) { if ((i+1 < nLen) && ((*this).GetChar(i+1) == cStrDel)) { - // Verdoppeltes String-Delimiter-Zeichen: - ++i; // kein String-Ende, naechstes Zeichen ueberlesen. - - _rStr += (*this).GetChar(i); // Zeichen gehoert zum Resultat-String + // doubled String-Delimiter: + ++i; // no end of String, skip next character + _rStr += (*this).GetChar(i); // Character belongs to Result-String } else { - // String-Ende - bInString = FALSE; + // end of String + bInString = sal_False; } } else { - _rStr += (*this).GetChar(i); // Zeichen gehoert zum Resultat-String + _rStr += (*this).GetChar(i); // Character belongs to Result-String } } else { - // Stimmt das Tokenzeichen ueberein, dann erhoehe nTok + // Does the Token-character match, then raise nTok if ( (*this).GetChar(i) == cTok ) { - // Vorzeitiger Abbruch der Schleife moeglich, denn - // wir haben, was wir wollten. + // Early termination of loop possible, because we found what we were looking for. nStartPos = i+1; break; } else { - _rStr += (*this).GetChar(i); // Zeichen gehoert zum Resultat-String + _rStr += (*this).GetChar(i); // Character belongs to Result-String } } } @@ -153,7 +151,7 @@ sal_Bool OEvoabTable::checkHeaderLine() { if (m_nFilePos == 0 && ((OEvoabConnection*)m_pConnection)->isHeaderLine()) { - BOOL bRead2; + sal_Bool bRead2; do { bRead2 = m_pFileStream->ReadByteStringLine(m_aCurrentLine,m_pConnection->getTextEncoding()); @@ -175,7 +173,7 @@ sal_Bool OEvoabTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_In return sal_False; OEvoabConnection* pConnection = (OEvoabConnection*)m_pConnection; // ---------------------------------------------------------- - // Positionierung vorbereiten: + // prepare positioning: //OSL_TRACE("OEvoabTable::(before SeekRow,m_pFileStriam Exist)m_aCurrentLine = %d\n", ((OUtoCStr(::rtl::OUString(m_aCurrentLine))) ? (OUtoCStr(::rtl::OUString(m_aCurrentLine))):("NULL")) ); m_nFilePos = nCurPos; @@ -310,7 +308,7 @@ sal_Bool OEvoabTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_In if (m_pFileStream->IsEof()) return sal_False; - m_nFilePos = m_pFileStream->Tell(); // Byte-Position in der Datei merken (am ZeilenANFANG) + m_nFilePos = m_pFileStream->Tell(); // save Byte-Position in the file (at start of line) m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding()); if (m_pFileStream->IsEof()) return sal_False; diff --git a/connectivity/source/drivers/evoab/LResultSet.cxx b/connectivity/source/drivers/evoab/LResultSet.cxx index 7bcc71d407..3abd4a12c3 100644 --- a/connectivity/source/drivers/evoab/LResultSet.cxx +++ b/connectivity/source/drivers/evoab/LResultSet.cxx @@ -45,8 +45,7 @@ using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace com::sun::star::sdbc; using namespace com::sun::star::sdbcx; -// using namespace com::sun::star::container; -// using namespace com::sun::star::util; + //------------------------------------------------------------------------------ OEvoabResultSet::OEvoabResultSet( OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator) : file::OResultSet(pStmt,_aSQLIterator) @@ -57,14 +56,14 @@ OEvoabResultSet::OEvoabResultSet( OStatement_Base* pStmt,connectivity::OSQLParse // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OEvoabResultSet::getImplementationName( ) throw ( RuntimeException) { - return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.evoab.ResultSet"); + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.evoab.ResultSet")); } // ------------------------------------------------------------------------- Sequence< ::rtl::OUString > SAL_CALL OEvoabResultSet::getSupportedServiceNames( ) throw( RuntimeException) { Sequence< ::rtl::OUString > aSupported(2); - aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.ResultSet"); - aSupported[1] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.ResultSet"); + aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.ResultSet")); + aSupported[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.ResultSet")); return aSupported; } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/evoab/LServices.cxx b/connectivity/source/drivers/evoab/LServices.cxx index 6619d90ebb..3ea2a455e1 100644 --- a/connectivity/source/drivers/evoab/LServices.cxx +++ b/connectivity/source/drivers/evoab/LServices.cxx @@ -30,13 +30,11 @@ #include "precompiled_connectivity.hxx" #include "LDriver.hxx" #include <cppuhelper/factory.hxx> -#include <osl/diagnose.h> using namespace connectivity::evoab; using ::rtl::OUString; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; -using ::com::sun::star::registry::XRegistryKey; using ::com::sun::star::lang::XSingleServiceFactory; using ::com::sun::star::lang::XMultiServiceFactory; @@ -49,31 +47,6 @@ typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc) rtl_ModuleCount* _pT ); -//*************************************************************************************** -// -// Die vorgeschriebene C-Api muss erfuellt werden! -// Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen. -// - -//--------------------------------------------------------------------------------------- -void REGISTER_PROVIDER( - const OUString& aServiceImplName, - const Sequence< OUString>& Services, - const Reference< ::com::sun::star::registry::XRegistryKey > & xKey) -{ - OUString aMainKeyName; - aMainKeyName = OUString::createFromAscii("/"); - aMainKeyName += aServiceImplName; - aMainKeyName += OUString::createFromAscii("/UNO/SERVICES"); - - Reference< ::com::sun::star::registry::XRegistryKey > xNewKey( xKey->createKey(aMainKeyName) ); - OSL_ENSURE(xNewKey.is(), "FILE::component_writeInfo : could not create a registry key !"); - - for (sal_Int32 i=0; i<Services.getLength(); ++i) - xNewKey->createKey(Services[i]); -} - - //--------------------------------------------------------------------------------------- struct ProviderRequest { @@ -113,7 +86,6 @@ struct ProviderRequest }; //--------------------------------------------------------------------------------------- - extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char **ppEnvTypeName, @@ -124,31 +96,6 @@ component_getImplementationEnvironment( } //--------------------------------------------------------------------------------------- -extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( - void* /*pServiceManager*/, - void* pRegistryKey - ) -{ - if (pRegistryKey) - try - { - Reference< ::com::sun::star::registry::XRegistryKey > xKey(reinterpret_cast< ::com::sun::star::registry::XRegistryKey*>(pRegistryKey)); - - REGISTER_PROVIDER( - OEvoabDriver::getImplementationName_Static(), - OEvoabDriver::getSupportedServiceNames_Static(), xKey); - - return sal_True; - } - catch (::com::sun::star::registry::InvalidRegistryException& ) - { - OSL_ENSURE(sal_False, "FILE::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !"); - } - - return sal_False; -} - -//--------------------------------------------------------------------------------------- extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplementationName, void* pServiceManager, diff --git a/connectivity/source/drivers/evoab/LTable.cxx b/connectivity/source/drivers/evoab/LTable.cxx index 505337dacf..41ac3773d1 100644 --- a/connectivity/source/drivers/evoab/LTable.cxx +++ b/connectivity/source/drivers/evoab/LTable.cxx @@ -72,7 +72,7 @@ using namespace ::com::sun::star::lang; // ------------------------------------------------------------------------- void OEvoabTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) { - BOOL bRead = TRUE; + sal_Bool bRead = sal_True; QuotedTokenizedString aHeaderLine; OEvoabConnection* pConnection = (OEvoabConnection*)m_pConnection; @@ -115,7 +115,7 @@ void OEvoabTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) m_aPrecisions.reserve(nFieldCount); m_aScales.reserve(nFieldCount); - sal_Bool bCase = getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers(); + sal_Bool bCase = getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers(); CharClass aCharClass(pConnection->getDriver()->getFactory(),_aLocale); // read description sal_Unicode cDecimalDelimiter = pConnection->getDecimalDelimiter(); @@ -141,11 +141,11 @@ void OEvoabTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) //OSL_TRACE("OEvoabTable::aColumnName = %s\n", ((OUtoCStr(::rtl::OUString(aColumnName))) ? (OUtoCStr(::rtl::OUString(aColumnName))):("NULL")) ); sal_Int32 eType; - UINT16 nPrecision = 0; - UINT16 nScale = 0; + sal_uInt16 nPrecision = 0; + sal_uInt16 nScale = 0; - BOOL bNumeric = FALSE; - ULONG nIndex = 0; + sal_Bool bNumeric = sal_False; + sal_uIntPtr nIndex = 0; // first without fielddelimiter String aField; @@ -155,7 +155,7 @@ void OEvoabTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) if (aField.Len() == 0 || (pConnection->getStringDelimiter() && pConnection->getStringDelimiter() == aField.GetChar(0))) { - bNumeric = FALSE; + bNumeric = sal_False; } else { @@ -169,21 +169,21 @@ void OEvoabTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) if (aField2.Len() == 0) { - bNumeric = FALSE; + bNumeric = sal_False; } else { - bNumeric = TRUE; + bNumeric = sal_True; xub_StrLen nDot = 0; for (xub_StrLen j = 0; j < aField2.Len(); j++) { sal_Unicode c = aField2.GetChar(j); - // nur Ziffern und Dezimalpunkt und Tausender-Trennzeichen? + // only digits, decimalpoint and thousands-delimiter if ((!cDecimalDelimiter || c != cDecimalDelimiter) && (!cThousandDelimiter || c != cThousandDelimiter) && !aCharClass.isDigit(aField2,j)) { - bNumeric = FALSE; + bNumeric = sal_False; break; } if (cDecimalDelimiter && c == cDecimalDelimiter) @@ -195,26 +195,26 @@ void OEvoabTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) } if (nDot > 1) // if there is more than one dot it isn't a number - bNumeric = FALSE; + bNumeric = sal_False; if (bNumeric && cThousandDelimiter) { - // Ist der Trenner richtig angegeben? + // is the delimiter given correctly String aValue = aField2.GetToken(0,cDecimalDelimiter); for (sal_Int32 j = aValue.Len() - 4; j >= 0; j -= 4) { sal_Unicode c = aValue.GetChar(j); - // nur Ziffern und Dezimalpunkt und Tausender-Trennzeichen? + // only digits, decimalpoint and thousands-delimiter? if (c == cThousandDelimiter && j) continue; else { - bNumeric = FALSE; + bNumeric = sal_False; break; } } } - // jetzt koennte es noch ein Datumsfeld sein + // Now it might still be a Date-field if (!bNumeric) { try @@ -236,12 +236,12 @@ void OEvoabTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) if(nPrecision) { eType = DataType::DECIMAL; - aTypeName = ::rtl::OUString::createFromAscii("DECIMAL"); + aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DECIMAL")); } else { eType = DataType::DOUBLE; - aTypeName = ::rtl::OUString::createFromAscii("DOUBLE"); + aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DOUBLE")); } } else @@ -255,21 +255,21 @@ void OEvoabTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) { case NUMBERFORMAT_DATE: eType = DataType::DATE; - aTypeName = ::rtl::OUString::createFromAscii("DATE"); + aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DATE")); break; case NUMBERFORMAT_DATETIME: eType = DataType::TIMESTAMP; - aTypeName = ::rtl::OUString::createFromAscii("TIMESTAMP"); + aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP")); break; case NUMBERFORMAT_TIME: eType = DataType::TIME; - aTypeName = ::rtl::OUString::createFromAscii("TIME"); + aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIME")); break; default: eType = DataType::VARCHAR; - nPrecision = 0; // nyi: Daten koennen aber laenger sein! + nPrecision = 0; // nyi: Data can be longer nScale = 0; - aTypeName = ::rtl::OUString::createFromAscii("VARCHAR"); + aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VARCHAR")); }; nFlags |= ColumnSearch::CHAR; } @@ -338,8 +338,8 @@ void OEvoabTable::construct() Sequence< ::com::sun::star::uno::Any > aArg(1); aArg[0] <<= aAppLocale; - Reference< ::com::sun::star::util::XNumberFormatsSupplier > xSupplier(m_pConnection->getDriver()->getFactory()->createInstanceWithArguments(::rtl::OUString::createFromAscii("com.sun.star.util.NumberFormatsSupplier"),aArg),UNO_QUERY); - m_xNumberFormatter = Reference< ::com::sun::star::util::XNumberFormatter >(m_pConnection->getDriver()->getFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.util.NumberFormatter")),UNO_QUERY); + Reference< ::com::sun::star::util::XNumberFormatsSupplier > xSupplier(m_pConnection->getDriver()->getFactory()->createInstanceWithArguments(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.NumberFormatsSupplier")),aArg),UNO_QUERY); + m_xNumberFormatter = Reference< ::com::sun::star::util::XNumberFormatter >(m_pConnection->getDriver()->getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.NumberFormatter"))),UNO_QUERY); m_xNumberFormatter->attachNumberFormatsSupplier(xSupplier); INetURLObject aURL; @@ -362,7 +362,7 @@ void OEvoabTable::construct() sal_Int32 nSize = m_pFileStream->Tell(); m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN); - // Buffersize abhaengig von der Filegroesse + // Buffer size is dependent on the file-size m_pFileStream->SetBufferSize(nSize > 1000000 ? 32768 : nSize > 100000 ? 16384 : nSize > 10000 ? 4096 : 1024); @@ -510,10 +510,10 @@ sal_Bool OEvoabTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols,sa *(_rRow->get())[0] = m_nFilePos; if (!bRetrieveData) - return TRUE; + return sal_True; OEvoabConnection* pConnection = (OEvoabConnection*)m_pConnection; - // Felder: + // Fields: xub_StrLen nStartPos = 0; String aStr; OSQLColumns::Vector::const_iterator aIter = _rCols.get().begin(); @@ -526,7 +526,7 @@ sal_Bool OEvoabTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols,sa (_rRow->get())[i+1]->setNull(); else { - // Laengen je nach Datentyp: + // Lengths for each data-type: sal_Int32 nLen, nType = 0; if(bIsTable) @@ -552,7 +552,7 @@ sal_Bool OEvoabTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols,sa nRes = m_xNumberFormatter->convertStringToNumber(::com::sun::star::util::NumberFormat::ALL,aStr); Reference<XPropertySet> xProp(m_xNumberFormatter->getNumberFormatsSupplier()->getNumberFormatSettings(),UNO_QUERY); com::sun::star::util::Date aDate; - xProp->getPropertyValue(::rtl::OUString::createFromAscii("NullDate")) >>= aDate; + xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NullDate"))) >>= aDate; switch(nType) { @@ -573,7 +573,7 @@ sal_Bool OEvoabTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols,sa } break; case DataType::DOUBLE: case DataType::INTEGER: - case DataType::DECIMAL: // #99178# OJ + case DataType::DECIMAL: case DataType::NUMERIC: { sal_Unicode cDecimalDelimiter = pConnection->getDecimalDelimiter(); @@ -584,23 +584,22 @@ sal_Bool OEvoabTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols,sa !cDecimalDelimiter && nType == DataType::INTEGER, "FalscherTyp"); - // In Standard-Notation (DezimalPUNKT ohne Tausender-Komma) umwandeln: + // Convert to standard-notation (DecimalPOINT without Thousands-comma): for (xub_StrLen j = 0; j < aStr.Len(); ++j) { if (cDecimalDelimiter && aStr.GetChar(j) == cDecimalDelimiter) aStrConverted += '.'; else if ( aStr.GetChar(j) == '.' ) // special case, if decimal seperator isn't '.' we have to vut the string after it - break; // #99189# OJ + break; else if (cThousandDelimiter && aStr.GetChar(j) == cThousandDelimiter) { - // weglassen + // leave out } else aStrConverted += aStr.GetChar(j) ; } double nVal = ::rtl::math::stringToDouble(aStrConverted.GetBuffer(),',','.',NULL,NULL); - // #99178# OJ if ( DataType::DECIMAL == nType || DataType::NUMERIC == nType ) *(_rRow->get())[i+1] = ORowSetValue(String::CreateFromDouble(nVal)); else @@ -609,7 +608,7 @@ sal_Bool OEvoabTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols,sa default: { - // Wert als String in Variable der Row uebernehmen + // Copy Value as String in Row-variable *(_rRow->get())[i+1] = ORowSetValue(aStr); } break; @@ -664,15 +663,15 @@ sal_Bool OEvoabTable::setColumnAliases() } } else - OSL_ENSURE( sal_False, "OEvoabTable::setColumnAliases: did not find one of the aliases!" ); + OSL_FAIL( "OEvoabTable::setColumnAliases: did not find one of the aliases!" ); } if(!bFound) aColumnFinalName = aColumnReadName; sColumnFinalName = aColumnFinalName; - sal_Bool bCase = getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers(); + sal_Bool bCase = getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers(); ::rtl::OUString aTypeName; - aTypeName = ::rtl::OUString::createFromAscii("VARCHAR"); + aTypeName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VARCHAR")); sdbcx::OColumn* pColumn = new sdbcx::OColumn(sColumnFinalName,aTypeName,::rtl::OUString(), ColumnValue::NULLABLE, m_aPrecisions[i], @@ -696,7 +695,7 @@ sal_Bool OEvoabTable::checkHeaderLine() { if (m_nFilePos == 0 && ((OEvoabConnection*)m_pConnection)->isHeaderLine()) { - BOOL bRead2; + sal_Bool bRead2; do { bRead2 = m_pFileStream->ReadByteStringLine(m_aCurrentLine,m_pConnection->getTextEncoding()); @@ -718,7 +717,7 @@ sal_Bool OEvoabTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_In return sal_False; OEvoabConnection* pConnection = (OEvoabConnection*)m_pConnection; // ---------------------------------------------------------- - // Positionierung vorbereiten: + // prepare positioning: //OSL_TRACE("OEvoabTable::(before SeekRow,m_pFileStriam Exist)m_aCurrentLine = %d\n", ((OUtoCStr(::rtl::OUString(m_aCurrentLine))) ? (OUtoCStr(::rtl::OUString(m_aCurrentLine))):("NULL")) ); m_nFilePos = nCurPos; @@ -851,7 +850,7 @@ sal_Bool OEvoabTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_In if (m_pFileStream->IsEof()) return sal_False; - m_nFilePos = m_pFileStream->Tell(); // Byte-Position in der Datei merken (am ZeilenANFANG) + m_nFilePos = m_pFileStream->Tell(); // save Byte-Position in the file (at start of line) m_pFileStream->ReadByteStringLine(m_aCurrentLine,pConnection->getTextEncoding()); if (m_pFileStream->IsEof()) return sal_False; diff --git a/connectivity/source/drivers/evoab/LTables.cxx b/connectivity/source/drivers/evoab/LTables.cxx index c104f9c315..41fbf8f7a0 100644 --- a/connectivity/source/drivers/evoab/LTables.cxx +++ b/connectivity/source/drivers/evoab/LTables.cxx @@ -54,7 +54,7 @@ namespace starutil = ::com::sun::star::util; sdbcx::ObjectType OEvoabTables::createObject(const ::rtl::OUString& _rName) { OEvoabTable* pRet = new OEvoabTable(this,(OEvoabConnection*)static_cast<OFileCatalog&>(m_rParent).getConnection(), - _rName,::rtl::OUString::createFromAscii("TABLE")); + _rName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE"))); sdbcx::ObjectType xRet = pRet; pRet->construct(); return xRet; diff --git a/connectivity/source/drivers/evoab/evoab.xcu b/connectivity/source/drivers/evoab/evoab.xcu index 4c8e3cc43a..4c8e3cc43a 100755..100644 --- a/connectivity/source/drivers/evoab/evoab.xcu +++ b/connectivity/source/drivers/evoab/evoab.xcu diff --git a/connectivity/source/drivers/evoab/evoab.xml b/connectivity/source/drivers/evoab/evoab.xml index 669eb109ad..669eb109ad 100644..100755 --- a/connectivity/source/drivers/evoab/evoab.xml +++ b/connectivity/source/drivers/evoab/evoab.xml diff --git a/connectivity/source/drivers/evoab/exports.dxp b/connectivity/source/drivers/evoab/exports.dxp index 9630d7e067..f0e1c69934 100644..100755 --- a/connectivity/source/drivers/evoab/exports.dxp +++ b/connectivity/source/drivers/evoab/exports.dxp @@ -1,3 +1,2 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory diff --git a/connectivity/source/drivers/evoab/makefile.mk b/connectivity/source/drivers/evoab/makefile.mk index 363b08e409..4c9357b71e 100644..100755 --- a/connectivity/source/drivers/evoab/makefile.mk +++ b/connectivity/source/drivers/evoab/makefile.mk @@ -32,7 +32,13 @@ TARGET=evoab VISIBILITY_HIDDEN=TRUE +.IF "$(ENABLE_EVOAB2)"=="TRUE" +dummy: + @echo "Evolution 1.x Addressbook build disabled in favour of Evolution 2.x Addressbook" +.ELSE + # --- Settings ---------------------------------- + .IF "$(DBGUTIL_OJ)"!="" ENVCFLAGS+=/FR$(SLO)$/ .ENDIF @@ -69,7 +75,7 @@ SHL1VERSIONMAP=$(SOLARENV)/src/component.map # --- Library ----------------------------------- -#SHL1TARGET=$(TARGET)$(DLLPOSTFIX) + SHL1TARGET= $(EVOAB_TARGET)$(DLLPOSTFIX) SHL1OBJS=$(SLOFILES) SHL1STDLIBS=\ @@ -100,5 +106,8 @@ DEF1NAME= $(SHL1TARGET) dummy: @echo "Nothing to build for GUI $(GUI)" .ENDIF +.ENDIF + # --- Targets ---------------------------------- + .INCLUDE : $(PRJ)$/target.pmk diff --git a/connectivity/source/drivers/evoab2/EApi.h b/connectivity/source/drivers/evoab2/EApi.h index c089fda927..c089fda927 100644..100755 --- a/connectivity/source/drivers/evoab2/EApi.h +++ b/connectivity/source/drivers/evoab2/EApi.h diff --git a/connectivity/source/drivers/evoab2/NCatalog.cxx b/connectivity/source/drivers/evoab2/NCatalog.cxx index 4698a6aab0..d1cc91b842 100644 --- a/connectivity/source/drivers/evoab2/NCatalog.cxx +++ b/connectivity/source/drivers/evoab2/NCatalog.cxx @@ -55,9 +55,9 @@ void OEvoabCatalog::refreshTables() { TStringVector aVector; Sequence< ::rtl::OUString > aTypes(1); - aTypes[0] = ::rtl::OUString::createFromAscii("TABLE"); + aTypes[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE")); Reference< XResultSet > xResult = m_xMetaData->getTables(Any(), - ::rtl::OUString::createFromAscii("%"),::rtl::OUString::createFromAscii("%"),aTypes); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),aTypes); if(xResult.is()) { diff --git a/connectivity/source/drivers/evoab2/NConnection.cxx b/connectivity/source/drivers/evoab2/NConnection.cxx index caf6d11d36..f056f61719 100644 --- a/connectivity/source/drivers/evoab2/NConnection.cxx +++ b/connectivity/source/drivers/evoab2/NConnection.cxx @@ -57,7 +57,7 @@ using namespace ::com::sun::star::lang; { ::rtl::OUString aExceptionType = aExceptionType_; if( aExceptionType.getLength() == 0 ) - aExceptionType = ::rtl::OUString::createFromAscii("Unknown" ) ; + aExceptionType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown")) ; ::rtl::OUString aTypeLine( RTL_CONSTASCII_USTRINGPARAM("\nType: " ) ); aTypeLine += aExceptionType; @@ -125,9 +125,9 @@ void OEvoabConnection::construct(const ::rtl::OUString& url, const Sequence< Pro } } - if (url.equalsAscii("sdbc:address:evolution:groupwise")) + if (url.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("sdbc:address:evolution:groupwise"))) setSDBCAddressType(SDBCAddress::EVO_GWISE); - else if (url.equalsAscii("sdbc:address:evolution:ldap")) + else if (url.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("sdbc:address:evolution:ldap"))) setSDBCAddressType(SDBCAddress::EVO_LDAP); else setSDBCAddressType(SDBCAddress::EVO_LOCAL); diff --git a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx index d868b2a8c0..5af4a68551 100644 --- a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx +++ b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx @@ -213,9 +213,9 @@ namespace connectivity switch( getFieldType( nCol ) ) { case DataType::BIT: - return ::rtl::OUString::createFromAscii( "BIT" ); + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BIT")); case DataType::VARCHAR: - return ::rtl::OUString::createFromAscii( "VARCHAR" ); + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VARCHAR")); default: break; } @@ -283,9 +283,9 @@ ODatabaseMetaDataResultSet::ORows& OEvoabDatabaseMetaData::getColumnRows( const // **************************************************** // Catalog - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(""))); // Schema - aRow[2] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("")); + aRow[2] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(""))); // COLUMN_SIZE aRow[7] = new ORowSetValueDecorator(s_nCOLUMN_SIZE); // BUFFER_LENGTH, not used @@ -307,10 +307,10 @@ ODatabaseMetaDataResultSet::ORows& OEvoabDatabaseMetaData::getColumnRows( const // CHAR_OCTET_LENGTH, refer to [5] aRow[16] = new ORowSetValueDecorator(s_nCHAR_OCTET_LENGTH); // IS_NULLABLE - aRow[18] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii( "YES" )); + aRow[18] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("YES"))); - aRow[3] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii( "TABLE" )); + aRow[3] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE"))); ::osl::MutexGuard aGuard( m_aMutex ); initFields(); @@ -464,7 +464,7 @@ sal_Bool SAL_CALL OEvoabDatabaseMetaData::supportsNonNullableColumns( ) throw(S ::rtl::OUString OEvoabDatabaseMetaData::impl_getIdentifierQuoteString_throw( ) { // normally this is " - ::rtl::OUString aVal = ::rtl::OUString::createFromAscii("\""); + ::rtl::OUString aVal(RTL_CONSTASCII_USTRINGPARAM("\"")); return aVal; } // ------------------------------------------------------------------------- @@ -1017,7 +1017,7 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTableTypes( ) throw // there exists no possibility to get table types so we have to check static ::rtl::OUString sTableTypes[] = { - ::rtl::OUString::createFromAscii("TABLE"), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE")), // Currently we only support a 'TABLE' nothing more complex }; ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes); @@ -1056,7 +1056,7 @@ Reference< XResultSet > OEvoabDatabaseMetaData::impl_getTypeInfo_throw( ) ODatabaseMetaDataResultSet::ORow aRow; aRow.reserve(19); aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(new ORowSetValueDecorator(::rtl::OUString::createFromAscii("VARCHAR"))); + aRow.push_back(new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VARCHAR")))); aRow.push_back(new ORowSetValueDecorator(DataType::VARCHAR)); aRow.push_back(new ORowSetValueDecorator((sal_Int32)s_nCHAR_OCTET_LENGTH)); aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue()); @@ -1078,7 +1078,7 @@ Reference< XResultSet > OEvoabDatabaseMetaData::impl_getTypeInfo_throw( ) aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("VARCHAR")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VARCHAR"))); aRow[2] = new ORowSetValueDecorator(DataType::VARCHAR); aRow[3] = new ORowSetValueDecorator((sal_Int32)65535); aRows.push_back(aRow); @@ -1111,7 +1111,7 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables( // check if any type is given // when no types are given then we have to return all tables e.g. TABLE - const ::rtl::OUString aTable(::rtl::OUString::createFromAscii("TABLE")); + const ::rtl::OUString aTable(RTL_CONSTASCII_USTRINGPARAM("TABLE")); sal_Bool bTableFound = sal_True; sal_Int32 nLength = types.getLength(); diff --git a/connectivity/source/drivers/evoab2/NDriver.cxx b/connectivity/source/drivers/evoab2/NDriver.cxx index 4b5cd5550d..ae34a7e771 100644 --- a/connectivity/source/drivers/evoab2/NDriver.cxx +++ b/connectivity/source/drivers/evoab2/NDriver.cxx @@ -46,7 +46,6 @@ using namespace osl; using namespace connectivity::evoab; -//using namespace connectivity::file; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::sdbcx; @@ -91,7 +90,7 @@ void OEvoabDriver::disposing() //------------------------------------------------------------------------------ rtl::OUString OEvoabDriver::getImplementationName_Static( ) throw(RuntimeException) { - return rtl::OUString::createFromAscii(EVOAB_DRIVER_IMPL_NAME); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(EVOAB_DRIVER_IMPL_NAME)); // this name is referenced in the configuration and in the evoab.xml // Please take care when changing it. } @@ -102,7 +101,7 @@ Sequence< ::rtl::OUString > OEvoabDriver::getSupportedServiceNames_Static( ) th // which service is supported // for more information @see com.sun.star.sdbc.Driver Sequence< ::rtl::OUString > aSNS( 1 ); - aSNS[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.Driver"); + aSNS[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.Driver")); return aSNS; } //------------------------------------------------------------------ @@ -183,7 +182,7 @@ sal_Int32 SAL_CALL OEvoabDriver::getMinorVersion( ) throw(RuntimeException) // -------------------------------------------------------------------------------- sal_Bool OEvoabDriver::acceptsURL_Stat( const ::rtl::OUString& url ) { - return (url.equalsAscii("sdbc:address:evolution:local") || url.equalsAscii("sdbc:address:evolution:groupwise")||url.equalsAscii("sdbc:address:evolution:ldap"))&& EApiInit(); + return (url.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("sdbc:address:evolution:local")) || url.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("sdbc:address:evolution:groupwise"))||url.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("sdbc:address:evolution:ldap")))&& EApiInit(); } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/evoab2/NResultSet.cxx b/connectivity/source/drivers/evoab2/NResultSet.cxx index e16e459bf6..ce0713537c 100644 --- a/connectivity/source/drivers/evoab2/NResultSet.cxx +++ b/connectivity/source/drivers/evoab2/NResultSet.cxx @@ -77,13 +77,13 @@ namespace ErrorCondition = ::com::sun::star::sdb::ErrorCondition; //------------------------------------------------------------------------------ ::rtl::OUString SAL_CALL OEvoabResultSet::getImplementationName( ) throw ( RuntimeException) \ { - return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.evoab.ResultSet"); + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.evoab.ResultSet")); } // ------------------------------------------------------------------------- Sequence< ::rtl::OUString > SAL_CALL OEvoabResultSet::getSupportedServiceNames( ) throw( RuntimeException) { Sequence< ::rtl::OUString > aSupported(1); - aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.ResultSet"); + aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.ResultSet")); return aSupported; } // ------------------------------------------------------------------------- @@ -234,7 +234,7 @@ executeQuery (EBook* pBook, EBookQuery* pQuery, GList **ppList, { rtl::OString aUser( getUserName( pBook ) ); const char *pAuth = e_source_get_property( pSource, "auth" ); - bAuthSuccess = e_book_authenticate_user( pBook, aUser, rPassword, pAuth, pError ); + bAuthSuccess = e_book_authenticate_user( pBook, aUser.getStr(), rPassword.getStr(), pAuth, pError ); } if (bAuthSuccess) @@ -518,7 +518,7 @@ void OEvoabResultSet::construct( const QueryData& _rData ) { ENSURE_OR_THROW( _rData.getQuery(), "internal error: no EBookQuery" ); - EBook *pBook = openBook( ::rtl::OUStringToOString( _rData.sTable, RTL_TEXTENCODING_UTF8 ) ); + EBook *pBook = openBook(::rtl::OUStringToOString(_rData.sTable, RTL_TEXTENCODING_UTF8).getStr()); if ( !pBook ) m_pConnection->throwGenericSQLException( STR_CANNOT_OPEN_BOOK, *this ); diff --git a/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx b/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx index ed727feb07..335b44418c 100644 --- a/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx +++ b/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx @@ -54,7 +54,7 @@ OEvoabResultSetMetaData::~OEvoabResultSetMetaData() void OEvoabResultSetMetaData::setEvoabFields(const ::rtl::Reference<connectivity::OSQLColumns> &xColumns) throw(SQLException) { OSQLColumns::Vector::const_iterator aIter; - static const ::rtl::OUString aName(::rtl::OUString::createFromAscii("Name")); + static const ::rtl::OUString aName(RTL_CONSTASCII_USTRINGPARAM("Name")); for (aIter = xColumns->get().begin(); aIter != xColumns->get().end(); ++aIter) { @@ -134,7 +134,7 @@ sal_Bool SAL_CALL OEvoabResultSetMetaData::isCaseSensitive( sal_Int32 /*nColumnN // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OEvoabResultSetMetaData::getTableName( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException) { - return m_aTableName;//::rtl::OUString::createFromAscii("TABLE"); + return m_aTableName;//::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE")); } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OEvoabResultSetMetaData::getCatalogName( sal_Int32 /*nColumnNum*/ ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/evoab2/NServices.cxx b/connectivity/source/drivers/evoab2/NServices.cxx index e01013fdde..2e39639b52 100644 --- a/connectivity/source/drivers/evoab2/NServices.cxx +++ b/connectivity/source/drivers/evoab2/NServices.cxx @@ -36,7 +36,6 @@ using namespace connectivity::evoab; using ::rtl::OUString; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; -using ::com::sun::star::registry::XRegistryKey; using ::com::sun::star::lang::XSingleServiceFactory; using ::com::sun::star::lang::XMultiServiceFactory; @@ -49,31 +48,6 @@ typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc) rtl_ModuleCount* _pT ); -//*************************************************************************************** -// -// Die vorgeschriebene C-Api muss erfuellt werden! -// Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen. -// - -//--------------------------------------------------------------------------------------- -void REGISTER_PROVIDER( - const OUString& aServiceImplName, - const Sequence< OUString>& Services, - const Reference< ::com::sun::star::registry::XRegistryKey > & xKey) -{ - OUString aMainKeyName; - aMainKeyName = OUString::createFromAscii("/"); - aMainKeyName += aServiceImplName; - aMainKeyName += OUString::createFromAscii("/UNO/SERVICES"); - - Reference< ::com::sun::star::registry::XRegistryKey > xNewKey( xKey->createKey(aMainKeyName) ); - OSL_ENSURE(xNewKey.is(), "EVOAB::component_writeInfo : could not create a registry key !"); - - for (sal_Int32 i=0; i<Services.getLength(); ++i) - xNewKey->createKey(Services[i]); -} - - //--------------------------------------------------------------------------------------- struct ProviderRequest { @@ -105,7 +79,7 @@ struct ProviderRequest } catch(::com::sun::star::uno::Exception) { - OSL_ENSURE(0,"Service Creation Exception"); + OSL_FAIL("Service Creation Exception"); } return xRet.is(); } @@ -114,7 +88,6 @@ struct ProviderRequest }; //--------------------------------------------------------------------------------------- - extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char **ppEnvTypeName, uno_Environment ** /*ppEnv*/ @@ -124,31 +97,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnviron } //--------------------------------------------------------------------------------------- -extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( - void* /*pServiceManager*/, - void* pRegistryKey - ) -{ - if (pRegistryKey) - try - { - Reference< ::com::sun::star::registry::XRegistryKey > xKey(reinterpret_cast< ::com::sun::star::registry::XRegistryKey*>(pRegistryKey)); - - REGISTER_PROVIDER( - OEvoabDriver::getImplementationName_Static(), - OEvoabDriver::getSupportedServiceNames_Static(), xKey); - - return sal_True; - } - catch (::com::sun::star::registry::InvalidRegistryException& ) - { - OSL_ENSURE(sal_False, "FILE::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !"); - } - - return sal_False; -} - -//--------------------------------------------------------------------------------------- extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplementationName, void* pServiceManager, diff --git a/connectivity/source/drivers/evoab2/NStatement.cxx b/connectivity/source/drivers/evoab2/NStatement.cxx index 43bbaf2fcf..30cec213e0 100644 --- a/connectivity/source/drivers/evoab2/NStatement.cxx +++ b/connectivity/source/drivers/evoab2/NStatement.cxx @@ -208,8 +208,8 @@ OCommonStatement::createTest( const ::rtl::OUString &aColumnName, ::rtl::OString sMatch = rtl::OUStringToOString( aMatch, RTL_TEXTENCODING_UTF8 ); ::rtl::OString sColumnName = rtl::OUStringToOString( aColumnName, RTL_TEXTENCODING_UTF8 ); - return e_book_query_field_test( e_contact_field_id( sColumnName ), - eTest, sMatch ); + return e_book_query_field_test( e_contact_field_id( sColumnName.getStr() ), + eTest, sMatch.getStr() ); } // ------------------------------------------------------------------------- @@ -413,7 +413,7 @@ EBookQuery *OCommonStatement::whereAnalysis( const OSQLParseNode* parseTree ) { // String containing only a '%' and nothing else matches everything pResult = createTest( aColumnName, E_BOOK_QUERY_CONTAINS, - rtl::OUString::createFromAscii( "" ) ); + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")) ); } else if( aMatchString.indexOf( WILDCARD ) == -1 ) { // Simple string , eg. "to match" "contains in evo" @@ -428,7 +428,7 @@ EBookQuery *OCommonStatement::whereAnalysis( const OSQLParseNode* parseTree ) m_pConnection->throwGenericSQLException(STR_QUERY_NOT_LIKE_TOO_COMPLEX,*this); } else if( (aMatchString.indexOf ( WILDCARD ) == aMatchString.lastIndexOf ( WILDCARD ) ) ) - { // One occurance of '%' matches... + { // One occurrence of '%' matches... if ( aMatchString.indexOf ( WILDCARD ) == 0 ) pResult = createTest( aColumnName, E_BOOK_QUERY_ENDS_WITH, aMatchString.copy( 1 ) ); else if ( aMatchString.indexOf ( WILDCARD ) == aMatchString.getLength() - 1 ) @@ -477,10 +477,10 @@ rtl::OUString OCommonStatement::getTableName() OSQLParseNode::getTableComponents( pNodeForTableName, aCatalog, aSchema, aTableName,NULL); } else - OSL_ENSURE( false, "odd table layout" ); + OSL_FAIL( "odd table layout" ); } else - OSL_ENSURE( false, "unusual table layout" ); + OSL_FAIL( "unusual table layout" ); } return aTableName; } diff --git a/connectivity/source/drivers/evoab2/NTables.cxx b/connectivity/source/drivers/evoab2/NTables.cxx index a41d13db5a..a883d823a8 100644 --- a/connectivity/source/drivers/evoab2/NTables.cxx +++ b/connectivity/source/drivers/evoab2/NTables.cxx @@ -60,10 +60,10 @@ typedef connectivity::sdbcx::OCollection OCollection_TYPE; ObjectType OEvoabTables::createObject(const ::rtl::OUString& aName) { - ::rtl::OUString aSchema = ::rtl::OUString::createFromAscii("%"); + ::rtl::OUString aSchema( RTL_CONSTASCII_USTRINGPARAM( "%" )); Sequence< ::rtl::OUString > aTypes(1); - aTypes[0] = ::rtl::OUString::createFromAscii("TABLE"); + aTypes[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE")); ::rtl::OUString sEmpty; Reference< XResultSet > xResult = m_xMetaData->getTables(Any(),aSchema,aName,aTypes); diff --git a/connectivity/source/drivers/evoab2/evoab.component b/connectivity/source/drivers/evoab2/evoab.component new file mode 100755 index 0000000000..a99719388d --- /dev/null +++ b/connectivity/source/drivers/evoab2/evoab.component @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.sdbc.evoab.OEvoabDriver"> + <service name="com.sun.star.sdbc.Driver"/> + </implementation> +</component> diff --git a/connectivity/source/drivers/evoab2/evoab.xml b/connectivity/source/drivers/evoab2/evoab.xml index fbf309cbf0..fbf309cbf0 100644..100755 --- a/connectivity/source/drivers/evoab2/evoab.xml +++ b/connectivity/source/drivers/evoab2/evoab.xml diff --git a/connectivity/source/drivers/evoab2/evoab2.xcu b/connectivity/source/drivers/evoab2/evoab2.xcu index bda1fb8648..bda1fb8648 100755..100644 --- a/connectivity/source/drivers/evoab2/evoab2.xcu +++ b/connectivity/source/drivers/evoab2/evoab2.xcu diff --git a/connectivity/source/drivers/evoab2/makefile.mk b/connectivity/source/drivers/evoab2/makefile.mk index 126af90763..6f61762a0c 100644..100755 --- a/connectivity/source/drivers/evoab2/makefile.mk +++ b/connectivity/source/drivers/evoab2/makefile.mk @@ -69,7 +69,7 @@ SHL1VERSIONMAP=$(SOLARENV)/src/component.map # --- Library ----------------------------------- -#SHL1TARGET=$(TARGET)$(DLLPOSTFIX) + SHL1TARGET= $(EVOAB_TARGET)$(DLLPOSTFIX) SHL1OBJS=$(SLOFILES) SHL1STDLIBS=\ @@ -107,6 +107,15 @@ SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME= $(SHL1TARGET) .ENDIF + # --- Targets ---------------------------------- .INCLUDE : $(PRJ)$/target.pmk + +ALLTAR : $(MISC)/evoab.component + +$(MISC)/evoab.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + evoab.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt evoab.component diff --git a/connectivity/source/drivers/file/FCatalog.cxx b/connectivity/source/drivers/file/FCatalog.cxx index 5144486ac5..ad4430cb88 100644 --- a/connectivity/source/drivers/file/FCatalog.cxx +++ b/connectivity/source/drivers/file/FCatalog.cxx @@ -72,7 +72,7 @@ void OFileCatalog::refreshTables() TStringVector aVector; Sequence< ::rtl::OUString > aTypes; Reference< XResultSet > xResult = m_xMetaData->getTables(Any(), - ::rtl::OUString::createFromAscii("%"),::rtl::OUString::createFromAscii("%"),aTypes); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),aTypes); fillNames(xResult,aVector); if(m_pTables) diff --git a/connectivity/source/drivers/file/FColumns.cxx b/connectivity/source/drivers/file/FColumns.cxx index fb25c29700..ae1d119011 100644 --- a/connectivity/source/drivers/file/FColumns.cxx +++ b/connectivity/source/drivers/file/FColumns.cxx @@ -73,7 +73,7 @@ sdbcx::ObjectType OColumns::createObject(const ::rtl::OUString& _rName) sal_False, sal_False, sal_False, - m_pTable->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); + m_pTable->getConnection()->getMetaData()->supportsMixedCaseQuotedIdentifiers()); xRet = pRet; break; } diff --git a/connectivity/source/drivers/file/FConnection.cxx b/connectivity/source/drivers/file/FConnection.cxx index 4d2df42be6..a24de50729 100644 --- a/connectivity/source/drivers/file/FConnection.cxx +++ b/connectivity/source/drivers/file/FConnection.cxx @@ -178,7 +178,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV // set fields to fetch Sequence< OUString > aProps(1); OUString* pProps = aProps.getArray(); - pProps[ 0 ] = OUString::createFromAscii( "Title" ); + pProps[ 0 ] = OUString(RTL_CONSTASCII_USTRINGPARAM("Title")); try { @@ -198,7 +198,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV } else { - OSL_ENSURE(0,"OConnection::construct: ::ucbhelper::Content isn't a folde nor a document! How that?!"); + OSL_FAIL("OConnection::construct: ::ucbhelper::Content isn't a folde nor a document! How that?!"); throw SQLException(); } } @@ -405,7 +405,7 @@ Reference< XDynamicResultSet > OConnection::getDir() const Reference<XDynamicResultSet> xContent; Sequence< ::rtl::OUString > aProps(1); ::rtl::OUString* pProps = aProps.getArray(); - pProps[ 0 ] = ::rtl::OUString::createFromAscii( "Title" ); + pProps[ 0 ] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Title")); try { Reference<XContentIdentifier> xIdent = getContent()->getIdentifier(); diff --git a/connectivity/source/drivers/file/FDatabaseMetaData.cxx b/connectivity/source/drivers/file/FDatabaseMetaData.cxx index 470ad0c6fd..737e32d930 100644 --- a/connectivity/source/drivers/file/FDatabaseMetaData.cxx +++ b/connectivity/source/drivers/file/FDatabaseMetaData.cxx @@ -89,7 +89,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns( const ::rtl::OUString& /*columnNamePattern*/ ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getColumns" ); - OSL_ENSURE(0,"Should be overloaded!"); + OSL_FAIL("Should be overloaded!"); return new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eColumns ); } @@ -175,7 +175,7 @@ namespace } catch( const Exception& ) { - OSL_ENSURE( sal_False, "isCaseSensitiveParentFolder: caught an unexpected exception!" ); + OSL_FAIL( "isCaseSensitiveParentFolder: caught an unexpected exception!" ); } return nIsCS; @@ -197,7 +197,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( // check if any type is given // when no types are given then we have to return all tables e.g. TABLE - static const ::rtl::OUString aTable(::rtl::OUString::createFromAscii("TABLE")); + static const ::rtl::OUString aTable(RTL_CONSTASCII_USTRINGPARAM("TABLE")); sal_Bool bTableFound = sal_True; sal_Int32 nLength = types.getLength(); @@ -221,7 +221,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( Reference<XDynamicResultSet> xContent = m_pConnection->getDir(); Reference < XSortedDynamicResultSetFactory > xSRSFac( - m_pConnection->getDriver()->getFactory()->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.ucb.SortedDynamicResultSetFactory") ), UNO_QUERY ); + m_pConnection->getDriver()->getFactory()->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SortedDynamicResultSetFactory")) ), UNO_QUERY ); Sequence< NumberedSortingInfo > aSortInfo( 1 ); NumberedSortingInfo* pInfo = aSortInfo.getArray(); @@ -291,7 +291,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( { aName = aName.replaceAt(aName.getLength()-(aFilenameExtension.Len()+1),aFilenameExtension.Len()+1,::rtl::OUString()); sal_Unicode nChar = aName.toChar(); - if ( match(tableNamePattern,aName.getStr(),'\0') && ( !bCheckEnabled || ( bCheckEnabled && ((nChar < '0' || nChar > '9')))) ) + if ( match(tableNamePattern,aName,'\0') && ( !bCheckEnabled || ( bCheckEnabled && ((nChar < '0' || nChar > '9')))) ) { aRow.push_back(new ORowSetValueDecorator(aName)); bNewRow = sal_True; @@ -306,7 +306,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( if (!aURL.getExtension().getLength()) { sal_Unicode nChar = aURL.getBase().getStr()[0]; - if(match(tableNamePattern,aURL.getBase().getStr(),'\0') && ( !bCheckEnabled || ( bCheckEnabled && ((nChar < '0' || nChar > '9')))) ) + if(match(tableNamePattern,aURL.getBase(),'\0') && ( !bCheckEnabled || ( bCheckEnabled && ((nChar < '0' || nChar > '9')))) ) { aRow.push_back(new ORowSetValueDecorator(::rtl::OUString(aURL.getBase()))); bNewRow = sal_True; @@ -426,13 +426,13 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges( const ::rtl::OUString* pEnd = pBegin + aNames.getLength(); for(;pBegin != pEnd;++pBegin) { - if(match(tableNamePattern,pBegin->getStr(),'\0')) + if(match(tableNamePattern,*pBegin,'\0')) { static ODatabaseMetaDataResultSet::ORow aRow(8); aRow[2] = new ORowSetValueDecorator(*pBegin); aRow[6] = ODatabaseMetaDataResultSet::getSelectValue(); - aRow[7] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("NO")); + aRow[7] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NO"))); aRows.push_back(aRow); Reference< XPropertySet> xTable; @@ -551,7 +551,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLExc ::rtl::OUString ODatabaseMetaData::impl_getIdentifierQuoteString_throw( ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::impl_getIdentifierQuoteString_throw" ); - static const ::rtl::OUString sQuote = ::rtl::OUString::createFromAscii("\""); + static const ::rtl::OUString sQuote(RTL_CONSTASCII_USTRINGPARAM("\"")); return sQuote; } // ------------------------------------------------------------------------- @@ -711,7 +711,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLE { ODatabaseMetaDataResultSet::ORow aRow; aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TABLE"))); + aRow.push_back(new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE")))); aRows.push_back(aRow); } pResult->setRows(aRows); @@ -973,7 +973,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQL ::rtl::OUString SAL_CALL ODatabaseMetaData::getURL( ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "ODatabaseMetaData::getURL" ); - static const ::rtl::OUString aValue = ::rtl::OUString::createFromAscii("sdbc:file:"); + static const ::rtl::OUString aValue( RTL_CONSTASCII_USTRINGPARAM( "sdbc:file:" )); return aValue; } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/file/FDateFunctions.cxx b/connectivity/source/drivers/file/FDateFunctions.cxx index a7a1bcc4d7..ac2b26d41c 100644 --- a/connectivity/source/drivers/file/FDateFunctions.cxx +++ b/connectivity/source/drivers/file/FDateFunctions.cxx @@ -70,7 +70,7 @@ ORowSetValue OOp_DayOfWeek::operate(const ORowSetValue& lhs) const nRet = 1; break; default: - OSL_ENSURE(0,"Error in enum values for date"); + OSL_FAIL("Error in enum values for date"); } return nRet; } @@ -136,7 +136,7 @@ ORowSetValue OOp_DayName::operate(const ORowSetValue& lhs) const sRet = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Sunday")); break; default: - OSL_ENSURE(0,"Error in enum values for date"); + OSL_FAIL("Error in enum values for date"); } return sRet; } diff --git a/connectivity/source/drivers/file/FDriver.cxx b/connectivity/source/drivers/file/FDriver.cxx index f04bd3f489..363c29cef5 100644 --- a/connectivity/source/drivers/file/FDriver.cxx +++ b/connectivity/source/drivers/file/FDriver.cxx @@ -75,14 +75,14 @@ void OFileDriver::disposing() //------------------------------------------------------------------------------ rtl::OUString OFileDriver::getImplementationName_Static( ) throw(RuntimeException) { - return rtl::OUString::createFromAscii("com.sun.star.sdbc.driver.file.Driver"); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.driver.file.Driver")); } //------------------------------------------------------------------------------ Sequence< ::rtl::OUString > OFileDriver::getSupportedServiceNames_Static( ) throw (RuntimeException) { Sequence< ::rtl::OUString > aSNS( 2 ); - aSNS[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.Driver"); - aSNS[1] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.Driver"); + aSNS[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.Driver")); + aSNS[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.Driver")); return aSNS; } @@ -129,7 +129,7 @@ sal_Bool SAL_CALL OFileDriver::acceptsURL( const ::rtl::OUString& url ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileDriver::acceptsURL" ); - return (!url.compareTo(::rtl::OUString::createFromAscii("sdbc:file:"),10)); + return (!url.compareTo(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:file:")),10)); } // -------------------------------------------------------------------------------- Sequence< DriverPropertyInfo > SAL_CALL OFileDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/file/FNoException.cxx b/connectivity/source/drivers/file/FNoException.cxx index e092fb5ce8..93e7cb4b2a 100644 --- a/connectivity/source/drivers/file/FNoException.cxx +++ b/connectivity/source/drivers/file/FNoException.cxx @@ -89,28 +89,28 @@ void OPreparedStatement::scanParameter(OSQLParseNode* pParseNode,::std::vector< RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::scanParameter" ); DBG_ASSERT(pParseNode != NULL,"OResultSet: interner Fehler: ungueltiger ParseNode"); - // Parameter Name-Regel gefunden? + // found parameter Name-Rule? if (SQL_ISRULE(pParseNode,parameter)) { DBG_ASSERT(pParseNode->count() >= 1,"OResultSet: Parse Tree fehlerhaft"); DBG_ASSERT(pParseNode->getChild(0)->getNodeType() == SQL_NODE_PUNCTUATION,"OResultSet: Parse Tree fehlerhaft"); _rParaNodes.push_back(pParseNode); - // Weiterer Abstieg nicht erforderlich + // Further descend not nessesary return; } - // Weiter absteigen im Parse Tree - for (UINT32 i = 0; i < pParseNode->count(); i++) + // Further descend in Parse Tree + for (sal_uInt32 i = 0; i < pParseNode->count(); i++) scanParameter(pParseNode->getChild(i),_rParaNodes); } // ----------------------------------------------------------------------------- OKeyValue* OResultSet::GetOrderbyKeyValue(OValueRefRow& _rRow) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::GetOrderbyKeyValue" ); - UINT32 nBookmarkValue = Abs((sal_Int32)(_rRow->get())[0]->getValue()); + sal_uInt32 nBookmarkValue = Abs((sal_Int32)(_rRow->get())[0]->getValue()); - OKeyValue* pKeyValue = OKeyValue::createKeyValue((UINT32)nBookmarkValue); + OKeyValue* pKeyValue = OKeyValue::createKeyValue((sal_uInt32)nBookmarkValue); ::std::vector<sal_Int32>::iterator aIter = m_aOrderbyColumnNumber.begin(); for (;aIter != m_aOrderbyColumnNumber.end(); ++aIter) @@ -123,11 +123,4 @@ OKeyValue* OResultSet::GetOrderbyKeyValue(OValueRefRow& _rRow) } // ----------------------------------------------------------------------------- - - - - - - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/file/FPreparedStatement.cxx b/connectivity/source/drivers/file/FPreparedStatement.cxx index 700a8b9a69..9b797fb483 100644 --- a/connectivity/source/drivers/file/FPreparedStatement.cxx +++ b/connectivity/source/drivers/file/FPreparedStatement.cxx @@ -479,7 +479,7 @@ void OPreparedStatement::setParameter(sal_Int32 parameterIndex, const ORowSetVal *((m_aParameterRow->get())[parameterIndex]) = x; } // ----------------------------------------------------------------------------- -UINT32 OPreparedStatement::AddParameter(OSQLParseNode * pParameter, const Reference<XPropertySet>& _xCol) +sal_uInt32 OPreparedStatement::AddParameter(OSQLParseNode * pParameter, const Reference<XPropertySet>& _xCol) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OPreparedStatement::AddParameter" ); OSL_UNUSED( pParameter ); @@ -491,17 +491,17 @@ UINT32 OPreparedStatement::AddParameter(OSQLParseNode * pParameter, const Refere #endif ::rtl::OUString sParameterName; - // Parameter-Column aufsetzen: + // set up Parameter-Column: sal_Int32 eType = DataType::VARCHAR; - UINT32 nPrecision = 255; + sal_uInt32 nPrecision = 255; sal_Int32 nScale = 0; sal_Int32 nNullable = ColumnValue::NULLABLE; if (_xCol.is()) { - // Typ, Precision, Scale ... der angegebenen Column verwenden, - // denn dieser Column wird der Wert zugewiesen bzw. mit dieser - // Column wird der Wert verglichen. + // Use type, precision, scale ... from the given column, + // because this Column will get a value assigned or + // with this Column the value will be compared. _xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)) >>= eType; _xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION)) >>= nPrecision; _xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE)) >>= nScale; @@ -573,23 +573,22 @@ void OPreparedStatement::initializeResultSet(OResultSet* _pResult) m_pResultSet->setParameterColumns(m_xParamColumns); m_pResultSet->setParameterRow(m_aParameterRow); - // Parameter substituieren (AssignValues und Kriterien): + // Substitute parameter (AssignValues and criteria): if (!m_xParamColumns->get().empty()) { - // Zunaechst AssignValues - USHORT nParaCount=0; // gibt die aktuelle Anzahl der bisher gesetzen Parameter an + // begin with AssignValues + sal_uInt16 nParaCount=0; // gives the current number of previously set Parameters - // Nach zu substituierenden Parametern suchen: - size_t nCount = m_aAssignValues.is() ? m_aAssignValues->get().size() : 1; // 1 ist wichtig fuer die Kriterien + // search for parameters to be substituted: + size_t nCount = m_aAssignValues.is() ? m_aAssignValues->get().size() : 1; // 1 is important for the Criteria for (size_t j = 1; j < nCount; j++) { - UINT32 nParameter = (*m_aAssignValues).getParameterIndex(j); + sal_uInt32 nParameter = (*m_aAssignValues).getParameterIndex(j); if (nParameter == SQL_NO_PARAMETER) - continue; // dieser AssignValue ist kein Parameter + continue; // this AssignValue is no Parameter - ++nParaCount; // ab hier ist der Parameter gueltig - // Parameter ersetzen. Wenn Parameter nicht verfuegbar, - // Value auf NULL setzen. + ++nParaCount; // now the Parameter is valid + // Replace Parameter. If the Parameter isn't available, set value to NULL // (*m_aAssignValues)[j] = (*m_aParameterRow)[(UINT16)nParameter]; } @@ -627,8 +626,8 @@ void OPreparedStatement::parseParamterElem(const String& _sColumnName,OSQLParseN } if(nParameter == -1) nParameter = AddParameter(pRow_Value_Constructor_Elem,xCol); - // Nr. des Parameters in der Variablen merken: - SetAssignValue(_sColumnName, String(), TRUE, nParameter); + // Save number of parameter in the variable: + SetAssignValue(_sColumnName, String(), sal_True, nParameter); } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx index 72736cf0b8..71d2f3ecf7 100644 --- a/connectivity/source/drivers/file/FResultSet.cxx +++ b/connectivity/source/drivers/file/FResultSet.cxx @@ -75,13 +75,8 @@ using namespace com::sun::star::sdbc; using namespace com::sun::star::sdbcx; using namespace com::sun::star::container; -// Maximale Anzahl von Rows, die mit ORDER BY sortiert durchlaufen werden koennen: -#if defined (WIN) -#define MAX_KEYSET_SIZE 0x3ff0 // Etwas weniger als ein Segment, damit - // noch Platz fuer Memory Debug-Informationen -#else +// Maximal number of Rows, that can be processed being sorted with ORDER BY: #define MAX_KEYSET_SIZE 0x40000 // 256K -#endif namespace { @@ -144,7 +139,7 @@ OResultSet::OResultSet(OStatement_Base* pStmt,OSQLParseTreeIterator& _aSQLIterat m_nResultSetConcurrency = isCount() ? ResultSetConcurrency::READ_ONLY : ResultSetConcurrency::UPDATABLE; construct(); - m_aSkipDeletedSet.SetDeleted(m_bShowDeleted); + m_aSkipDeletedSet.SetDeletedVisible(m_bShowDeleted); osl_decrementInterlockedCount( &m_refCount ); } @@ -246,7 +241,6 @@ const ORowSetValue& OResultSet::getValue(sal_Int32 columnIndex ) throw(::com::su ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - //columnIndex = mapColumn(columnIndex); checkIndex(columnIndex ); @@ -258,8 +252,7 @@ void OResultSet::checkIndex(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc { //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::checkIndex" ); if ( columnIndex <= 0 - // || columnIndex > (sal_Int32)m_xColumns->size() - || columnIndex >= m_nColumnCount ) + || columnIndex >= m_nColumnCount ) ::dbtools::throwInvalidIndexException(*this); } // ------------------------------------------------------------------------- @@ -651,7 +644,7 @@ void SAL_CALL OResultSet::insertRow( ) throw(SQLException, RuntimeException) // we know that we append new rows at the end // so we have to know where the end is m_aSkipDeletedSet.skipDeleted(IResultSetHelper::LAST,1,sal_False); - m_bRowInserted = m_pTable->InsertRow(*m_aInsertRow, TRUE, m_xColsIdx); + m_bRowInserted = m_pTable->InsertRow(*m_aInsertRow, sal_True, m_xColsIdx); if(m_bRowInserted && m_pFileSet.is()) { sal_Int32 nPos = (m_aInsertRow->get())[0]->getValue(); @@ -907,20 +900,20 @@ IPropertyArrayHelper & OResultSet::getInfoHelper() } //------------------------------------------------------------------ -BOOL OResultSet::ExecuteRow(IResultSetHelper::Movement eFirstCursorPosition, - INT32 nFirstOffset, - BOOL bEvaluate, - BOOL bRetrieveData) +sal_Bool OResultSet::ExecuteRow(IResultSetHelper::Movement eFirstCursorPosition, + sal_Int32 nFirstOffset, + sal_Bool bEvaluate, + sal_Bool bRetrieveData) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::ExecuteRow" ); OSL_ENSURE(m_pSQLAnalyzer,"OResultSet::ExecuteRow: Analyzer isn't set!"); - // Fuer weitere Fetch-Operationen werden diese Angaben ggf. veraendert ... + // For further Fetch-Operations this information may possibly be changed ... IResultSetHelper::Movement eCursorPosition = eFirstCursorPosition; - INT32 nOffset = nFirstOffset; + sal_Int32 nOffset = nFirstOffset; const OSQLColumns & rTableCols = *(m_pTable->getTableColumns()); - BOOL bHasRestriction = m_pSQLAnalyzer->hasRestriction(); + sal_Bool bHasRestriction = m_pSQLAnalyzer->hasRestriction(); again: // protect from reading over the end when someboby is inserting while we are reading @@ -935,7 +928,7 @@ again: return sal_False; } - if (!bEvaluate) // Laeuft keine Auswertung, dann nur Ergebniszeile fuellen + if (!bEvaluate) // If no evaluation runs, then just fill the results-row { m_pTable->fetchRow(m_aRow,rTableCols, sal_True,bRetrieveData); } @@ -943,11 +936,15 @@ again: { m_pTable->fetchRow(m_aEvaluateRow, rTableCols, sal_True,bRetrieveData || bHasRestriction); - if ( (!m_bShowDeleted && m_aEvaluateRow->isDeleted()) - || (bHasRestriction && //!bShowDeleted && m_aEvaluateRow->isDeleted() ||// keine Anzeige von geloeschten Saetzen - !m_pSQLAnalyzer->evaluateRestriction())) // Auswerten der Bedingungen - { // naechsten Satz auswerten - // aktuelle Zeile loeschen im Keyset + if ( ( !m_bShowDeleted + && m_aEvaluateRow->isDeleted() + ) + || ( bHasRestriction + && !m_pSQLAnalyzer->evaluateRestriction() + ) + ) + { // Evaluate the next record + // delete current row in Keyset if (m_pEvaluationKeySet) { ++m_aEvaluateIter; @@ -960,8 +957,7 @@ again: } else if (m_pFileSet.is()) { - OSL_ENSURE(//!m_pFileSet->IsFrozen() && - eCursorPosition == IResultSetHelper::NEXT, "Falsche CursorPosition!"); + OSL_ENSURE(eCursorPosition == IResultSetHelper::NEXT, "Falsche CursorPosition!"); eCursorPosition = IResultSetHelper::NEXT; nOffset = 1; } @@ -984,27 +980,27 @@ again: } else { - // aStatus.Set(SQL_STAT_NO_DATA_FOUND); return sal_False; } - // Nochmal probieren ... + // Try again ... goto again; } } - // Evaluate darf nur gesetzt sein, - // wenn der Keyset weiter aufgebaut werden soll - if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT && !isCount() && - (m_pFileSet.is() || m_pSortIndex) && bEvaluate) + // Evaluate may only be set, + // if the Keyset will be constructed further + if ( ( m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT ) + && !isCount() + && bEvaluate + ) { if (m_pSortIndex) { - OKeyValue* pKeyValue = GetOrderbyKeyValue(m_aEvaluateRow); + OKeyValue* pKeyValue = GetOrderbyKeyValue( m_aSelectRow ); m_pSortIndex->AddKeyValue(pKeyValue); } else if (m_pFileSet.is()) { - // OSL_ENSURE(!m_pFileSet->IsFrozen() , "Falsche CursorPosition!"); sal_uInt32 nBookmarkValue = Abs((sal_Int32)(m_aEvaluateRow->get())[0]->getValue()); m_pFileSet->get().push_back(nBookmarkValue); } @@ -1014,13 +1010,13 @@ again: sal_Bool bOK = sal_True; if (bEvaluate) { - // jetzt die eigentliche Ergebniszeile Lesen - bOK = m_pTable->fetchRow(m_aEvaluateRow, *(m_pTable->getTableColumns()), sal_True,TRUE); + // read the actual result-row + bOK = m_pTable->fetchRow(m_aEvaluateRow, *(m_pTable->getTableColumns()), sal_True,sal_True); } if (bOK) { - // Nur die zu aendernden Werte uebergeben: + // just give the values to be changed: if(!m_pTable->UpdateRow(*m_aAssignValues,m_aEvaluateRow, m_xColsIdx)) return sal_False; } @@ -1030,7 +1026,7 @@ again: sal_Bool bOK = sal_True; if (bEvaluate) { - bOK = m_pTable->fetchRow(m_aEvaluateRow, *(m_pTable->getTableColumns()), sal_True,TRUE); + bOK = m_pTable->fetchRow(m_aEvaluateRow, *(m_pTable->getTableColumns()), sal_True,sal_True); } if (bOK) { @@ -1042,21 +1038,21 @@ again: } //------------------------------------------------------------------- -BOOL OResultSet::Move(IResultSetHelper::Movement eCursorPosition, INT32 nOffset, BOOL bRetrieveData) +sal_Bool OResultSet::Move(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Bool bRetrieveData) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::Move" ); //IgnoreDeletedRows: // - INT32 nTempPos = m_nRowPos; + sal_Int32 nTempPos = m_nRowPos; if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT && !isCount()) { - if (!m_pFileSet.is()) // kein Index verfuegbar + if (!m_pFileSet.is()) //no Index available { - // Normales FETCH - ExecuteRow(eCursorPosition,nOffset,FALSE,bRetrieveData); + // Normal FETCH + ExecuteRow(eCursorPosition,nOffset,sal_False,bRetrieveData); // now set the bookmark for outside this is the logical pos and not the file pos *(*m_aRow->get().begin()) = sal_Int32(m_nRowPos + 1); @@ -1076,7 +1072,6 @@ BOOL OResultSet::Move(IResultSetHelper::Movement eCursorPosition, INT32 nOffset, m_nRowPos = 0; break; case IResultSetHelper::LAST: - // OSL_ENSURE(IsRowCountFinal(), "Fehler im Keyset!"); // muss eingefroren sein, sonst Fehler beim SQLCursor m_nRowPos = m_pFileSet->get().size() - 1; break; case IResultSetHelper::RELATIVE: @@ -1091,20 +1086,19 @@ BOOL OResultSet::Move(IResultSetHelper::Movement eCursorPosition, INT32 nOffset, } // OffRange? - // Der FileCursor ist ausserhalb des gueltigen Bereichs, wenn + // The FileCursor is outside of the valid range, if: // a.) m_nRowPos < 1 - // b.) Ein KeySet besteht und m_nRowPos > m_pFileSet->size() - if (m_nRowPos < 0 || (m_pFileSet->isFrozen() && eCursorPosition != IResultSetHelper::BOOKMARK && m_nRowPos >= (INT32)m_pFileSet->get().size() )) // && m_pFileSet->IsFrozen() + // b.) a KeySet exists and m_nRowPos > m_pFileSet->size() + if (m_nRowPos < 0 || (m_pFileSet->isFrozen() && eCursorPosition != IResultSetHelper::BOOKMARK && m_nRowPos >= (sal_Int32)m_pFileSet->get().size() )) // && m_pFileSet->IsFrozen() { - // aStatus.Set(SQL_STAT_NO_DATA_FOUND); goto Error; } else { - if (m_nRowPos < (INT32)m_pFileSet->get().size()) + if (m_nRowPos < (sal_Int32)m_pFileSet->get().size()) { - // Fetch ueber Index - ExecuteRow(IResultSetHelper::BOOKMARK,(m_pFileSet->get())[m_nRowPos],FALSE,bRetrieveData); + // Fetch via Index + ExecuteRow(IResultSetHelper::BOOKMARK,(m_pFileSet->get())[m_nRowPos],sal_False,bRetrieveData); // now set the bookmark for outside *(*m_aRow->get().begin()) = sal_Int32(m_nRowPos + 1); @@ -1113,42 +1107,40 @@ BOOL OResultSet::Move(IResultSetHelper::Movement eCursorPosition, INT32 nOffset, m_pSQLAnalyzer->setSelectionEvaluationResult(m_aSelectRow,m_aColMapping); } } - else // Index muss weiter aufgebaut werden + else // Index must be further constructed { - // Zunaechst auf die letzte bekannte Zeile setzen + // set first on the last known row if (!m_pFileSet->get().empty()) { m_aFileSetIter = m_pFileSet->get().end()-1; - // m_pFileSet->SeekPos(m_pFileSet->size()-1); m_pTable->seekRow(IResultSetHelper::BOOKMARK, *m_aFileSetIter, m_nFilePos); } sal_Bool bOK = sal_True; - // Ermitteln der Anzahl weiterer Fetches - while (bOK && m_nRowPos >= (INT32)m_pFileSet->get().size()) + // Determine the number of further Fetches + while (bOK && m_nRowPos >= (sal_Int32)m_pFileSet->get().size()) { if (m_pEvaluationKeySet) { - if (m_nRowPos >= (INT32)m_pEvaluationKeySet->size()) + if (m_nRowPos >= (sal_Int32)m_pEvaluationKeySet->size()) return sal_False; - // aStatus.Set(SQL_STAT_NO_DATA_FOUND); else if (m_nRowPos == 0) { m_aEvaluateIter = m_pEvaluationKeySet->begin(); - bOK = ExecuteRow(IResultSetHelper::BOOKMARK,*m_aEvaluateIter,TRUE, bRetrieveData); + bOK = ExecuteRow(IResultSetHelper::BOOKMARK,*m_aEvaluateIter,sal_True, bRetrieveData); } else { ++m_aEvaluateIter; - bOK = ExecuteRow(IResultSetHelper::BOOKMARK,*m_aEvaluateIter,TRUE, bRetrieveData); + bOK = ExecuteRow(IResultSetHelper::BOOKMARK,*m_aEvaluateIter,sal_True, bRetrieveData); } } else - bOK = ExecuteRow(IResultSetHelper::NEXT,1,TRUE, FALSE);//bRetrieveData); + bOK = ExecuteRow(IResultSetHelper::NEXT,1,sal_True, sal_False);//bRetrieveData); } if (bOK) { - // jetzt nochmal die Ergebnisse lesen + // read the results again m_pTable->fetchRow(m_aRow, *(m_pTable->getTableColumns()), sal_True,bRetrieveData); // now set the bookmark for outside @@ -1159,14 +1151,10 @@ BOOL OResultSet::Move(IResultSetHelper::Movement eCursorPosition, INT32 nOffset, m_pSQLAnalyzer->setSelectionEvaluationResult(m_aSelectRow,m_aColMapping); } } - else if (!m_pFileSet->isFrozen()) // keinen gueltigen Satz gefunden + else if (!m_pFileSet->isFrozen()) // no valid record found { - //m_pFileSet->Freeze(); m_pFileSet->setFrozen(); - - // DELETEZ(m_pEvaluationKeySet); m_pEvaluationKeySet = NULL; - // aStatus.Set(SQL_STAT_NO_DATA_FOUND); goto Error; } } @@ -1175,7 +1163,7 @@ BOOL OResultSet::Move(IResultSetHelper::Movement eCursorPosition, INT32 nOffset, } else if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT && isCount()) { - // Fetch des COUNT(*) + // Fetch the COUNT(*) switch (eCursorPosition) { case IResultSetHelper::NEXT: @@ -1203,8 +1191,8 @@ BOOL OResultSet::Move(IResultSetHelper::Movement eCursorPosition, INT32 nOffset, goto Error; else if (m_nRowPos == 0) { - // COUNT(*) in Ergebnisrow packen - // (muss die erste und einzige Variable in der Row sein) + // put COUNT(*) in result-row + // (must be the first and only variable in the row) if (m_aRow->get().size() >= 2) { *(m_aRow->get())[1] = m_nRowCountResult; @@ -1221,14 +1209,14 @@ BOOL OResultSet::Move(IResultSetHelper::Movement eCursorPosition, INT32 nOffset, } } else - // Fetch nur bei SELECT moeglich! + // Fetch only possible at SELECT! return sal_False; return sal_True; Error: - // steht der Cursor vor dem ersten Satz - // dann wird die position beibehalten + // is the Cursor positioned before the first row + // then the position will be maintained if (nTempPos == -1) m_nRowPos = nTempPos; else @@ -1249,12 +1237,9 @@ Error: m_nRowPos = -1; break; case IResultSetHelper::BOOKMARK: - m_nRowPos = nTempPos; // vorherige Position + m_nRowPos = nTempPos; // last Position } } - // delete pGuard; - // rMode = (!bShowDeleted && aStatus.IsSuccessful() && m_aRow->isDeleted()) ? // keine Anzeige von geloeschten Saetzen - // OCursor::SQL_MOD_INVALID : OCursor::SQL_MOD_NONE; return sal_False; } // ------------------------------------------------------------------------- @@ -1263,11 +1248,11 @@ void OResultSet::sortRows() RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::sortRows" ); if (!m_pSQLAnalyzer->hasRestriction() && m_aOrderbyColumnNumber.size() == 1) { - // Ist nur ein Feld fuer die Sortierung angegeben - // Und diese Feld ist indiziert, dann den Index ausnutzen + // is just one field given for sorting + // and this field is indexed, then the Index will be used Reference<XIndexesSupplier> xIndexSup; m_pTable->queryInterface(::getCppuType((const Reference<XIndexesSupplier>*)0)) >>= xIndexSup; - // Reference<XIndexesSupplier> xIndexSup(m_pTable,UNO_QUERY); + Reference<XIndexAccess> xIndexes; if(xIndexSup.is()) { @@ -1298,8 +1283,8 @@ void OResultSet::sortRows() ::std::vector<sal_Int32>::iterator aOrderByIter = m_aOrderbyColumnNumber.begin(); for (::std::vector<sal_Int16>::size_type i=0;aOrderByIter != m_aOrderbyColumnNumber.end(); ++aOrderByIter,++i) { - OSL_ENSURE((sal_Int32)m_aRow->get().size() > *aOrderByIter,"Invalid Index"); - switch ((*(m_aRow->get().begin()+*aOrderByIter))->getValue().getTypeKind()) + OSL_ENSURE((sal_Int32)m_aSelectRow->get().size() > *aOrderByIter,"Invalid Index"); + switch ((*(m_aSelectRow->get().begin()+*aOrderByIter))->getValue().getTypeKind()) { case DataType::CHAR: case DataType::VARCHAR: @@ -1322,13 +1307,13 @@ void OResultSet::sortRows() eKeyType[i] = SQL_ORDERBYKEY_DOUBLE; break; - // Andere Typen sind nicht implementiert (und damit immer FALSE) + // Other types aren't implemented (so they are always FALSE) default: eKeyType[i] = SQL_ORDERBYKEY_NONE; - OSL_ASSERT("OFILECursor::Execute: Datentyp nicht implementiert"); + OSL_FAIL("OFILECursor::Execute: Datentyp nicht implementiert"); break; } - (m_aEvaluateRow->get())[*aOrderByIter]->setBound(sal_True); + (m_aSelectRow->get())[*aOrderByIter]->setBound(sal_True); } m_pSortIndex = new OSortIndex(eKeyType,m_aOrderbyAscending); @@ -1339,31 +1324,33 @@ void OResultSet::sortRows() while (m_aEvaluateIter != m_pEvaluationKeySet->end()) { - ExecuteRow(IResultSetHelper::BOOKMARK,(*m_aEvaluateIter),TRUE); + ExecuteRow(IResultSetHelper::BOOKMARK,(*m_aEvaluateIter),sal_True); ++m_aEvaluateIter; } } else { - while (ExecuteRow(IResultSetHelper::NEXT,1,TRUE)) + while ( ExecuteRow( IResultSetHelper::NEXT, 1, sal_False, sal_True ) ) { + m_aSelectRow->get()[0]->setValue( m_aRow->get()[0]->getValue() ); + if ( m_pSQLAnalyzer->hasFunctions() ) + m_pSQLAnalyzer->setSelectionEvaluationResult( m_aSelectRow, m_aColMapping ); + const sal_Int32 nBookmark = (*m_aRow->get().begin())->getValue(); + ExecuteRow( IResultSetHelper::BOOKMARK, nBookmark, sal_True, sal_False ); } } - // Sortiertes Keyset erzeugen - // DELETEZ(m_pEvaluationKeySet); + // create sorted Keyset m_pEvaluationKeySet = NULL; m_pFileSet = NULL; m_pFileSet = m_pSortIndex->CreateKeySet(); - // if(!bDistinct) - // SetRowCount(pFileSet->count()); DELETEZ(m_pSortIndex); - // Nun kann ueber den Index sortiert zugegriffen werden. + // now access to a sorted set is possible via Index } // ------------------------------------------------------------------------- -BOOL OResultSet::OpenImpl() +sal_Bool OResultSet::OpenImpl() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::OpenImpl" ); OSL_ENSURE(m_pSQLAnalyzer,"No analyzer set with setSqlAnalyzer!"); @@ -1398,11 +1385,10 @@ BOOL OResultSet::OpenImpl() m_nResultSetConcurrency = (m_pTable->isReadOnly() || isCount()) ? ResultSetConcurrency::READ_ONLY : ResultSetConcurrency::UPDATABLE; - // Neuen Index aufbauen: + // create new Index: m_pFileSet = NULL; - // DELETEZ(m_pEvaluationKeySet); - // An den Anfang positionieren + // position at the beginning m_nRowPos = -1; m_nFilePos = 0; m_nRowCountResult = -1; @@ -1419,8 +1405,8 @@ BOOL OResultSet::OpenImpl() lcl_throwError(STR_QUERY_COMPLEX_COUNT,*this); m_nRowCountResult = 0; - // Vorlaeufig einfach ueber alle Datensaetze iterieren und - // dabei die Aktionen bearbeiten (bzw. einfach nur zaehlen): + // for now simply iterate over all rows and + // do all actions (or just count) { sal_Bool bOK = sal_True; if (m_pEvaluationKeySet) @@ -1432,9 +1418,9 @@ BOOL OResultSet::OpenImpl() while (bOK) { if (m_pEvaluationKeySet) - ExecuteRow(IResultSetHelper::BOOKMARK,(*m_aEvaluateIter),TRUE); + ExecuteRow(IResultSetHelper::BOOKMARK,(*m_aEvaluateIter),sal_True); else - bOK = ExecuteRow(IResultSetHelper::NEXT,1,TRUE); + bOK = ExecuteRow(IResultSetHelper::NEXT,1,sal_True); if (bOK) { @@ -1447,17 +1433,15 @@ BOOL OResultSet::OpenImpl() } } - // Ergebnis von COUNT(*) in m_nRowCountResult merken. - // nRowCount, also die Anzahl der Rows in der Ergebnismenge, ist bei dieser - // Anfrage = 1! + // save result of COUNT(*) in m_nRowCountResult. + // nRowCount (number of Rows in the result) = 1 for this request! m_pEvaluationKeySet = NULL; - // DELETEZ(m_pEvaluationKeySet); } } else { - BOOL bDistinct = FALSE; - BOOL bWasSorted = FALSE; + sal_Bool bDistinct = sal_False; + sal_Bool bWasSorted = sal_False; OSQLParseNode *pDistinct = m_pParseTree->getChild(1); ::std::vector<sal_Int32> aOrderbyColumnNumberSave; ::std::vector<TAscendingOrder> aOrderbyAscendingSave; @@ -1467,18 +1451,17 @@ BOOL OResultSet::OpenImpl() // Sort on all columns, saving original order for later if(IsSorted()) { - aOrderbyColumnNumberSave = m_aOrderbyColumnNumber;// .assign(m_aOrderbyColumnNumber.begin(), m_aOrderbyColumnNumber.end()); + aOrderbyColumnNumberSave = m_aOrderbyColumnNumber; m_aOrderbyColumnNumber.clear(); aOrderbyAscendingSave.assign(m_aOrderbyAscending.begin(), m_aOrderbyAscending.end()); - bWasSorted = TRUE; + bWasSorted = sal_True; } // the first column is the bookmark column ::std::vector<sal_Int32>::iterator aColStart = (m_aColMapping.begin()+1); ::std::copy(aColStart, m_aColMapping.end(),::std::back_inserter(m_aOrderbyColumnNumber)); -// m_aOrderbyColumnNumber.assign(aColStart, m_aColMapping.end()); m_aOrderbyAscending.assign(m_aColMapping.size()-1, SQL_ASC); - bDistinct = TRUE; + bDistinct = sal_True; } if (IsSorted()) @@ -1489,9 +1472,8 @@ BOOL OResultSet::OpenImpl() m_pFileSet = new OKeySet(); if (!m_pSQLAnalyzer->hasRestriction()) - // jetzt kann das Keyset schon gefuellt werden! - // Aber Achtung: es wird davon ausgegangen, das die FilePositionen als Folge 1..n - // abgelegt werden! + // now the Keyset can be filled! + // But be careful: It is assumed, that the FilePositions will be stored as sequence 1..n { if ( m_nLastVisitedPos > 0) m_pFileSet->get().reserve( m_nLastVisitedPos ); @@ -1501,7 +1483,7 @@ BOOL OResultSet::OpenImpl() } OSL_ENSURE(m_pFileSet.is(),"Kein KeySet vorhanden! :-("); - if(bDistinct && m_pFileSet.is()) // sicher ist sicher + if(bDistinct && m_pFileSet.is()) { OValueRow aSearchRow = new OValueVector(m_aRow->get().size()); OValueRefVector::Vector::iterator aRowIter = m_aRow->get().begin(); @@ -1516,15 +1498,15 @@ BOOL OResultSet::OpenImpl() if (nMaxRow) { #if OSL_DEBUG_LEVEL > 1 - INT32 nFound=0; + sal_Int32 nFound=0; #endif - INT32 nPos; - INT32 nKey; + sal_Int32 nPos; + sal_Int32 nKey; for( size_t j = nMaxRow-1; j > 0; --j) { nPos = (m_pFileSet->get())[j]; - ExecuteRow(IResultSetHelper::BOOKMARK,nPos,FALSE); + ExecuteRow(IResultSetHelper::BOOKMARK,nPos,sal_False); m_pSQLAnalyzer->setSelectionEvaluationResult(m_aSelectRow,m_aColMapping); { // copy row values OValueRefVector::Vector::iterator copyFrom = m_aSelectRow->get().begin(); @@ -1533,12 +1515,11 @@ BOOL OResultSet::OpenImpl() copyFrom != m_aSelectRow->get().end(); ++copyFrom,++copyTo) *copyTo = *(*copyFrom); - // *aSearchRow = *m_aRow; } // compare with next row nKey = (m_pFileSet->get())[j-1]; - ExecuteRow(IResultSetHelper::BOOKMARK,nKey,FALSE); + ExecuteRow(IResultSetHelper::BOOKMARK,nKey,sal_False); m_pSQLAnalyzer->setSelectionEvaluationResult(m_aSelectRow,m_aColMapping); OValueRefVector::Vector::iterator loopInRow = m_aSelectRow->get().begin(); OValueVector::Vector::iterator existentInSearchRow = aSearchRow->get().begin(); @@ -1579,17 +1560,16 @@ BOOL OResultSet::OpenImpl() ::std::sort(m_pFileSet->get().begin(),m_pFileSet->get().end()); } } - // SetRowCount(m_pFileSet->count()); } } } break; case SQL_STATEMENT_UPDATE: case SQL_STATEMENT_DELETE: - // waehrend der Bearbeitung die Anzahl der bearbeiteten Rows zaehlen: + // during processing count the number of processed Rows m_nRowCountResult = 0; - // Vorlaeufig einfach ueber alle Datensaetze iterieren und - // dabei die Aktionen bearbeiten (bzw. einfach nur zaehlen): + // for now simply iterate over all rows and + // run the actions (or simply count): { sal_Bool bOK = sal_True; @@ -1602,9 +1582,9 @@ BOOL OResultSet::OpenImpl() while (bOK) { if (m_pEvaluationKeySet) - ExecuteRow(IResultSetHelper::BOOKMARK,(*m_aEvaluateIter),TRUE); + ExecuteRow(IResultSetHelper::BOOKMARK,(*m_aEvaluateIter),sal_True); else - bOK = ExecuteRow(IResultSetHelper::NEXT,1,TRUE); + bOK = ExecuteRow(IResultSetHelper::NEXT,1,sal_True); if (bOK) { @@ -1617,19 +1597,16 @@ BOOL OResultSet::OpenImpl() } } - // Ergebnis von COUNT(*) in nRowCountResult merken. - // nRowCount, also die Anzahl der Rows in der Ergebnismenge, ist bei dieser - // Anfrage = 1! - // DELETEZ(m_pEvaluationKeySet); + // save result of COUNT(*) in nRowCountResult. + // nRowCount (number of rows in the result-set) = 1 for this request! m_pEvaluationKeySet = NULL; } - // SetRowCount(1); break; case SQL_STATEMENT_INSERT: m_nRowCountResult = 0; OSL_ENSURE(m_aAssignValues.is(),"No assign values set!"); - if(!m_pTable->InsertRow(*m_aAssignValues, TRUE,m_xColsIdx)) + if(!m_pTable->InsertRow(*m_aAssignValues, sal_True,m_xColsIdx)) { m_nFilePos = 0; return sal_False; @@ -1638,11 +1615,11 @@ BOOL OResultSet::OpenImpl() m_nRowCountResult = 1; break; default: - OSL_ENSURE( false, "OResultSet::OpenImpl: unsupported statement type!" ); + OSL_FAIL( "OResultSet::OpenImpl: unsupported statement type!" ); break; } - // FilePos zuruecksetzen + // reset FilePos m_nFilePos = 0; return sal_True; @@ -1683,7 +1660,7 @@ void OResultSet::setBoundedColumns(const OValueRefRow& _rRow, ::std::vector<sal_Int32>& _rColMapping) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::setBoundedColumns" ); - ::comphelper::UStringMixEqual aCase(_xMetaData->storesMixedCaseQuotedIdentifiers()); + ::comphelper::UStringMixEqual aCase(_xMetaData->supportsMixedCaseQuotedIdentifiers()); Reference<XPropertySet> xTableColumn; ::rtl::OUString sTableColumnName, sSelectColumnRealName; @@ -1748,7 +1725,7 @@ void OResultSet::setBoundedColumns(const OValueRefRow& _rRow, } catch (Exception&) { - OSL_ENSURE(sal_False, "OResultSet::setBoundedColumns: caught an Exception!"); + OSL_FAIL("OResultSet::setBoundedColumns: caught an Exception!"); } } // in this case we got more select columns as columns exist in the table @@ -1884,7 +1861,6 @@ sal_Bool OResultSet::isRowDeleted() const void SAL_CALL OResultSet::disposing( const EventObject& Source ) throw (RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OResultSet::disposing" ); - // Reference<XInterface> xInt = m_pTable; Reference<XPropertySet> xProp = m_pTable; if(m_pTable && Source.Source == xProp) { diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx index 1ccb031bba..78232769c2 100644 --- a/connectivity/source/drivers/file/FStatement.cxx +++ b/connectivity/source/drivers/file/FStatement.cxx @@ -430,41 +430,24 @@ void OStatement_Base::setOrderbyColumn( OSQLParseNode* pColumnRef, aColumnName = pColumnRef->getChild(0)->getTokenValue(); else if (pColumnRef->count() == 3) { - // Nur die Table Range-Variable darf hier vorkommen: -// if (!(pColumnRef->getChild(0)->getTokenValue() == aTableRange)) -// { -// aStatus.Set(SQL_STAT_ERROR, -// String::CreateFromAscii("S1000"), -// aStatus.CreateErrorMessage(String(SdbResId(STR_STAT_INVALID_RANGE_VAR))), -// 0, String() ); - // return; - // } pColumnRef->getChild(2)->parseNodeToStr( aColumnName, getOwnConnection(), NULL, sal_False, sal_False ); } else { - // aStatus.SetStatementTooComplex(); throw SQLException(); } Reference<XColumnLocate> xColLocate(m_xColNames,UNO_QUERY); if(!xColLocate.is()) return; - // Alles geprueft und wir haben den Namen der Column. - // Die wievielte Column ist das? - try - { - m_aOrderbyColumnNumber.push_back(xColLocate->findColumn(aColumnName)); - } - catch(Exception) - { - ::rtl::Reference<OSQLColumns> aSelectColumns = m_aSQLIterator.getSelectColumns(); - ::comphelper::UStringMixEqual aCase; - OSQLColumns::Vector::const_iterator aFind = ::connectivity::find(aSelectColumns->get().begin(),aSelectColumns->get().end(),aColumnName,aCase); - if ( aFind == aSelectColumns->get().end() ) - throw SQLException(); - m_aOrderbyColumnNumber.push_back((aFind - aSelectColumns->get().begin()) + 1); - } + // Everything tested and we have the name of the Column. + // What number is the Column? + ::rtl::Reference<OSQLColumns> aSelectColumns = m_aSQLIterator.getSelectColumns(); + ::comphelper::UStringMixEqual aCase; + OSQLColumns::Vector::const_iterator aFind = ::connectivity::find(aSelectColumns->get().begin(),aSelectColumns->get().end(),aColumnName,aCase); + if ( aFind == aSelectColumns->get().end() ) + throw SQLException(); + m_aOrderbyColumnNumber.push_back((aFind - aSelectColumns->get().begin()) + 1); // Ascending or Descending? m_aOrderbyAscending.push_back((SQL_ISTOKEN(pAscendingDescending,DESC)) ? SQL_DESC : SQL_ASC); @@ -579,7 +562,7 @@ void OStatement_Base::initializeResultSet(OResultSet* _pResult) _pResult->setSelectRow(m_aSelectRow); m_pSQLAnalyzer->bindSelectRow(m_aRow); - m_pEvaluationKeySet = m_pSQLAnalyzer->bindEvaluationRow(m_aEvaluateRow); // Werte im Code des Compilers setzen + m_pEvaluationKeySet = m_pSQLAnalyzer->bindEvaluationRow(m_aEvaluateRow); // Set values in the code of the Compiler _pResult->setEvaluationKeySet(m_pEvaluationKeySet); } // ----------------------------------------------------------------------------- @@ -593,11 +576,11 @@ void OStatement_Base::GetAssignValues() } if (SQL_ISRULE(m_pParseTree,select_statement)) - // Keine zu setzenden Werte bei SELECT + // no values have to be set for SELECT return; else if (SQL_ISRULE(m_pParseTree,insert_statement)) { - // Row fuer die zu setzenden Werte anlegen (Referenz durch new) + // Create Row for the values to be set (Reference trough new) if(m_aAssignValues.is()) m_aAssignValues->get().clear(); sal_Int32 nCount = Reference<XIndexAccess>(m_xColNames,UNO_QUERY)->getCount(); @@ -607,7 +590,7 @@ void OStatement_Base::GetAssignValues() m_aParameterIndexes.resize(nCount+1,SQL_NO_PARAMETER); - // Liste der Columns-Namen, die in der column_commalist vorkommen (mit ; getrennt): + // List of Column-Names, that exist in the column_commalist (seperated by ;): ::std::vector<String> aColumnNameList; OSL_ENSURE(m_pParseTree->count() >= 4,"OResultSet: Fehler im Parse Tree"); @@ -632,7 +615,7 @@ void OStatement_Base::GetAssignValues() OSL_ENSURE(SQL_ISRULE(pColumnCommalist,column_commalist),"OResultSet: Fehler im Parse Tree"); OSL_ENSURE(pColumnCommalist->count() > 0,"OResultSet: Fehler im Parse Tree"); - // Alle Columns in der column_commalist ... + // All Columns in the column_commalist ... for (sal_uInt32 i = 0; i < pColumnCommalist->count(); i++) { OSQLParseNode * pCol = pColumnCommalist->getChild(i); @@ -643,19 +626,19 @@ void OStatement_Base::GetAssignValues() if ( aColumnNameList.empty() ) throwFunctionSequenceException(*this); - // Werte ... + // Values ... OSQLParseNode * pValuesOrQuerySpec = m_pParseTree->getChild(4); OSL_ENSURE(pValuesOrQuerySpec != NULL,"OResultSet: pValuesOrQuerySpec darf nicht NULL sein!"); OSL_ENSURE(SQL_ISRULE(pValuesOrQuerySpec,values_or_query_spec),"OResultSet: ! SQL_ISRULE(pValuesOrQuerySpec,values_or_query_spec)"); OSL_ENSURE(pValuesOrQuerySpec->count() > 0,"OResultSet: pValuesOrQuerySpec->count() <= 0"); - // nur "VALUES" ist erlaubt ... + // just "VALUES" is allowed ... if (! SQL_ISTOKEN(pValuesOrQuerySpec->getChild(0),VALUES)) throwFunctionSequenceException(*this); OSL_ENSURE(pValuesOrQuerySpec->count() == 4,"OResultSet: pValuesOrQuerySpec->count() != 4"); - // Liste von Werten + // List of values OSQLParseNode * pInsertAtomCommalist = pValuesOrQuerySpec->getChild(2); OSL_ENSURE(pInsertAtomCommalist != NULL,"OResultSet: pInsertAtomCommalist darf nicht NULL sein!"); OSL_ENSURE(pInsertAtomCommalist->count() > 0,"OResultSet: pInsertAtomCommalist <= 0"); @@ -669,7 +652,7 @@ void OStatement_Base::GetAssignValues() OSL_ENSURE(pRow_Value_Const != NULL,"OResultSet: pRow_Value_Const darf nicht NULL sein!"); if(SQL_ISRULE(pRow_Value_Const,parameter)) { - ParseAssignValues(aColumnNameList,pRow_Value_Const,nIndex++); // kann nur ein Columnname vorhanden sein pro Schleife + ParseAssignValues(aColumnNameList,pRow_Value_Const,nIndex++); // only one Columnname allowed per loop } else if(pRow_Value_Const->isToken()) ParseAssignValues(aColumnNameList,pRow_Value_Const,static_cast<xub_StrLen>(i)); @@ -703,7 +686,7 @@ void OStatement_Base::GetAssignValues() OSL_ENSURE(SQL_ISRULE(pAssignmentCommalist,assignment_commalist),"OResultSet: Fehler im Parse Tree"); OSL_ENSURE(pAssignmentCommalist->count() > 0,"OResultSet: pAssignmentCommalist->count() <= 0"); - // Alle Zuweisungen (Kommaliste) bearbeiten ... + // work on all assignments (commalist) ... ::std::vector< String> aList(1); for (sal_uInt32 i = 0; i < pAssignmentCommalist->count(); i++) { @@ -720,7 +703,6 @@ void OStatement_Base::GetAssignValues() OSL_ENSURE(pComp->getNodeType() == SQL_NODE_EQUAL,"OResultSet: pComp->getNodeType() != SQL_NODE_COMPARISON"); if (pComp->getTokenValue().toChar() != '=') { - // aStatus.SetInvalidStatement(); throwFunctionSequenceException(*this); } @@ -745,61 +727,54 @@ void OStatement_Base::ParseAssignValues(const ::std::vector< String>& aColumnNam pRow_Value_Constructor_Elem->getNodeType() == SQL_NODE_INTNUM || pRow_Value_Constructor_Elem->getNodeType() == SQL_NODE_APPROXNUM) { - // Wert setzen: + // set value: SetAssignValue(aColumnName, pRow_Value_Constructor_Elem->getTokenValue()); } else if (SQL_ISTOKEN(pRow_Value_Constructor_Elem,NULL)) { - // NULL setzen - SetAssignValue(aColumnName, String(), TRUE); + // set NULL + SetAssignValue(aColumnName, String(), sal_True); } else if (SQL_ISRULE(pRow_Value_Constructor_Elem,parameter)) parseParamterElem(aColumnName,pRow_Value_Constructor_Elem); else { - // aStatus.SetStatementTooComplex(); throwFunctionSequenceException(*this); } } //------------------------------------------------------------------ void OStatement_Base::SetAssignValue(const String& aColumnName, const String& aValue, - BOOL bSetNull, - UINT32 nParameter) + sal_Bool bSetNull, + sal_uInt32 nParameter) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OStatement_Base::SetAssignValue" ); Reference<XPropertySet> xCol; m_xColNames->getByName(aColumnName) >>= xCol; sal_Int32 nId = Reference<XColumnLocate>(m_xColNames,UNO_QUERY)->findColumn(aColumnName); - // Kommt diese Column ueberhaupt in der Datei vor? + // does this column actually exist in the file? if (!xCol.is()) { - // Diese Column gibt es nicht! -// aStatus.Set(SQL_STAT_ERROR, -// String::CreateFromAscii("S0022"), -// aStatus.CreateErrorMessage(String(SdbResId(STR_STAT_COLUMN_NOT_FOUND))), -// 0, String() ); + // This Column doesn't exist! throwFunctionSequenceException(*this); } - // Value an die Row mit den zuzuweisenden Werten binden: - // const ODbVariantRef& xValue = (*aAssignValues)[pFileColumn->GetId()]; - // Alles geprueft und wir haben den Namen der Column. - // Jetzt eine Value allozieren, den Wert setzen und die Value an die Row binden. + // Everything tested and we have the names of the Column. + // Now allocate one Value, set the value and tie the value to the Row. if (bSetNull) (m_aAssignValues->get())[nId]->setNull(); else { switch (::comphelper::getINT32(xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))) { - // Kriterium je nach Typ als String oder double in die Variable packen ... + // put criteria depending on the Type as String or double in the variable case DataType::CHAR: case DataType::VARCHAR: case DataType::LONGVARCHAR: *(m_aAssignValues->get())[nId] = ORowSetValue(aValue); - // Zeichensatz ist bereits konvertiert, da ja das gesamte Statement konvertiert wurde + //Characterset is already converted, since the entire statement was converted break; case DataType::BIT: @@ -810,7 +785,6 @@ void OStatement_Base::SetAssignValue(const String& aColumnName, *(m_aAssignValues->get())[nId] = sal_False; else { - // aStatus.Set(SQL_STAT_ERROR); // nyi: genauer! throwFunctionSequenceException(*this); } } @@ -826,24 +800,15 @@ void OStatement_Base::SetAssignValue(const String& aColumnName, case DataType::TIME: case DataType::TIMESTAMP: { - *(m_aAssignValues->get())[nId] = ORowSetValue(aValue); // .ToDouble -// try -// { -// double n = xValue->toDouble(); -// xValue->setDouble(n); -// } -// catch ( ... ) -// { -// aStatus.SetDriverNotCapableError(); -// } + *(m_aAssignValues->get())[nId] = ORowSetValue(aValue); } break; default: throwFunctionSequenceException(*this); } } - // Parameter-Nr. merken (als User Data) - // SQL_NO_PARAMETER = kein Parameter. + // save Parameter-No. (as User Data) + // SQL_NO_PARAMETER = no Parameter. m_aAssignValues->setParameterIndex(nId,nParameter); if(nParameter != SQL_NO_PARAMETER) m_aParameterIndexes[nParameter] = nId; diff --git a/connectivity/source/drivers/file/FTable.cxx b/connectivity/source/drivers/file/FTable.cxx index edcf565aa9..892a57ca35 100644 --- a/connectivity/source/drivers/file/FTable.cxx +++ b/connectivity/source/drivers/file/FTable.cxx @@ -51,7 +51,7 @@ using namespace ::com::sun::star::container; DBG_NAME( file_OFileTable ) OFileTable::OFileTable(sdbcx::OCollection* _pTables,OConnection* _pConnection) -: OTable_TYPEDEF(_pTables,_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers()) +: OTable_TYPEDEF(_pTables,_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers()) ,m_pConnection(_pConnection) ,m_pFileStream(NULL) ,m_nFilePos(0) @@ -73,7 +73,7 @@ OFileTable::OFileTable( sdbcx::OCollection* _pTables,OConnection* _pConnection, const ::rtl::OUString& _Description , const ::rtl::OUString& _SchemaName, const ::rtl::OUString& _CatalogName - ) : OTable_TYPEDEF(_pTables,_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers(), + ) : OTable_TYPEDEF(_pTables,_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers(), _Name, _Type, _Description, @@ -103,7 +103,7 @@ void OFileTable::refreshColumns() RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::refreshColumns" ); TStringVector aVector; Reference< XResultSet > xResult = m_pConnection->getMetaData()->getColumns(Any(), - m_SchemaName,m_Name,::rtl::OUString::createFromAscii("%")); + m_SchemaName,m_Name,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%"))); if(xResult.is()) { @@ -205,19 +205,19 @@ void SAL_CALL OFileTable::release() throw() OTable_TYPEDEF::release(); } // ----------------------------------------------------------------------------- -BOOL OFileTable::InsertRow(OValueRefVector& /*rRow*/, BOOL /*bFlush*/,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& /*_xCols*/) +sal_Bool OFileTable::InsertRow(OValueRefVector& /*rRow*/, sal_Bool /*bFlush*/,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& /*_xCols*/) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::InsertRow" ); return sal_False; } // ----------------------------------------------------------------------------- -BOOL OFileTable::DeleteRow(const OSQLColumns& /*_rCols*/) +sal_Bool OFileTable::DeleteRow(const OSQLColumns& /*_rCols*/) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::DeleteRow" ); return sal_False; } // ----------------------------------------------------------------------------- -BOOL OFileTable::UpdateRow(OValueRefVector& /*rRow*/, OValueRefRow& /*pOrgRow*/,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& /*_xCols*/) +sal_Bool OFileTable::UpdateRow(OValueRefVector& /*rRow*/, OValueRefRow& /*pOrgRow*/,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& /*_xCols*/) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::UpdateRow" ); return sal_False; @@ -226,13 +226,13 @@ BOOL OFileTable::UpdateRow(OValueRefVector& /*rRow*/, OValueRefRow& /*pOrgRow*/, void OFileTable::addColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& /*descriptor*/) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::addColumn" ); - OSL_ENSURE( false, "OFileTable::addColumn: not implemented!" ); + OSL_FAIL( "OFileTable::addColumn: not implemented!" ); } // ----------------------------------------------------------------------------- void OFileTable::dropColumn(sal_Int32 /*_nPos*/) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileTable::dropColumn" ); - OSL_ENSURE( false, "OFileTable::addColumn: not implemented!" ); + OSL_FAIL( "OFileTable::addColumn: not implemented!" ); } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/file/fanalyzer.cxx b/connectivity/source/drivers/file/fanalyzer.cxx index 773b24b277..cbff002d24 100644 --- a/connectivity/source/drivers/file/fanalyzer.cxx +++ b/connectivity/source/drivers/file/fanalyzer.cxx @@ -104,7 +104,26 @@ void OSQLAnalyzer::start(OSQLParseNode* pSQLParseNode) m_pConnection->throwGenericSQLException(STR_QUERY_COMPLEX_COUNT,NULL); } else - m_aSelectionEvaluations.push_back( TPredicates() ); + { + if ( SQL_ISPUNCTUATION( pColumnRef, "*" ) + || ( SQL_ISRULE( pColumnRef, column_ref ) + && ( pColumnRef->count() == 3 ) + && ( pColumnRef->getChild(0)->getNodeType() == SQL_NODE_NAME ) + && SQL_ISPUNCTUATION( pColumnRef->getChild(1), "." ) + && SQL_ISRULE( pColumnRef->getChild(2), column_val ) + && SQL_ISPUNCTUATION( pColumnRef->getChild(2)->getChild(0), "*" ) + ) + ) + { + // push one element for each column of our table + const Reference< XNameAccess > xColumnNames( m_aCompiler->getOrigColumns() ); + const Sequence< ::rtl::OUString > aColumnNames( xColumnNames->getElementNames() ); + for ( sal_Int32 j=0; j<aColumnNames.getLength(); ++j ) + m_aSelectionEvaluations.push_back( TPredicates() ); + } + else + m_aSelectionEvaluations.push_back( TPredicates() ); + } } } } @@ -115,10 +134,9 @@ void OSQLAnalyzer::start(OSQLParseNode* pSQLParseNode) //------------------------------------------------------------------ void OSQLAnalyzer::bindRow(OCodeList& rCodeList,const OValueRefRow& _pRow,OEvaluateSetList& _rEvaluateSetList) { - // Zaehlen, wieviele Kriterien - // wenn nur ein Kriterium, und das entsprechende Feld ist indiziert - // dann wird der Index verwendet - + // count criteria + // if only one criterion, and the corresponding field is indexed + // then the index will be used OEvaluateSet* pEvaluateSet = NULL; for (OCodeList::iterator aIter = rCodeList.begin(); aIter != rCodeList.end(); ++aIter) @@ -166,10 +184,10 @@ void OSQLAnalyzer::bindSelectRow(const OValueRefRow& _pRow) ::std::vector<sal_Int32>* pKeySet = NULL; OEvaluateSet* pEvaluateSet = NULL; - // Keyset erzeugen mit kleinster Liste + // create Keyset with smallest list if(!aEvaluateSetList.empty()) { - // welche Liste hat den kleinsten count ? + // which list has the smallest count? OEvaluateSetList::iterator i = aEvaluateSetList.begin(); pEvaluateSet = *(i); for(++i; i != aEvaluateSetList.end();++i) @@ -188,7 +206,7 @@ void OSQLAnalyzer::bindSelectRow(const OValueRefRow& _pRow) (*pKeySet)[k] = j->second; } - // alle loeschen + // delete all for(i = aEvaluateSetList.begin(); i != aEvaluateSetList.end();++i) delete (*i); } @@ -203,20 +221,20 @@ void OSQLAnalyzer::describeParam(::rtl::Reference<OSQLColumns> rParameterColumns OCodeStack aCodeStack; if (!rCodeList.size()) - return; // kein Praedikat + return; // no predicate if (!rParameterColumns->get().size()) - return; // keine Parameter + return; // no parameters - // Anlegen von Columns, die eine genauere Beschreibung fuer die enthalten + // Create columns, that have a more precise description for the included ::rtl::Reference<OSQLColumns> aNewParamColumns = new OSQLColumns(*rParameterColumns); - // Anlegen einer Testzeile, wird benoetigt um die Parameter zu beschreiben + // Create a Test-row, is needed to describe the parameters OValueRefRow aParameterRow = new OValueRefVector(rParameterColumns->get().size()); bindParameterRow(aParameterRow); OValueRefRow aTestRow = new OValueRefVector(Reference< XIndexAccess>(m_aCompiler->getOrigColumns(),UNO_QUERY)->getCount()); - delete bindEvaluationRow(aTestRow); // Binden der Attribute an die Values + delete bindEvaluationRow(aTestRow); // Bind the attributes to the values for(OCodeList::iterator aIter = rCodeList.begin(); aIter != rCodeList.end(); ++aIter) { @@ -226,10 +244,10 @@ void OSQLAnalyzer::describeParam(::rtl::Reference<OSQLColumns> rParameterColumns aCodeStack.push(pOperand); else { - if (pOperator->getRequestedOperands() == 2) // bei zwei Operatoren ist es moeglich - { // einen Parameter weiter zu spezifizieren + if (pOperator->getRequestedOperands() == 2) // with two Operands it is possible + { // to specify one parameter better OOperandParam *pParam = PTR_CAST(OOperandParam,aCodeStack.top()); - if (pParam) // Anpassen des ParameterTyps, wenn der linke Operand ein Attribut ist + if (pParam) // adjust the Parameter-types, if the left Operand is an attribute { OOperandAttr *pLeft = PTR_CAST(OOperandAttr,*(rCodeList.end() - 2)); if (pLeft) @@ -252,10 +270,9 @@ void OSQLAnalyzer::describeParam(::rtl::Reference<OSQLColumns> rParameterColumns if (IS_TYPE(OOperandResult,pOperand)) delete pOperand; else - OSL_ENSURE(0,"Illegal here!"); + OSL_FAIL("Illegal here!"); rParameterColumns = aNewParamColumns; - // m_aCompiler->setParameterColumns(rParameterColumns); } // ----------------------------------------------------------------------------- @@ -266,12 +283,12 @@ OOperandAttr* OSQLAnalyzer::createOperandAttr(sal_Int32 _nPos, return new OOperandAttr(static_cast<sal_uInt16>(_nPos),_xCol); } // ----------------------------------------------------------------------------- -BOOL OSQLAnalyzer::hasRestriction() const +sal_Bool OSQLAnalyzer::hasRestriction() const { return m_aCompiler->hasCode(); } // ----------------------------------------------------------------------------- -BOOL OSQLAnalyzer::hasFunctions() const +sal_Bool OSQLAnalyzer::hasFunctions() const { if ( m_bSelectionFirstTime ) { @@ -292,11 +309,12 @@ void OSQLAnalyzer::setSelectionEvaluationResult(OValueRefRow& _pRow,const ::std: { if ( aIter->second.is() ) { - sal_Int32 map = nPos; // the first column (index 0) is for convenience only. The first real select column is no 1. - if ( (nPos > 0) && (nPos < static_cast<sal_Int32>(_rColumnMapping.size())) ) + sal_Int32 map = nPos; + if ( nPos < static_cast< sal_Int32 >( _rColumnMapping.size() ) ) map = _rColumnMapping[nPos]; - aIter->second->startSelection((_pRow->get())[map]); + if ( map > 0 ) + aIter->second->startSelection( (_pRow->get())[map] ); } } } diff --git a/connectivity/source/drivers/file/fcode.cxx b/connectivity/source/drivers/file/fcode.cxx index bb48041a30..ad8662c7d0 100644 --- a/connectivity/source/drivers/file/fcode.cxx +++ b/connectivity/source/drivers/file/fcode.cxx @@ -43,13 +43,8 @@ using namespace ::comphelper; using namespace connectivity; using namespace connectivity::file; -//using namespace ::com::sun::star::uno; -//using namespace ::com::sun::star::lang; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdb; -//using namespace ::com::sun::star::container; -//using namespace ::com::sun::star::beans; -//using namespace ::com::sun::star::sdbcx; TYPEINIT0(OCode); TYPEINIT1(OOperand, OCode); @@ -135,7 +130,7 @@ sal_Bool OOperandAttr::isIndexed() const } //------------------------------------------------------------------ OOperandParam::OOperandParam(OSQLParseNode* pNode, sal_Int32 _nPos) - : OOperandRow(static_cast<sal_uInt16>(_nPos), DataType::VARCHAR) // Standard-Typ + : OOperandRow(static_cast<sal_uInt16>(_nPos), DataType::VARCHAR) // Standard-Type { OSL_ENSURE(SQL_ISRULE(pNode,parameter),"Argument ist kein Parameter"); OSL_ENSURE(pNode->count() > 0,"Fehler im Parse Tree"); @@ -148,20 +143,18 @@ OOperandParam::OOperandParam(OSQLParseNode* pNode, sal_Int32 _nPos) aParameterName = pNode->getChild(1)->getTokenValue(); else { - OSL_ASSERT("Fehler im Parse Tree"); + OSL_FAIL("Fehler im Parse Tree"); } - // Parameter-Column aufsetzen mit defult typ, kann zu einem spaeteren Zeitpunkt ueber DescribeParameter - // genauer spezifiziert werden + // set up Parameter-Column with default type, can be specified more precisely later using Describe-Parameter - // Identitaet merken (hier eigentlich nicht erforderlich, aber aus - // Symmetriegruenden ...) + // save Identity (not escpecially necessary here, just for the sake of symmetry) // todo // OColumn* pColumn = new OFILEColumn(aParameterName,eDBType,255,0,SQL_FLAGS_NULLALLOWED); // rParamColumns->AddColumn(pColumn); - // der Wert wird erst kurz vor der Auswertung gesetzt + // the value will be set just before the evaluation } @@ -207,7 +200,7 @@ OOperandConst::OOperandConst(const OSQLParseNode& rColumnRef, const rtl::OUStrin } else { - OSL_ASSERT("Parse Error"); + OSL_FAIL("Parse Error"); } m_aValue.setBound(sal_True); } @@ -348,7 +341,7 @@ sal_Bool OOp_COMPARE::operate(const OOperand* pLeft, const OOperand* pRight) con sal_Bool bResult = sal_False; sal_Int32 eDBType = pLeft->getDBType(); - // Vergleich (je nach Datentyp): + // Comparison (depending on Data-type): switch (eDBType) { case DataType::CHAR: @@ -356,7 +349,7 @@ sal_Bool OOp_COMPARE::operate(const OOperand* pLeft, const OOperand* pRight) con case DataType::LONGVARCHAR: { rtl::OUString sLH = aLH, sRH = aRH; - INT32 nRes = rtl_ustr_compareIgnoreAsciiCase_WithLength + sal_Int32 nRes = rtl_ustr_compareIgnoreAsciiCase_WithLength ( sLH.pData->buffer, sLH.pData->length, diff --git a/connectivity/source/drivers/file/fcomp.cxx b/connectivity/source/drivers/file/fcomp.cxx index 9e05f9a91f..d054360d0f 100644 --- a/connectivity/source/drivers/file/fcomp.cxx +++ b/connectivity/source/drivers/file/fcomp.cxx @@ -58,10 +58,9 @@ using namespace ::com::sun::star::util; DBG_NAME(OPredicateCompiler) //------------------------------------------------------------------ OPredicateCompiler::OPredicateCompiler(OSQLAnalyzer* pAnalyzer)//,OCursor& rCurs) - // : m_rCursor(rCurs) : m_pAnalyzer(pAnalyzer) , m_nParamCounter(0) - , m_bORCondition(FALSE) + , m_bORCondition(sal_False) { DBG_CTOR(OPredicateCompiler,NULL); } @@ -79,17 +78,15 @@ void OPredicateCompiler::dispose() m_orgColumns = NULL; m_xIndexes.clear(); } -//------------------------------------------------------------------ -// inline OCursor& OPredicateCompiler::Cursor() const {return m_rCursor;} -//------------------------------------------------------------------ + void OPredicateCompiler::start(OSQLParseNode* pSQLParseNode) { if (!pSQLParseNode) return; m_nParamCounter = 0; - // Parse Tree analysieren (je nach Statement-Typ) - // und Zeiger auf WHERE-Klausel setzen: + // analyse Parse Tree (depending on Statement-type) + // and set pointer on WHERE-clause: OSQLParseNode * pWhereClause = NULL; OSQLParseNode * pOrderbyClause = NULL; @@ -119,6 +116,7 @@ void OPredicateCompiler::start(OSQLParseNode* pSQLParseNode) pWhereClause = pTableExp->getChild(1); pOrderbyClause = pTableExp->getChild(4); + (void)pOrderbyClause; } else if (SQL_ISRULE(pSQLParseNode,update_statement_searched)) { @@ -131,12 +129,12 @@ void OPredicateCompiler::start(OSQLParseNode* pSQLParseNode) pWhereClause = pSQLParseNode->getChild(3); } else - // Anderes Statement. Keine Selektionskriterien. + // Other Statement. no selection-criteria return; if (SQL_ISRULE(pWhereClause,where_clause)) { - // Wenn es aber eine where_clause ist, dann darf sie nicht leer sein: + // a where-clause is not allowed to be empty: DBG_ASSERT(pWhereClause->count() == 2,"OFILECursor: Fehler im Parse Tree"); OSQLParseNode * pComparisonPredicate = pWhereClause->getChild(1); @@ -146,8 +144,7 @@ void OPredicateCompiler::start(OSQLParseNode* pSQLParseNode) } else { - // Die Where Clause ist meistens optional, d. h. es koennte sich auch - // um "optional_where_clause" handeln. + // The where-clause is optionally in the majority of cases, i.e. it might be an "optional-where-clause". DBG_ASSERT(SQL_ISRULE(pWhereClause,opt_where_clause),"OPredicateCompiler: Fehler im Parse Tree"); } } @@ -156,18 +153,18 @@ void OPredicateCompiler::start(OSQLParseNode* pSQLParseNode) OOperand* OPredicateCompiler::execute(OSQLParseNode* pPredicateNode) { OOperand* pOperand = NULL; - if (pPredicateNode->count() == 3 && // Ausdruck is geklammert + if (pPredicateNode->count() == 3 && // Expression is bracketed SQL_ISPUNCTUATION(pPredicateNode->getChild(0),"(") && SQL_ISPUNCTUATION(pPredicateNode->getChild(2),")")) { execute(pPredicateNode->getChild(1)); } else if ((SQL_ISRULE(pPredicateNode,search_condition) || (SQL_ISRULE(pPredicateNode,boolean_term))) - && // AND/OR-Verknuepfung: + && // AND/OR-linkage: pPredicateNode->count() == 3) { - execute(pPredicateNode->getChild(0)); // Bearbeiten des linken Zweigs - execute(pPredicateNode->getChild(2)); // Bearbeiten des rechten Zweigs + execute(pPredicateNode->getChild(0)); // process the left branch + execute(pPredicateNode->getChild(2)); // process the right branch if (SQL_ISTOKEN(pPredicateNode->getChild(1),OR)) // OR-Operator { @@ -178,7 +175,7 @@ OOperand* OPredicateCompiler::execute(OSQLParseNode* pPredicateNode) m_aCodeList.push_back(new OOp_AND()); else { - DBG_ERROR("OPredicateCompiler: Fehler im Parse Tree"); + OSL_FAIL("OPredicateCompiler: Fehler im Parse Tree"); } } else if (SQL_ISRULE(pPredicateNode,boolean_factor)) @@ -204,8 +201,8 @@ OOperand* OPredicateCompiler::execute(OSQLParseNode* pPredicateNode) } else if(SQL_ISRULE(pPredicateNode,num_value_exp)) { - execute(pPredicateNode->getChild(0)); // Bearbeiten des linken Zweigs - execute(pPredicateNode->getChild(2)); // Bearbeiten des rechten Zweigs + execute(pPredicateNode->getChild(0)); // process the left branch + execute(pPredicateNode->getChild(2)); // process the right branch if (SQL_ISPUNCTUATION(pPredicateNode->getChild(1),"+")) { m_aCodeList.push_back(new OOp_ADD()); @@ -214,13 +211,13 @@ OOperand* OPredicateCompiler::execute(OSQLParseNode* pPredicateNode) m_aCodeList.push_back(new OOp_SUB()); else { - DBG_ERROR("OPredicateCompiler: Fehler im Parse Tree num_value_exp"); + OSL_FAIL("OPredicateCompiler: Fehler im Parse Tree num_value_exp"); } } else if(SQL_ISRULE(pPredicateNode,term)) { - execute(pPredicateNode->getChild(0)); // Bearbeiten des linken Zweigs - execute(pPredicateNode->getChild(2)); // Bearbeiten des rechten Zweigs + execute(pPredicateNode->getChild(0)); // process the left branch + execute(pPredicateNode->getChild(2)); // process the right branch if (SQL_ISPUNCTUATION(pPredicateNode->getChild(1),"*")) { m_aCodeList.push_back(new OOp_MUL()); @@ -229,11 +226,11 @@ OOperand* OPredicateCompiler::execute(OSQLParseNode* pPredicateNode) m_aCodeList.push_back(new OOp_DIV()); else { - DBG_ERROR("OPredicateCompiler: Fehler im Parse Tree num_value_exp"); + OSL_FAIL("OPredicateCompiler: Fehler im Parse Tree num_value_exp"); } } else - pOperand = execute_Operand(pPredicateNode); // jetzt werden nur einfache Operanden verarbeitet + pOperand = execute_Operand(pPredicateNode); // now only simple operands will be processed return pOperand; } @@ -277,7 +274,7 @@ OOperand* OPredicateCompiler::execute_COMPARE(OSQLParseNode* pPredicateNode) th else if (pPrec->getNodeType() == SQL_NODE_GREAT) ePredicateType = SQLFilterOperator::GREATER; else - OSL_ENSURE( false, "OPredicateCompiler::execute_COMPARE: unexpected node type!" ); + OSL_FAIL( "OPredicateCompiler::execute_COMPARE: unexpected node type!" ); execute(pPredicateNode->getChild(0)); execute(pPredicateNode->getChild(2)); @@ -464,7 +461,7 @@ OOperand* OPredicateCompiler::execute_Operand(OSQLParseNode* pPredicateNode) thr pOperand = m_pAnalyzer->createOperandAttr(Reference< XColumnLocate>(m_orgColumns,UNO_QUERY)->findColumn(aColumnName),xCol,m_xIndexes); } else - {// Column existiert nicht im Resultset + {// Column doesn't exist in the Result-set const ::rtl::OUString sError( m_pAnalyzer->getConnection()->getResources().getResourceStringWithSubstitution( STR_INVALID_COLUMNNAME, "$columnname$", aColumnName @@ -474,7 +471,7 @@ OOperand* OPredicateCompiler::execute_Operand(OSQLParseNode* pPredicateNode) thr } catch(Exception &) { - OSL_ENSURE(0,"OPredicateCompiler::execute_Operand Exception"); + OSL_FAIL("OPredicateCompiler::execute_Operand Exception"); } } else if (SQL_ISRULE(pPredicateNode,parameter)) @@ -494,7 +491,7 @@ OOperand* OPredicateCompiler::execute_Operand(OSQLParseNode* pPredicateNode) thr else if((pPredicateNode->count() == 2) && (SQL_ISPUNCTUATION(pPredicateNode->getChild(0),"+") || SQL_ISPUNCTUATION(pPredicateNode->getChild(0),"-")) && pPredicateNode->getChild(1)->getNodeType() == SQL_NODE_INTNUM) - { // falls -1 bzw. +1 vorhanden ist + { // if -1 or +1 is there ::rtl::OUString aValue(pPredicateNode->getChild(0)->getTokenValue()); aValue += pPredicateNode->getChild(1)->getTokenValue(); pOperand = new OOperandConst(*pPredicateNode->getChild(1), aValue); @@ -560,7 +557,7 @@ sal_Bool OPredicateInterpreter::evaluate(OCodeList& rCodeList) OCodeList::iterator aIter = rCodeList.begin(); if (!(*aIter)) - return sal_True; // kein Praedikat + return sal_True; // no Predicate for(;aIter != rCodeList.end();++aIter) { @@ -587,7 +584,7 @@ void OPredicateInterpreter::evaluateSelection(OCodeList& rCodeList,ORowSetValueD { OCodeList::iterator aIter = rCodeList.begin(); if (!(*aIter)) - return ; // kein Praedikat + return ; // no Predicate for(;aIter != rCodeList.end();++aIter) { @@ -781,7 +778,7 @@ OOperand* OPredicateCompiler::executeFunction(OSQLParseNode* pPredicateNode) thr pOperator = new OOp_Second(); break; default: - OSL_ENSURE(0,"Error in switch!"); + OSL_FAIL("Error in switch!"); } break; case SQL_TOKEN_CHAR: @@ -869,7 +866,7 @@ OOperand* OPredicateCompiler::executeFunction(OSQLParseNode* pPredicateNode) thr pOperator = new OOp_Week(); break; default: - OSL_ENSURE(0,"Error in switch!"); + OSL_FAIL("Error in switch!"); } } break; diff --git a/connectivity/source/drivers/file/file.xml b/connectivity/source/drivers/file/file.xml index b3b681c305..b3b681c305 100644..100755 --- a/connectivity/source/drivers/file/file.xml +++ b/connectivity/source/drivers/file/file.xml diff --git a/connectivity/source/drivers/file/makefile.mk b/connectivity/source/drivers/file/makefile.mk index 41f061de80..41f061de80 100644..100755 --- a/connectivity/source/drivers/file/makefile.mk +++ b/connectivity/source/drivers/file/makefile.mk diff --git a/connectivity/source/drivers/file/quotedstring.cxx b/connectivity/source/drivers/file/quotedstring.cxx index 5847b94e88..c71afa3d41 100644 --- a/connectivity/source/drivers/file/quotedstring.cxx +++ b/connectivity/source/drivers/file/quotedstring.cxx @@ -45,48 +45,48 @@ namespace connectivity return 0; xub_StrLen nTokCount = 1; - BOOL bStart = TRUE; // Stehen wir auf dem ersten Zeichen im Token? - BOOL bInString = FALSE; // Befinden wir uns INNERHALB eines (cStrDel delimited) String? + sal_Bool bStart = sal_True; // Are we on the first character in the Token? + sal_Bool bInString = sal_False; // Are we WITHIN a (cStrDel delimited) String? - // Suche bis Stringende nach dem ersten nicht uebereinstimmenden Zeichen + // Search for String-end after the first not matching character for( xub_StrLen i = 0; i < nLen; ++i ) { const sal_Unicode cChar = m_sString.GetChar(i); if (bStart) { - bStart = FALSE; - // Erstes Zeichen ein String-Delimiter? + bStart = sal_False; + // First character a String-Delimiter? if ( cChar == cStrDel ) { - bInString = TRUE; // dann sind wir jetzt INNERHALB des Strings! - continue; // dieses Zeichen ueberlesen! + bInString = sal_True; // then we are now WITHIN the string! + continue; // skip this character! } } if (bInString) { - // Wenn jetzt das String-Delimiter-Zeichen auftritt ... + // when now the String-Delimiter-character occurs ... if ( cChar == cStrDel ) { if ((i+1 < nLen) && (m_sString.GetChar(i+1) == cStrDel)) { - // Verdoppeltes String-Delimiter-Zeichen: - ++i; // kein String-Ende, naechstes Zeichen ueberlesen. + // double String-Delimter-character: + ++i; // no string-end, skip next character. } else { - // String-Ende - bInString = FALSE; + // String-End + bInString = sal_False; } } } // if (bInString) else { - // Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount + // does the Token-character match, then raise TokCount if ( cChar == cTok ) { ++nTokCount; - bStart = TRUE; + bStart = sal_True; } } } @@ -103,58 +103,57 @@ namespace connectivity const xub_StrLen nLen = m_sString.Len(); if ( nLen ) { - BOOL bInString = (nStartPos < nLen) && (m_sString.GetChar(nStartPos) == cStrDel); // Befinden wir uns INNERHALB eines (cStrDel delimited) String? + sal_Bool bInString = (nStartPos < nLen) && (m_sString.GetChar(nStartPos) == cStrDel); // are we WITHIN a (cStrDel delimited) String? - // Erstes Zeichen ein String-Delimiter? + // First character a String-Delimiter? if (bInString ) - ++nStartPos; // dieses Zeichen ueberlesen! + ++nStartPos; // skip this character! if ( nStartPos >= nLen ) return; sal_Unicode* pData = _rStr.AllocBuffer( nLen - nStartPos + 1 ); const sal_Unicode* pStart = pData; - // Suche bis Stringende nach dem ersten nicht uebereinstimmenden Zeichen + // Search until end of string for the first not matching character for( xub_StrLen i = nStartPos; i < nLen; ++i ) { const sal_Unicode cChar = m_sString.GetChar(i); if (bInString) { - // Wenn jetzt das String-Delimiter-Zeichen auftritt ... + // when now the String-Delimiter-character occurs ... if ( cChar == cStrDel ) { if ((i+1 < nLen) && (m_sString.GetChar(i+1) == cStrDel)) { - // Verdoppeltes String-Delimiter-Zeichen: - // kein String-Ende, naechstes Zeichen ueberlesen. + // double String Delimiter-character + // no end of string, skip next character. ++i; - *pData++ = m_sString.GetChar(i); // Zeichen gehoert zum Resultat-String + *pData++ = m_sString.GetChar(i); // character belongs to Result-String } else { - // String-Ende - bInString = FALSE; + //end of String + bInString = sal_False; *pData = 0; } } else { - *pData++ = cChar; // Zeichen gehoert zum Resultat-String + *pData++ = cChar; // character belongs to Result-String } } else { - // Stimmt das Tokenzeichen ueberein, dann erhoehe nTok + // does the Token-sign match, then raise nTok if ( cChar == cTok ) { - // Vorzeitiger Abbruch der Schleife moeglich, denn - // wir haben, was wir wollten. + // premature break of loop possible, because we found what we were looking for nStartPos = i+1; break; } else { - *pData++ = cChar; // Zeichen gehoert zum Resultat-String + *pData++ = cChar; // character belongs to Result-String } } } // for( xub_StrLen i = nStartPos; i < nLen; ++i ) diff --git a/connectivity/source/drivers/flat/ECatalog.cxx b/connectivity/source/drivers/flat/ECatalog.cxx index f1327e152b..f82eb7de00 100644 --- a/connectivity/source/drivers/flat/ECatalog.cxx +++ b/connectivity/source/drivers/flat/ECatalog.cxx @@ -55,7 +55,7 @@ void OFlatCatalog::refreshTables() TStringVector aVector; Sequence< ::rtl::OUString > aTypes; Reference< XResultSet > xResult = m_xMetaData->getTables(Any(), - ::rtl::OUString::createFromAscii("%"),::rtl::OUString::createFromAscii("%"),aTypes); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("%")),aTypes); if(xResult.is()) { diff --git a/connectivity/source/drivers/flat/EConnection.cxx b/connectivity/source/drivers/flat/EConnection.cxx index 0097e075ef..fa1abf048a 100644 --- a/connectivity/source/drivers/flat/EConnection.cxx +++ b/connectivity/source/drivers/flat/EConnection.cxx @@ -53,6 +53,7 @@ using namespace ::com::sun::star::lang; // -------------------------------------------------------------------------------- OFlatConnection::OFlatConnection(ODriver* _pDriver) : OConnection(_pDriver) + ,m_nMaxRowsToScan(50) ,m_bHeaderLine(sal_True) ,m_cFieldDelimiter(';') ,m_cStringDelimiter('"') @@ -105,10 +106,15 @@ void OFlatConnection::construct(const ::rtl::OUString& url,const Sequence< Prope OSL_VERIFY( pBegin->Value >>= aVal ); m_cThousandDelimiter = aVal.toChar(); } + else if ( !pBegin->Name.compareToAscii("MaxRowScan") ) + { + pBegin->Value >>= m_nMaxRowsToScan; + } } osl_decrementInterlockedCount( &m_refCount ); OConnection::construct(url,info); + m_bShowDeleted = sal_True; // we do not supported rows for this type } // -------------------------------------------------------------------------------- Reference< XDatabaseMetaData > SAL_CALL OFlatConnection::getMetaData( ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/flat/EDatabaseMetaData.cxx b/connectivity/source/drivers/flat/EDatabaseMetaData.cxx index 62568e68ef..85d65153d4 100644 --- a/connectivity/source/drivers/flat/EDatabaseMetaData.cxx +++ b/connectivity/source/drivers/flat/EDatabaseMetaData.cxx @@ -49,7 +49,6 @@ using namespace ::comphelper; using namespace connectivity; using namespace connectivity::flat; -// using namespace connectivity::file; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::sdbcx; @@ -82,7 +81,7 @@ Reference< XResultSet > OFlatDatabaseMetaData::impl_getTypeInfo_throw( ) ODatabaseMetaDataResultSet::ORow aRow; aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue()); - aRow.push_back(new ORowSetValueDecorator(::rtl::OUString::createFromAscii("CHAR"))); + aRow.push_back(new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CHAR")))); aRow.push_back(new ORowSetValueDecorator(DataType::CHAR)); aRow.push_back(new ORowSetValueDecorator((sal_Int32)254)); aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue()); @@ -103,60 +102,60 @@ Reference< XResultSet > OFlatDatabaseMetaData::impl_getTypeInfo_throw( ) aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("VARCHAR")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VARCHAR"))); aRow[2] = new ORowSetValueDecorator(DataType::VARCHAR); aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue(); aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue(); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("LONGVARCHAR")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LONGVARCHAR"))); aRow[2] = new ORowSetValueDecorator(DataType::LONGVARCHAR); aRow[3] = new ORowSetValueDecorator((sal_Int32)65535); aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue(); aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue(); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DATE")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DATE"))); aRow[2] = new ORowSetValueDecorator(DataType::DATE); aRow[3] = new ORowSetValueDecorator((sal_Int32)10); aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue(); aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue(); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIME")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIME"))); aRow[2] = new ORowSetValueDecorator(DataType::TIME); aRow[3] = new ORowSetValueDecorator((sal_Int32)8); aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue(); aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue(); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIMESTAMP")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP"))); aRow[2] = new ORowSetValueDecorator(DataType::TIMESTAMP); aRow[3] = new ORowSetValueDecorator((sal_Int32)19); aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue(); aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue(); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("BOOL")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BOOL"))); aRow[2] = new ORowSetValueDecorator(DataType::BIT); aRow[3] = ODatabaseMetaDataResultSet::get1Value(); aRow[9] = ODatabaseMetaDataResultSet::getBasicValue(); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DECIMAL")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DECIMAL"))); aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL); aRow[3] = new ORowSetValueDecorator((sal_Int32)20); aRow[15] = new ORowSetValueDecorator((sal_Int32)15); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("DOUBLE")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DOUBLE"))); aRow[2] = new ORowSetValueDecorator(DataType::DOUBLE); aRow[3] = new ORowSetValueDecorator((sal_Int32)20); aRow[15] = ODatabaseMetaDataResultSet::get0Value(); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("NUMERIC")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NUMERIC"))); aRow[2] = new ORowSetValueDecorator(DataType::NUMERIC); aRow[3] = new ORowSetValueDecorator((sal_Int32)20); aRow[15] = new ORowSetValueDecorator((sal_Int32)20); @@ -236,10 +235,10 @@ Reference< XResultSet > SAL_CALL OFlatDatabaseMetaData::getColumns( switch(sal_Int32(aRow[11]->getValue())) { case ColumnValue::NO_NULLS: - aRow[18] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("NO")); + aRow[18] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NO"))); break; case ColumnValue::NULLABLE: - aRow[18] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("YES")); + aRow[18] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("YES"))); break; default: aRow[18] = new ORowSetValueDecorator(::rtl::OUString()); diff --git a/connectivity/source/drivers/flat/EDriver.cxx b/connectivity/source/drivers/flat/EDriver.cxx index 13d79d8756..48560bfb46 100644 --- a/connectivity/source/drivers/flat/EDriver.cxx +++ b/connectivity/source/drivers/flat/EDriver.cxx @@ -50,7 +50,7 @@ using namespace ::com::sun::star::lang; //------------------------------------------------------------------------------ rtl::OUString ODriver::getImplementationName_Static( ) throw(RuntimeException) { - return rtl::OUString::createFromAscii("com.sun.star.comp.sdbc.flat.ODriver"); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sdbc.flat.ODriver")); } //------------------------------------------------------------------ @@ -85,7 +85,7 @@ Reference< XConnection > SAL_CALL ODriver::connect( const ::rtl::OUString& url, sal_Bool SAL_CALL ODriver::acceptsURL( const ::rtl::OUString& url ) throw(SQLException, RuntimeException) { - return url.compareTo(::rtl::OUString::createFromAscii("sdbc:flat:"),10) == 0; + return url.compareTo(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:flat:")),10) == 0; } // ----------------------------------------------------------------------------- Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/flat/EResultSet.cxx b/connectivity/source/drivers/flat/EResultSet.cxx index 0d15b881db..94d47c3002 100644 --- a/connectivity/source/drivers/flat/EResultSet.cxx +++ b/connectivity/source/drivers/flat/EResultSet.cxx @@ -45,8 +45,7 @@ using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace com::sun::star::sdbc; using namespace com::sun::star::sdbcx; -// using namespace com::sun::star::container; -// using namespace com::sun::star::util; + //------------------------------------------------------------------------------ OFlatResultSet::OFlatResultSet( OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator) : file::OResultSet(pStmt,_aSQLIterator) @@ -57,14 +56,14 @@ OFlatResultSet::OFlatResultSet( OStatement_Base* pStmt,connectivity::OSQLParseTr // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL OFlatResultSet::getImplementationName( ) throw ( RuntimeException) { - return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.flat.ResultSet"); + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.flat.ResultSet")); } // ------------------------------------------------------------------------- Sequence< ::rtl::OUString > SAL_CALL OFlatResultSet::getSupportedServiceNames( ) throw( RuntimeException) { Sequence< ::rtl::OUString > aSupported(2); - aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.ResultSet"); - aSupported[1] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.ResultSet"); + aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.ResultSet")); + aSupported[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.ResultSet")); return aSupported; } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx index 02cc780a47..14bf8ee5fe 100644 --- a/connectivity/source/drivers/flat/ETable.cxx +++ b/connectivity/source/drivers/flat/ETable.cxx @@ -73,7 +73,7 @@ using namespace ::com::sun::star::lang; void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatTable::fillColumns" ); - BOOL bRead = TRUE; + sal_Bool bRead = sal_True; QuotedTokenizedString aHeaderLine; OFlatConnection* pConnection = (OFlatConnection*)m_pConnection; @@ -114,11 +114,11 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) m_aScales.clear(); // reserve some space m_aColumns->get().reserve(nFieldCount+1); - m_aTypes.reserve(nFieldCount+1); - m_aPrecisions.reserve(nFieldCount+1); - m_aScales.reserve(nFieldCount+1); + m_aTypes.assign(nFieldCount+1,DataType::SQLNULL); + m_aPrecisions.assign(nFieldCount+1,-1); + m_aScales.assign(nFieldCount+1,-1); - const sal_Bool bCase = m_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers(); + const sal_Bool bCase = m_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers(); CharClass aCharClass(pConnection->getDriver()->getFactory(),_aLocale); // read description const sal_Unicode cDecimalDelimiter = pConnection->getDecimalDelimiter(); @@ -126,106 +126,186 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) String aColumnName; ::rtl::OUString aTypeName; ::comphelper::UStringMixEqual aCase(bCase); - xub_StrLen nStartPosHeaderLine = 0; // use for eficient way to get the tokens - xub_StrLen nStartPosFirstLine = 0; // use for eficient way to get the tokens - xub_StrLen nStartPosFirstLine2 = 0; - for (xub_StrLen i = 0; i < nFieldCount; i++) + ::std::vector<String> aColumnNames,m_aTypeNames; + m_aTypeNames.resize(nFieldCount); + const sal_Int32 nMaxRowsToScan = pConnection->getMaxRowsToScan(); + sal_Int32 nRowCount = 0; + do { - if ( bHasHeaderLine ) + xub_StrLen nStartPosHeaderLine = 0; // use for eficient way to get the tokens + xub_StrLen nStartPosFirstLine = 0; // use for eficient way to get the tokens + xub_StrLen nStartPosFirstLine2 = 0; + for (xub_StrLen i = 0; i < nFieldCount; i++) { - aHeaderLine.GetTokenSpecial(aColumnName,nStartPosHeaderLine,m_cFieldDelimiter,m_cStringDelimiter); - if ( !aColumnName.Len() ) + if ( nRowCount == 0) { - aColumnName = 'C'; - aColumnName += String::CreateFromInt32(i+1); + if ( bHasHeaderLine ) + { + aHeaderLine.GetTokenSpecial(aColumnName,nStartPosHeaderLine,m_cFieldDelimiter,m_cStringDelimiter); + if ( !aColumnName.Len() ) + { + aColumnName = 'C'; + aColumnName += String::CreateFromInt32(i+1); + } + } + else + { + // no column name so ... + aColumnName = 'C'; + aColumnName += String::CreateFromInt32(i+1); + } + aColumnNames.push_back(aColumnName); } + impl_fillColumnInfo_nothrow(aFirstLine,nStartPosFirstLine,nStartPosFirstLine2,m_aTypes[i],m_aPrecisions[i],m_aScales[i],m_aTypeNames[i],cDecimalDelimiter,cThousandDelimiter,aCharClass); } - else + ++nRowCount; + } + while(nRowCount < nMaxRowsToScan && m_pFileStream->ReadByteStringLine(aFirstLine,nEncoding)); + + for (xub_StrLen i = 0; i < nFieldCount; i++) + { + // check if the columname already exists + String aAlias(aColumnNames[i]); + OSQLColumns::Vector::const_iterator aFind = connectivity::find(m_aColumns->get().begin(),m_aColumns->get().end(),aAlias,aCase); + sal_Int32 nExprCnt = 0; + while(aFind != m_aColumns->get().end()) { - // no column name so ... - aColumnName = 'C'; - aColumnName += String::CreateFromInt32(i+1); + (aAlias = aColumnNames[i]) += String::CreateFromInt32(++nExprCnt); + aFind = connectivity::find(m_aColumns->get().begin(),m_aColumns->get().end(),aAlias,aCase); } - sal_Int32 eType; - UINT16 nPrecision = 0; - UINT16 nScale = 0; - BOOL bNumeric = FALSE; - ULONG nIndex = 0; + sdbcx::OColumn* pColumn = new sdbcx::OColumn(aAlias,m_aTypeNames[i],::rtl::OUString(),::rtl::OUString(), + ColumnValue::NULLABLE, + m_aPrecisions[i], + m_aScales[i], + m_aTypes[i], + sal_False, + sal_False, + sal_False, + bCase); + Reference< XPropertySet> xCol = pColumn; + m_aColumns->get().push_back(xCol); + } + m_pFileStream->Seek(m_nStartRowFilePos); +} +void OFlatTable::impl_fillColumnInfo_nothrow(QuotedTokenizedString& aFirstLine,xub_StrLen& nStartPosFirstLine,xub_StrLen& nStartPosFirstLine2 + ,sal_Int32& io_nType,sal_Int32& io_nPrecisions,sal_Int32& io_nScales,String& o_sTypeName + ,const sal_Unicode cDecimalDelimiter,const sal_Unicode cThousandDelimiter,const CharClass& aCharClass) +{ + if ( io_nType != DataType::VARCHAR ) + { + sal_Bool bNumeric = io_nType == DataType::SQLNULL || io_nType == DataType::DOUBLE || io_nType == DataType::DECIMAL || io_nType == DataType::INTEGER; + sal_uLong nIndex = 0; - // first without fielddelimiter - String aField; - aFirstLine.GetTokenSpecial(aField,nStartPosFirstLine,m_cFieldDelimiter,'\0'); - if (aField.Len() == 0 || - (m_cStringDelimiter && m_cStringDelimiter == aField.GetChar(0))) + if ( bNumeric ) { - bNumeric = FALSE; - if ( m_cStringDelimiter != '\0' ) - aFirstLine.GetTokenSpecial(aField,nStartPosFirstLine2,m_cFieldDelimiter,m_cStringDelimiter); - else - nStartPosFirstLine2 = nStartPosFirstLine; - } - else - { - String aField2; - if ( m_cStringDelimiter != '\0' ) - aFirstLine.GetTokenSpecial(aField2,nStartPosFirstLine2,m_cFieldDelimiter,m_cStringDelimiter); - else - aField2 = aField; - - if (aField2.Len() == 0) + // first without fielddelimiter + String aField; + aFirstLine.GetTokenSpecial(aField,nStartPosFirstLine,m_cFieldDelimiter,'\0'); + if (aField.Len() == 0 || + (m_cStringDelimiter && m_cStringDelimiter == aField.GetChar(0))) { - bNumeric = FALSE; + bNumeric = sal_False; + if ( m_cStringDelimiter != '\0' ) + aFirstLine.GetTokenSpecial(aField,nStartPosFirstLine2,m_cFieldDelimiter,m_cStringDelimiter); + else + nStartPosFirstLine2 = nStartPosFirstLine; } else { - bNumeric = TRUE; - xub_StrLen nDot = 0; - xub_StrLen nDecimalDelCount = 0; - for (xub_StrLen j = 0; j < aField2.Len(); j++) + String aField2; + if ( m_cStringDelimiter != '\0' ) + aFirstLine.GetTokenSpecial(aField2,nStartPosFirstLine2,m_cFieldDelimiter,m_cStringDelimiter); + else + aField2 = aField; + + if (aField2.Len() == 0) { - const sal_Unicode c = aField2.GetChar(j); - // nur Ziffern und Dezimalpunkt und Tausender-Trennzeichen? - if ( ( !cDecimalDelimiter || c != cDecimalDelimiter ) && - ( !cThousandDelimiter || c != cThousandDelimiter ) && - !aCharClass.isDigit(aField2,j) && - ( j != 0 || (c != '+' && c != '-' ) ) ) - { - bNumeric = FALSE; - break; - } - if (cDecimalDelimiter && c == cDecimalDelimiter) - { - nPrecision = 15; // we have an decimal value - nScale = 2; - ++nDecimalDelCount; - } // if (cDecimalDelimiter && c == cDecimalDelimiter) - if ( c == '.' ) - ++nDot; + bNumeric = sal_False; } - - if (nDecimalDelCount > 1 || nDot > 1 ) // if there is more than one dot it isn't a number - bNumeric = FALSE; - if (bNumeric && cThousandDelimiter) + else { - // Ist der Trenner richtig angegeben? - const String aValue = aField2.GetToken(0,cDecimalDelimiter); - for (sal_Int32 j = aValue.Len() - 4; j >= 0; j -= 4) + bNumeric = sal_True; + xub_StrLen nDot = 0; + xub_StrLen nDecimalDelCount = 0; + xub_StrLen nSpaceCount = 0; + for (xub_StrLen j = 0; j < aField2.Len(); j++) { - const sal_Unicode c = aValue.GetChar(static_cast<sal_uInt16>(j)); - // nur Ziffern und Dezimalpunkt und Tausender-Trennzeichen? - if (c == cThousandDelimiter && j) + const sal_Unicode c = aField2.GetChar(j); + if ( j == nSpaceCount && m_cFieldDelimiter != 32 && c == 32 ) + { + ++nSpaceCount; continue; - else + } + // just digits, decimal- and thousands-delimiter? + if ( ( !cDecimalDelimiter || c != cDecimalDelimiter ) && + ( !cThousandDelimiter || c != cThousandDelimiter ) && + !aCharClass.isDigit(aField2,j) && + ( j != 0 || (c != '+' && c != '-' ) ) ) { - bNumeric = FALSE; + bNumeric = sal_False; break; } + if (cDecimalDelimiter && c == cDecimalDelimiter) + { + io_nPrecisions = 15; // we have an decimal value + io_nScales = 2; + ++nDecimalDelCount; + } // if (cDecimalDelimiter && c == cDecimalDelimiter) + if ( c == '.' ) + ++nDot; } - } - // jetzt koennte es noch ein Datumsfeld sein - if (!bNumeric) + if (nDecimalDelCount > 1 || nDot > 1 ) // if there is more than one dot it isn't a number + bNumeric = sal_False; + if (bNumeric && cThousandDelimiter) + { + // Is the delimiter correct? + const String aValue = aField2.GetToken(0,cDecimalDelimiter); + for (sal_Int32 j = aValue.Len() - 4; j >= 0; j -= 4) + { + const sal_Unicode c = aValue.GetChar(static_cast<sal_uInt16>(j)); + // just digits, decimal- and thousands-delimiter? + if (c == cThousandDelimiter && j) + continue; + else + { + bNumeric = sal_False; + break; + } + } + } + + // now also check for a date field + if (!bNumeric) + { + try + { + nIndex = m_xNumberFormatter->detectNumberFormat(::com::sun::star::util::NumberFormat::ALL,aField2); + } + catch(Exception&) + { + } + } + } + } + } + else if ( io_nType == DataType::DATE || io_nType == DataType::TIMESTAMP || io_nType == DataType::TIME) + { + String aField; + aFirstLine.GetTokenSpecial(aField,nStartPosFirstLine,m_cFieldDelimiter,'\0'); + if (aField.Len() == 0 || + (m_cStringDelimiter && m_cStringDelimiter == aField.GetChar(0))) + { + } + else + { + String aField2; + if ( m_cStringDelimiter != '\0' ) + aFirstLine.GetTokenSpecial(aField2,nStartPosFirstLine2,m_cFieldDelimiter,m_cStringDelimiter); + else + aField2 = aField; + if (aField2.Len() ) { try { @@ -243,87 +323,83 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) { if (cDecimalDelimiter) { - if(nPrecision) + if(io_nPrecisions) { - eType = DataType::DECIMAL; + io_nType = DataType::DECIMAL; static const ::rtl::OUString s_sDECIMAL(RTL_CONSTASCII_USTRINGPARAM("DECIMAL")); - aTypeName = s_sDECIMAL; + o_sTypeName = s_sDECIMAL; } else { - eType = DataType::DOUBLE; + io_nType = DataType::DOUBLE; static const ::rtl::OUString s_sDOUBLE(RTL_CONSTASCII_USTRINGPARAM("DOUBLE")); - aTypeName = s_sDOUBLE; + o_sTypeName = s_sDOUBLE; } } else - eType = DataType::INTEGER; + { + io_nType = DataType::INTEGER; + io_nPrecisions = 0; + io_nScales = 0; + } nFlags = ColumnSearch::BASIC; } else { - switch (comphelper::getNumberFormatType(m_xNumberFormatter,nIndex)) { case NUMBERFORMAT_DATE: - eType = DataType::DATE; + io_nType = DataType::DATE; { static const ::rtl::OUString s_sDATE(RTL_CONSTASCII_USTRINGPARAM("DATE")); - aTypeName = s_sDATE; + o_sTypeName = s_sDATE; } break; case NUMBERFORMAT_DATETIME: - eType = DataType::TIMESTAMP; + io_nType = DataType::TIMESTAMP; { static const ::rtl::OUString s_sTIMESTAMP(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP")); - aTypeName = s_sTIMESTAMP; + o_sTypeName = s_sTIMESTAMP; } break; case NUMBERFORMAT_TIME: - eType = DataType::TIME; + io_nType = DataType::TIME; { static const ::rtl::OUString s_sTIME(RTL_CONSTASCII_USTRINGPARAM("TIME")); - aTypeName = s_sTIME; + o_sTypeName = s_sTIME; } break; default: - eType = DataType::VARCHAR; - nPrecision = 0; // nyi: Daten koennen aber laenger sein! - nScale = 0; + io_nType = DataType::VARCHAR; + io_nPrecisions = 0; // nyi: Data can be longer! + io_nScales = 0; { static const ::rtl::OUString s_sVARCHAR(RTL_CONSTASCII_USTRINGPARAM("VARCHAR")); - aTypeName = s_sVARCHAR; + o_sTypeName = s_sVARCHAR; } }; nFlags |= ColumnSearch::CHAR; } - - // check if the columname already exists - String aAlias(aColumnName); - OSQLColumns::Vector::const_iterator aFind = connectivity::find(m_aColumns->get().begin(),m_aColumns->get().end(),aAlias,aCase); - sal_Int32 nExprCnt = 0; - while(aFind != m_aColumns->get().end()) + } + else + { + String aField; + aFirstLine.GetTokenSpecial(aField,nStartPosFirstLine,m_cFieldDelimiter,'\0'); + if (aField.Len() == 0 || + (m_cStringDelimiter && m_cStringDelimiter == aField.GetChar(0))) { - (aAlias = aColumnName) += String::CreateFromInt32(++nExprCnt); - aFind = connectivity::find(m_aColumns->get().begin(),m_aColumns->get().end(),aAlias,aCase); + if ( m_cStringDelimiter != '\0' ) + aFirstLine.GetTokenSpecial(aField,nStartPosFirstLine2,m_cFieldDelimiter,m_cStringDelimiter); + else + nStartPosFirstLine2 = nStartPosFirstLine; + } + else + { + String aField2; + if ( m_cStringDelimiter != '\0' ) + aFirstLine.GetTokenSpecial(aField2,nStartPosFirstLine2,m_cFieldDelimiter,m_cStringDelimiter); } - - sdbcx::OColumn* pColumn = new sdbcx::OColumn(aAlias,aTypeName,::rtl::OUString(),::rtl::OUString(), - ColumnValue::NULLABLE, - nPrecision, - nScale, - eType, - sal_False, - sal_False, - sal_False, - bCase); - Reference< XPropertySet> xCol = pColumn; - m_aColumns->get().push_back(xCol); - m_aTypes.push_back(eType); - m_aPrecisions.push_back(nPrecision); - m_aScales.push_back(nScale); } - m_pFileStream->Seek(m_nStartRowFilePos); } // ------------------------------------------------------------------------- OFlatTable::OFlatTable(sdbcx::OCollection* _pTables,OFlatConnection* _pConnection, @@ -356,11 +432,11 @@ void OFlatTable::construct() Sequence< ::com::sun::star::uno::Any > aArg(1); aArg[0] <<= aAppLocale; - Reference< ::com::sun::star::util::XNumberFormatsSupplier > xSupplier(m_pConnection->getDriver()->getFactory()->createInstanceWithArguments(::rtl::OUString::createFromAscii("com.sun.star.util.NumberFormatsSupplier"),aArg),UNO_QUERY); - m_xNumberFormatter = Reference< ::com::sun::star::util::XNumberFormatter >(m_pConnection->getDriver()->getFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.util.NumberFormatter")),UNO_QUERY); + Reference< ::com::sun::star::util::XNumberFormatsSupplier > xSupplier(m_pConnection->getDriver()->getFactory()->createInstanceWithArguments(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.NumberFormatsSupplier")),aArg),UNO_QUERY); + m_xNumberFormatter = Reference< ::com::sun::star::util::XNumberFormatter >(m_pConnection->getDriver()->getFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.NumberFormatter"))),UNO_QUERY); m_xNumberFormatter->attachNumberFormatsSupplier(xSupplier); Reference<XPropertySet> xProp(xSupplier->getNumberFormatSettings(),UNO_QUERY); - xProp->getPropertyValue(::rtl::OUString::createFromAscii("NullDate")) >>= m_aNullDate; + xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NullDate"))) >>= m_aNullDate; INetURLObject aURL; aURL.SetURL(getEntry()); @@ -381,7 +457,7 @@ void OFlatTable::construct() sal_Int32 nSize = m_pFileStream->Tell(); m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN); - // Buffersize abhaengig von der Filegroesse + // Buffersize is dependent on the file-size m_pFileStream->SetBufferSize(nSize > 1000000 ? 32768 : nSize > 100000 ? 16384 : nSize > 10000 ? 4096 : 1024); @@ -531,7 +607,7 @@ sal_Bool OFlatTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols,sal *(_rRow->get())[0] = m_nFilePos; if (!bRetrieveData) - return TRUE; + return sal_True; if ( m_bNeedToReadLine ) { sal_Int32 nCurrentPos = 0; @@ -543,7 +619,7 @@ sal_Bool OFlatTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols,sal OFlatConnection* pConnection = (OFlatConnection*)m_pConnection; const sal_Unicode cDecimalDelimiter = pConnection->getDecimalDelimiter(); const sal_Unicode cThousandDelimiter = pConnection->getThousandDelimiter(); - // Felder: + // Fields: xub_StrLen nStartPos = 0; String aStr; OSQLColumns::Vector::const_iterator aIter = _rCols.get().begin(); @@ -558,7 +634,7 @@ sal_Bool OFlatTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols,sal (_rRow->get())[i]->setNull(); else { - // Laengen je nach Datentyp: + // lengths depending on data-type: sal_Int32 nLen, nType = 0; if(bIsTable) @@ -601,7 +677,7 @@ sal_Bool OFlatTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols,sal } break; case DataType::DOUBLE: case DataType::INTEGER: - case DataType::DECIMAL: // #99178# OJ + case DataType::DECIMAL: case DataType::NUMERIC: { @@ -611,11 +687,11 @@ sal_Bool OFlatTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols,sal sal_Unicode* pData = aStrConverted.AllocBuffer(aStr.Len()); const sal_Unicode* pStart = pData; - OSL_ENSURE(cDecimalDelimiter && nType != DataType::INTEGER || - !cDecimalDelimiter && nType == DataType::INTEGER, + OSL_ENSURE((cDecimalDelimiter && nType != DataType::INTEGER) || + (!cDecimalDelimiter && nType == DataType::INTEGER), "FalscherTyp"); - // In Standard-Notation (DezimalPUNKT ohne Tausender-Komma) umwandeln: + // convert to Standard-Notation (DecimalPOINT without thousands-comma): for (xub_StrLen j = 0; j < aStr.Len(); ++j) { const sal_Unicode cChar = aStr.GetChar(j); @@ -623,10 +699,10 @@ sal_Bool OFlatTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols,sal *pData++ = '.'; //aStrConverted.Append( '.' ); else if ( cChar == '.' ) // special case, if decimal seperator isn't '.' we have to put the string after it - continue; // #99189# OJ + continue; else if (cThousandDelimiter && cChar == cThousandDelimiter) { - // weglassen + // leave out } else *pData++ = cChar; @@ -651,7 +727,7 @@ sal_Bool OFlatTable::fetchRow(OValueRefRow& _rRow,const OSQLColumns & _rCols,sal default: { - // Wert als String in Variable der Row uebernehmen + // Copy Value as String in Row-Variable *(_rRow->get())[i] = ORowSetValue(aStr); } break; @@ -671,7 +747,7 @@ sal_Bool OFlatTable::seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatTable::seekRow" ); OSL_ENSURE(m_pFileStream,"OFlatTable::seekRow: FileStream is NULL!"); // ---------------------------------------------------------- - // Positionierung vorbereiten: + // Prepare positioning: m_nFilePos = nCurPos; switch(eCursorPosition) diff --git a/connectivity/source/drivers/flat/ETables.cxx b/connectivity/source/drivers/flat/ETables.cxx index e3b1be37cf..e709141b52 100644 --- a/connectivity/source/drivers/flat/ETables.cxx +++ b/connectivity/source/drivers/flat/ETables.cxx @@ -54,7 +54,7 @@ namespace starutil = ::com::sun::star::util; sdbcx::ObjectType OFlatTables::createObject(const ::rtl::OUString& _rName) { OFlatTable* pRet = new OFlatTable(this,(OFlatConnection*)static_cast<OFileCatalog&>(m_rParent).getConnection(), - _rName,::rtl::OUString::createFromAscii("TABLE")); + _rName,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE"))); sdbcx::ObjectType xRet = pRet; pRet->construct(); return xRet; diff --git a/connectivity/source/drivers/flat/Eservices.cxx b/connectivity/source/drivers/flat/Eservices.cxx index bb142b83fe..a8cddebadf 100644 --- a/connectivity/source/drivers/flat/Eservices.cxx +++ b/connectivity/source/drivers/flat/Eservices.cxx @@ -30,13 +30,11 @@ #include "precompiled_connectivity.hxx" #include "flat/EDriver.hxx" #include <cppuhelper/factory.hxx> -#include <osl/diagnose.h> using namespace connectivity::flat; using ::rtl::OUString; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; -using ::com::sun::star::registry::XRegistryKey; using ::com::sun::star::lang::XSingleServiceFactory; using ::com::sun::star::lang::XMultiServiceFactory; @@ -49,31 +47,6 @@ typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc) rtl_ModuleCount* _pT ); -//*************************************************************************************** -// -// Die vorgeschriebene C-Api muss erfuellt werden! -// Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen. -// - -//--------------------------------------------------------------------------------------- -void REGISTER_PROVIDER( - const OUString& aServiceImplName, - const Sequence< OUString>& Services, - const Reference< ::com::sun::star::registry::XRegistryKey > & xKey) -{ - OUString aMainKeyName; - aMainKeyName = OUString::createFromAscii("/"); - aMainKeyName += aServiceImplName; - aMainKeyName += OUString::createFromAscii("/UNO/SERVICES"); - - Reference< ::com::sun::star::registry::XRegistryKey > xNewKey( xKey->createKey(aMainKeyName) ); - OSL_ENSURE(xNewKey.is(), "FILE::component_writeInfo : could not create a registry key !"); - - for (sal_Int32 i=0; i<Services.getLength(); ++i) - xNewKey->createKey(Services[i]); -} - - //--------------------------------------------------------------------------------------- struct ProviderRequest { @@ -113,7 +86,6 @@ struct ProviderRequest }; //--------------------------------------------------------------------------------------- - extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char **ppEnvTypeName, @@ -124,31 +96,6 @@ component_getImplementationEnvironment( } //--------------------------------------------------------------------------------------- -extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( - void* /*pServiceManager*/, - void* pRegistryKey - ) -{ - if (pRegistryKey) - try - { - Reference< ::com::sun::star::registry::XRegistryKey > xKey(reinterpret_cast< ::com::sun::star::registry::XRegistryKey*>(pRegistryKey)); - - REGISTER_PROVIDER( - ODriver::getImplementationName_Static(), - ODriver::getSupportedServiceNames_Static(), xKey); - - return sal_True; - } - catch (::com::sun::star::registry::InvalidRegistryException& ) - { - OSL_ENSURE(sal_False, "FILE::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !"); - } - - return sal_False; -} - -//--------------------------------------------------------------------------------------- extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplementationName, void* pServiceManager, diff --git a/connectivity/source/drivers/flat/exports.dxp b/connectivity/source/drivers/flat/exports.dxp index 9630d7e067..f0e1c69934 100644..100755 --- a/connectivity/source/drivers/flat/exports.dxp +++ b/connectivity/source/drivers/flat/exports.dxp @@ -1,3 +1,2 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory diff --git a/connectivity/source/drivers/flat/flat.component b/connectivity/source/drivers/flat/flat.component new file mode 100755 index 0000000000..fe8b79ee73 --- /dev/null +++ b/connectivity/source/drivers/flat/flat.component @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.sdbc.flat.ODriver"> + <service name="com.sun.star.sdbc.Driver"/> + <service name="com.sun.star.sdbcx.Driver"/> + </implementation> +</component> diff --git a/connectivity/source/drivers/flat/flat.mxp.map b/connectivity/source/drivers/flat/flat.mxp.map index 54a8532f78..2737c61b5a 100644..100755 --- a/connectivity/source/drivers/flat/flat.mxp.map +++ b/connectivity/source/drivers/flat/flat.mxp.map @@ -1,5 +1,4 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory __mh_dylib_header ___builtin_delete diff --git a/connectivity/source/drivers/flat/flat.xcu b/connectivity/source/drivers/flat/flat.xcu index ed29028ea9..ba43121844 100755..100644 --- a/connectivity/source/drivers/flat/flat.xcu +++ b/connectivity/source/drivers/flat/flat.xcu @@ -75,8 +75,18 @@ <value>false</value> </prop> </node> + <node oor:name="MaxRowScan" oor:op="replace"> + <prop oor:name="Value" oor:type="xs:int"> + <value>100</value> + </prop> + </node> </node> <node oor:name="Features"> + <node oor:name="MaxRowScan" oor:op="replace"> + <prop oor:name="Value" oor:type="xs:boolean"> + <value>true</value> + </prop> + </node> <node oor:name="UseSQL92NamingConstraints" oor:op="replace"> <prop oor:name="Value" oor:type="xs:boolean"> <value>true</value> diff --git a/connectivity/source/drivers/flat/flat.xml b/connectivity/source/drivers/flat/flat.xml index 77b45c48da..77b45c48da 100644..100755 --- a/connectivity/source/drivers/flat/flat.xml +++ b/connectivity/source/drivers/flat/flat.xml diff --git a/connectivity/source/drivers/flat/makefile.mk b/connectivity/source/drivers/flat/makefile.mk index da801c44a8..0fe857919d 100644..100755 --- a/connectivity/source/drivers/flat/makefile.mk +++ b/connectivity/source/drivers/flat/makefile.mk @@ -105,3 +105,11 @@ DEF1EXPORTFILE= exports.dxp .INCLUDE : $(PRJ)$/target.pmk + +ALLTAR : $(MISC)/flat.component + +$(MISC)/flat.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + flat.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt flat.component diff --git a/connectivity/source/drivers/hsqldb/HCatalog.cxx b/connectivity/source/drivers/hsqldb/HCatalog.cxx index 2412ed906c..7c7d66fc00 100644 --- a/connectivity/source/drivers/hsqldb/HCatalog.cxx +++ b/connectivity/source/drivers/hsqldb/HCatalog.cxx @@ -40,7 +40,6 @@ // ------------------------------------------------------------------------- using namespace connectivity; using namespace connectivity::hsqldb; -//using namespace connectivity::sdbcx; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::sdbcx; diff --git a/connectivity/source/drivers/hsqldb/HColumns.cxx b/connectivity/source/drivers/hsqldb/HColumns.cxx index c8d83e0d2b..8c7b58c33d 100644 --- a/connectivity/source/drivers/hsqldb/HColumns.cxx +++ b/connectivity/source/drivers/hsqldb/HColumns.cxx @@ -83,7 +83,7 @@ void OHSQLColumn::construct() Sequence< ::rtl::OUString > SAL_CALL OHSQLColumn::getSupportedServiceNames( ) throw(RuntimeException) { Sequence< ::rtl::OUString > aSupported(1); - aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.Column"); + aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.Column")); return aSupported; } diff --git a/connectivity/source/drivers/hsqldb/HConnection.cxx b/connectivity/source/drivers/hsqldb/HConnection.cxx index 543e6b3932..34888d13d1 100644 --- a/connectivity/source/drivers/hsqldb/HConnection.cxx +++ b/connectivity/source/drivers/hsqldb/HConnection.cxx @@ -219,7 +219,7 @@ namespace connectivity { namespace hsqldb } // ------------------------------------------------------------------- - Reference< XGraphic > SAL_CALL OHsqlConnection::getTableIcon( const ::rtl::OUString& _TableName, ::sal_Int32 _ColorMode ) throw (RuntimeException) + Reference< XGraphic > SAL_CALL OHsqlConnection::getTableIcon( const ::rtl::OUString& _TableName, ::sal_Int32 /*_ColorMode*/ ) throw (RuntimeException) { MethodGuard aGuard( *this ); @@ -227,7 +227,7 @@ namespace connectivity { namespace hsqldb if ( !impl_isTextTable_nothrow( _TableName ) ) return NULL; - return impl_getTextTableIcon_nothrow( _ColorMode ); + return impl_getTextTableIcon_nothrow(); } // ------------------------------------------------------------------- @@ -335,7 +335,7 @@ namespace connectivity { namespace hsqldb { Reference< XRow > xValueAccess( xTableHsqlType, UNO_QUERY_THROW ); ::rtl::OUString sTableType = xValueAccess->getString( 1 ); - bIsTextTable = sTableType.equalsAscii( "TEXT" ); + bIsTextTable = sTableType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "TEXT" ) ); } } catch( const Exception& ) @@ -347,7 +347,7 @@ namespace connectivity { namespace hsqldb } // ------------------------------------------------------------------- - Reference< XGraphic > OHsqlConnection::impl_getTextTableIcon_nothrow( ::sal_Int32 _ColorMode ) + Reference< XGraphic > OHsqlConnection::impl_getTextTableIcon_nothrow() { Reference< XGraphic > xGraphic; try @@ -359,13 +359,12 @@ namespace connectivity { namespace hsqldb // assemble the image URL ::rtl::OUStringBuffer aImageURL; - aImageURL.appendAscii( "private:graphicrepository/" ); // load the graphic from the global graphic repository - aImageURL.appendAscii( "database/" ); // the relative path within the images.zip - if ( _ColorMode == GraphicColorMode::NORMAL ) - aImageURL.appendAscii( LINKED_TEXT_TABLE_IMAGE_RESOURCE ); - else - aImageURL.appendAscii( LINKED_TEXT_TABLE_IMAGE_RESOURCE_HC ); - // the name of the graphic to use + // load the graphic from the global graphic repository + aImageURL.appendAscii( "private:graphicrepository/" ); + // the relative path within the images.zip + aImageURL.appendAscii( "database/" ); + aImageURL.appendAscii( LINKED_TEXT_TABLE_IMAGE_RESOURCE ); + // the name of the graphic to use ::rtl::OUString sImageURL( aImageURL.makeStringAndClear() ); // ask the provider to obtain a graphic diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx index c551312d0c..95d71edee8 100644 --- a/connectivity/source/drivers/hsqldb/HDriver.cxx +++ b/connectivity/source/drivers/hsqldb/HDriver.cxx @@ -57,6 +57,8 @@ #include "resource/hsqldb_res.hrc" #include "resource/sharedresources.hxx" +#include <o3tl/compat_functional.hxx> + //........................................................................ namespace connectivity { @@ -190,11 +192,11 @@ namespace connectivity for (;pIter != pEnd; ++pIter) { - if ( pIter->Name.equalsAscii("Storage") ) + if ( pIter->Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Storage")) ) { xStorage.set(pIter->Value,UNO_QUERY); } - else if ( pIter->Name.equalsAscii("URL") ) + else if ( pIter->Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("URL")) ) { pIter->Value >>= sURL; } @@ -274,22 +276,38 @@ namespace connectivity if ( pStream.get() ) { ByteString sLine; + ByteString sVersionString; while ( pStream->ReadLine(sLine) ) { - if ( sLine.Equals("version=",0,sizeof("version=")-1) ) + if ( sLine.Len() == 0 ) + continue; + const ByteString sIniKey = sLine.GetToken( 0, '=' ); + const ByteString sValue = sLine.GetToken( 1, '=' ); + if ( sIniKey.Equals( "hsqldb.compatible_version" ) ) + { + sVersionString = sValue; + } + else { - sLine = sLine.GetToken(1,'='); - const sal_Int32 nMajor = sLine.GetToken(0,'.').ToInt32(); - const sal_Int32 nMinor = sLine.GetToken(1,'.').ToInt32(); - const sal_Int32 nMicro = sLine.GetToken(2,'.').ToInt32(); - if ( nMajor > 1 - || ( nMajor == 1 && nMinor > 8 ) - || ( nMajor == 1 && nMinor == 8 && nMicro > 0 ) ) + if ( sIniKey.Equals( "version" ) + && ( sVersionString.Len() == 0 ) + ) { - ::connectivity::SharedResources aResources; - sMessage = aResources.getResourceString(STR_ERROR_NEW_VERSION); + sVersionString = sValue; } - break; + } + } + if ( sVersionString.Len() ) + { + const sal_Int32 nMajor = sVersionString.GetToken(0,'.').ToInt32(); + const sal_Int32 nMinor = sVersionString.GetToken(1,'.').ToInt32(); + const sal_Int32 nMicro = sVersionString.GetToken(2,'.').ToInt32(); + if ( nMajor > 1 + || ( nMajor == 1 && nMinor > 8 ) + || ( nMajor == 1 && nMinor == 8 && nMicro > 0 ) ) + { + ::connectivity::SharedResources aResources; + sMessage = aResources.getResourceString(STR_ERROR_NEW_VERSION); } } } @@ -478,14 +496,14 @@ namespace connectivity //------------------------------------------------------------------------------ rtl::OUString ODriverDelegator::getImplementationName_Static( ) throw(RuntimeException) { - return rtl::OUString::createFromAscii("com.sun.star.sdbcx.comp.hsqldb.Driver"); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.comp.hsqldb.Driver")); } //------------------------------------------------------------------------------ Sequence< ::rtl::OUString > ODriverDelegator::getSupportedServiceNames_Static( ) throw (RuntimeException) { Sequence< ::rtl::OUString > aSNS( 2 ); aSNS[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.Driver")); - aSNS[1] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.Driver"); + aSNS[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.Driver")); return aSNS; } //------------------------------------------------------------------ @@ -573,9 +591,9 @@ namespace connectivity if ( xStorage.is() ) { ::rtl::OUString sKey = StorageContainer::getRegisteredKey(xStorage); - TWeakPairVector::iterator i = ::std::find_if(m_aConnections.begin(),m_aConnections.end(),::std::compose1( + TWeakPairVector::iterator i = ::std::find_if(m_aConnections.begin(),m_aConnections.end(),::o3tl::compose1( ::std::bind2nd(::std::equal_to< ::rtl::OUString >(),sKey) - ,::std::compose1(::std::select1st<TWeakConnectionPair>(),::std::select2nd< TWeakPair >()))); + ,::o3tl::compose1(::o3tl::select1st<TWeakConnectionPair>(),::o3tl::select2nd< TWeakPair >()))); if ( i != m_aConnections.end() ) shutdownConnection(i); } @@ -609,9 +627,9 @@ namespace connectivity ::rtl::OUString sKey = StorageContainer::getRegisteredKey(xStorage); if ( sKey.getLength() ) { - TWeakPairVector::iterator i = ::std::find_if(m_aConnections.begin(),m_aConnections.end(),::std::compose1( + TWeakPairVector::iterator i = ::std::find_if(m_aConnections.begin(),m_aConnections.end(),::o3tl::compose1( ::std::bind2nd(::std::equal_to< ::rtl::OUString >(),sKey) - ,::std::compose1(::std::select1st<TWeakConnectionPair>(),::std::select2nd< TWeakPair >()))); + ,::o3tl::compose1(::o3tl::select1st<TWeakConnectionPair>(),::o3tl::select2nd< TWeakPair >()))); OSL_ENSURE( i != m_aConnections.end(), "ODriverDelegator::preCommit: they're committing a storage which I do not know!" ); if ( i != m_aConnections.end() ) { @@ -636,7 +654,7 @@ namespace connectivity } catch(Exception&) { - OSL_ENSURE( false, "ODriverDelegator::preCommit: caught an exception!" ); + OSL_FAIL( "ODriverDelegator::preCommit: caught an exception!" ); } } } @@ -787,7 +805,7 @@ namespace connectivity // second round, this time without matching the country return lcl_getCollationForLocale( _rLocaleString, true ); - OSL_ENSURE( false, "lcl_getCollationForLocale: unknown locale string, falling back to Latin1_General!" ); + OSL_FAIL( "lcl_getCollationForLocale: unknown locale string, falling back to Latin1_General!" ); return "Latin1_General"; } @@ -799,7 +817,7 @@ namespace connectivity { //......................................................... Reference< XMultiServiceFactory > xConfigProvider( - _rxORB->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationProvider" ) ), + _rxORB->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationProvider")) ), UNO_QUERY ); OSL_ENSURE( xConfigProvider.is(), "lcl_getSystemLocale: could not create the config provider!" ); @@ -811,13 +829,13 @@ namespace connectivity // arguments for creating the config access Sequence< Any > aArguments(2); // the path to the node to open - ::rtl::OUString sNodePath = ::rtl::OUString::createFromAscii ("/org.openoffice.Setup/L10N" ); - aArguments[0] <<= PropertyValue( ::rtl::OUString::createFromAscii( "nodepath"), 0, + ::rtl::OUString sNodePath(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Setup/L10N" )); + aArguments[0] <<= PropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")), 0, makeAny( sNodePath ), PropertyState_DIRECT_VALUE ); // the depth: -1 means unlimited aArguments[1] <<= PropertyValue( - ::rtl::OUString::createFromAscii( "depth"), 0, + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("depth")), 0, makeAny( (sal_Int32)-1 ), PropertyState_DIRECT_VALUE ); @@ -825,7 +843,7 @@ namespace connectivity // create the access Reference< XPropertySet > xNode( xConfigProvider->createInstanceWithArguments( - ::rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationAccess" ), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess")), aArguments ), UNO_QUERY ); OSL_ENSURE( xNode.is(), "lcl_getSystemLocale: invalid access returned (should throw an exception instead)!" ); @@ -837,7 +855,7 @@ namespace connectivity } catch( const Exception& ) { - OSL_ENSURE( sal_False, "lcl_getSystemLocale: caught an exception!" ); + OSL_FAIL( "lcl_getSystemLocale: caught an exception!" ); } if ( !sLocaleString.getLength() ) { @@ -875,7 +893,7 @@ namespace connectivity } catch( const Exception& ) { - OSL_ENSURE( sal_False, "ODriverDelegator::onConnectedNewDatabase: caught an exception!" ); + OSL_FAIL( "ODriverDelegator::onConnectedNewDatabase: caught an exception!" ); } } diff --git a/connectivity/source/drivers/hsqldb/HStorageAccess.cxx b/connectivity/source/drivers/hsqldb/HStorageAccess.cxx index b4a898275b..ce69f2e33f 100644 --- a/connectivity/source/drivers/hsqldb/HStorageAccess.cxx +++ b/connectivity/source/drivers/hsqldb/HStorageAccess.cxx @@ -92,7 +92,7 @@ SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_NativeStor } catch(Exception&) { - OSL_ENSURE( false, "NativeStorageAccess::close: caught an exception while flushing!" ); + OSL_FAIL( "NativeStorageAccess::close: caught an exception while flushing!" ); } #ifdef HSQLDB_DBG { @@ -443,7 +443,7 @@ void write_to_storage_stream_from_buffer( JNIEnv* env, jobject /*obj_this*/, jst if (JNI_FALSE != env->ExceptionCheck()) { env->ExceptionClear(); - OSL_ENSURE(0,"ExceptionClear"); + OSL_FAIL("ExceptionClear"); } OSL_ENSURE(buf,"buf is NULL"); if ( buf && len > 0 && len <= env->GetArrayLength(buffer)) @@ -466,7 +466,7 @@ void write_to_storage_stream_from_buffer( JNIEnv* env, jobject /*obj_this*/, jst } catch(Exception& e) { - OSL_ENSURE(0,"Exception caught! : write [BII)V"); + OSL_FAIL("Exception caught! : write [BII)V"); StorageContainer::throwJavaException(e,env); } } @@ -525,7 +525,7 @@ void write_to_storage_stream( JNIEnv* env, jobject /*obj_this*/, jstring name, j } catch(Exception& e) { - OSL_ENSURE(0,"Exception catched! : writeBytes(aData);"); + OSL_FAIL("Exception catched! : writeBytes(aData);"); StorageContainer::throwJavaException(e,env); } } diff --git a/connectivity/source/drivers/hsqldb/HStorageMap.cxx b/connectivity/source/drivers/hsqldb/HStorageMap.cxx index 72722d5645..5e947f223b 100644 --- a/connectivity/source/drivers/hsqldb/HStorageMap.cxx +++ b/connectivity/source/drivers/hsqldb/HStorageMap.cxx @@ -37,6 +37,8 @@ #include "diagnose_ex.h" #include <osl/thread.h> +#include <o3tl/compat_functional.hxx> + //........................................................................ namespace connectivity { @@ -83,7 +85,7 @@ namespace connectivity catch(const Exception& e) { OSL_UNUSED( e ); - OSL_ENSURE(0,"Could not dispose OutputStream"); + OSL_FAIL("Could not dispose OutputStream"); } m_xOutputStream.clear(); } @@ -91,7 +93,7 @@ namespace connectivity catch(Exception& ex) { OSL_UNUSED( ex ); - OSL_ENSURE(0,"Exception catched!"); + OSL_FAIL("Exception catched!"); } } // ----------------------------------------------------------------------------- @@ -136,7 +138,7 @@ namespace connectivity ::rtl::OUString StorageContainer::removeOldURLPrefix(const ::rtl::OUString& _sURL) { ::rtl::OUString sRet = _sURL; -#if defined(WIN) || defined(WNT) +#if defined(WNT) sal_Int32 nIndex = sRet.lastIndexOf('\\'); #else sal_Int32 nIndex = sRet.lastIndexOf('/'); @@ -156,7 +158,7 @@ namespace connectivity if (JNI_FALSE != env->ExceptionCheck()) { env->ExceptionClear(); - OSL_ENSURE(0,"ExceptionClear"); + OSL_FAIL("ExceptionClear"); } ::rtl::OUString aStr; if ( jstr ) @@ -173,7 +175,7 @@ namespace connectivity if (JNI_FALSE != env->ExceptionCheck()) { env->ExceptionClear(); - OSL_ENSURE(0,"ExceptionClear"); + OSL_FAIL("ExceptionClear"); } return aStr; } @@ -185,9 +187,9 @@ namespace connectivity TStorages& rMap = lcl_getStorageMap(); // check if the storage is already in our map TStorages::iterator aFind = ::std::find_if(rMap.begin(),rMap.end(), - ::std::compose1( + ::o3tl::compose1( ::std::bind2nd(::std::equal_to<Reference<XStorage> >(),_xStorage) - ,::std::compose1(::std::select1st<TStorageURLPair>(),::std::compose1(::std::select1st<TStorages::mapped_type>(),::std::select2nd<TStorages::value_type>()))) + ,::o3tl::compose1(::o3tl::select1st<TStorageURLPair>(),::o3tl::compose1(::o3tl::select1st<TStorages::mapped_type>(),::o3tl::select2nd<TStorages::value_type>()))) ); if ( aFind == rMap.end() ) { @@ -216,9 +218,9 @@ namespace connectivity TStorages& rMap = lcl_getStorageMap(); // check if the storage is already in our map TStorages::iterator aFind = ::std::find_if(rMap.begin(),rMap.end(), - ::std::compose1( + ::o3tl::compose1( ::std::bind2nd(::std::equal_to<Reference<XStorage> >(),_xStorage) - ,::std::compose1(::std::select1st<TStorageURLPair>(),::std::compose1(::std::select1st<TStorages::mapped_type>(),::std::select2nd<TStorages::value_type>()))) + ,::o3tl::compose1(::o3tl::select1st<TStorageURLPair>(),::o3tl::compose1(::o3tl::select1st<TStorages::mapped_type>(),::o3tl::select2nd<TStorages::value_type>()))) ); if ( aFind != rMap.end() ) sKey = aFind->first; @@ -311,7 +313,7 @@ namespace connectivity if ( _nMode < 16 ) sMessage += "0"; sMessage += ::rtl::OString::valueOf( _nMode, 16 ).toAsciiUpperCase(); - OSL_ENSURE( false, sMessage.getStr() ); + OSL_FAIL( sMessage.getStr() ); #endif StorageContainer::throwJavaException(e,env); } diff --git a/connectivity/source/drivers/hsqldb/HTable.cxx b/connectivity/source/drivers/hsqldb/HTable.cxx index 8b426adfaa..732737eaf8 100644 --- a/connectivity/source/drivers/hsqldb/HTable.cxx +++ b/connectivity/source/drivers/hsqldb/HTable.cxx @@ -327,7 +327,7 @@ void OHSQLTable::dropDefaultValue(const ::rtl::OUString& _rColName) // ----------------------------------------------------------------------------- ::rtl::OUString OHSQLTable::getAlterTableColumnPart() { - ::rtl::OUString sSql = ::rtl::OUString::createFromAscii("ALTER TABLE "); + ::rtl::OUString sSql( RTL_CONSTASCII_USTRINGPARAM( "ALTER TABLE " )); const ::rtl::OUString sQuote = getMetaData()->getIdentifierQuoteString( ); ::rtl::OUString sComposedName( ::dbtools::composeTableName( getMetaData(), m_CatalogName, m_SchemaName, m_Name, sal_True, ::dbtools::eInTableDefinitions ) ); @@ -340,7 +340,7 @@ void OHSQLTable::executeStatement(const ::rtl::OUString& _rStatement ) { ::rtl::OUString sSQL = _rStatement; if(sSQL.lastIndexOf(',') == (sSQL.getLength()-1)) - sSQL = sSQL.replaceAt(sSQL.getLength()-1,1,::rtl::OUString::createFromAscii(")")); + sSQL = sSQL.replaceAt(sSQL.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"))); Reference< XStatement > xStmt = getConnection()->createStatement( ); if ( xStmt.is() ) diff --git a/connectivity/source/drivers/hsqldb/HTables.cxx b/connectivity/source/drivers/hsqldb/HTables.cxx index ea2521a633..0e0725af27 100644 --- a/connectivity/source/drivers/hsqldb/HTables.cxx +++ b/connectivity/source/drivers/hsqldb/HTables.cxx @@ -140,14 +140,14 @@ void OTables::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) ::rtl::OUString sCatalog,sSchema,sTable; ::dbtools::qualifiedNameComponents(m_xMetaData,_sElementName,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation); - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DROP "); + ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "DROP " )); Reference<XPropertySet> xProp(xObject,UNO_QUERY); sal_Bool bIsView; - if((bIsView = (xProp.is() && ::comphelper::getString(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))) == ::rtl::OUString::createFromAscii("VIEW")))) // here we have a view - aSql += ::rtl::OUString::createFromAscii("VIEW "); + if((bIsView = (xProp.is() && ::comphelper::getString(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))) == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VIEW"))))) // here we have a view + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VIEW ")); else - aSql += ::rtl::OUString::createFromAscii("TABLE "); + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE ")); ::rtl::OUString sComposedName( ::dbtools::composeTableName( m_xMetaData, sCatalog, sSchema, sTable, sal_True, ::dbtools::eInDataManipulation ) ); diff --git a/connectivity/source/drivers/hsqldb/HUser.cxx b/connectivity/source/drivers/hsqldb/HUser.cxx index 840e54d3f6..a968a0ca0d 100644 --- a/connectivity/source/drivers/hsqldb/HUser.cxx +++ b/connectivity/source/drivers/hsqldb/HUser.cxx @@ -131,16 +131,16 @@ void OHSQLUser::findPrivilegesAndGrantPrivileges(const ::rtl::OUString& objName, if ( xRes.is() ) { - static const ::rtl::OUString sSELECT = ::rtl::OUString::createFromAscii("SELECT"); - static const ::rtl::OUString sINSERT = ::rtl::OUString::createFromAscii("INSERT"); - static const ::rtl::OUString sUPDATE = ::rtl::OUString::createFromAscii("UPDATE"); - static const ::rtl::OUString sDELETE = ::rtl::OUString::createFromAscii("DELETE"); - static const ::rtl::OUString sREAD = ::rtl::OUString::createFromAscii("READ"); - static const ::rtl::OUString sCREATE = ::rtl::OUString::createFromAscii("CREATE"); - static const ::rtl::OUString sALTER = ::rtl::OUString::createFromAscii("ALTER"); - static const ::rtl::OUString sREFERENCE = ::rtl::OUString::createFromAscii("REFERENCE"); - static const ::rtl::OUString sDROP = ::rtl::OUString::createFromAscii("DROP"); - static const ::rtl::OUString sYes = ::rtl::OUString::createFromAscii("YES"); + static const ::rtl::OUString sSELECT( RTL_CONSTASCII_USTRINGPARAM( "SELECT" )); + static const ::rtl::OUString sINSERT( RTL_CONSTASCII_USTRINGPARAM( "INSERT" )); + static const ::rtl::OUString sUPDATE( RTL_CONSTASCII_USTRINGPARAM( "UPDATE" )); + static const ::rtl::OUString sDELETE( RTL_CONSTASCII_USTRINGPARAM( "DELETE" )); + static const ::rtl::OUString sREAD( RTL_CONSTASCII_USTRINGPARAM( "READ" )); + static const ::rtl::OUString sCREATE( RTL_CONSTASCII_USTRINGPARAM( "CREATE" )); + static const ::rtl::OUString sALTER( RTL_CONSTASCII_USTRINGPARAM( "ALTER" )); + static const ::rtl::OUString sREFERENCE( RTL_CONSTASCII_USTRINGPARAM( "REFERENCE" )); + static const ::rtl::OUString sDROP( RTL_CONSTASCII_USTRINGPARAM( "DROP" )); + static const ::rtl::OUString sYes( RTL_CONSTASCII_USTRINGPARAM( "YES" )); nRightsWithGrant = nRights = 0; @@ -239,12 +239,12 @@ void SAL_CALL OHSQLUser::grantPrivileges( const ::rtl::OUString& objName, sal_In if(sPrivs.getLength()) { ::rtl::OUString sGrant; - sGrant += ::rtl::OUString::createFromAscii("GRANT "); + sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GRANT ")); sGrant += sPrivs; - sGrant += ::rtl::OUString::createFromAscii(" ON "); + sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON ")); Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData(); sGrant += ::dbtools::quoteTableName(xMeta,objName,::dbtools::eInDataManipulation); - sGrant += ::rtl::OUString::createFromAscii(" TO "); + sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" TO ")); sGrant += m_Name; Reference<XStatement> xStmt = m_xConnection->createStatement(); @@ -269,12 +269,12 @@ void SAL_CALL OHSQLUser::revokePrivileges( const ::rtl::OUString& objName, sal_I if(sPrivs.getLength()) { ::rtl::OUString sGrant; - sGrant += ::rtl::OUString::createFromAscii("REVOKE "); + sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("REVOKE ")); sGrant += sPrivs; - sGrant += ::rtl::OUString::createFromAscii(" ON "); + sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON ")); Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData(); sGrant += ::dbtools::quoteTableName(xMeta,objName,::dbtools::eInDataManipulation); - sGrant += ::rtl::OUString::createFromAscii(" FROM "); + sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" FROM ")); sGrant += m_Name; Reference<XStatement> xStmt = m_xConnection->createStatement(); @@ -290,11 +290,11 @@ void SAL_CALL OHSQLUser::changePassword( const ::rtl::OUString& /*oldPassword*/, ::osl::MutexGuard aGuard(m_aMutex); checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed); ::rtl::OUString sAlterPwd; - sAlterPwd = ::rtl::OUString::createFromAscii("SET PASSWORD FOR "); + sAlterPwd = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SET PASSWORD FOR ")); sAlterPwd += m_Name; - sAlterPwd += ::rtl::OUString::createFromAscii("@\"%\" = PASSWORD('") ; + sAlterPwd += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("@\"%\" = PASSWORD('")) ; sAlterPwd += newPassword; - sAlterPwd += ::rtl::OUString::createFromAscii("')") ; + sAlterPwd += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("')")) ; Reference<XStatement> xStmt = m_xConnection->createStatement(); @@ -309,41 +309,41 @@ void SAL_CALL OHSQLUser::changePassword( const ::rtl::OUString& /*oldPassword*/, { ::rtl::OUString sPrivs; if((nRights & Privilege::INSERT) == Privilege::INSERT) - sPrivs += ::rtl::OUString::createFromAscii("INSERT"); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INSERT")); if((nRights & Privilege::DELETE) == Privilege::DELETE) { if(sPrivs.getLength()) - sPrivs += ::rtl::OUString::createFromAscii(","); - sPrivs += ::rtl::OUString::createFromAscii("DELETE"); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DELETE")); } if((nRights & Privilege::UPDATE) == Privilege::UPDATE) { if(sPrivs.getLength()) - sPrivs += ::rtl::OUString::createFromAscii(","); - sPrivs += ::rtl::OUString::createFromAscii("UPDATE"); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UPDATE")); } if((nRights & Privilege::ALTER) == Privilege::ALTER) { if(sPrivs.getLength()) - sPrivs += ::rtl::OUString::createFromAscii(","); - sPrivs += ::rtl::OUString::createFromAscii("ALTER"); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ALTER")); } if((nRights & Privilege::SELECT) == Privilege::SELECT) { if(sPrivs.getLength()) - sPrivs += ::rtl::OUString::createFromAscii(","); - sPrivs += ::rtl::OUString::createFromAscii("SELECT"); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SELECT")); } if((nRights & Privilege::REFERENCE) == Privilege::REFERENCE) { if(sPrivs.getLength()) - sPrivs += ::rtl::OUString::createFromAscii(","); - sPrivs += ::rtl::OUString::createFromAscii("REFERENCES"); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("REFERENCES")); } return sPrivs; diff --git a/connectivity/source/drivers/hsqldb/HUsers.cxx b/connectivity/source/drivers/hsqldb/HUsers.cxx index 6e91008f1d..9816e56c4f 100644 --- a/connectivity/source/drivers/hsqldb/HUsers.cxx +++ b/connectivity/source/drivers/hsqldb/HUsers.cxx @@ -44,7 +44,6 @@ using namespace connectivity; using namespace connectivity::hsqldb; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; -// using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; @@ -81,18 +80,18 @@ Reference< XPropertySet > OUsers::createDescriptor() // XAppend sdbcx::ObjectType OUsers::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor ) { - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("GRANT USAGE ON * TO "); + ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "GRANT USAGE ON * TO " )); ::rtl::OUString aQuote = m_xConnection->getMetaData()->getIdentifierQuoteString( ); ::rtl::OUString sUserName( _rForName ); aSql += ::dbtools::quoteName(aQuote,sUserName) - + ::rtl::OUString::createFromAscii(" @\"%\" "); + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" @\"%\" ")); ::rtl::OUString sPassword; descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD)) >>= sPassword; if ( sPassword.getLength() ) { - aSql += ::rtl::OUString::createFromAscii(" IDENTIFIED BY '"); + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" IDENTIFIED BY '")); aSql += sPassword; - aSql += ::rtl::OUString::createFromAscii("'"); + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'")); } Reference< XStatement > xStmt = m_xConnection->createStatement( ); @@ -107,7 +106,7 @@ sdbcx::ObjectType OUsers::appendObject( const ::rtl::OUString& _rForName, const void OUsers::dropObject(sal_Int32 /*nPos*/,const ::rtl::OUString _sElementName) { { - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("REVOKE ALL ON * FROM "); + ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "REVOKE ALL ON * FROM " )); ::rtl::OUString aQuote = m_xConnection->getMetaData()->getIdentifierQuoteString( ); aSql += ::dbtools::quoteName(aQuote,_sElementName); diff --git a/connectivity/source/drivers/hsqldb/HViews.cxx b/connectivity/source/drivers/hsqldb/HViews.cxx index 2c8c429d87..55b51f66fc 100644 --- a/connectivity/source/drivers/hsqldb/HViews.cxx +++ b/connectivity/source/drivers/hsqldb/HViews.cxx @@ -119,7 +119,7 @@ void HViews::dropObject(sal_Int32 _nPos,const ::rtl::OUString /*_sElementName*/) sal_Bool bIsNew = connectivity::sdbcx::ODescriptor::isNew( xObject ); if (!bIsNew) { - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DROP VIEW"); + ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "DROP VIEW" )); Reference<XPropertySet> xProp(xObject,UNO_QUERY); aSql += ::dbtools::composeTableName( m_xMetaData, xProp, ::dbtools::eInTableDefinitions, false, false, true ); @@ -142,13 +142,13 @@ void HViews::createView( const Reference< XPropertySet >& descriptor ) { Reference<XConnection> xConnection = static_cast<OHCatalog&>(m_rParent).getConnection(); - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("CREATE VIEW "); + ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "CREATE VIEW " )); ::rtl::OUString aQuote = xConnection->getMetaData()->getIdentifierQuoteString( ); ::rtl::OUString sSchema,sCommand; aSql += ::dbtools::composeTableName( m_xMetaData, descriptor, ::dbtools::eInTableDefinitions, false, false, true ); - aSql += ::rtl::OUString::createFromAscii(" AS "); + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" AS ")); descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND)) >>= sCommand; aSql += sCommand; diff --git a/connectivity/source/drivers/hsqldb/Hservices.cxx b/connectivity/source/drivers/hsqldb/Hservices.cxx index 12fd647576..98eacbb5bb 100644 --- a/connectivity/source/drivers/hsqldb/Hservices.cxx +++ b/connectivity/source/drivers/hsqldb/Hservices.cxx @@ -31,13 +31,11 @@ #include "hsqldb/HDriver.hxx" #include <cppuhelper/factory.hxx> -#include <osl/diagnose.h> using namespace connectivity::hsqldb; using ::rtl::OUString; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; -using ::com::sun::star::registry::XRegistryKey; using ::com::sun::star::lang::XSingleServiceFactory; using ::com::sun::star::lang::XMultiServiceFactory; @@ -50,31 +48,6 @@ typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc) rtl_ModuleCount* _pT ); -//*************************************************************************************** -// -// Die vorgeschriebene C-Api muss erfuellt werden! -// Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen. -// - -//--------------------------------------------------------------------------------------- -void REGISTER_PROVIDER( - const OUString& aServiceImplName, - const Sequence< OUString>& Services, - const Reference< ::com::sun::star::registry::XRegistryKey > & xKey) -{ - OUString aMainKeyName; - aMainKeyName = OUString::createFromAscii("/"); - aMainKeyName += aServiceImplName; - aMainKeyName += OUString::createFromAscii("/UNO/SERVICES"); - - Reference< ::com::sun::star::registry::XRegistryKey > xNewKey( xKey->createKey(aMainKeyName) ); - OSL_ENSURE(xNewKey.is(), "ADABAS::component_writeInfo : could not create a registry key !"); - - for (sal_Int32 i=0; i<Services.getLength(); ++i) - xNewKey->createKey(Services[i]); -} - - //--------------------------------------------------------------------------------------- struct ProviderRequest { @@ -114,7 +87,6 @@ struct ProviderRequest }; //--------------------------------------------------------------------------------------- - extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char **ppEnvTypeName, @@ -125,31 +97,6 @@ component_getImplementationEnvironment( } //--------------------------------------------------------------------------------------- -extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( - void* /*pServiceManager*/, - void* pRegistryKey - ) -{ - if (pRegistryKey) - try - { - Reference< ::com::sun::star::registry::XRegistryKey > xKey(reinterpret_cast< ::com::sun::star::registry::XRegistryKey*>(pRegistryKey)); - - REGISTER_PROVIDER( - ODriverDelegator::getImplementationName_Static(), - ODriverDelegator::getSupportedServiceNames_Static(), xKey); - - return sal_True; - } - catch (::com::sun::star::registry::InvalidRegistryException& ) - { - OSL_ENSURE(sal_False, "ODBC::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !"); - } - - return sal_False; -} - -//--------------------------------------------------------------------------------------- extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplementationName, void* pServiceManager, diff --git a/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx b/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx index 532d7ca0de..98d8322d50 100644 --- a/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx +++ b/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx @@ -91,7 +91,7 @@ SAL_DLLPUBLIC_EXPORT jboolean JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Storag } catch(Exception& e) { - OSL_ENSURE(0,"Exception catched! : Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_isStreamElement"); + OSL_FAIL("Exception catched! : Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_isStreamElement"); if (JNI_FALSE != env->ExceptionCheck()) env->ExceptionClear(); ::rtl::OString cstr( ::rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_JAVA_UTF8 ) ); @@ -130,7 +130,7 @@ SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageFil } catch(Exception& e) { - OSL_ENSURE(0,"Exception catched! : Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_removeElement"); + OSL_FAIL("Exception catched! : Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_removeElement"); StorageContainer::throwJavaException(e,env); } } @@ -173,7 +173,7 @@ SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageFil } catch(Exception& e) { - OSL_ENSURE(0,"Exception catched! : Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_renameElement"); + OSL_FAIL("Exception catched! : Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_renameElement"); StorageContainer::throwJavaException(e,env); } } diff --git a/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx b/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx index be64f013d7..c80eba89c2 100644 --- a/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx +++ b/connectivity/source/drivers/hsqldb/StorageNativeInputStream.cxx @@ -191,7 +191,7 @@ SAL_DLLPUBLIC_EXPORT jlong JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNa } catch(Exception& e) { - OSL_ENSURE(0,"Exception catched! : skip();"); + OSL_FAIL("Exception catched! : skip();"); StorageContainer::throwJavaException(e,env); } } @@ -234,7 +234,7 @@ SAL_DLLPUBLIC_EXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNat } catch(Exception& e) { - OSL_ENSURE(0,"Exception caught! : available();"); + OSL_FAIL("Exception caught! : available();"); StorageContainer::throwJavaException(e,env); } } @@ -278,7 +278,7 @@ SAL_DLLPUBLIC_EXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNat } catch(Exception& e) { - OSL_ENSURE(0,"Exception catched! : skip();"); + OSL_FAIL("Exception catched! : skip();"); StorageContainer::throwJavaException(e,env); } diff --git a/connectivity/source/drivers/hsqldb/StorageNativeOutputStream.cxx b/connectivity/source/drivers/hsqldb/StorageNativeOutputStream.cxx index 36ec342e32..17b7fd89db 100644 --- a/connectivity/source/drivers/hsqldb/StorageNativeOutputStream.cxx +++ b/connectivity/source/drivers/hsqldb/StorageNativeOutputStream.cxx @@ -213,7 +213,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb } catch(Exception&) { - OSL_ENSURE( false, "StorageNativeOutputStream::sync: could not flush output stream!" ); + OSL_FAIL( "StorageNativeOutputStream::sync: could not flush output stream!" ); } } } diff --git a/connectivity/source/drivers/hsqldb/exports.dxp b/connectivity/source/drivers/hsqldb/exports.dxp index 7ff56f4f99..3efc73741d 100644..100755 --- a/connectivity/source/drivers/hsqldb/exports.dxp +++ b/connectivity/source/drivers/hsqldb/exports.dxp @@ -1,5 +1,4 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_openStream Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_write__Ljava_lang_String_2Ljava_lang_String_2_3BII diff --git a/connectivity/source/drivers/hsqldb/hsqldb.component b/connectivity/source/drivers/hsqldb/hsqldb.component new file mode 100755 index 0000000000..eb8ae477e7 --- /dev/null +++ b/connectivity/source/drivers/hsqldb/hsqldb.component @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.sdbcx.comp.hsqldb.Driver"> + <service name="com.sun.star.sdbc.Driver"/> + <service name="com.sun.star.sdbcx.Driver"/> + </implementation> +</component> diff --git a/connectivity/source/drivers/hsqldb/hsqldb.map b/connectivity/source/drivers/hsqldb/hsqldb.map index a13f907752..c1d8320d19 100644..100755 --- a/connectivity/source/drivers/hsqldb/hsqldb.map +++ b/connectivity/source/drivers/hsqldb/hsqldb.map @@ -1,7 +1,6 @@ UDK_3_0_0 { global: component_getImplementationEnvironment; - component_writeInfo; component_getFactory; Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_openStream; Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeOutputStream_write__Ljava_lang_String_2Ljava_lang_String_2_3BII; diff --git a/connectivity/source/drivers/hsqldb/hsqldb.xcu b/connectivity/source/drivers/hsqldb/hsqldb.xcu index af9c348242..af9c348242 100755..100644 --- a/connectivity/source/drivers/hsqldb/hsqldb.xcu +++ b/connectivity/source/drivers/hsqldb/hsqldb.xcu diff --git a/connectivity/source/drivers/hsqldb/hsqldb.xml b/connectivity/source/drivers/hsqldb/hsqldb.xml index f8e5c61af6..f8e5c61af6 100644..100755 --- a/connectivity/source/drivers/hsqldb/hsqldb.xml +++ b/connectivity/source/drivers/hsqldb/hsqldb.xml diff --git a/connectivity/source/drivers/hsqldb/hsqlui.hrc b/connectivity/source/drivers/hsqldb/hsqlui.hrc index 052b603a72..e17ffb5e99 100644..100755 --- a/connectivity/source/drivers/hsqldb/hsqlui.hrc +++ b/connectivity/source/drivers/hsqldb/hsqlui.hrc @@ -29,7 +29,6 @@ #define CONNECTIVITY_HSQLUI_HRC #define LINKED_TEXT_TABLE_IMAGE_RESOURCE "linked_text_table.png" -#define LINKED_TEXT_TABLE_IMAGE_RESOURCE_HC "linked_text_table_hc.png" #endif // CONNECTIVITY_HSQLUI_HRC diff --git a/connectivity/source/drivers/hsqldb/hsqlui.src b/connectivity/source/drivers/hsqldb/hsqlui.src index 0e0189c5e2..27166edf26 100644 --- a/connectivity/source/drivers/hsqldb/hsqlui.src +++ b/connectivity/source/drivers/hsqldb/hsqlui.src @@ -32,7 +32,7 @@ /* Note: The resource file built here (hsqldb.res, finally) is *not* included in the final OOo installation. Instead, it is only built to ensure that - the two images below are included in the application-wide image repository + the image below is included in the application-wide image repository (images.zip). This way, they can be accessed at runtime, but without the indirection via a resource file - the GraphicProvider service supports a "private:imagerepository/*" protocol meanwhile, which allows this. @@ -46,8 +46,3 @@ Image 1000 { ImageBitmap = Bitmap { File = LINKED_TEXT_TABLE_IMAGE_RESOURCE; }; }; - -Image 1001 -{ - ImageBitmap = Bitmap { File = LINKED_TEXT_TABLE_IMAGE_RESOURCE_HC; }; -}; diff --git a/connectivity/source/drivers/hsqldb/makefile.mk b/connectivity/source/drivers/hsqldb/makefile.mk index 21274e8d42..6e400696fa 100644..100755 --- a/connectivity/source/drivers/hsqldb/makefile.mk +++ b/connectivity/source/drivers/hsqldb/makefile.mk @@ -103,6 +103,7 @@ SHL1STDLIBS=\ SHL1DEPN= +SHL1CREATEJNILIB=TRUE SHL1IMPLIB= i$(HSQLDB_TARGET) SHL1DEF= $(MISC)$/$(SHL1TARGET).def @@ -115,3 +116,11 @@ DEF1EXPORTFILE= exports.dxp .INCLUDE : $(PRJ)$/target.pmk + +ALLTAR : $(MISC)/hsqldb.component + +$(MISC)/hsqldb.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + hsqldb.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt hsqldb.component diff --git a/connectivity/source/drivers/jdbc/Array.cxx b/connectivity/source/drivers/jdbc/Array.cxx index db0a3bf5c0..77b2492b9f 100644 --- a/connectivity/source/drivers/jdbc/Array.cxx +++ b/connectivity/source/drivers/jdbc/Array.cxx @@ -44,7 +44,7 @@ java_sql_Array::~java_sql_Array() jclass java_sql_Array::getMyClass() const { - // die Klasse muss nur einmal geholt werden, daher statisch + // the class must be fetched once, therefore its static if( !theClass ) theClass = findMyClass("java/sql/Array"); @@ -65,87 +65,77 @@ sal_Int32 SAL_CALL java_sql_Array::getBaseType( ) throw(::com::sun::star::sdbc: ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL java_sql_Array::getArray( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { - jobjectArray out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { jobject obj = convertTypeMapToJavaMap(t.pEnv,typeMap); static const char * cSignature = "(Ljava/util/Map;)[Ljava/lang/Object;"; static const char * cMethodName = "getArray"; static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); - // Java-Call absetzen - out = (jobjectArray)t.pEnv->CallObjectMethod( object, mID, obj); + // submit Java-Call + (jobjectArray)t.pEnv->CallObjectMethod( object, mID, obj); ThrowSQLException(t.pEnv,*this); - // und aufraeumen + // and clean up t.pEnv->DeleteLocalRef(obj); } //t.pEnv - return ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >();//copyArrayAndDelete< ::com::sun::star::uno::Any,jobject>(t.pEnv,out); + return ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >(); } ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL java_sql_Array::getArrayAtIndex( sal_Int32 index, sal_Int32 count, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { - jobjectArray out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { jobject obj = convertTypeMapToJavaMap(t.pEnv,typeMap); static const char * cSignature = "(IILjava/util/Map;)[Ljava/lang/Object;"; static const char * cMethodName = "getArray"; - // Java-Call absetzen + // submit Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); - out = (jobjectArray)t.pEnv->CallObjectMethod( object, mID, index,count,obj); + (jobjectArray)t.pEnv->CallObjectMethod( object, mID, index,count,obj); ThrowSQLException(t.pEnv,*this); - // und aufraeumen + // and clean up t.pEnv->DeleteLocalRef(obj); - } //t.pEnv - return ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >();//copyArrayAndDelete< ::com::sun::star::uno::Any,jobject>(t.pEnv,out); + } + return ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >(); } ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL java_sql_Array::getResultSet( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { - jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); { - // Parameter konvertieren + // convert Parameter jobject obj = convertTypeMapToJavaMap(t.pEnv,typeMap); - // temporaere Variable initialisieren + // initialize temporary variable static const char * cSignature = "(Ljava/util/Map;)Ljava/sql/ResultSet;"; static const char * cMethodName = "getResultSet"; - // Java-Call absetzen + // submit Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); - out = t.pEnv->CallObjectMethod( object, mID, obj); + t.pEnv->CallObjectMethod( object, mID, obj); ThrowSQLException(t.pEnv,*this); - // und aufraeumen + // and cleanup t.pEnv->DeleteLocalRef(obj); - } //t.pEnv - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! - // return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); + } return NULL; } ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL java_sql_Array::getResultSetAtIndex( sal_Int32 index, sal_Int32 count, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { - jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); { - // Parameter konvertieren + // convert parameter jobject obj = convertTypeMapToJavaMap(t.pEnv,typeMap); - // temporaere Variable initialisieren + // initialize temporary variable static const char * cSignature = "(Ljava/util/Map;)Ljava/sql/ResultSet;"; static const char * cMethodName = "getResultSetAtIndex"; // Java-Call absetzen static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); - out = t.pEnv->CallObjectMethod( object, mID, index,count,obj); + t.pEnv->CallObjectMethod( object, mID, index,count,obj); ThrowSQLException(t.pEnv,*this); - // und aufraeumen + // and cleanup t.pEnv->DeleteLocalRef(obj); - } //t.pEnv - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! - // return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out ); + } return NULL; } diff --git a/connectivity/source/drivers/jdbc/Blob.cxx b/connectivity/source/drivers/jdbc/Blob.cxx index d523786a31..a0d9fd73a8 100644 --- a/connectivity/source/drivers/jdbc/Blob.cxx +++ b/connectivity/source/drivers/jdbc/Blob.cxx @@ -53,7 +53,7 @@ java_sql_Blob::~java_sql_Blob() jclass java_sql_Blob::getMyClass() const { - // die Klasse muss nur einmal geholt werden, daher statisch + // the class must be fetched only once, therefore it's static if( !theClass ) theClass = findMyClass("java/sql/Blob"); return theClass; @@ -65,10 +65,10 @@ sal_Int64 SAL_CALL java_sql_Blob::length( ) throw(::com::sun::star::sdbc::SQLEx SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); { - // temporaere Variable initialisieren + // initialize temporary variable static const char * cSignature = "()J"; static const char * cMethodName = "length"; - // Java-Call absetzen + // submit Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); out = t.pEnv->CallLongMethod( object, mID ); @@ -82,10 +82,10 @@ sal_Int64 SAL_CALL java_sql_Blob::length( ) throw(::com::sun::star::sdbc::SQLEx SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); ::com::sun::star::uno::Sequence< sal_Int8 > aSeq; { - // temporaere Variable initialisieren + // initialize temporary variable static const char * cSignature = "(JI)[B"; static const char * cMethodName = "getBytes"; - // Java-Call absetzen + // submit Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); jbyteArray out = (jbyteArray)t.pEnv->CallObjectMethod( object, mID,pos,count); @@ -98,7 +98,7 @@ sal_Int64 SAL_CALL java_sql_Blob::length( ) throw(::com::sun::star::sdbc::SQLEx t.pEnv->DeleteLocalRef(out); } } //t.pEnv - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // WARNING: the caller becomes the owner of the returned pointer return aSeq; } @@ -107,7 +107,7 @@ sal_Int64 SAL_CALL java_sql_Blob::length( ) throw(::com::sun::star::sdbc::SQLEx SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); static jmethodID mID(NULL); jobject out = callObjectMethod(t.pEnv,"getBinaryStream","()Ljava/io/InputStream;", mID); - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // WARNING: the caller becomes the owner of the returned pointer return out==0 ? 0 : new java_io_InputStream( t.pEnv, out ); } @@ -117,13 +117,13 @@ sal_Int64 SAL_CALL java_sql_Blob::position( const ::com::sun::star::uno::Sequenc SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); { - // temporaere Variable initialisieren + // initialize temporary variable static const char * cSignature = "([BI)J"; static const char * cMethodName = "position"; - // Java-Call absetzen + // submit Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); - // Parameter konvertieren + // convert Parameter jbyteArray pByteArray = t.pEnv->NewByteArray(pattern.getLength()); t.pEnv->SetByteArrayRegion(pByteArray,0,pattern.getLength(),(jbyte*)pattern.getConstArray()); out = t.pEnv->CallLongMethod( object, mID, pByteArray,start ); @@ -140,7 +140,7 @@ sal_Int64 SAL_CALL java_sql_Blob::positionOfBlob( const ::com::sun::star::uno::R // the pattern parameter. Since the effort for proper implementation is rather high - we would need // to translated patter into a byte[] -, we defer this functionality for the moment (hey, it was // unusable, anyway) - // 2005-11-15 / #i57457# / frank.schoenheit@sun.com + // #i57457# return 0; } diff --git a/connectivity/source/drivers/jdbc/Boolean.cxx b/connectivity/source/drivers/jdbc/Boolean.cxx index b69ef1a73b..cc41160b28 100644 --- a/connectivity/source/drivers/jdbc/Boolean.cxx +++ b/connectivity/source/drivers/jdbc/Boolean.cxx @@ -40,7 +40,7 @@ java_lang_Boolean::~java_lang_Boolean() {} jclass java_lang_Boolean::st_getMyClass() { - // die Klasse muss nur einmal geholt werden, daher statisch + // the class must be fetched only once, therefore static if( !theClass ) theClass = findMyClass("java/lang/Boolean"); return theClass; diff --git a/connectivity/source/drivers/jdbc/CallableStatement.cxx b/connectivity/source/drivers/jdbc/CallableStatement.cxx index 293bb7e9ba..910b64347d 100644 --- a/connectivity/source/drivers/jdbc/CallableStatement.cxx +++ b/connectivity/source/drivers/jdbc/CallableStatement.cxx @@ -44,7 +44,6 @@ using namespace connectivity; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; -// using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; @@ -165,9 +164,9 @@ Any SAL_CALL java_sql_CallableStatement::getObject( sal_Int32 columnIndex, const SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); createStatement(t.pEnv); static jmethodID mID(NULL); - /*jobject out = */callObjectMethodWithIntArg(t.pEnv,"getObject","(I)Ljava/lang/Object;", mID, columnIndex); - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! - return Any(); //out==0 ? 0 : new java_lang_Object( t.pEnv, out ); + callObjectMethodWithIntArg(t.pEnv,"getObject","(I)Ljava/lang/Object;", mID, columnIndex); + // WARNING: the caller becomes the owner of the returned pointer + return Any(); } sal_Int16 SAL_CALL java_sql_CallableStatement::getShort( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) @@ -195,7 +194,7 @@ sal_Int16 SAL_CALL java_sql_CallableStatement::getShort( sal_Int32 columnIndex ) createStatement(t.pEnv); static jmethodID mID(NULL); jobject out = callObjectMethodWithIntArg(t.pEnv,"getTime","(I)Ljava/sql/Time;", mID, columnIndex); - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // WARNING: the caller becomes the owner of the returned pointer return out ? static_cast <com::sun::star::util::Time> (java_sql_Time( t.pEnv, out )) : ::com::sun::star::util::Time(); } @@ -205,7 +204,7 @@ sal_Int16 SAL_CALL java_sql_CallableStatement::getShort( sal_Int32 columnIndex ) createStatement(t.pEnv); static jmethodID mID(NULL); jobject out = callObjectMethodWithIntArg(t.pEnv,"getTimestamp","(I)Ljava/sql/Timestamp;", mID, columnIndex); - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // WARNING: the caller becomes the owner of the returned pointer return out ? static_cast <com::sun::star::util::DateTime> (java_sql_Timestamp( t.pEnv, out )) : ::com::sun::star::util::DateTime(); } @@ -218,13 +217,13 @@ void SAL_CALL java_sql_CallableStatement::registerOutParameter( sal_Int32 parame { createStatement(t.pEnv); - // temporaere Variable initialisieren + // initialize temporary variable static const char * cSignature = "(IILjava/lang/String;)V"; static const char * cMethodName = "registerOutParameter"; - // Java-Call absetzen + // execute Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); - // Parameter konvertieren + // Convert Parameter jdbc::LocalRef< jstring > str( t.env(),convertwchar_tToJavaString(t.pEnv,typeName)); t.pEnv->CallVoidMethod( object, mID, parameterIndex,sqlType,str.get()); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -238,10 +237,10 @@ void SAL_CALL java_sql_CallableStatement::registerNumericOutParameter( sal_Int32 { createStatement(t.pEnv); - // temporaere Variable initialisieren + // initialize temporary variable static const char * cSignature = "(III)V"; static const char * cMethodName = "registerOutParameter"; - // Java-Call absetzen + // execute Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); t.pEnv->CallVoidMethod( object, mID, parameterIndex,sqlType,scale); @@ -253,7 +252,7 @@ jclass java_sql_CallableStatement::theClass = 0; jclass java_sql_CallableStatement::getMyClass() const { - // die Klasse muss nur einmal geholt werden, daher statisch + // the class must be fetched only once, therefore static if( !theClass ) theClass = findMyClass("java/sql/CallableStatement"); return theClass; @@ -276,7 +275,7 @@ Reference< starsdbc::XArray > SAL_CALL java_sql_CallableStatement::getArray( sal createStatement(t.pEnv); static jmethodID mID(NULL); jobject out = callObjectMethodWithIntArg(t.pEnv,"getArray","(I)Ljava/sql/Array;", mID, columnIndex); - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // WARNING: the caller becomes the owner of the returned pointer return out==0 ? 0 : new java_sql_Array( t.pEnv, out ); } @@ -286,7 +285,7 @@ Reference< starsdbc::XClob > SAL_CALL java_sql_CallableStatement::getClob( sal_I createStatement(t.pEnv); static jmethodID mID(NULL); jobject out = callObjectMethodWithIntArg(t.pEnv,"getClob","(I)Ljava/sql/Clob;", mID, columnIndex); - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // WARNING: the caller becomes the owner of the returned pointer return out==0 ? 0 : new java_sql_Clob( t.pEnv, out ); } Reference< starsdbc::XBlob > SAL_CALL java_sql_CallableStatement::getBlob( sal_Int32 columnIndex ) throw(starsdbc::SQLException, RuntimeException) @@ -295,7 +294,7 @@ Reference< starsdbc::XBlob > SAL_CALL java_sql_CallableStatement::getBlob( sal_I createStatement(t.pEnv); static jmethodID mID(NULL); jobject out = callObjectMethodWithIntArg(t.pEnv,"getBlob","(I)Ljava/sql/Blob;", mID, columnIndex); - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // WARNING: the caller becomes the owner of the returned pointer return out==0 ? 0 : new java_sql_Blob( t.pEnv, out ); } @@ -305,7 +304,7 @@ Reference< starsdbc::XRef > SAL_CALL java_sql_CallableStatement::getRef( sal_Int createStatement(t.pEnv); static jmethodID mID(NULL); jobject out = callObjectMethodWithIntArg(t.pEnv,"getRef","(I)Ljava/sql/Ref;", mID, columnIndex); - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // WARNING: the caller becomes the owner of the returned pointer return out==0 ? 0 : new java_sql_Ref( t.pEnv, out ); } // ----------------------------------------------------------------------------- @@ -327,12 +326,12 @@ void java_sql_CallableStatement::createStatement(JNIEnv* /*_pEnv*/) SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); if( t.pEnv && !object ){ - // temporaere Variable initialisieren + // initialize temporary variable static const char * cSignature = "(Ljava/lang/String;II)Ljava/sql/CallableStatement;"; static const char * cMethodName = "prepareCall"; - // Java-Call absetzen + // execute Java-Call jobject out = NULL; - // Parameter konvertieren + // convert Parameter jdbc::LocalRef< jstring > str( t.env(),convertwchar_tToJavaString(t.pEnv,m_sSqlStatement)); static jmethodID mID(NULL); diff --git a/connectivity/source/drivers/jdbc/Class.cxx b/connectivity/source/drivers/jdbc/Class.cxx index e1e6d8d8f4..b122ad593d 100644 --- a/connectivity/source/drivers/jdbc/Class.cxx +++ b/connectivity/source/drivers/jdbc/Class.cxx @@ -44,7 +44,7 @@ java_lang_Class::~java_lang_Class() jclass java_lang_Class::getMyClass() const { - // die Klasse muss nur einmal geholt werden, daher statisch + // the class must be fetched only once, therefore static if( !theClass ) theClass = findMyClass("java/lang/Class"); return theClass; @@ -58,10 +58,10 @@ java_lang_Class * java_lang_Class::forName( const ::rtl::OUString& _par0 ) { ::rtl::OString sClassName = ::rtl::OUStringToOString(_par0, RTL_TEXTENCODING_JAVA_UTF8); sClassName = sClassName.replace('.','/'); - out = t.pEnv->FindClass(sClassName); + out = t.pEnv->FindClass(sClassName.getStr()); ThrowSQLException(t.pEnv,0); } //t.pEnv - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // WARNING: the caller becomes the owner of the returned pointer return out==0 ? NULL : new java_lang_Class( t.pEnv, out ); } diff --git a/connectivity/source/drivers/jdbc/Clob.cxx b/connectivity/source/drivers/jdbc/Clob.cxx index 69b1e34253..6cc5a4573f 100644 --- a/connectivity/source/drivers/jdbc/Clob.cxx +++ b/connectivity/source/drivers/jdbc/Clob.cxx @@ -53,7 +53,7 @@ java_sql_Clob::~java_sql_Clob() jclass java_sql_Clob::getMyClass() const { - // die Klasse muss nur einmal geholt werden, daher statisch + // the class must be fetched only once, therefore static if( !theClass ) theClass = findMyClass("java/sql/Clob"); return theClass; @@ -66,10 +66,10 @@ sal_Int64 SAL_CALL java_sql_Clob::length( ) throw(::com::sun::star::sdbc::SQLEx SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); { - // temporaere Variable initialisieren + // initialize temporary variable static const char * cSignature = "()J"; static const char * cMethodName = "length"; - // Java-Call absetzen + // execute Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); out = t.pEnv->CallLongMethod( object, mID ); @@ -84,17 +84,17 @@ sal_Int64 SAL_CALL java_sql_Clob::length( ) throw(::com::sun::star::sdbc::SQLEx SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); ::rtl::OUString aStr; { - // temporaere Variable initialisieren + // initialize temporary variable static const char * cSignature = "(JI)Ljava/lang/String;"; static const char * cMethodName = "getSubString"; - // Java-Call absetzen + // execute Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); jstring out = (jstring)t.pEnv->CallObjectMethod( object, mID,pos,subStringLength); ThrowSQLException(t.pEnv,*this); aStr = JavaString2String(t.pEnv,out); } //t.pEnv - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // WARNING: the caller becomes the owner of the returned pointer return aStr; } @@ -105,7 +105,7 @@ sal_Int64 SAL_CALL java_sql_Clob::length( ) throw(::com::sun::star::sdbc::SQLEx static jmethodID mID(NULL); jobject out = callObjectMethod(t.pEnv,"getCharacterStream","()Ljava/io/Reader;", mID); - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // WARNING: the caller becomes the owner of the returned pointer return out==0 ? 0 : new java_io_Reader( t.pEnv, out ); } @@ -117,12 +117,12 @@ sal_Int64 SAL_CALL java_sql_Clob::position( const ::rtl::OUString& searchstr, sa { jvalue args[1]; - // Parameter konvertieren + // convert Parameter args[0].l = convertwchar_tToJavaString(t.pEnv,searchstr); - // temporaere Variable initialisieren + // initialize temporary Variable static const char * cSignature = "(Ljava/lang/String;I)J"; static const char * cMethodName = "position"; - // Java-Call absetzen + // execute Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); out = t.pEnv->CallLongMethod( object, mID, args[0].l,start ); diff --git a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx index 27d7833272..256c08fd36 100644 --- a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx +++ b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx @@ -63,7 +63,7 @@ java_sql_DatabaseMetaData::~java_sql_DatabaseMetaData() jclass java_sql_DatabaseMetaData::getMyClass() const { - // die Klasse muss nur einmal geholt werden, daher statisch + // the class must be fetched only once, therefore static if( !theClass ) theClass = findMyClass("java/sql/DatabaseMetaData"); return theClass; @@ -130,10 +130,10 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables( SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); { - // Java-Call absetzen + // execute Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); - OSL_VERIFY_RES( !isExceptionOccured(t.pEnv,sal_True),"Exception occured!"); + OSL_VERIFY_RES( !isExceptionOccurred(t.pEnv,sal_True),"Exception occurred!"); jvalue args[4]; args[3].l = 0; @@ -141,7 +141,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables( if ( typeFilterCount ) { jobjectArray pObjArray = static_cast< jobjectArray >( t.pEnv->NewObjectArray( (jsize)typeFilterCount, java_lang_String::st_getMyClass(), 0 ) ); - OSL_VERIFY_RES( !isExceptionOccured( t.pEnv, sal_True ), "Exception occured!" ); + OSL_VERIFY_RES( !isExceptionOccurred( t.pEnv, sal_True ), "Exception occurred!" ); const ::rtl::OUString* typeFilter = _types.getConstArray(); bool bIncludeAllTypes = false; for ( sal_Int32 i=0; i<typeFilterCount; ++i, ++typeFilter ) @@ -153,7 +153,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables( } jstring aT = convertwchar_tToJavaString( t.pEnv, *typeFilter ); t.pEnv->SetObjectArrayElement( pObjArray, (jsize)i, aT ); - OSL_VERIFY_RES( !isExceptionOccured( t.pEnv, sal_True ), "Exception occured!" ); + OSL_VERIFY_RES( !isExceptionOccurred( t.pEnv, sal_True ), "Exception occurred!" ); } if ( bIncludeAllTypes ) @@ -161,7 +161,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables( // the SDBC API allows to pass "%" as table type filter, but in JDBC, "all table types" // is represented by the table type being <null/> t.pEnv->DeleteLocalRef( pObjArray ); - OSL_VERIFY_RES( !isExceptionOccured( t.pEnv, sal_True ), "Exception occured!" ); + OSL_VERIFY_RES( !isExceptionOccurred( t.pEnv, sal_True ), "Exception occurred!" ); } else { @@ -189,23 +189,23 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables( if ( aCatalogFilter.hasValue() ) { t.pEnv->DeleteLocalRef((jstring)args[0].l); - OSL_VERIFY_RES( !isExceptionOccured( t.pEnv, sal_True ), "Exception occured!" ); + OSL_VERIFY_RES( !isExceptionOccurred( t.pEnv, sal_True ), "Exception occurred!" ); } if(args[1].l) { t.pEnv->DeleteLocalRef((jstring)args[1].l); - OSL_VERIFY_RES( !isExceptionOccured( t.pEnv, sal_True ), "Exception occured!" ); + OSL_VERIFY_RES( !isExceptionOccurred( t.pEnv, sal_True ), "Exception occurred!" ); } if(tableNamePattern.getLength()) { t.pEnv->DeleteLocalRef((jstring)args[2].l); - OSL_VERIFY_RES( !isExceptionOccured( t.pEnv, sal_True ), "Exception occured!" ); + OSL_VERIFY_RES( !isExceptionOccurred( t.pEnv, sal_True ), "Exception occurred!" ); } //for(INT16 i=0;i<len;i++) if ( args[3].l ) { t.pEnv->DeleteLocalRef( (jobjectArray)args[3].l ); - OSL_VERIFY_RES( !isExceptionOccured( t.pEnv, sal_True ), "Exception occured!" ); + OSL_VERIFY_RES( !isExceptionOccurred( t.pEnv, sal_True ), "Exception occurred!" ); } if ( jThrow ) @@ -359,11 +359,11 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getIndexInfo( SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); { - // Java-Call absetzen + // execute Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); jvalue args[5]; - // Parameter konvertieren + // convert Parameter args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0; args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema); args[2].l = convertwchar_tToJavaString(t.pEnv,table); @@ -371,7 +371,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getIndexInfo( args[4].z = approximate; out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l,args[3].z,args[4].z ); - // und aufraeumen + // and clean up if(catalog.hasValue()) t.pEnv->DeleteLocalRef((jstring)args[0].l); if(args[1].l) @@ -400,17 +400,17 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getBestRowIdentifier SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); { - // Java-Call absetzen + // execute Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); jvalue args[3]; - // Parameter konvertieren + // convert Parameter args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0; args[1].l = schema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schema); args[2].l = convertwchar_tToJavaString(t.pEnv,table); out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[1].l,args[2].l,scope,nullable); - // und aufraeumen + // and cleanup if(catalog.hasValue()) t.pEnv->DeleteLocalRef((jstring)args[0].l); if(args[1].l) @@ -439,7 +439,6 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTablePrivileges( if ( xReturn.is() ) { // we have to check the result columns for the tables privleges - // #106324# Reference< XResultSetMetaDataSupplier > xMetaSup(xReturn,UNO_QUERY); if ( xMetaSup.is() ) { @@ -517,11 +516,11 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getCrossReference( SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); { - // Java-Call absetzen + // execute Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); jvalue args[6]; - // Parameter konvertieren + // convert Parameter args[0].l = primaryCatalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(primaryCatalog)) : 0; args[1].l = primarySchema.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,primarySchema); args[2].l = convertwchar_tToJavaString(t.pEnv,primaryTable); @@ -530,7 +529,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getCrossReference( args[5].l = convertwchar_tToJavaString(t.pEnv,foreignTable); out = t.pEnv->CallObjectMethod( object, mID, args[0].l,args[2].l,args[2].l,args[3].l,args[4].l,args[5].l ); - // und aufraeumen + // and clean up if(primaryCatalog.hasValue()) t.pEnv->DeleteLocalRef((jstring)args[0].l); if(args[1].l) @@ -1432,12 +1431,12 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getUDTs( static const char * cSignature = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[I)Ljava/sql/ResultSet;"; static const char * cMethodName = "getUDTs"; - // Java-Call absetzen + // dismiss Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); { jvalue args[4]; - // temporaere Variable initialisieren + // initialize temporary Variable args[0].l = catalog.hasValue() ? convertwchar_tToJavaString(t.pEnv,comphelper::getString(catalog)) : 0; args[1].l = schemaPattern.toChar() == '%' ? NULL : convertwchar_tToJavaString(t.pEnv,schemaPattern); args[2].l = convertwchar_tToJavaString(t.pEnv,typeNamePattern); diff --git a/connectivity/source/drivers/jdbc/Date.cxx b/connectivity/source/drivers/jdbc/Date.cxx index 24c4a7e9cc..a2c05a67bf 100644 --- a/connectivity/source/drivers/jdbc/Date.cxx +++ b/connectivity/source/drivers/jdbc/Date.cxx @@ -43,7 +43,7 @@ java_util_Date::~java_util_Date() jclass java_util_Date::getMyClass() const { - // die Klasse muss nur einmal geholt werden, daher statisch + // the class must be fetched only once, therefore static if( !theClass ) theClass = findMyClass("java/util/Date"); return theClass; diff --git a/connectivity/source/drivers/jdbc/DriverPropertyInfo.cxx b/connectivity/source/drivers/jdbc/DriverPropertyInfo.cxx index e39682d0c6..f64e9cc4f7 100644 --- a/connectivity/source/drivers/jdbc/DriverPropertyInfo.cxx +++ b/connectivity/source/drivers/jdbc/DriverPropertyInfo.cxx @@ -32,10 +32,10 @@ #include "java/lang/Boolean.hxx" #include "java/tools.hxx" #include "java/lang/String.hxx" + using namespace connectivity; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; -// using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; @@ -52,7 +52,7 @@ java_sql_DriverPropertyInfo::~java_sql_DriverPropertyInfo() // -------------------------------------------------------------------------------- jclass java_sql_DriverPropertyInfo::getMyClass() const { - // die Klasse muss nur einmal geholt werden, daher statisch + // the class must be fetched only once, therefore static if( !theClass ) theClass = findMyClass("java/sql/DriverPropertyInfo"); return theClass; diff --git a/connectivity/source/drivers/jdbc/Exception.cxx b/connectivity/source/drivers/jdbc/Exception.cxx index 682c01ac2b..09e0624d54 100644 --- a/connectivity/source/drivers/jdbc/Exception.cxx +++ b/connectivity/source/drivers/jdbc/Exception.cxx @@ -41,7 +41,7 @@ java_lang_Exception::~java_lang_Exception() jclass java_lang_Exception::getMyClass() const { - // die Klasse muss nur einmal geholt werden, daher statisch + // the class must be fetched only once, therefore static if( !theClass ) theClass = findMyClass("java/lang/Exception"); return theClass; diff --git a/connectivity/source/drivers/jdbc/InputStream.cxx b/connectivity/source/drivers/jdbc/InputStream.cxx index d1741c7e58..33e8acc3a4 100644 --- a/connectivity/source/drivers/jdbc/InputStream.cxx +++ b/connectivity/source/drivers/jdbc/InputStream.cxx @@ -51,7 +51,7 @@ java_io_InputStream::~java_io_InputStream() jclass java_io_InputStream::getMyClass() const { - // die Klasse muss nur einmal geholt werden, daher statisch + // the class must be fetched only once, therefore static if( !theClass ) theClass = findMyClass("java/io/InputStream"); return theClass; @@ -92,7 +92,7 @@ sal_Int32 SAL_CALL java_io_InputStream::readBytes( ::com::sun::star::uno::Sequen jbyteArray pByteArray = t.pEnv->NewByteArray(nBytesToRead); static const char * cSignature = "([BII)I"; static const char * cMethodName = "read"; - // Java-Call absetzen + // execute Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); out = t.pEnv->CallIntMethod( object, mID, pByteArray, 0, nBytesToRead ); diff --git a/connectivity/source/drivers/jdbc/JBigDecimal.cxx b/connectivity/source/drivers/jdbc/JBigDecimal.cxx index 81451382ba..a724a07de1 100644 --- a/connectivity/source/drivers/jdbc/JBigDecimal.cxx +++ b/connectivity/source/drivers/jdbc/JBigDecimal.cxx @@ -43,7 +43,7 @@ java_math_BigDecimal::~java_math_BigDecimal() jclass java_math_BigDecimal::getMyClass() const { - // die Klasse muss nur einmal geholt werden, daher statisch + // the class must be fetched only once, therefore static if( !theClass ) theClass = findMyClass("java/math/BigDecimal"); return theClass; @@ -54,8 +54,8 @@ java_math_BigDecimal::java_math_BigDecimal( const ::rtl::OUString& _par0 ): java SDBThreadAttach t; if( !t.pEnv ) return; - // Java-Call fuer den Konstruktor absetzen - // temporaere Variable initialisieren + // Java-Call for the Constructor + // initialize temporary Variable static const char * cSignature = "(Ljava/lang/String;)V"; jobject tempObj; static jmethodID mID(NULL); @@ -67,7 +67,7 @@ java_math_BigDecimal::java_math_BigDecimal( const ::rtl::OUString& _par0 ): java saveRef( t.pEnv, tempObj ); t.pEnv->DeleteLocalRef( tempObj ); ThrowSQLException( t.pEnv, NULL ); - // und aufraeumen + // and cleanup } java_math_BigDecimal::java_math_BigDecimal( const double& _par0 ): java_lang_Object( NULL, (jobject)NULL ) @@ -75,8 +75,8 @@ java_math_BigDecimal::java_math_BigDecimal( const double& _par0 ): java_lang_Obj SDBThreadAttach t; if( !t.pEnv ) return; - // Java-Call fuer den Konstruktor absetzen - // temporaere Variable initialisieren + // Java-Call for the Constructor + // initialize temporary Variable static const char * cSignature = "(D)V"; jobject tempObj; static jmethodID mID(NULL); @@ -85,7 +85,7 @@ java_math_BigDecimal::java_math_BigDecimal( const double& _par0 ): java_lang_Obj saveRef( t.pEnv, tempObj ); t.pEnv->DeleteLocalRef( tempObj ); ThrowSQLException( t.pEnv, NULL ); - // und aufraeumen + // and cleanup } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/jdbc/JConnection.cxx b/connectivity/source/drivers/jdbc/JConnection.cxx index a8ed19cd87..9621b33410 100644 --- a/connectivity/source/drivers/jdbc/JConnection.cxx +++ b/connectivity/source/drivers/jdbc/JConnection.cxx @@ -325,7 +325,7 @@ void java_sql_Connection::disposing() // ------------------------------------------------------------------------- jclass java_sql_Connection::getMyClass() const { - // die Klasse muss nur einmal geholt werden, daher statisch + // the class must be fetched only once, therefore static if( !theClass ) theClass = findMyClass("java/sql/Connection"); return theClass; @@ -427,9 +427,9 @@ Reference< ::com::sun::star::container::XNameAccess > SAL_CALL java_sql_Connecti SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); static jmethodID mID(NULL); - /*jobject out = */callObjectMethod(t.pEnv,"getTypeMap","()Ljava/util/Map;", mID); - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! - return 0;// ? 0 : Map2XNameAccess( t.pEnv, out ); + callObjectMethod(t.pEnv,"getTypeMap","()Ljava/util/Map;", mID); + // WARNING: the caller becomes the owner of the returned pointer + return 0; } // ------------------------------------------------------------------------- void SAL_CALL java_sql_Connection::setTypeMap( const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException) @@ -545,13 +545,13 @@ Reference< XPreparedStatement > SAL_CALL java_sql_Connection::prepareCall( const SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); { - // temporaere Variable initialisieren + // initialize temporary Variable static const char * cSignature = "(Ljava/lang/String;)Ljava/lang/String;"; static const char * cMethodName = "nativeSQL"; - // Java-Call absetzen + // Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); - // Parameter konvertieren + // Convert Parameter jdbc::LocalRef< jstring > str( t.env(),convertwchar_tToJavaString(t.pEnv,sql)); jobject out = t.pEnv->CallObjectMethod( object, mID, str.get() ); @@ -578,7 +578,7 @@ Any SAL_CALL java_sql_Connection::getWarnings( ) throw(SQLException, RuntimeExc SDBThreadAttach t; static jmethodID mID(NULL); jobject out = callObjectMethod(t.pEnv,"getWarnings","()Ljava/sql/SQLWarning;", mID); - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // WARNING: the caller becomes the owner of the returned pointer if( out ) { java_sql_SQLWarning_BASE warn_base(t.pEnv, out); @@ -819,17 +819,17 @@ sal_Bool java_sql_Connection::construct(const ::rtl::OUString& url, if ( t.pEnv && m_Driver_theClass && m_pDriverobject ) { - // temporaere Variable initialisieren + // initialize temporary Variable static const char * cSignature = "(Ljava/lang/String;Ljava/util/Properties;)Ljava/sql/Connection;"; static const char * cMethodName = "connect"; - // Java-Call absetzen + // Java-Call static jmethodID mID = NULL; if ( !mID ) mID = t.pEnv->GetMethodID( m_Driver_theClass, cMethodName, cSignature ); if ( mID ) { jvalue args[2]; - // Parameter konvertieren + // convert Parameter args[0].l = convertwchar_tToJavaString(t.pEnv,url); java_util_Properties* pProps = createStringPropertyArray(info); args[1].l = pProps->getJavaObject(); diff --git a/connectivity/source/drivers/jdbc/JDriver.cxx b/connectivity/source/drivers/jdbc/JDriver.cxx index c56aba8740..8decaa3751 100644 --- a/connectivity/source/drivers/jdbc/JDriver.cxx +++ b/connectivity/source/drivers/jdbc/JDriver.cxx @@ -65,7 +65,7 @@ java_sql_Driver::~java_sql_Driver() //------------------------------------------------------------------------------ rtl::OUString java_sql_Driver::getImplementationName_Static( ) throw(RuntimeException) { - return ::rtl::OUString::createFromAscii("com.sun.star.comp.sdbc.JDBCDriver"); + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sdbc.JDBCDriver")); // this name is referenced in the configuration and in the jdbc.xml // Please take care when changing it. } @@ -73,7 +73,7 @@ rtl::OUString java_sql_Driver::getImplementationName_Static( ) throw(RuntimeExc Sequence< ::rtl::OUString > java_sql_Driver::getSupportedServiceNames_Static( ) throw (RuntimeException) { Sequence< ::rtl::OUString > aSNS( 1 ); - aSNS[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.Driver"); + aSNS[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.Driver")); return aSNS; } //------------------------------------------------------------------ @@ -116,7 +116,7 @@ Reference< XConnection > SAL_CALL java_sql_Driver::connect( const ::rtl::OUStrin java_sql_Connection* pConnection = new java_sql_Connection( *this ); xOut = pConnection; if ( !pConnection->construct(url,info) ) - xOut.clear(); // an error occured and the java driver didn't throw an exception + xOut.clear(); // an error occurred and the java driver didn't throw an exception else m_aLogger.log( LogLevel::INFO, STR_LOG_DRIVER_SUCCESS ); } @@ -129,7 +129,7 @@ sal_Bool SAL_CALL java_sql_Driver::acceptsURL( const ::rtl::OUString& url ) thro // I feel responsible for all jdbc url's sal_Bool bEnabled = sal_False; OSL_VERIFY_EQUALS( jfw_getEnabled( &bEnabled ), JFW_E_NONE, "error in jfw_getEnabled" ); - static const ::rtl::OUString s_sJdbcPrefix = ::rtl::OUString::createFromAscii("jdbc:"); + static const ::rtl::OUString s_sJdbcPrefix( RTL_CONSTASCII_USTRINGPARAM( "jdbc:" )); return bEnabled && 0 == url.compareTo(s_sJdbcPrefix, 5); } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/jdbc/JStatement.cxx b/connectivity/source/drivers/jdbc/JStatement.cxx index bde76228d3..b5847ba21e 100644 --- a/connectivity/source/drivers/jdbc/JStatement.cxx +++ b/connectivity/source/drivers/jdbc/JStatement.cxx @@ -109,7 +109,7 @@ void SAL_CALL OStatement_BASE2::disposing() // ------------------------------------------------------------------------- jclass java_sql_Statement_Base::getMyClass() const { - // die Klasse muss nur einmal geholt werden, daher statisch + // the class must be fetched only once, therefore static if( !theClass ) theClass = findMyClass("java/sql/Statement"); return theClass; @@ -163,7 +163,7 @@ Reference< XResultSet > SAL_CALL java_sql_Statement_Base::getGeneratedValues( ) jobject out(0); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); createStatement(t.pEnv); - // temporaere Variable initialisieren + // initialize temporary Variable try { static jmethodID mID(NULL); @@ -240,13 +240,13 @@ sal_Bool SAL_CALL java_sql_Statement_Base::execute( const ::rtl::OUString& sql ) { createStatement(t.pEnv); m_sSqlStatement = sql; - // temporaere Variable initialisieren + // initialize temporary Variable static const char * cSignature = "(Ljava/lang/String;)Z"; static const char * cMethodName = "execute"; - // Java-Call absetzen + // Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); - // Parameter konvertieren + // convert Parameter jdbc::LocalRef< jstring > str( t.env(), convertwchar_tToJavaString( t.pEnv, sql ) ); { jdbc::ContextClassLoaderScope ccl( t.env(), @@ -275,13 +275,13 @@ Reference< XResultSet > SAL_CALL java_sql_Statement_Base::executeQuery( const :: { createStatement(t.pEnv); m_sSqlStatement = sql; - // temporaere Variable initialisieren + // initialize temporary variable static const char * cSignature = "(Ljava/lang/String;)Ljava/sql/ResultSet;"; static const char * cMethodName = "executeQuery"; - // Java-Call absetzen + // Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); - // Parameter konvertieren + // convert Parameter jdbc::LocalRef< jstring > str( t.env(), convertwchar_tToJavaString( t.pEnv, sql ) ); { jdbc::ContextClassLoaderScope ccl( t.env(), @@ -294,7 +294,7 @@ Reference< XResultSet > SAL_CALL java_sql_Statement_Base::executeQuery( const :: ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); } } //t.pEnv - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // WARNING: the caller becomes the owner of the returned pointer return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out, m_aLogger, *m_pConnection,this ); } // ------------------------------------------------------------------------- @@ -368,7 +368,7 @@ Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL java_sql_Statement_Base static jmethodID mID(NULL); jobject out = callResultSetMethod(t.env(),"getResultSet",mID); - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // WARNING: the caller becomes the owner of the returned pointer return out==0 ? 0 : new java_sql_ResultSet( t.pEnv, out, m_aLogger, *m_pConnection,this ); } // ------------------------------------------------------------------------- @@ -398,7 +398,7 @@ Any SAL_CALL java_sql_Statement_Base::getWarnings( ) throw(::com::sun::star::sd createStatement(t.pEnv); static jmethodID mID(NULL); jobject out = callObjectMethod(t.pEnv,"getWarnings","()Ljava/sql/SQLWarning;", mID); - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // WARNING: the caller becomes the owner of the returned pointer if( out ) { java_sql_SQLWarning_BASE warn_base( t.pEnv, out ); @@ -758,7 +758,7 @@ java_sql_Statement::~java_sql_Statement() jclass java_sql_Statement::getMyClass() const { - // die Klasse muss nur einmal geholt werden, daher statisch + // the class must be fetched only once, therefore static if( !theClass ) theClass = findMyClass("java/sql/Statement"); return theClass; @@ -771,10 +771,10 @@ void java_sql_Statement::createStatement(JNIEnv* _pEnv) checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); if( _pEnv && !object ){ - // temporaere Variable initialisieren + // initialize temporary variable static const char * cSignature = "(II)Ljava/sql/Statement;"; static const char * cMethodName = "createStatement"; - // Java-Call absetzen + // Java-Call jobject out = NULL; static jmethodID mID(NULL); if ( !mID ) diff --git a/connectivity/source/drivers/jdbc/Object.cxx b/connectivity/source/drivers/jdbc/Object.cxx index 3a7184393f..a78d8fe3de 100644 --- a/connectivity/source/drivers/jdbc/Object.cxx +++ b/connectivity/source/drivers/jdbc/Object.cxx @@ -104,7 +104,7 @@ void SDBThreadAttach::releaseRef() } } // ----------------------------------------------------------------------------- -// statische Variablen der Klasse: +// static variables of the class jclass java_lang_Object::theClass = 0; jclass java_lang_Object::getMyClass() const @@ -113,14 +113,14 @@ jclass java_lang_Object::getMyClass() const theClass = findMyClass("java/lang/Object"); return theClass; } -// der eigentliche Konstruktor +// the actual constructor java_lang_Object::java_lang_Object(const Reference<XMultiServiceFactory >& _rxFactory) : m_xFactory(_rxFactory),object( 0 ) { SDBThreadAttach::addRef(); } -// der protected-Konstruktor fuer abgeleitete Klassen +// the protected-constructor for the derived classes java_lang_Object::java_lang_Object( JNIEnv * pXEnv, jobject myObj ) : object( NULL ) { @@ -155,7 +155,7 @@ void java_lang_Object::clearObject() clearObject(*t.pEnv); } } -// der protected-Konstruktor fuer abgeleitete Klassen +// the protected-constructor for the derived classes void java_lang_Object::saveRef( JNIEnv * pXEnv, jobject myObj ) { OSL_ENSURE( myObj, "object in c++ -> Java Wrapper" ); @@ -281,7 +281,7 @@ sal_Int32 java_lang_Object::callIntMethod( const char* _pMethodName, jmethodID& // call method jint out( t.pEnv->CallIntMethod( object, _inout_MethodID ) ); if ( _bIgnoreException ) - isExceptionOccured(t.pEnv,sal_True); + isExceptionOccurred(t.pEnv,sal_True); else ThrowSQLException( t.pEnv, NULL ); @@ -320,7 +320,7 @@ void java_lang_Object::callVoidMethodWithIntArg( const char* _pMethodName, jmeth // call method t.pEnv->CallVoidMethod( object, _inout_MethodID,_nArgument ); if ( _bIgnoreException ) - isExceptionOccured(t.pEnv,sal_True); + isExceptionOccurred(t.pEnv,sal_True); else ThrowSQLException( t.pEnv, NULL ); } @@ -333,7 +333,7 @@ void java_lang_Object::callVoidMethodWithBoolArg( const char* _pMethodName, jmet // call method t.pEnv->CallVoidMethod( object, _inout_MethodID,_nArgument ); if ( _bIgnoreException ) - isExceptionOccured(t.pEnv,sal_True); + isExceptionOccurred(t.pEnv,sal_True); else ThrowSQLException( t.pEnv, NULL ); } @@ -412,7 +412,7 @@ sal_Int32 java_lang_Object::callIntMethodWithStringArg( const char* _pMethodName // ----------------------------------------------------------------------------- jclass java_lang_Object::findMyClass(const char* _pClassName) { - // die Klasse muss nur einmal geholt werden, daher statisch + // the class must be fetched only once, therefore static SDBThreadAttach t; jclass tempClass = t.pEnv->FindClass(_pClassName); OSL_ENSURE(tempClass,"Java : FindClass nicht erfolgreich!"); if(!tempClass) diff --git a/connectivity/source/drivers/jdbc/PreparedStatement.cxx b/connectivity/source/drivers/jdbc/PreparedStatement.cxx index 21092d5148..5c112dd70e 100644 --- a/connectivity/source/drivers/jdbc/PreparedStatement.cxx +++ b/connectivity/source/drivers/jdbc/PreparedStatement.cxx @@ -73,7 +73,7 @@ java_sql_PreparedStatement::~java_sql_PreparedStatement() jclass java_sql_PreparedStatement::getMyClass() const { - // die Klasse muss nur einmal geholt werden, daher statisch + // the class must be fetched only once, therefore static if( !theClass ) theClass = findMyClass("java/sql/PreparedStatement"); return theClass; @@ -129,16 +129,16 @@ void SAL_CALL java_sql_PreparedStatement::setString( sal_Int32 parameterIndex, c m_aLogger.log( LogLevel::FINER, STR_LOG_STRING_PARAMETER, parameterIndex, x ); SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); - { // temporaere Variable initialisieren + { // initialize temporary Variable createStatement(t.pEnv); static const char * cSignature = "(ILjava/lang/String;)V"; static const char * cMethodName = "setString"; - // Java-Call absetzen + // Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); jdbc::LocalRef< jstring > str( t.env(),convertwchar_tToJavaString(t.pEnv,x)); t.pEnv->CallVoidMethod( object, mID, parameterIndex,str.get()); - // und aufraeumen + // and clean up ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); } //t.pEnv } @@ -332,10 +332,10 @@ void SAL_CALL java_sql_PreparedStatement::setObjectWithInfo( sal_Int32 parameter { createStatement(t.pEnv); - // temporaere Variable initialisieren + // initialize temporary Variable static const char * cSignature = "(ILjava/lang/Object;II)V"; static const char * cMethodName = "setObject"; - // Java-Call absetzen + // Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); { @@ -375,7 +375,7 @@ void SAL_CALL java_sql_PreparedStatement::setObjectWithInfo( sal_Int32 parameter t.pEnv->CallVoidMethod( object, mID, parameterIndex,obj,targetSqlType,scale); t.pEnv->DeleteLocalRef(obj); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen + // and clean up } //mID } //t.pEnv } @@ -430,10 +430,10 @@ void SAL_CALL java_sql_PreparedStatement::setBytes( sal_Int32 parameterIndex, co { createStatement(t.pEnv); - // temporaere Variable initialisieren + // initialize temporary Variable static const char * cSignature = "(I[B)V"; static const char * cMethodName = "setBytes"; - // Java-Call absetzen + // Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); jbyteArray pByteArray = t.pEnv->NewByteArray(x.getLength()); @@ -455,10 +455,10 @@ void SAL_CALL java_sql_PreparedStatement::setCharacterStream( sal_Int32 paramete { createStatement(t.pEnv); - // temporaere Variable initialisieren + // initialize temporary variable static const char * cSignature = "(ILjava/io/InputStream;I)V"; static const char * cMethodName = "setCharacterStream"; - // Java-Call absetzen + // Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); Sequence< sal_Int8 > aSeq; @@ -472,9 +472,9 @@ void SAL_CALL java_sql_PreparedStatement::setCharacterStream( sal_Int32 paramete args2[0].l = pByteArray; args2[1].i = 0; args2[2].i = actualLength; - // temporaere Variable initialisieren + // initialize temporary variable const char * cSignatureStream = "([BII)V"; - // Java-Call absetzen + // Java-Call jclass aClass = t.pEnv->FindClass("java/io/CharArrayInputStream"); static jmethodID mID2 = NULL; if ( !mID2 ) @@ -484,7 +484,7 @@ void SAL_CALL java_sql_PreparedStatement::setCharacterStream( sal_Int32 paramete tempObj = t.pEnv->NewObjectA( aClass, mID2, args2 ); t.pEnv->CallVoidMethod( object, mID, parameterIndex,tempObj,actualLength); - // und aufraeumen + // and clean up t.pEnv->DeleteLocalRef(pByteArray); t.pEnv->DeleteLocalRef(tempObj); t.pEnv->DeleteLocalRef(aClass); @@ -502,10 +502,10 @@ void SAL_CALL java_sql_PreparedStatement::setBinaryStream( sal_Int32 parameterIn SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); { createStatement(t.pEnv); - // temporaere Variable initialisieren + // initialize temporary variable static const char * cSignature = "(ILjava/io/InputStream;I)V"; static const char * cMethodName = "setBinaryStream"; - // Java-Call absetzen + // Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); { @@ -521,9 +521,9 @@ void SAL_CALL java_sql_PreparedStatement::setBinaryStream( sal_Int32 parameterIn args2[1].i = 0; args2[2].i = (sal_Int32)actualLength; - // temporaere Variable initialisieren + // initialize temporary variable const char * cSignatureStream = "([BII)V"; - // Java-Call absetzen + // Java-Call jclass aClass = t.pEnv->FindClass("java/io/ByteArrayInputStream"); static jmethodID mID2 = NULL; if ( !mID2 ) @@ -532,7 +532,7 @@ void SAL_CALL java_sql_PreparedStatement::setBinaryStream( sal_Int32 parameterIn if(mID2) tempObj = t.pEnv->NewObjectA( aClass, mID2, args2 ); t.pEnv->CallVoidMethod( object, mID, parameterIndex,tempObj,(sal_Int32)actualLength); - // und aufraeumen + // and clean up t.pEnv->DeleteLocalRef(pByteArray); t.pEnv->DeleteLocalRef(tempObj); t.pEnv->DeleteLocalRef(aClass); @@ -630,14 +630,14 @@ void java_sql_PreparedStatement::createStatement(JNIEnv* _pEnv) checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed); if( !object && _pEnv ){ - // temporaere Variable initialisieren + // initialize temporary variable static const char * cSignature = "(Ljava/lang/String;II)Ljava/sql/PreparedStatement;"; static const char * cMethodName = "prepareStatement"; jvalue args[1]; - // Parameter konvertieren + // convert Parameter args[0].l = convertwchar_tToJavaString(_pEnv,m_sSqlStatement); - // Java-Call absetzen + // Java-Call jobject out = NULL; static jmethodID mID(NULL); if ( !mID ) diff --git a/connectivity/source/drivers/jdbc/Reader.cxx b/connectivity/source/drivers/jdbc/Reader.cxx index 6bf9bf9b9f..9998b6c87d 100644 --- a/connectivity/source/drivers/jdbc/Reader.cxx +++ b/connectivity/source/drivers/jdbc/Reader.cxx @@ -49,7 +49,7 @@ java_io_Reader::~java_io_Reader() jclass java_io_Reader::getMyClass() const { - // die Klasse muss nur einmal geholt werden, daher statisch + // the class must be fetched only once, therefore static if( !theClass ) theClass = findMyClass("java/io/Reader"); return theClass; @@ -74,7 +74,7 @@ sal_Int32 SAL_CALL java_io_Reader::available( ) throw(::com::sun::star::io::Not { static const char * cSignature = "()Z"; static const char * cMethodName = "available"; - // Java-Call absetzen + // Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); out = t.pEnv->CallBooleanMethod( object, mID); @@ -99,7 +99,7 @@ sal_Int32 SAL_CALL java_io_Reader::readBytes( ::com::sun::star::uno::Sequence< s jcharArray pCharArray = t.pEnv->NewCharArray(nBytesToRead); static const char * cSignature = "([CII)I"; static const char * cMethodName = "read"; - // Java-Call absetzen + // Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); out = t.pEnv->CallIntMethod( object, mID, pCharArray, 0, nBytesToRead ); diff --git a/connectivity/source/drivers/jdbc/Ref.cxx b/connectivity/source/drivers/jdbc/Ref.cxx index 82a4aa418a..ad49a24f76 100644 --- a/connectivity/source/drivers/jdbc/Ref.cxx +++ b/connectivity/source/drivers/jdbc/Ref.cxx @@ -48,7 +48,7 @@ java_sql_Ref::~java_sql_Ref() jclass java_sql_Ref::getMyClass() const { - // die Klasse muss nur einmal geholt werden, daher statisch + // the class must be fetched only once, therefore static if( !theClass ) theClass = findMyClass("java/sql/Ref"); return theClass; diff --git a/connectivity/source/drivers/jdbc/ResultSet.cxx b/connectivity/source/drivers/jdbc/ResultSet.cxx index b71f145183..7712dfddc6 100644 --- a/connectivity/source/drivers/jdbc/ResultSet.cxx +++ b/connectivity/source/drivers/jdbc/ResultSet.cxx @@ -65,7 +65,6 @@ using namespace ::comphelper; using namespace connectivity; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; -// using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; @@ -105,7 +104,7 @@ java_sql_ResultSet::~java_sql_ResultSet() jclass java_sql_ResultSet::getMyClass() const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::getMyClass" ); - // die Klasse muss nur einmal geholt werden, daher statisch + // the class must be fetched only once, therefore static if( !theClass ) theClass = findMyClass("java/sql/ResultSet"); return theClass; @@ -162,7 +161,7 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_ResultSet::get static jmethodID mID(NULL); jobject out = callObjectMethodWithIntArg(t.pEnv,"getBinaryStream","(I)Ljava/io/InputStream;", mID, columnIndex); - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // WARNING: the caller becomes the owner of the returned pointer return out==0 ? 0 : new java_io_InputStream( t.pEnv, out ); } // ------------------------------------------------------------------------- @@ -173,7 +172,7 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL java_sql_ResultSet::get static jmethodID mID(NULL); jobject out = callObjectMethodWithIntArg(t.pEnv,"getCharacterStream","(I)Ljava/io/Reader;", mID, columnIndex); - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // WARNING: the caller becomes the owner of the returned pointer return out==0 ? 0 : new java_io_Reader( t.pEnv, out ); } // ------------------------------------------------------------------------- @@ -219,7 +218,7 @@ Sequence< sal_Int8 > SAL_CALL java_sql_ResultSet::getBytes( sal_Int32 columnInde SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); static jmethodID mID(NULL); jobject out = callObjectMethodWithIntArg(t.pEnv,"getDate","(I)Ljava/sql/Date;", mID, columnIndex); - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // WARNING: the caller becomes the owner of the returned pointer return out ? static_cast <com::sun::star::util::Date> (java_sql_Date( t.pEnv, out )) : ::com::sun::star::util::Date(); } // ------------------------------------------------------------------------- @@ -284,7 +283,7 @@ Reference< XArray > SAL_CALL java_sql_ResultSet::getArray( sal_Int32 columnIndex static jmethodID mID(NULL); jobject out = callObjectMethodWithIntArg(t.pEnv,"getArray","(I)Ljava/sql/Array;", mID, columnIndex); - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // WARNING: the caller becomes the owner of the returned pointer return out==0 ? 0 : new java_sql_Array( t.pEnv, out ); } // ------------------------------------------------------------------------- @@ -295,7 +294,7 @@ Reference< XClob > SAL_CALL java_sql_ResultSet::getClob( sal_Int32 columnIndex ) SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); static jmethodID mID(NULL); jobject out = callObjectMethodWithIntArg(t.pEnv,"getClob","(I)Ljava/sql/Clob;", mID, columnIndex); - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // WARNING: the caller becomes the owner of the returned pointer return out==0 ? 0 : new java_sql_Clob( t.pEnv, out ); } // ------------------------------------------------------------------------- @@ -305,7 +304,7 @@ Reference< XBlob > SAL_CALL java_sql_ResultSet::getBlob( sal_Int32 columnIndex ) SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); static jmethodID mID(NULL); jobject out = callObjectMethodWithIntArg(t.pEnv,"getBlob","(I)Ljava/sql/Blob;", mID, columnIndex); - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // WARNING: the caller becomes the owner of the returned pointer return out==0 ? 0 : new java_sql_Blob( t.pEnv, out ); } // ------------------------------------------------------------------------- @@ -317,7 +316,7 @@ Reference< XRef > SAL_CALL java_sql_ResultSet::getRef( sal_Int32 columnIndex ) t static jmethodID mID(NULL); jobject out = callObjectMethodWithIntArg(t.pEnv,"getRef","(I)Ljava/sql/Ref;", mID, columnIndex); - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // WARNING: the caller becomes the owner of the returned pointer return out==0 ? 0 : new java_sql_Ref( t.pEnv, out ); } // ------------------------------------------------------------------------- @@ -330,11 +329,11 @@ Any SAL_CALL java_sql_ResultSet::getObject( sal_Int32 columnIndex, const Referen SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); { jvalue args[2]; - // Parameter konvertieren + // convert parameter args[0].i = (sal_Int32)columnIndex; args[1].l = convertTypeMapToJavaMap(t.pEnv,typeMap); - // temporaere Variable initialisieren - // Java-Call absetzen + // initialize temporary Variable + // Java-Call static jmethodID mID(NULL); if ( !mID ) { @@ -347,7 +346,7 @@ Any SAL_CALL java_sql_ResultSet::getObject( sal_Int32 columnIndex, const Referen out = t.pEnv->CallObjectMethodA( object, mID, args); t.pEnv->DeleteLocalRef((jstring)args[1].l); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); - // und aufraeumen + // and clean up if ( out ) { if ( t.pEnv->IsInstanceOf(out,java_lang_String::st_getMyClass()) ) @@ -409,7 +408,7 @@ sal_Int16 SAL_CALL java_sql_ResultSet::getShort( sal_Int32 columnIndex ) throw(S SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); static jmethodID mID(NULL); jobject out = callObjectMethodWithIntArg(t.pEnv,"getTime","(I)Ljava/sql/Time;", mID, columnIndex); - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // WARNING: the caller becomes the owner of the returned pointer return out ? static_cast <com::sun::star::util::Time> (java_sql_Time( t.pEnv, out )) : ::com::sun::star::util::Time(); } // ------------------------------------------------------------------------- @@ -421,7 +420,7 @@ sal_Int16 SAL_CALL java_sql_ResultSet::getShort( sal_Int32 columnIndex ) throw(S SDBThreadAttach t; OSL_ENSURE(t.pEnv,"Java Enviroment geloescht worden!"); static jmethodID mID(NULL); jobject out = callObjectMethodWithIntArg(t.pEnv,"getTimestamp","(I)Ljava/sql/Timestamp;", mID, columnIndex); - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // WARNING: the caller becomes the owner of the returned pointer return out ? static_cast <com::sun::star::util::DateTime> (java_sql_Timestamp( t.pEnv, out )) : ::com::sun::star::util::DateTime(); } // ------------------------------------------------------------------------- @@ -579,7 +578,7 @@ void SAL_CALL java_sql_ResultSet::clearWarnings( ) throw(::com::sun::star::sdbc SDBThreadAttach t; static jmethodID mID(NULL); jobject out = callObjectMethod(t.pEnv,"getWarnings","()Ljava/sql/SQLWarning;", mID); - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // WARNING: the caller becomes the owner of the returned pointer if( out ) { java_sql_SQLWarning_BASE warn_base( t.pEnv, out ); @@ -707,8 +706,8 @@ void SAL_CALL java_sql_ResultSet::updateString( sal_Int32 columnIndex, const ::r { - // temporaere Variable initialisieren - // Java-Call absetzen + // initialize temporary variable + // Java-Call static jmethodID mID(NULL); if ( !mID ) { @@ -719,7 +718,7 @@ void SAL_CALL java_sql_ResultSet::updateString( sal_Int32 columnIndex, const ::r } { - // Parameter konvertieren + // convert parameter jdbc::LocalRef< jstring > str( t.env(),convertwchar_tToJavaString(t.pEnv,x)); t.pEnv->CallVoidMethod( object, mID,columnIndex,str.get()); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -734,8 +733,8 @@ void SAL_CALL java_sql_ResultSet::updateBytes( sal_Int32 columnIndex, const ::co SDBThreadAttach t; { - // temporaere Variable initialisieren - // Java-Call absetzen + // initialize temporary variable + // Java-Call static jmethodID mID(NULL); if ( !mID ) { @@ -748,7 +747,7 @@ void SAL_CALL java_sql_ResultSet::updateBytes( sal_Int32 columnIndex, const ::co { jbyteArray aArray = t.pEnv->NewByteArray(x.getLength()); t.pEnv->SetByteArrayRegion(aArray,0,x.getLength(),(jbyte*)x.getConstArray()); - // Parameter konvertieren + // convert parameter t.pEnv->CallVoidMethod( object, mID,columnIndex,aArray); t.pEnv->DeleteLocalRef(aArray); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -792,8 +791,8 @@ void SAL_CALL java_sql_ResultSet::updateBinaryStream( sal_Int32 columnIndex, con SDBThreadAttach t; { - // temporaere Variable initialisieren - // Java-Call absetzen + // initialize temporary variable + // Java-Call static jmethodID mID(NULL); if ( !mID ) { @@ -803,7 +802,7 @@ void SAL_CALL java_sql_ResultSet::updateBinaryStream( sal_Int32 columnIndex, con } { - // Parameter konvertieren + // convert Parameter jobject obj = createByteInputStream(x,length); t.pEnv->CallVoidMethod( object, mID, columnIndex,obj,length); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -824,8 +823,8 @@ void SAL_CALL java_sql_ResultSet::updateCharacterStream( sal_Int32 columnIndex, SDBThreadAttach t; { - // temporaere Variable initialisieren - // Java-Call absetzen + // initialize temporary variable + // Java-Call static jmethodID mID(NULL); if ( !mID ) { @@ -835,7 +834,7 @@ void SAL_CALL java_sql_ResultSet::updateCharacterStream( sal_Int32 columnIndex, } { - // Parameter konvertieren + // convert Parameter jobject obj = createCharArrayReader(x,length); t.pEnv->CallVoidMethod( object, mID, columnIndex,obj,length); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); @@ -866,15 +865,15 @@ void SAL_CALL java_sql_ResultSet::updateObject( sal_Int32 columnIndex, const ::c void SAL_CALL java_sql_ResultSet::updateNumericObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSet::updateNumericObject" ); - // OSL_ENSURE(0,"java_sql_ResultSet::updateNumericObject: NYI"); + // OSL_FAIL("java_sql_ResultSet::updateNumericObject: NYI"); try { SDBThreadAttach t; { - // temporaere Variable initialisieren - // Java-Call absetzen + // initialize temporary variable + // Java-Call static jmethodID mID(NULL); if ( !mID ) { @@ -885,7 +884,7 @@ void SAL_CALL java_sql_ResultSet::updateNumericObject( sal_Int32 columnIndex, co } { - // Parameter konvertieren + // convert parameter double nTemp = 0.0; ::std::auto_ptr<java_math_BigDecimal> pBigDecimal; if ( x >>= nTemp) @@ -894,7 +893,7 @@ void SAL_CALL java_sql_ResultSet::updateNumericObject( sal_Int32 columnIndex, co } else pBigDecimal.reset(new java_math_BigDecimal(::comphelper::getString(x))); - //obj = convertwchar_tToJavaString(t.pEnv,::comphelper::getString(x)); + t.pEnv->CallVoidMethod( object, mID, columnIndex,pBigDecimal->getJavaObject(),scale); ThrowLoggedSQLException( m_aLogger, t.pEnv, *this ); } diff --git a/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx b/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx index 6bbe0d493d..a6da0676a2 100644 --- a/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx +++ b/connectivity/source/drivers/jdbc/ResultSetMetaData.cxx @@ -36,7 +36,6 @@ using namespace connectivity; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; -// using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; @@ -64,7 +63,7 @@ java_sql_ResultSetMetaData::~java_sql_ResultSetMetaData() jclass java_sql_ResultSetMetaData::getMyClass() const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "jdbc", "Ocke.Janssen@sun.com", "java_sql_ResultSetMetaData::getMyClass" ); - // die Klasse muss nur einmal geholt werden, daher statisch + // The class needs to be fetched just once, that is why it is static if( !theClass ) theClass = findMyClass("java/sql/ResultSetMetaData"); return theClass; diff --git a/connectivity/source/drivers/jdbc/SQLException.cxx b/connectivity/source/drivers/jdbc/SQLException.cxx index 93dd658da4..a0ebe17938 100644 --- a/connectivity/source/drivers/jdbc/SQLException.cxx +++ b/connectivity/source/drivers/jdbc/SQLException.cxx @@ -34,7 +34,6 @@ using namespace connectivity; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; -// using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; @@ -67,7 +66,7 @@ jclass java_sql_SQLException_BASE::getMyClass() const } jclass java_sql_SQLException_BASE::st_getMyClass() { - // die Klasse muss nur einmal geholt werden, daher statisch + // The class needs to be fetched just once, that is why it is static if( !theClass ) theClass = findMyClass("java/sql/SQLException"); return theClass; @@ -78,7 +77,7 @@ starsdbc::SQLException java_sql_SQLException_BASE::getNextException() const SDBThreadAttach t; static jmethodID mID(NULL); jobject out = callObjectMethod(t.pEnv,"getNextException","()Ljava/sql/SQLException;", mID); - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // WARNING: the caller will become the owner of the returned pointers !!! if( out ) { java_sql_SQLException_BASE warn_base(t.pEnv,out); diff --git a/connectivity/source/drivers/jdbc/SQLWarning.cxx b/connectivity/source/drivers/jdbc/SQLWarning.cxx index ac01b0e2f3..aa5c8fe456 100644 --- a/connectivity/source/drivers/jdbc/SQLWarning.cxx +++ b/connectivity/source/drivers/jdbc/SQLWarning.cxx @@ -41,7 +41,7 @@ java_sql_SQLWarning_BASE::~java_sql_SQLWarning_BASE() jclass java_sql_SQLWarning_BASE::getMyClass() const { - // die Klasse muss nur einmal geholt werden, daher statisch + // the class needs to be fetched only once, that is why it is static if( !theClass ) theClass = findMyClass("java/sql/SQLWarning"); return theClass; diff --git a/connectivity/source/drivers/jdbc/String.cxx b/connectivity/source/drivers/jdbc/String.cxx index a2155054f1..a85a3fd6b2 100644 --- a/connectivity/source/drivers/jdbc/String.cxx +++ b/connectivity/source/drivers/jdbc/String.cxx @@ -46,7 +46,7 @@ jclass java_lang_String::getMyClass() const } jclass java_lang_String::st_getMyClass() { - // die Klasse muss nur einmal geholt werden, daher statisch + // the class needs to be fetched only once, that is why it is static if( !theClass ) theClass = findMyClass("java/lang/String"); return theClass; diff --git a/connectivity/source/drivers/jdbc/Throwable.cxx b/connectivity/source/drivers/jdbc/Throwable.cxx index 0ae5b66b6b..50302bcb7c 100644 --- a/connectivity/source/drivers/jdbc/Throwable.cxx +++ b/connectivity/source/drivers/jdbc/Throwable.cxx @@ -46,7 +46,7 @@ jclass java_lang_Throwable::getMyClass() const } jclass java_lang_Throwable::st_getMyClass() { - // die Klasse muss nur einmal geholt werden, daher statisch + // the class needs to be fetched only once, that is why it is static if( !theClass ) theClass = findMyClass("java/lang/Throwable"); return theClass; diff --git a/connectivity/source/drivers/jdbc/Timestamp.cxx b/connectivity/source/drivers/jdbc/Timestamp.cxx index 6474e9cfc3..f38a1a610b 100644 --- a/connectivity/source/drivers/jdbc/Timestamp.cxx +++ b/connectivity/source/drivers/jdbc/Timestamp.cxx @@ -46,13 +46,13 @@ java_sql_Date::java_sql_Date( const ::com::sun::star::util::Date& _rOut ) : java if( !t.pEnv ) return; jvalue args[1]; - // Parameter konvertieren + // Convert parameters ::rtl::OUString sDateStr; sDateStr = ::dbtools::DBTypeConversion::toDateString(_rOut); args[0].l = convertwchar_tToJavaString(t.pEnv,sDateStr); - // Java-Call fuer den Konstruktor absetzen - // temporaere Variable initialisieren + // Turn of Java-Call for the constructor + // initialise temporary variables static const char * cSignature = "(Ljava/lang/String;)Ljava/sql/Date;"; jobject tempObj; static jmethodID mID(NULL); @@ -61,7 +61,7 @@ java_sql_Date::java_sql_Date( const ::com::sun::star::util::Date& _rOut ) : java tempObj = t.pEnv->CallStaticObjectMethod( getMyClass(), mID, args[0].l ); saveRef( t.pEnv, tempObj ); t.pEnv->DeleteLocalRef( tempObj ); - // und aufraeumen + // and clean } java_sql_Date::~java_sql_Date() @@ -73,7 +73,7 @@ jclass java_sql_Date::getMyClass() const } jclass java_sql_Date::st_getMyClass() { - // die Klasse muss nur einmal geholt werden, daher statisch + // the class needs only be fetched once, that is why it is static if( !theClass ) theClass = findMyClass("java/sql/Date"); return theClass; @@ -100,7 +100,7 @@ jclass java_sql_Time::getMyClass() const } jclass java_sql_Time::st_getMyClass() { - // die Klasse muss nur einmal geholt werden, daher statisch + // the class needs only be fetched once, that is why it is static if( !theClass ) theClass = findMyClass("java/sql/Time"); return theClass; @@ -111,13 +111,13 @@ java_sql_Time::java_sql_Time( const ::com::sun::star::util::Time& _rOut ): java_ if( !t.pEnv ) return; jvalue args[1]; - // Parameter konvertieren + // Convert parameters ::rtl::OUString sDateStr; sDateStr = ::dbtools::DBTypeConversion::toTimeString(_rOut); args[0].l = convertwchar_tToJavaString(t.pEnv,sDateStr); - // Java-Call fuer den Konstruktor absetzen - // temporaere Variable initialisieren + // Turn off Java-Call for the constructor + // intialise temporary variables static const char * cSignature = "(Ljava/lang/String;)Ljava/sql/Time;"; jobject tempObj; static jmethodID mID(NULL); @@ -127,7 +127,7 @@ java_sql_Time::java_sql_Time( const ::com::sun::star::util::Time& _rOut ): java_ t.pEnv->DeleteLocalRef((jstring)args[0].l); saveRef( t.pEnv, tempObj ); t.pEnv->DeleteLocalRef( tempObj ); - // und aufraeumen + // and clean } // ----------------------------------------------------------------------------- java_sql_Time::operator ::com::sun::star::util::Time() @@ -147,13 +147,15 @@ jclass java_sql_Timestamp::getMyClass() const { return st_getMyClass(); } + jclass java_sql_Timestamp::st_getMyClass() { - // die Klasse muss nur einmal geholt werden, daher statisch + // the class needs only be fetched once, that is why it is static if( !theClass ) theClass = findMyClass("java/sql/Timestamp"); return theClass; } + java_sql_Timestamp::java_sql_Timestamp(const ::com::sun::star::util::DateTime& _rOut) :java_util_Date( NULL, (jobject)NULL ) { @@ -161,14 +163,14 @@ java_sql_Timestamp::java_sql_Timestamp(const ::com::sun::star::util::DateTime& _ if( !t.pEnv ) return; jvalue args[1]; - // Parameter konvertieren + // Convert parameters ::rtl::OUString sDateStr; sDateStr = ::dbtools::DBTypeConversion::toDateTimeString(_rOut); args[0].l = convertwchar_tToJavaString(t.pEnv,sDateStr); - // Java-Call fuer den Konstruktor absetzen - // temporaere Variable initialisieren + // Turn off Java-Call for the constructor + // initialise temporary variables static const char * cSignature = "(Ljava/lang/String;)Ljava/sql/Timestamp;"; jobject tempObj; static jmethodID mID(NULL); @@ -178,20 +180,9 @@ java_sql_Timestamp::java_sql_Timestamp(const ::com::sun::star::util::DateTime& _ saveRef( t.pEnv, tempObj ); t.pEnv->DeleteLocalRef( tempObj ); - // und aufraeumen + // and clean } -sal_Int32 java_sql_Timestamp::getNanos() -{ - static jmethodID mID(NULL); - return callIntMethod("getNanos",mID); -} - -void java_sql_Timestamp::setNanos( sal_Int32 _par0 ) -{ - static jmethodID mID(NULL); - callVoidMethodWithIntArg("setNanos",mID,_par0); -} // ----------------------------------------------------------------------------- java_sql_Timestamp::operator ::com::sun::star::util::DateTime() { diff --git a/connectivity/source/drivers/jdbc/exports.dxp b/connectivity/source/drivers/jdbc/exports.dxp index 9630d7e067..f0e1c69934 100644..100755 --- a/connectivity/source/drivers/jdbc/exports.dxp +++ b/connectivity/source/drivers/jdbc/exports.dxp @@ -1,3 +1,2 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory diff --git a/connectivity/source/drivers/jdbc/jdbc.component b/connectivity/source/drivers/jdbc/jdbc.component new file mode 100755 index 0000000000..5d7db4690b --- /dev/null +++ b/connectivity/source/drivers/jdbc/jdbc.component @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.sdbc.JDBCDriver"> + <service name="com.sun.star.sdbc.Driver"/> + </implementation> +</component> diff --git a/connectivity/source/drivers/jdbc/jdbc.mxp.map b/connectivity/source/drivers/jdbc/jdbc.mxp.map index a4457e2478..e02823e8c4 100644..100755 --- a/connectivity/source/drivers/jdbc/jdbc.mxp.map +++ b/connectivity/source/drivers/jdbc/jdbc.mxp.map @@ -1,5 +1,4 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory __mh_dylib_header ___builtin_delete diff --git a/connectivity/source/drivers/jdbc/jdbc.xcu b/connectivity/source/drivers/jdbc/jdbc.xcu index 49ae3b4015..49ae3b4015 100755..100644 --- a/connectivity/source/drivers/jdbc/jdbc.xcu +++ b/connectivity/source/drivers/jdbc/jdbc.xcu diff --git a/connectivity/source/drivers/jdbc/jdbc.xml b/connectivity/source/drivers/jdbc/jdbc.xml index 8fe04eb8a5..8fe04eb8a5 100644..100755 --- a/connectivity/source/drivers/jdbc/jdbc.xml +++ b/connectivity/source/drivers/jdbc/jdbc.xml diff --git a/connectivity/source/drivers/jdbc/jservices.cxx b/connectivity/source/drivers/jdbc/jservices.cxx index 5d0dc8e2ae..aebe76b6fc 100644 --- a/connectivity/source/drivers/jdbc/jservices.cxx +++ b/connectivity/source/drivers/jdbc/jservices.cxx @@ -35,7 +35,6 @@ using namespace connectivity; using ::rtl::OUString; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; -using ::com::sun::star::registry::XRegistryKey; using ::com::sun::star::lang::XSingleServiceFactory; using ::com::sun::star::lang::XMultiServiceFactory; @@ -48,31 +47,6 @@ typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc) rtl_ModuleCount* _pModCount ); -//*************************************************************************************** -// -// Die vorgeschriebene C-Api muss erfuellt werden! -// Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen. -// - -//--------------------------------------------------------------------------------------- -void REGISTER_PROVIDER( - const OUString& aServiceImplName, - const Sequence< OUString>& Services, - const Reference< ::com::sun::star::registry::XRegistryKey > & xKey) -{ - OUString aMainKeyName; - aMainKeyName = OUString::createFromAscii("/"); - aMainKeyName += aServiceImplName; - aMainKeyName += OUString::createFromAscii("/UNO/SERVICES"); - - Reference< ::com::sun::star::registry::XRegistryKey > xNewKey( xKey->createKey(aMainKeyName) ); - OSL_ENSURE(xNewKey.is(), "SBA::component_writeInfo : could not create a registry key !"); - - for (sal_Int32 i=0; i<Services.getLength(); ++i) - xNewKey->createKey(Services[i]); -} - - //--------------------------------------------------------------------------------------- struct ProviderRequest { @@ -123,31 +97,6 @@ component_getImplementationEnvironment( } //--------------------------------------------------------------------------------------- -extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( - void* /*pServiceManager*/, - void* pRegistryKey - ) -{ - if (pRegistryKey) - try - { - Reference< ::com::sun::star::registry::XRegistryKey > xKey(reinterpret_cast< ::com::sun::star::registry::XRegistryKey*>(pRegistryKey)); - - REGISTER_PROVIDER( - java_sql_Driver::getImplementationName_Static(), - java_sql_Driver::getSupportedServiceNames_Static(), xKey); - - return sal_True; - } - catch (::com::sun::star::registry::InvalidRegistryException& ) - { - OSL_ENSURE(sal_False, "SBA::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !"); - } - - return sal_False; -} - -//--------------------------------------------------------------------------------------- extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplementationName, void* pServiceManager, diff --git a/connectivity/source/drivers/jdbc/makefile.mk b/connectivity/source/drivers/jdbc/makefile.mk index d676945f17..befdc73d7b 100644..100755 --- a/connectivity/source/drivers/jdbc/makefile.mk +++ b/connectivity/source/drivers/jdbc/makefile.mk @@ -110,3 +110,11 @@ DEF1EXPORTFILE= exports.dxp .INCLUDE : $(PRJ)$/target.pmk + +ALLTAR : $(MISC)/jdbc.component + +$(MISC)/jdbc.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + jdbc.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt jdbc.component diff --git a/connectivity/source/drivers/jdbc/tools.cxx b/connectivity/source/drivers/jdbc/tools.cxx index 2485943db4..5527aec92e 100644 --- a/connectivity/source/drivers/jdbc/tools.cxx +++ b/connectivity/source/drivers/jdbc/tools.cxx @@ -41,7 +41,6 @@ using namespace connectivity; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; -// using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; @@ -53,13 +52,13 @@ void java_util_Properties::setProperty(const ::rtl::OUString key, const ::rtl::O { jvalue args[2]; - // Parameter konvertieren + // Convert Parameter args[0].l = convertwchar_tToJavaString(t.pEnv,key); args[1].l = convertwchar_tToJavaString(t.pEnv,value); - // temporaere Variable initialisieren + // Initialize temporary Variables static const char * cSignature = "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object;"; static const char * cMethodName = "setProperty"; - // Java-Call absetzen + // Turn off Java-Call static jmethodID mID(NULL); obtainMethodId(t.pEnv, cMethodName,cSignature, mID); out = t.pEnv->CallObjectMethod(object, mID, args[0].l,args[1].l); @@ -70,7 +69,7 @@ void java_util_Properties::setProperty(const ::rtl::OUString key, const ::rtl::O if(out) t.pEnv->DeleteLocalRef(out); } //t.pEnv - // ACHTUNG: der Aufrufer wird Eigentuemer des zurueckgelieferten Zeigers !!! + // WARNING: The caller will be owner of the returned pointers!!! } jclass java_util_Properties::theClass = 0; @@ -79,7 +78,7 @@ java_util_Properties::~java_util_Properties() jclass java_util_Properties::getMyClass() const { - // die Klasse muss nur einmal geholt werden, daher statisch + // the class needs only be called once, that is why it is static if( !theClass ) theClass = findMyClass("java/util/Properties"); return theClass; @@ -91,8 +90,8 @@ java_util_Properties::java_util_Properties( ): java_lang_Object( NULL, (jobject) SDBThreadAttach t; if( !t.pEnv ) return; - // Java-Call fuer den Konstruktor absetzen - // temporaere Variable initialisieren + // Turn off Java-Call for the constructor + // Initialize temperary Variables static const char * cSignature = "()V"; jobject tempObj; static jmethodID mID(NULL); @@ -191,7 +190,7 @@ jobject connectivity::convertTypeMapToJavaMap(JNIEnv* /*pEnv*/,const Reference< return 0; } // ----------------------------------------------------------------------------- -sal_Bool connectivity::isExceptionOccured(JNIEnv *pEnv,sal_Bool _bClear) +sal_Bool connectivity::isExceptionOccurred(JNIEnv *pEnv,sal_Bool _bClear) { if ( !pEnv ) return sal_False; @@ -224,8 +223,8 @@ jobject connectivity::createByteInputStream(const ::com::sun::star::uno::Referen SDBThreadAttach t; if( !t.pEnv || !x.is() ) return NULL; - // Java-Call fuer den Konstruktor absetzen - // temporaere Variable initialisieren + // Turn off Java-Call for the constructor + // Initialize temperary variables jclass clazz = java_lang_Object::findMyClass("java/io/ByteArrayInputStream"); static jmethodID mID(NULL); if ( !mID ) @@ -251,8 +250,8 @@ jobject connectivity::createCharArrayReader(const ::com::sun::star::uno::Referen SDBThreadAttach t; if( !t.pEnv || !x.is() ) return NULL; - // Java-Call fuer den Konstruktor absetzen - // temporaere Variable initialisieren + // Turn off Java-Call for the constructor + // Initialize temperary Variables jclass clazz = java_lang_Object::findMyClass("java/io/CharArrayReader"); static jmethodID mID(NULL); if ( !mID ) diff --git a/connectivity/source/drivers/kab/KDEInit.h b/connectivity/source/drivers/kab/KDEInit.h index c1f3963561..c1f3963561 100644..100755 --- a/connectivity/source/drivers/kab/KDEInit.h +++ b/connectivity/source/drivers/kab/KDEInit.h diff --git a/connectivity/source/drivers/kab/KDatabaseMetaData.cxx b/connectivity/source/drivers/kab/KDatabaseMetaData.cxx index a8b3f368f3..18c8915dec 100644 --- a/connectivity/source/drivers/kab/KDatabaseMetaData.cxx +++ b/connectivity/source/drivers/kab/KDatabaseMetaData.cxx @@ -220,7 +220,7 @@ sal_Bool SAL_CALL KabDatabaseMetaData::supportsNonNullableColumns( ) throw(SQLE ::rtl::OUString SAL_CALL KabDatabaseMetaData::getIdentifierQuoteString( ) throw(SQLException, RuntimeException) { // normally this is " - ::rtl::OUString aVal = ::rtl::OUString::createFromAscii("\""); + ::rtl::OUString aVal(RTL_CONSTASCII_USTRINGPARAM("\"")); return aVal; } // ------------------------------------------------------------------------- @@ -567,7 +567,7 @@ sal_Bool SAL_CALL KabDatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(S { // if someday we support more than the default address book, // this method should return the URL which was used to create it - ::rtl::OUString aValue = ::rtl::OUString::createFromAscii("sdbc:address:kab:"); + ::rtl::OUString aValue( RTL_CONSTASCII_USTRINGPARAM( "sdbc:address:kab:" )); return aValue; } // ------------------------------------------------------------------------- @@ -579,13 +579,13 @@ sal_Bool SAL_CALL KabDatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(S // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL KabDatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException) { - ::rtl::OUString aValue = ::rtl::OUString::createFromAscii("kab"); + ::rtl::OUString aValue( RTL_CONSTASCII_USTRINGPARAM( "kab" )); return aValue; } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL KabDatabaseMetaData::getDriverVersion() throw(SQLException, RuntimeException) { - ::rtl::OUString aValue = ::rtl::OUString::createFromAscii(KAB_DRIVER_VERSION); + ::rtl::OUString aValue(RTL_CONSTASCII_USTRINGPARAM(KAB_DRIVER_VERSION)); return aValue; } // ------------------------------------------------------------------------- @@ -792,7 +792,7 @@ Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getTableTypes( ) throw(SQ Reference< XResultSet > xRef = pResult; static ODatabaseMetaDataResultSet::ORows aRows; - static const ::rtl::OUString aTable(::rtl::OUString::createFromAscii("TABLE")); + static const ::rtl::OUString aTable(RTL_CONSTASCII_USTRINGPARAM("TABLE")); if (aRows.empty()) { @@ -816,7 +816,7 @@ Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getTypeInfo( ) throw(SQLE ODatabaseMetaDataResultSet::ORow aRow(19); aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue(); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("CHAR")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CHAR"))); aRow[2] = new ORowSetValueDecorator(DataType::CHAR); aRow[3] = new ORowSetValueDecorator((sal_Int32) 254); aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue(); @@ -887,7 +887,7 @@ Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getColumns( aRow[14] = ODatabaseMetaDataResultSet::getEmptyValue(); aRow[15] = ODatabaseMetaDataResultSet::getEmptyValue(); aRow[16] = new ORowSetValueDecorator((sal_Int32) 254); - aRow[18] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("YES")); + aRow[18] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("YES"))); sal_Int32 nPosition = 1; QString aQtName; @@ -899,7 +899,7 @@ Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getColumns( { aRow[4] = new ORowSetValueDecorator(sName); aRow[5] = new ORowSetValueDecorator(DataType::TIMESTAMP); - aRow[6] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIMESTAMP")); + aRow[6] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP"))); aRow[17] = new ORowSetValueDecorator(nPosition++); aRows.push_back(aRow); } @@ -917,7 +917,7 @@ Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getColumns( { aRow[4] = new ORowSetValueDecorator(sName); aRow[5] = new ORowSetValueDecorator(DataType::CHAR); - aRow[6] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("CHAR")); + aRow[6] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CHAR"))); aRow[7] = new ORowSetValueDecorator((sal_Int32) 256); // Might be VARCHAR and not CHAR[256]... aRow[17] = new ORowSetValueDecorator(nPosition); @@ -941,7 +941,7 @@ Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getTables( // check whether we have tables in the requested types // for the moment, we answer only the "TABLE" table type // when no types are given at all, we return all the tables - static const ::rtl::OUString aTable(::rtl::OUString::createFromAscii("TABLE")); + static const ::rtl::OUString aTable(RTL_CONSTASCII_USTRINGPARAM("TABLE")); sal_Bool bTableFound = sal_False; const ::rtl::OUString* p = types.getConstArray(), * pEnd = p + types.getLength(); @@ -1014,7 +1014,7 @@ Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getVersionColumns( aRow[2] = new ORowSetValueDecorator(sName); aRow[3] = new ORowSetValueDecorator(DataType::TIMESTAMP); - aRow[4] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIMESTAMP")); + aRow[4] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP"))); aRow[5] = ODatabaseMetaDataResultSet::getEmptyValue(); aRow[6] = ODatabaseMetaDataResultSet::getEmptyValue(); @@ -1075,7 +1075,7 @@ Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getCrossReference( // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL KabDatabaseMetaData::getUDTs( const Any&, const ::rtl::OUString&, const ::rtl::OUString&, const Sequence< sal_Int32 >& ) throw(SQLException, RuntimeException) { - OSL_ENSURE(0,"Not implemented yet!"); + OSL_FAIL("Not implemented yet!"); throw SQLException(); } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/kab/KDriver.cxx b/connectivity/source/drivers/kab/KDriver.cxx index 22368d60fc..549d8aa745 100644 --- a/connectivity/source/drivers/kab/KDriver.cxx +++ b/connectivity/source/drivers/kab/KDriver.cxx @@ -106,7 +106,7 @@ namespace if ( !_rFunction ) { // did not find the symbol - OSL_ENSURE( false, ::rtl::OString( "lcl_getFunctionFromModuleOrUnload: could not find the symbol " ) + ::rtl::OString( _pAsciiSymbolName ) ); + OSL_FAIL( ::rtl::OString( "lcl_getFunctionFromModuleOrUnload: could not find the symbol " ) + ::rtl::OString( _pAsciiSymbolName ) ); osl_unloadModule( _rModule ); _rModule = NULL; } @@ -126,7 +126,7 @@ bool KabImplModule::impl_loadModule() OSL_ENSURE( !m_hConnectorModule && !m_pConnectionFactoryFunc && !m_pApplicationInitFunc && !m_pApplicationShutdownFunc && !m_pKDEVersionCheckFunc, "KabImplModule::impl_loadModule: inconsistence: inconsistency (never attempted load before, but some values already set)!"); - const ::rtl::OUString sModuleName = ::rtl::OUString::createFromAscii( SAL_MODULENAME( "kabdrv1" ) ); + const ::rtl::OUString sModuleName(RTL_CONSTASCII_USTRINGPARAM( SAL_MODULENAME( "kabdrv1" ) )); m_hConnectorModule = osl_loadModuleRelative( &thisModule, sModuleName.pData, SAL_LOADMODULE_NOW ); // LAZY! #i61335# OSL_ENSURE( m_hConnectorModule, "KabImplModule::impl_loadModule: could not load the implementation library!" ); if ( !m_hConnectorModule ) @@ -360,7 +360,7 @@ Sequence< ::rtl::OUString > KabDriver::getSupportedServiceNames_Static( ) throw // which service is supported // for more information @see com.sun.star.sdbc.Driver Sequence< ::rtl::OUString > aSNS( 1 ); - aSNS[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.Driver"); + aSNS[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.Driver")); return aSNS; } @@ -418,7 +418,7 @@ sal_Bool SAL_CALL KabDriver::acceptsURL( const ::rtl::OUString& url ) return sal_False; // here we have to look whether we support this URL format - return (!url.compareTo(::rtl::OUString::createFromAscii("sdbc:address:kab:"), 16)); + return (!url.compareTo(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:address:kab:")), 16)); } // -------------------------------------------------------------------------------- Sequence< DriverPropertyInfo > SAL_CALL KabDriver::getPropertyInfo( const ::rtl::OUString&, const Sequence< PropertyValue >& ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/kab/KResultSetMetaData.cxx b/connectivity/source/drivers/kab/KResultSetMetaData.cxx index c9bc2853f1..567f3fbaf5 100644 --- a/connectivity/source/drivers/kab/KResultSetMetaData.cxx +++ b/connectivity/source/drivers/kab/KResultSetMetaData.cxx @@ -52,7 +52,7 @@ KabResultSetMetaData::~KabResultSetMetaData() void KabResultSetMetaData::setKabFields(const ::rtl::Reference<connectivity::OSQLColumns> &xColumns) throw(SQLException) { OSQLColumns::Vector::const_iterator aIter; - static const ::rtl::OUString aName(::rtl::OUString::createFromAscii("Name")); + static const ::rtl::OUString aName(RTL_CONSTASCII_USTRINGPARAM("Name")); for (aIter = xColumns->get().begin(); aIter != xColumns->get().end(); ++aIter) { diff --git a/connectivity/source/drivers/kab/KServices.cxx b/connectivity/source/drivers/kab/KServices.cxx index 640f84d96d..b385ba7393 100644 --- a/connectivity/source/drivers/kab/KServices.cxx +++ b/connectivity/source/drivers/kab/KServices.cxx @@ -31,13 +31,11 @@ #include "KDriver.hxx" #include <cppuhelper/factory.hxx> -#include <osl/diagnose.h> using namespace connectivity::kab; using ::rtl::OUString; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; -using ::com::sun::star::registry::XRegistryKey; using ::com::sun::star::lang::XSingleServiceFactory; using ::com::sun::star::lang::XMultiServiceFactory; @@ -50,31 +48,6 @@ typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc) rtl_ModuleCount* _pTemp ); -//*************************************************************************************** -// -// The following C Api must be provided! -// It consists in three functions that must be exported by the module -// - -//--------------------------------------------------------------------------------------- -void REGISTER_PROVIDER( - const OUString& aServiceImplName, - const Sequence< OUString>& Services, - const Reference< ::com::sun::star::registry::XRegistryKey > & xKey) -{ - OUString aMainKeyName; - aMainKeyName = OUString::createFromAscii("/"); - aMainKeyName += aServiceImplName; - aMainKeyName += OUString::createFromAscii("/UNO/SERVICES"); - - Reference< ::com::sun::star::registry::XRegistryKey > xNewKey( xKey->createKey(aMainKeyName) ); - OSL_ENSURE(xNewKey.is(), "KAB::component_writeInfo : could not create a registry key !"); - - for (sal_Int32 i=0; i<Services.getLength(); ++i) - xNewKey->createKey(Services[i]); -} - - //--------------------------------------------------------------------------------------- struct ProviderRequest { @@ -124,31 +97,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnviron } //--------------------------------------------------------------------------------------- -extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( - void*, - void* pRegistryKey - ) -{ - if (pRegistryKey) - try - { - Reference< ::com::sun::star::registry::XRegistryKey > xKey(reinterpret_cast< ::com::sun::star::registry::XRegistryKey*>(pRegistryKey)); - - REGISTER_PROVIDER( - KabDriver::getImplementationName_Static(), - KabDriver::getSupportedServiceNames_Static(), xKey); - - return sal_True; - } - catch (::com::sun::star::registry::InvalidRegistryException& ) - { - OSL_ENSURE(sal_False, "KAB::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !"); - } - - return sal_False; -} - -//--------------------------------------------------------------------------------------- extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplementationName, void* pServiceManager, diff --git a/connectivity/source/drivers/kab/exports.dxp b/connectivity/source/drivers/kab/exports.dxp index 9630d7e067..f0e1c69934 100644..100755 --- a/connectivity/source/drivers/kab/exports.dxp +++ b/connectivity/source/drivers/kab/exports.dxp @@ -1,3 +1,2 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory diff --git a/connectivity/source/drivers/kab/kab.xcu b/connectivity/source/drivers/kab/kab.xcu index 0cc515e4ee..0cc515e4ee 100755..100644 --- a/connectivity/source/drivers/kab/kab.xcu +++ b/connectivity/source/drivers/kab/kab.xcu diff --git a/connectivity/source/drivers/kab/kab.xml b/connectivity/source/drivers/kab/kab.xml index 115b9f5522..115b9f5522 100644..100755 --- a/connectivity/source/drivers/kab/kab.xml +++ b/connectivity/source/drivers/kab/kab.xml diff --git a/connectivity/source/drivers/kab/kab1.component b/connectivity/source/drivers/kab/kab1.component new file mode 100755 index 0000000000..77227501d3 --- /dev/null +++ b/connectivity/source/drivers/kab/kab1.component @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.sdbc.kab.Driver"> + <service name="com.sun.star.sdbc.Driver"/> + </implementation> +</component> diff --git a/connectivity/source/drivers/kab/kabdrv.map b/connectivity/source/drivers/kab/kabdrv.map index 5de866f2e5..5de866f2e5 100644..100755 --- a/connectivity/source/drivers/kab/kabdrv.map +++ b/connectivity/source/drivers/kab/kabdrv.map diff --git a/connectivity/source/drivers/kab/makefile.mk b/connectivity/source/drivers/kab/makefile.mk index 98bedf66ed..13d4857c91 100644..100755 --- a/connectivity/source/drivers/kab/makefile.mk +++ b/connectivity/source/drivers/kab/makefile.mk @@ -46,6 +46,9 @@ CFLAGS+=$(KDE_CFLAGS) .IF "$(KDE_ROOT)"!="" EXTRALIBPATHS+=-L$(KDE_ROOT)$/lib +.IF "$(OS)$(CPU)" == "LINUXX" +EXTRALIBPATHS+=-L$(KDE_ROOT)$/lib64 +.ENDIF .ENDIF # === KAB base library ========================== @@ -136,3 +139,11 @@ dummy: .INCLUDE : $(PRJ)$/target.pmk + +ALLTAR : $(MISC)/kab1.component + +$(MISC)/kab1.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + kab1.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt kab1.component diff --git a/connectivity/source/drivers/macab/MacabAddressBook.cxx b/connectivity/source/drivers/macab/MacabAddressBook.cxx index 97469643cf..1f7d0a6b18 100644 --- a/connectivity/source/drivers/macab/MacabAddressBook.cxx +++ b/connectivity/source/drivers/macab/MacabAddressBook.cxx @@ -81,7 +81,7 @@ const ::rtl::OUString & MacabAddressBook::getDefaultTableName() { /* This string probably needs to be localized. */ static const ::rtl::OUString aDefaultTableName - (::rtl::OUString::createFromAscii("Address Book")); + (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Address Book"))); return aDefaultTableName; } @@ -247,9 +247,9 @@ void MacabAddressBook::manageDuplicateGroups(::std::vector<MacabGroup *> _xGroup if(count != 1) { ::rtl::OUString sName = (*iter1)->getName(); - sName += ::rtl::OUString::createFromAscii(" (") + + sName += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" (")) + ::rtl::OUString::valueOf(count) + - ::rtl::OUString::createFromAscii(")"); + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")")); (*iter1)->setName(sName); } } diff --git a/connectivity/source/drivers/macab/MacabDatabaseMetaData.cxx b/connectivity/source/drivers/macab/MacabDatabaseMetaData.cxx index 3392d0f208..7a8687eb13 100644 --- a/connectivity/source/drivers/macab/MacabDatabaseMetaData.cxx +++ b/connectivity/source/drivers/macab/MacabDatabaseMetaData.cxx @@ -217,7 +217,7 @@ sal_Bool SAL_CALL MacabDatabaseMetaData::supportsNonNullableColumns( ) throw(SQ ::rtl::OUString SAL_CALL MacabDatabaseMetaData::getIdentifierQuoteString( ) throw(SQLException, RuntimeException) { // normally this is " - ::rtl::OUString aVal = ::rtl::OUString::createFromAscii("\""); + ::rtl::OUString aVal(RTL_CONSTASCII_USTRINGPARAM("\"")); return aVal; } // ------------------------------------------------------------------------- @@ -564,7 +564,7 @@ sal_Bool SAL_CALL MacabDatabaseMetaData::supportsANSI92IntermediateSQL( ) throw { // if someday we support more than the default address book, // this method should return the URL which was used to create it - ::rtl::OUString aValue = ::rtl::OUString::createFromAscii("sdbc:address:macab:"); + ::rtl::OUString aValue( RTL_CONSTASCII_USTRINGPARAM( "sdbc:address:macab:" )); return aValue; } // ------------------------------------------------------------------------- @@ -576,13 +576,13 @@ sal_Bool SAL_CALL MacabDatabaseMetaData::supportsANSI92IntermediateSQL( ) throw // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL MacabDatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException) { - ::rtl::OUString aValue = ::rtl::OUString::createFromAscii("macab"); + ::rtl::OUString aValue( RTL_CONSTASCII_USTRINGPARAM( "macab" )); return aValue; } // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL MacabDatabaseMetaData::getDriverVersion() throw(SQLException, RuntimeException) { - ::rtl::OUString aValue = ::rtl::OUString::createFromAscii(MACAB_DRIVER_VERSION); + ::rtl::OUString aValue(RTL_CONSTASCII_USTRINGPARAM(MACAB_DRIVER_VERSION)); return aValue; } // ------------------------------------------------------------------------- @@ -789,7 +789,7 @@ Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getTableTypes( ) throw( Reference< XResultSet > xRef = pResult; static ODatabaseMetaDataResultSet::ORows aRows; - static const ::rtl::OUString aTable(::rtl::OUString::createFromAscii("TABLE")); + static const ::rtl::OUString aTable(RTL_CONSTASCII_USTRINGPARAM("TABLE")); if (aRows.empty()) { @@ -814,7 +814,7 @@ Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getTypeInfo( ) throw(SQ // We support four types: char, timestamp, integer, float aRow[0] = ODatabaseMetaDataResultSet::getEmptyValue(); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("CHAR")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CHAR"))); aRow[2] = new ORowSetValueDecorator(DataType::CHAR); aRow[3] = new ORowSetValueDecorator((sal_Int32) 254); aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue(); @@ -835,20 +835,20 @@ Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getTypeInfo( ) throw(SQ aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIMESTAMP")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP"))); aRow[2] = new ORowSetValueDecorator(DataType::TIMESTAMP); aRow[3] = new ORowSetValueDecorator((sal_Int32)19); aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue(); aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue(); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("INTEGER")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INTEGER"))); aRow[2] = new ORowSetValueDecorator(DataType::INTEGER); aRow[3] = new ORowSetValueDecorator((sal_Int32)20); aRow[15] = new ORowSetValueDecorator((sal_Int32)20); aRows.push_back(aRow); - aRow[1] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("FLOAT")); + aRow[1] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FLOAT"))); aRow[2] = new ORowSetValueDecorator(DataType::FLOAT); aRow[3] = new ORowSetValueDecorator((sal_Int32)20); aRow[15] = new ORowSetValueDecorator((sal_Int32)15); @@ -909,7 +909,7 @@ Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getColumns( aRow[14] = ODatabaseMetaDataResultSet::getEmptyValue(); aRow[15] = ODatabaseMetaDataResultSet::getEmptyValue(); aRow[16] = new ORowSetValueDecorator((sal_Int32) 254); - aRow[18] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("YES")); + aRow[18] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("YES"))); sal_Int32 nPosition = 1; ::rtl::OUString sName; @@ -930,24 +930,24 @@ Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getColumns( { case kABStringProperty: aRow[5] = new ORowSetValueDecorator(DataType::CHAR); - aRow[6] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("CHAR")); + aRow[6] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CHAR"))); aRow[7] = new ORowSetValueDecorator((sal_Int32) 256); aRows.push_back(aRow); break; case kABDateProperty: aRow[5] = new ORowSetValueDecorator(DataType::TIMESTAMP); - aRow[6] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIMESTAMP")); + aRow[6] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP"))); aRows.push_back(aRow); break; case kABIntegerProperty: aRow[5] = new ORowSetValueDecorator(DataType::INTEGER); - aRow[6] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("INTEGER")); + aRow[6] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INTEGER"))); aRow[7] = new ORowSetValueDecorator((sal_Int32) 20); aRows.push_back(aRow); break; case kABRealProperty: aRow[5] = new ORowSetValueDecorator(DataType::FLOAT); - aRow[6] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("FLOAT")); + aRow[6] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FLOAT"))); aRow[7] = new ORowSetValueDecorator((sal_Int32) 15); aRows.push_back(aRow); break; @@ -974,7 +974,7 @@ Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getTables( // check whether we have tables in the requested types // for the moment, we answer only the "TABLE" table type // when no types are given at all, we return all the tables - static const ::rtl::OUString aTable(::rtl::OUString::createFromAscii("TABLE")); + static const ::rtl::OUString aTable(RTL_CONSTASCII_USTRINGPARAM("TABLE")); sal_Bool bTableFound = sal_False; const ::rtl::OUString* p = types.getConstArray(), * pEnd = p + types.getLength(); @@ -1058,7 +1058,7 @@ Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getVersionColumns( aRow[1] = ODatabaseMetaDataResultSet::getEmptyValue(); aRow[2] = new ORowSetValueDecorator(sName); aRow[3] = new ORowSetValueDecorator(DataType::TIMESTAMP); - aRow[4] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIMESTAMP")); + aRow[4] = new ORowSetValueDecorator(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TIMESTAMP"))); aRow[5] = ODatabaseMetaDataResultSet::getEmptyValue(); aRow[6] = ODatabaseMetaDataResultSet::getEmptyValue(); @@ -1119,7 +1119,7 @@ Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getCrossReference( // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL MacabDatabaseMetaData::getUDTs( const Any&, const ::rtl::OUString&, const ::rtl::OUString&, const Sequence< sal_Int32 >& ) throw(SQLException, RuntimeException) { - OSL_ENSURE(0,"Not implemented yet!"); + OSL_FAIL("Not implemented yet!"); throw SQLException(); } // ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/macab/MacabDriver.cxx b/connectivity/source/drivers/macab/MacabDriver.cxx index abcfe98bd0..3751b24ddc 100644 --- a/connectivity/source/drivers/macab/MacabDriver.cxx +++ b/connectivity/source/drivers/macab/MacabDriver.cxx @@ -84,7 +84,7 @@ namespace if ( !_rFunction ) { // did not find the symbol - OSL_ENSURE( false, ::rtl::OString( "lcl_getFunctionFromModuleOrUnload: could not find the symbol " ) + ::rtl::OString( _pAsciiSymbolName ) ); + OSL_FAIL( ::rtl::OString( "lcl_getFunctionFromModuleOrUnload: could not find the symbol " ) + ::rtl::OString( _pAsciiSymbolName ) ); osl_unloadModule( _rModule ); _rModule = NULL; } @@ -104,7 +104,7 @@ bool MacabImplModule::impl_loadModule() OSL_ENSURE( !m_hConnectorModule && !m_pConnectionFactoryFunc, "MacabImplModule::impl_loadModule: inconsistence: inconsistency (never attempted load before, but some values already set)!"); - const ::rtl::OUString sModuleName = ::rtl::OUString::createFromAscii( SAL_MODULENAME( "macabdrv1" ) ); + const ::rtl::OUString sModuleName(RTL_CONSTASCII_USTRINGPARAM( SAL_MODULENAME( "macabdrv1" )) ); m_hConnectorModule = osl_loadModuleRelative( &thisModule, sModuleName.pData, SAL_LOADMODULE_NOW ); // LAZY! #i61335# OSL_ENSURE( m_hConnectorModule, "MacabImplModule::impl_loadModule: could not load the implementation library!" ); if ( !m_hConnectorModule ) @@ -235,7 +235,7 @@ Sequence< ::rtl::OUString > MacabDriver::getSupportedServiceNames_Static( ) thr // which service is supported // for more information @see com.sun.star.sdbc.Driver Sequence< ::rtl::OUString > aSNS( 1 ); - aSNS[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.Driver"); + aSNS[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.Driver")); return aSNS; } @@ -293,7 +293,7 @@ sal_Bool SAL_CALL MacabDriver::acceptsURL( const ::rtl::OUString& url ) return sal_False; // here we have to look whether we support this URL format - return (!url.compareTo(::rtl::OUString::createFromAscii("sdbc:address:macab:"), 18)); + return (!url.compareTo(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:address:macab:")), 18)); } // -------------------------------------------------------------------------------- Sequence< DriverPropertyInfo > SAL_CALL MacabDriver::getPropertyInfo( const ::rtl::OUString&, const Sequence< PropertyValue >& ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/macab/MacabHeader.cxx b/connectivity/source/drivers/macab/MacabHeader.cxx index 11519522d6..39fb28c62c 100644 --- a/connectivity/source/drivers/macab/MacabHeader.cxx +++ b/connectivity/source/drivers/macab/MacabHeader.cxx @@ -306,10 +306,11 @@ MacabHeader::iterator::~iterator () { } -void MacabHeader::iterator::operator= (MacabHeader *_record) +MacabHeader::iterator& MacabHeader::iterator::operator= (MacabHeader *_record) { id = 0; record = _record; + return *this; } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/macab/MacabHeader.hxx b/connectivity/source/drivers/macab/MacabHeader.hxx index b0dc2820e6..f24b593a9b 100644 --- a/connectivity/source/drivers/macab/MacabHeader.hxx +++ b/connectivity/source/drivers/macab/MacabHeader.hxx @@ -57,7 +57,7 @@ namespace connectivity sal_Int32 id; MacabHeader *record; public: - void operator= (MacabHeader *_record); + iterator& operator= (MacabHeader *_record); iterator(); ~iterator(); void operator++ (); diff --git a/connectivity/source/drivers/macab/MacabRecords.cxx b/connectivity/source/drivers/macab/MacabRecords.cxx index 601808e9a7..a92e2313e9 100644 --- a/connectivity/source/drivers/macab/MacabRecords.cxx +++ b/connectivity/source/drivers/macab/MacabRecords.cxx @@ -448,7 +448,7 @@ MacabHeader *MacabRecords::createHeaderForRecordType(const CFArrayRef _records, else { // Couldn't find a required property... - OSL_ENSURE(false, ::rtl::OString("MacabRecords::createHeaderForRecordType: could not find required property: ") + + OSL_FAIL(::rtl::OString("MacabRecords::createHeaderForRecordType: could not find required property: ") + ::rtl::OUStringToOString(CFStringToOUString(requiredProperties[i]), RTL_TEXTENCODING_ASCII_US)); } } @@ -568,7 +568,7 @@ MacabHeader *MacabRecords::createHeaderForProperty(const ABPropertyType _propert multiLabelString = CFStringToOUString(localizedMultiLabel); CFRelease(multiLabel); CFRelease(localizedMultiLabel); - headerNameString = multiPropertyString + ::rtl::OUString::createFromAscii(": ") + fixLabel(multiLabelString); + headerNameString = multiPropertyString + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(": ")) + fixLabel(multiLabelString); headerNames[i] = new macabfield; headerNames[i]->value = OUStringToCFString(headerNameString); headerNames[i]->type = multiType; @@ -619,7 +619,7 @@ MacabHeader *MacabRecords::createHeaderForProperty(const ABPropertyType _propert if(multiValue && multiLabel) { localizedMultiLabel = ABCopyLocalizedPropertyOrLabel(multiLabel); - multiLabelString = multiPropertyString + ::rtl::OUString::createFromAscii(": ") + fixLabel(CFStringToOUString(localizedMultiLabel)); + multiLabelString = multiPropertyString + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(": ")) + fixLabel(CFStringToOUString(localizedMultiLabel)); CFRelease(multiLabel); CFRelease(localizedMultiLabel); multiLabel = OUStringToCFString(multiLabelString); @@ -707,7 +707,7 @@ MacabHeader *MacabRecords::createHeaderForProperty(const ABPropertyType _propert dictType = (ABPropertyType) getABTypeFromCFType( CFGetTypeID(dictValues[i]) ); localizedDictKey = ABCopyLocalizedPropertyOrLabel(dictKeys[i]); dictKeyString = CFStringToOUString(localizedDictKey); - dictLabelString = propertyNameString + ::rtl::OUString::createFromAscii(": ") + fixLabel(dictKeyString); + dictLabelString = propertyNameString + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(": ")) + fixLabel(dictKeyString); dictLabel = OUStringToCFString(dictLabelString); dictHeaders[i] = createHeaderForProperty(dictType, dictValues[i], dictLabel); if (!dictHeaders[i]) @@ -847,7 +847,7 @@ void MacabRecords::manageDuplicateHeaders(macabfield **_headerNames, const sal_I // There is probably a better way to do this... ::rtl::OUString newName = CFStringToOUString((CFStringRef) _headerNames[i]->value); CFRelease(_headerNames[i]->value); - newName += ::rtl::OUString::createFromAscii(" (") + ::rtl::OUString::valueOf(count) + ::rtl::OUString::createFromAscii(")"); + newName += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" (")) + ::rtl::OUString::valueOf(count) + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")")); _headerNames[i]->value = OUStringToCFString(newName); } } @@ -939,7 +939,7 @@ void MacabRecords::insertPropertyIntoMacabRecord(const ABPropertyType _propertyT * scalar type, an error, or an unknown type are found. * Because of that, the following checks only occur for this type. * We store whether we have successfully placed this property - * into the MacabRecord (or whether an unrecoverable error occured). + * into the MacabRecord (or whether an unrecoverable error occurred). * Then, we try over and over again to place the property into the * record. There are three possible results: * 1) Success! @@ -968,7 +968,7 @@ void MacabRecords::insertPropertyIntoMacabRecord(const ABPropertyType _propertyT { bPlaced = sal_False; i++; - columnName = ::rtl::OUString(_propertyName) + ::rtl::OUString::createFromAscii(" (") + ::rtl::OUString::valueOf(i) + ::rtl::OUString::createFromAscii(")"); + columnName = ::rtl::OUString(_propertyName) + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" (")) + ::rtl::OUString::valueOf(i) + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")")); } // success! @@ -1040,7 +1040,7 @@ void MacabRecords::insertPropertyIntoMacabRecord(const ABPropertyType _propertyT localizedDictKey = ABCopyLocalizedPropertyOrLabel(dictKeys[i]); dictKeyString = CFStringToOUString(localizedDictKey); CFRelease(localizedDictKey); - newPropertyName = _propertyName + ::rtl::OUString::createFromAscii(": ") + fixLabel(dictKeyString); + newPropertyName = _propertyName + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(": ")) + fixLabel(dictKeyString); insertPropertyIntoMacabRecord(_abrecord, _header, newPropertyName, dictValues[i]); } @@ -1083,7 +1083,7 @@ void MacabRecords::insertPropertyIntoMacabRecord(const ABPropertyType _propertyT localizedMultiLabel = ABCopyLocalizedPropertyOrLabel(multiLabel); multiLabelString = CFStringToOUString(localizedMultiLabel); - newPropertyName = _propertyName + ::rtl::OUString::createFromAscii(": ") + fixLabel(multiLabelString); + newPropertyName = _propertyName + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(": ")) + fixLabel(multiLabelString); insertPropertyIntoMacabRecord(multiType, _abrecord, _header, newPropertyName, multiValue); /* free our variables */ @@ -1154,10 +1154,11 @@ MacabRecords::iterator::~iterator () } // ------------------------------------------------------------------------- -void MacabRecords::iterator::operator= (MacabRecords *_records) +MacabRecords::iterator& MacabRecords::iterator::operator= (MacabRecords *_records) { id = 0; records = _records; + return *this; } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/macab/MacabRecords.hxx b/connectivity/source/drivers/macab/MacabRecords.hxx index dfd6cb8429..0ac946b5c0 100644 --- a/connectivity/source/drivers/macab/MacabRecords.hxx +++ b/connectivity/source/drivers/macab/MacabRecords.hxx @@ -121,7 +121,7 @@ namespace connectivity MacabRecords *records; public: sal_Int32 id; - void operator= (MacabRecords *_records); + iterator& operator= (MacabRecords *_records); iterator(); ~iterator(); void operator++ (); diff --git a/connectivity/source/drivers/macab/MacabResultSet.cxx b/connectivity/source/drivers/macab/MacabResultSet.cxx index 314337fbe7..851052aa59 100644 --- a/connectivity/source/drivers/macab/MacabResultSet.cxx +++ b/connectivity/source/drivers/macab/MacabResultSet.cxx @@ -890,7 +890,7 @@ Any SAL_CALL MacabResultSet::getBookmark() throw( SQLException, RuntimeExceptio if (m_nRowPos != -1 && m_nRowPos != nRecords) { - macabfield *uidField = m_aMacabRecords->getField(m_nRowPos,::rtl::OUString::createFromAscii("UID")); + macabfield *uidField = m_aMacabRecords->getField(m_nRowPos,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UID"))); if(uidField != NULL) { if(uidField->type == kABStringProperty) @@ -912,7 +912,7 @@ sal_Bool SAL_CALL MacabResultSet::moveToBookmark(const Any& bookmark) throw( SQ for (sal_Int32 nRow = 0; nRow < nRecords; nRow++) { - macabfield *uidField = m_aMacabRecords->getField(m_nRowPos,::rtl::OUString::createFromAscii("UID")); + macabfield *uidField = m_aMacabRecords->getField(m_nRowPos,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UID"))); if(uidField != NULL) { if(uidField->type == kABStringProperty) diff --git a/connectivity/source/drivers/macab/MacabResultSetMetaData.cxx b/connectivity/source/drivers/macab/MacabResultSetMetaData.cxx index 27ff55dced..064065213c 100644 --- a/connectivity/source/drivers/macab/MacabResultSetMetaData.cxx +++ b/connectivity/source/drivers/macab/MacabResultSetMetaData.cxx @@ -55,7 +55,7 @@ MacabResultSetMetaData::~MacabResultSetMetaData() void MacabResultSetMetaData::setMacabFields(const ::rtl::Reference<connectivity::OSQLColumns> &xColumns) throw(SQLException) { OSQLColumns::Vector::const_iterator aIter; - static const ::rtl::OUString aName(::rtl::OUString::createFromAscii("Name")); + static const ::rtl::OUString aName(RTL_CONSTASCII_USTRINGPARAM("Name")); MacabRecords *aRecords; MacabHeader *aHeader; diff --git a/connectivity/source/drivers/macab/MacabServices.cxx b/connectivity/source/drivers/macab/MacabServices.cxx index d6e9e7b385..144eb9ac5c 100644 --- a/connectivity/source/drivers/macab/MacabServices.cxx +++ b/connectivity/source/drivers/macab/MacabServices.cxx @@ -31,13 +31,11 @@ #include "MacabDriver.hxx" #include <cppuhelper/factory.hxx> -#include <osl/diagnose.h> using namespace connectivity::macab; using ::rtl::OUString; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; -using ::com::sun::star::registry::XRegistryKey; using ::com::sun::star::lang::XSingleServiceFactory; using ::com::sun::star::lang::XMultiServiceFactory; @@ -50,31 +48,6 @@ typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc) rtl_ModuleCount* _pTemp ); -//*************************************************************************************** -// -// The following C Api must be provided! -// It consists in three functions that must be exported by the module -// - -//--------------------------------------------------------------------------------------- -void REGISTER_PROVIDER( - const OUString& aServiceImplName, - const Sequence< OUString>& Services, - const Reference< ::com::sun::star::registry::XRegistryKey > & xKey) -{ - OUString aMainKeyName; - aMainKeyName = OUString::createFromAscii("/"); - aMainKeyName += aServiceImplName; - aMainKeyName += OUString::createFromAscii("/UNO/SERVICES"); - - Reference< ::com::sun::star::registry::XRegistryKey > xNewKey( xKey->createKey(aMainKeyName) ); - OSL_ENSURE(xNewKey.is(), "MACAB::component_writeInfo : could not create a registry key !"); - - for (sal_Int32 i=0; i<Services.getLength(); ++i) - xNewKey->createKey(Services[i]); -} - - //--------------------------------------------------------------------------------------- struct ProviderRequest { @@ -124,31 +97,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnviron } //--------------------------------------------------------------------------------------- -extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( - void*, - void* pRegistryKey - ) -{ - if (pRegistryKey) - try - { - Reference< ::com::sun::star::registry::XRegistryKey > xKey(reinterpret_cast< ::com::sun::star::registry::XRegistryKey*>(pRegistryKey)); - - REGISTER_PROVIDER( - MacabDriver::getImplementationName_Static(), - MacabDriver::getSupportedServiceNames_Static(), xKey); - - return sal_True; - } - catch (::com::sun::star::registry::InvalidRegistryException& ) - { - OSL_ENSURE(sal_False, "MACAB::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !"); - } - - return sal_False; -} - -//--------------------------------------------------------------------------------------- extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplementationName, void* pServiceManager, diff --git a/connectivity/source/drivers/macab/exports.dxp b/connectivity/source/drivers/macab/exports.dxp index 9630d7e067..f0e1c69934 100755 --- a/connectivity/source/drivers/macab/exports.dxp +++ b/connectivity/source/drivers/macab/exports.dxp @@ -1,3 +1,2 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory diff --git a/connectivity/source/drivers/macab/macab.xcu b/connectivity/source/drivers/macab/macab.xcu index cbb9d0b6b0..cbb9d0b6b0 100755..100644 --- a/connectivity/source/drivers/macab/macab.xcu +++ b/connectivity/source/drivers/macab/macab.xcu diff --git a/connectivity/source/drivers/macab/macab1.component b/connectivity/source/drivers/macab/macab1.component new file mode 100755 index 0000000000..0a120c0418 --- /dev/null +++ b/connectivity/source/drivers/macab/macab1.component @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.sdbc.macab.Driver"> + <service name="com.sun.star.sdbc.Driver"/> + </implementation> +</component> diff --git a/connectivity/source/drivers/macab/macabutilities.hxx b/connectivity/source/drivers/macab/macabutilities.hxx index 9b9aa1f644..237a7e4456 100644 --- a/connectivity/source/drivers/macab/macabutilities.hxx +++ b/connectivity/source/drivers/macab/macabutilities.hxx @@ -111,7 +111,7 @@ namespace connectivity /* Get the length, and make sure that there is actually a string * here. */ - if(_originalLabel.indexOf(::rtl::OUString::createFromAscii("_$!<")) == 0) + if(_originalLabel.indexOf(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_$!<"))) == 0) { return _originalLabel.copy(4,_originalLabel.getLength()-8); } diff --git a/connectivity/source/drivers/macab/makefile.mk b/connectivity/source/drivers/macab/makefile.mk index 31ffede390..b2e8db65dc 100755 --- a/connectivity/source/drivers/macab/makefile.mk +++ b/connectivity/source/drivers/macab/makefile.mk @@ -128,3 +128,11 @@ dummy: .INCLUDE : $(PRJ)$/target.pmk + +ALLTAR : $(MISC)/macab1.component + +$(MISC)/macab1.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + macab1.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt macab1.component diff --git a/connectivity/source/drivers/mozab/MColumnAlias.cxx b/connectivity/source/drivers/mozab/MColumnAlias.cxx index 72a35ef63d..7cbd66ae72 100644 --- a/connectivity/source/drivers/mozab/MColumnAlias.cxx +++ b/connectivity/source/drivers/mozab/MColumnAlias.cxx @@ -174,7 +174,7 @@ void OColumnAlias::initialize( const ::com::sun::star::uno::Reference< ::com::su AliasMap::const_iterator pos = m_aAliasMap.find( _rAlias ); if ( pos == m_aAliasMap.end() ) { - OSL_ENSURE( false, "OColumnAlias::getProgrammaticNameOrFallbackToUTF8Alias: no programmatic name for this alias!" ); + OSL_FAIL( "OColumnAlias::getProgrammaticNameOrFallbackToUTF8Alias: no programmatic name for this alias!" ); return ::rtl::OUStringToOString( _rAlias, RTL_TEXTENCODING_UTF8 ); } return pos->second.programmaticAsciiName; diff --git a/connectivity/source/drivers/mozab/MColumnAlias.hxx b/connectivity/source/drivers/mozab/MColumnAlias.hxx index b668bba01e..4aa9c07d7f 100644 --- a/connectivity/source/drivers/mozab/MColumnAlias.hxx +++ b/connectivity/source/drivers/mozab/MColumnAlias.hxx @@ -34,7 +34,7 @@ #include <osl/mutex.hxx> #include <vector> -#include <hash_map> +#include <boost/unordered_map.hpp> namespace connectivity { @@ -59,7 +59,7 @@ namespace connectivity { } }; - typedef ::std::hash_map< ::rtl::OUString, AliasEntry, ::rtl::OUStringHash > AliasMap; + typedef ::boost::unordered_map< ::rtl::OUString, AliasEntry, ::rtl::OUStringHash > AliasMap; private: AliasMap m_aAliasMap; diff --git a/connectivity/source/drivers/mozab/MColumns.cxx b/connectivity/source/drivers/mozab/MColumns.cxx index 6a95f44df0..9e81cfdc0b 100644 --- a/connectivity/source/drivers/mozab/MColumns.cxx +++ b/connectivity/source/drivers/mozab/MColumns.cxx @@ -49,7 +49,6 @@ using namespace connectivity::sdbcx; using namespace connectivity; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; -// using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; diff --git a/connectivity/source/drivers/mozab/MConfigAccess.cxx b/connectivity/source/drivers/mozab/MConfigAccess.cxx index c45ee87ff8..4609b10985 100644 --- a/connectivity/source/drivers/mozab/MConfigAccess.cxx +++ b/connectivity/source/drivers/mozab/MConfigAccess.cxx @@ -58,7 +58,7 @@ namespace connectivity if ( xConfigProvider.is() ) { - ::rtl::OUString sCompleteNodePath = ::rtl::OUString::createFromAscii ("/org.openoffice.Office.DataAccess/DriverSettings/" ); + ::rtl::OUString sCompleteNodePath(RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.DataAccess/DriverSettings/" )); sCompleteNodePath += OConnection::getDriverImplementationName(); //========================================================= @@ -92,7 +92,7 @@ namespace connectivity } catch( const Exception& ) { - OSL_ENSURE( sal_False, "createDriverConfigNode: caught an exception while accessing the driver's config node!" ); + OSL_FAIL( "createDriverConfigNode: caught an exception while accessing the driver's config node!" ); } // outta here @@ -149,7 +149,7 @@ namespace connectivity } catch( const Exception& ) { - OSL_ENSURE( sal_False, "getDescription: caught an exception!" ); + OSL_FAIL( "getDescription: caught an exception!" ); } } if (sDescription.getLength() == 0) @@ -177,7 +177,7 @@ namespace connectivity } catch( const Exception& ) { - OSL_ENSURE( sal_False, "getPreferredProfileName: caught an exception!" ); + OSL_FAIL( "getPreferredProfileName: caught an exception!" ); } } return sPreferredName; diff --git a/connectivity/source/drivers/mozab/MConnection.cxx b/connectivity/source/drivers/mozab/MConnection.cxx index cdf3c6df91..f7bb24e053 100644 --- a/connectivity/source/drivers/mozab/MConnection.cxx +++ b/connectivity/source/drivers/mozab/MConnection.cxx @@ -101,7 +101,7 @@ const sal_Char* getSdbcScheme( SdbcScheme _eScheme ) // ----------------------------------------------------------------------------- ::rtl::OUString OConnection::getDriverImplementationName() { - return rtl::OUString::createFromAscii(MOZAB_DRIVER_IMPL_NAME); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(MOZAB_DRIVER_IMPL_NAME)); } // ----------------------------------------------------------------------------- @@ -159,7 +159,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV // sal_Int32 nLen = url.indexOf(':'); nLen = url.indexOf(':',nLen+1); - OSL_ENSURE( url.copy( 0, nLen ).equalsAscii( "sdbc:address" ), "OConnection::construct: invalid start of the URI - should never have survived XDriver::acceptsURL!" ); + OSL_ENSURE( url.copy( 0, nLen ).equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "sdbc:address" ) ), "OConnection::construct: invalid start of the URI - should never have survived XDriver::acceptsURL!" ); ::rtl::OUString aAddrbookURI(url.copy(nLen+1)); // Get Scheme @@ -573,11 +573,11 @@ void OConnection::throwSQLException( const ErrorDescriptor& _rError, const Refer "$1$", sParameter ) ); ::dbtools::throwGenericSQLException( sError, _rxContext ); - OSL_ENSURE( false, "OConnection::throwSQLException: unreachable (1)!" ); + OSL_FAIL( "OConnection::throwSQLException: unreachable (1)!" ); } throwGenericSQLException( _rError.getResId(), _rxContext ); - OSL_ENSURE( false, "OConnection::throwSQLException: unreachable (2)!" ); + OSL_FAIL( "OConnection::throwSQLException: unreachable (2)!" ); } if ( _rError.getErrorCondition() != 0 ) @@ -588,7 +588,7 @@ void OConnection::throwSQLException( const ErrorDescriptor& _rError, const Refer aErrorHelper.raiseException( _rError.getErrorCondition(), _rxContext, sParameter ); else aErrorHelper.raiseException( _rError.getErrorCondition(), _rxContext); - OSL_ENSURE( false, "OConnection::throwSQLException: unreachable (3)!" ); + OSL_FAIL( "OConnection::throwSQLException: unreachable (3)!" ); } throwGenericSQLException( STR_UNSPECIFIED_ERROR, _rxContext ); diff --git a/connectivity/source/drivers/mozab/MDriver.cxx b/connectivity/source/drivers/mozab/MDriver.cxx index 0b2950b3dd..37d0a74dda 100644 --- a/connectivity/source/drivers/mozab/MDriver.cxx +++ b/connectivity/source/drivers/mozab/MDriver.cxx @@ -93,7 +93,7 @@ void MozabDriver::disposing() //------------------------------------------------------------------------------ rtl::OUString MozabDriver::getImplementationName_Static( ) throw(RuntimeException) { - return rtl::OUString::createFromAscii(MOZAB_DRIVER_IMPL_NAME); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(MOZAB_DRIVER_IMPL_NAME)); // this name is referenced in the configuration and in the mozab.xml // Please take care when changing it. } @@ -159,7 +159,7 @@ Reference< XConnection > SAL_CALL MozabDriver::connect( const ::rtl::OUString& u ::connectivity::SharedResources aResources; const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution( STR_COULD_NOT_LOAD_LIB, - "$libname$", ::rtl::OUString::createFromAscii( SVLIBRARY( "mozabdrv" ) ) + "$libname$", ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SVLIBRARY( "mozabdrv" )) ) ) ); ::dbtools::throwGenericSQLException(sError,*this); @@ -237,7 +237,7 @@ EDriverType MozabDriver::impl_classifyURL( const ::rtl::OUString& url ) // There isn't any subschema: - but could be just subschema if ( aAddrbookURI.getLength() > 0 ) aAddrbookScheme= aAddrbookURI; - else if(url == ::rtl::OUString::createFromAscii("sdbc:address:") ) + else if(url == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:address:")) ) return Unknown; // TODO check else return Unknown; @@ -251,7 +251,7 @@ EDriverType MozabDriver::impl_classifyURL( const ::rtl::OUString& url ) const sal_Char* pScheme; } aSchemeMap[] = { -#if defined(WNT) || defined(WIN) +#if defined(WNT) { Outlook, "outlook" }, { OutlookExpress, "outlookexp" }, #endif @@ -283,7 +283,7 @@ namespace if ( !_rFunction ) { // did not find the symbol - OSL_ENSURE( false, ::rtl::OString( "lcl_getFunctionFromModuleOrUnload: could not find the symbol " ) + ::rtl::OString( _pAsciiSymbolName ) ); + OSL_FAIL( ::rtl::OString( "lcl_getFunctionFromModuleOrUnload: could not find the symbol " ) + ::rtl::OString( _pAsciiSymbolName ) ); osl_unloadModule( _rModule ); _rModule = NULL; } @@ -301,7 +301,7 @@ bool MozabDriver::ensureInit() OSL_ENSURE(NULL == m_pCreationFunc, "MozabDriver::ensureInit: inconsistence: already have a factory function!"); - const ::rtl::OUString sModuleName = ::rtl::OUString::createFromAscii(SVLIBRARY( "mozabdrv" )); + const ::rtl::OUString sModuleName(RTL_CONSTASCII_USTRINGPARAM(SVLIBRARY( "mozabdrv" ))); // load the mozabdrv library m_hModule = osl_loadModuleRelative(&thisModule, sModuleName.pData, 0); diff --git a/connectivity/source/drivers/mozab/MPreparedStatement.cxx b/connectivity/source/drivers/mozab/MPreparedStatement.cxx index c221684cbb..6136507a0b 100644 --- a/connectivity/source/drivers/mozab/MPreparedStatement.cxx +++ b/connectivity/source/drivers/mozab/MPreparedStatement.cxx @@ -418,7 +418,7 @@ ORowSetValue& x) sal_uInt32 OPreparedStatement::AddParameter(OSQLParseNode * pParameter, const Reference<XPropertySet>& _xCol) { OSL_UNUSED( pParameter ); - // Nr. des neu hinzuzufuegenden Parameters: + // Nr. of the new added Parameters sal_uInt32 nParameter = m_xParamColumns->get().size()+1; OSL_ENSURE(SQL_ISRULE(pParameter,parameter),"OResultSet::AddParameter: Argument ist kein Parameter"); @@ -430,7 +430,7 @@ sal_uInt32 OPreparedStatement::AddParameter(OSQLParseNode * pParameter, const Re ::rtl::OUString sParameterName; - // Parameter-Column aufsetzen: + // set up Parameter-Column: sal_Int32 eType = DataType::VARCHAR; sal_uInt32 nPrecision = 255; sal_Int32 nScale = 0; @@ -438,9 +438,9 @@ sal_uInt32 OPreparedStatement::AddParameter(OSQLParseNode * pParameter, const Re if (_xCol.is()) { - // Typ, Precision, Scale ... der angegebenen Column verwenden, - // denn dieser Column wird der Wert zugewiesen bzw. mit dieser - // Column wird der Wert verglichen. + // Type, Precision, Scale ... utilize the selected Columns, + // then this Column will get the value assigned or with this + // Column will the value be compared. eType = getINT32(_xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))); nPrecision = getINT32(_xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PRECISION))); nScale = getINT32(_xCol->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_SCALE))); @@ -510,18 +510,18 @@ void OPreparedStatement::scanParameter(OSQLParseNode* pParseNode,::std::vector< { OSL_ENSURE(pParseNode != NULL,"OResultSet: interner Fehler: ungueltiger ParseNode"); - // Parameter Name-Regel gefunden? + // Parameter Name-Row found? if (SQL_ISRULE(pParseNode,parameter)) { OSL_ENSURE(pParseNode->count() >= 1,"OResultSet: Parse Tree fehlerhaft"); OSL_ENSURE(pParseNode->getChild(0)->getNodeType() == SQL_NODE_PUNCTUATION,"OResultSet: Parse Tree fehlerhaft"); _rParaNodes.push_back(pParseNode); - // Weiterer Abstieg nicht erforderlich + // further search isn't necessary return; } - // Weiter absteigen im Parse Tree + // Search on in Parse Tree for (sal_uInt32 i = 0; i < pParseNode->count(); i++) scanParameter(pParseNode->getChild(i),_rParaNodes); } diff --git a/connectivity/source/drivers/mozab/MResultSet.cxx b/connectivity/source/drivers/mozab/MResultSet.cxx index 8ca4e57b81..4552b9dc69 100644 --- a/connectivity/source/drivers/mozab/MResultSet.cxx +++ b/connectivity/source/drivers/mozab/MResultSet.cxx @@ -122,7 +122,7 @@ OResultSet::OResultSet(OCommonStatement* pStmt, const ::boost::shared_ptr< conne ,m_RowStates(0) ,m_bIsReadOnly(-1) { - + m_aQuery.setMaxNrOfReturns(pStmt->getOwnConnection()->getMaxResultRecords()); } // ------------------------------------------------------------------------- @@ -172,7 +172,7 @@ void OResultSet::methodEntry() checkDisposed(OResultSet_BASE::rBHelper.bDisposed); if ( !m_pTable ) { - OSL_ENSURE( false, "OResultSet::methodEntry: looks like we're disposed, but how is this possible?" ); + OSL_FAIL( "OResultSet::methodEntry: looks like we're disposed, but how is this possible?" ); throw DisposedException( ::rtl::OUString(), *this ); } } @@ -362,7 +362,7 @@ sal_Bool OResultSet::pushCard(sal_uInt32 cardNumber) throw(SQLException, Runtime } } return sal_True; - + } // ------------------------------------------------------------------------- sal_Bool OResultSet::fetchRow(sal_Int32 cardNumber,sal_Bool bForceReload) throw(SQLException, RuntimeException) @@ -383,7 +383,7 @@ sal_Bool OResultSet::fetchRow(sal_Int32 cardNumber,sal_Bool bForceReload) throw( } else m_aQuery.resyncRow(cardNumber); - + if ( validRow( cardNumber ) == sal_False ) return sal_False; @@ -411,7 +411,7 @@ const ORowSetValue& OResultSet::getValue(sal_Int32 cardNumber, sal_Int32 columnI { if ( fetchRow( cardNumber ) == sal_False ) { - OSL_ASSERT("fetchRow() returned False" ); + OSL_FAIL("fetchRow() returned False" ); m_bWasNull = sal_True; return *ODatabaseMetaDataResultSet::getEmptyValue(); } @@ -626,7 +626,7 @@ IPropertyArrayHelper* OResultSet::createArrayHelper( ) const DECL_BOOL_PROP1IMPL(ISBOOKMARKABLE) PropertyAttribute::READONLY); DECL_PROP1IMPL(RESULTSETCONCURRENCY,sal_Int32) PropertyAttribute::READONLY); DECL_PROP1IMPL(RESULTSETTYPE, sal_Int32) PropertyAttribute::READONLY); - + return new OPropertyArrayHelper(aProps); } // ------------------------------------------------------------------------- @@ -642,7 +642,7 @@ sal_Bool OResultSet::convertFastPropertyValue( const Any& /*rValue*/ ) throw (::com::sun::star::lang::IllegalArgumentException) { - OSL_ENSURE( false, "OResultSet::convertFastPropertyValue: not implemented!" ); + OSL_FAIL( "OResultSet::convertFastPropertyValue: not implemented!" ); switch(nHandle) { case PROPERTY_ID_ISBOOKMARKABLE: @@ -663,7 +663,7 @@ void OResultSet::setFastPropertyValue_NoBroadcast( ) throw (Exception) { - OSL_ENSURE( false, "OResultSet::setFastPropertyValue_NoBroadcast: not implemented!" ); + OSL_FAIL( "OResultSet::setFastPropertyValue_NoBroadcast: not implemented!" ); switch(nHandle) { case PROPERTY_ID_ISBOOKMARKABLE: @@ -836,7 +836,7 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseT queryExpression.setExpressionCondition( MQueryExpression::AND ); } else { - OSL_ASSERT("analyseSQL: Error in Parse Tree"); + OSL_FAIL("analyseSQL: Error in Parse Tree"); } } else if (SQL_ISRULE(parseTree,comparison_predicate)) @@ -898,8 +898,9 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseT OSQLParseNode *pOptEscape; const OSQLParseNode* pPart2 = parseTree->getChild(1); pColumn = parseTree->getChild(0); // Match Item - pAtom = pPart2->getChild(parseTree->count()-2); // Match String - pOptEscape = pPart2->getChild(parseTree->count()-1); // Opt Escape Rule + pAtom = pPart2->getChild(pPart2->count()-2); // Match String + pOptEscape = pPart2->getChild(pPart2->count()-1); // Opt Escape Rule + (void)pOptEscape; const bool bNot = SQL_ISTOKEN(pPart2->getChild(0), NOT); if (!(pAtom->getNodeType() == SQL_NODE_STRING || @@ -981,7 +982,7 @@ void OResultSet::analyseWhereClause( const OSQLParseNode* parseT && matchString.indexOf( MATCHCHAR ) == -1 ) { - // One occurance of '%' - no '_' matches... + // One occurrence of '%' - no '_' matches... if ( matchString.indexOf ( WILDCARD ) == 0 ) { op = MQueryOp::EndsWith; @@ -1224,7 +1225,6 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep else { sal_Bool bDistinct = sal_False; - sal_Bool bWasSorted = sal_False; OSQLParseNode *pDistinct = m_pParseTree->getChild(1); if (pDistinct && pDistinct->getTokenID() == SQL_TOKEN_DISTINCT) { @@ -1233,8 +1233,6 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep m_aOrderbyColumnNumber.push_back(m_aColMapping[1]); m_aOrderbyAscending.push_back(SQL_DESC); } - else - bWasSorted = sal_True; bDistinct = sal_True; } @@ -1265,11 +1263,10 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep eKeyType[i] = SQL_ORDERBYKEY_DOUBLE; break; - // Andere Typen sind nicht implementiert (und damit immer - // FALSE) + // Other types aren't implemented (so they are always FALSE) default: eKeyType[i] = SQL_ORDERBYKEY_NONE; - OSL_ASSERT("MResultSet::executeQuery: Order By Data Type not implemented"); + OSL_FAIL("MResultSet::executeQuery: Order By Data Type not implemented"); break; } } @@ -1375,7 +1372,7 @@ void OResultSet::setBoundedColumns(const OValueRow& _rRow, const Reference<XDatabaseMetaData>& _xMetaData, ::std::vector<sal_Int32>& _rColMapping) { - ::comphelper::UStringMixEqual aCase(_xMetaData->storesMixedCaseQuotedIdentifiers()); + ::comphelper::UStringMixEqual aCase(_xMetaData->supportsMixedCaseQuotedIdentifiers()); Reference<XPropertySet> xTableColumn; ::rtl::OUString sTableColumnName, sSelectColumnRealName; @@ -1442,7 +1439,7 @@ void OResultSet::setBoundedColumns(const OValueRow& _rRow, } catch (Exception&) { - OSL_ENSURE(sal_False, "OResultSet::setBoundedColumns: caught an Exception!"); + OSL_FAIL("OResultSet::setBoundedColumns: caught an Exception!"); } } } @@ -1566,7 +1563,7 @@ sal_Bool OResultSet::seekRow( eRowPosition pos, sal_Int32 nOffset ) } else //The requested row has not been retrived until now. We should get the right card for it. nCurCard = nCurPos + deletedCount(); - + while ( nCurCard > nNumberOfRecords && !m_aQuery.queryComplete() ) { m_aQuery.checkRowAvailable( nCurCard ); if ( m_aQuery.hadError() ) @@ -1606,7 +1603,7 @@ void OResultSet::setColumnMapping(const ::std::vector<sal_Int32>& _aColumnMappin ResultSetEntryGuard aGuard( *this ); if ( fetchCurrentRow() == sal_False ) m_pStatement->getOwnConnection()->throwSQLException( STR_ERROR_GET_ROW, *this ); - + OSL_ENSURE((!m_aRow->isDeleted()),"getBookmark called for deleted row"); return makeAny((sal_Int32)(m_aRow->get())[0]); } @@ -1644,7 +1641,7 @@ sal_Int32 OResultSet::compareBookmarks( const ::com::sun::star::uno::Any& lhs, c nResult = 1; else nResult = 0; - + return nResult; } sal_Bool OResultSet::hasOrderedBookmarks( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) @@ -1672,7 +1669,7 @@ void OResultSet::checkPendingUpdate() throw(SQLException, RuntimeException) { OSL_TRACE("checkPendingUpdate, m_nRowPos = %u", m_nRowPos ); const sal_Int32 nCurrentRow = getCurrentCardNumber(); - + if ((m_nNewRow && nCurrentRow != m_nNewRow) || ( m_nUpdatedRow && m_nUpdatedRow != nCurrentRow)) { @@ -1682,7 +1679,7 @@ void OResultSet::checkPendingUpdate() throw(SQLException, RuntimeException) ) ); ::dbtools::throwGenericSQLException(sError,*this); } - + } void OResultSet::updateValue(sal_Int32 columnIndex ,const ORowSetValue& x) throw(SQLException, RuntimeException) { @@ -1859,14 +1856,14 @@ void SAL_CALL OResultSet::updateRow( ) throw(::com::sun::star::sdbc::SQLExcepti m_RowStates = RowStates_Error; m_pStatement->getOwnConnection()->throwSQLException( STR_ROW_CAN_NOT_SAVE, *this ); } - + if (!m_aQuery.commitRow(nCurrentCard)) { m_RowStates = RowStates_Error; m_nUpdatedRow = 0; m_pStatement->getOwnConnection()->throwSQLException( m_aQuery.getError(), *this ); } - + m_nUpdatedRow = 0; fetchCurrentRow(); OSL_TRACE("updateRow out, m_nRowPos = %u", m_nRowPos ); @@ -1878,7 +1875,7 @@ void SAL_CALL OResultSet::deleteRow( ) throw(::com::sun::star::sdbc::SQLExcepti ResultSetEntryGuard aGuard( *this ); if (rowDeleted()) m_pStatement->getOwnConnection()->throwSQLException( STR_ROW_ALREADY_DELETED, *this ); - + const sal_Int32 nCurrentRow = getCurrentCardNumber(); //fetchRow(nCurrentRow); if (!nCurrentRow) @@ -1907,7 +1904,7 @@ void SAL_CALL OResultSet::moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLE OSL_TRACE("moveToInsertRow in, m_nRowPos = %u", m_nRowPos ); ResultSetEntryGuard aGuard( *this ); m_nOldRowPos = m_nRowPos; - + if (!m_nNewRow) //no new row now, insert one { checkDisposed(OResultSet_BASE::rBHelper.bDisposed); @@ -1920,7 +1917,7 @@ void SAL_CALL OResultSet::moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLE m_nNewRow = m_aQuery.createNewCard(); if (!m_nNewRow) m_pStatement->getOwnConnection()->throwSQLException( STR_CAN_NOT_CREATE_ROW, *this ); - + m_RowStates = RowStates_Normal; fillKeySet(m_nNewRow); } diff --git a/connectivity/source/drivers/mozab/MResultSet.hxx b/connectivity/source/drivers/mozab/MResultSet.hxx index a39cb0e7e0..7f0f93985d 100644 --- a/connectivity/source/drivers/mozab/MResultSet.hxx +++ b/connectivity/source/drivers/mozab/MResultSet.hxx @@ -123,9 +123,9 @@ namespace connectivity virtual ~OResultSet(); public: DECLARE_SERVICE_INFO(); - + OResultSet(OCommonStatement* pStmt, const ::boost::shared_ptr< ::connectivity::OSQLParseTreeIterator >& _pSQLIterator ); - + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > operator *() { diff --git a/connectivity/source/drivers/mozab/MResultSetMetaData.cxx b/connectivity/source/drivers/mozab/MResultSetMetaData.cxx index 170cf18e24..3ca9036c33 100644 --- a/connectivity/source/drivers/mozab/MResultSetMetaData.cxx +++ b/connectivity/source/drivers/mozab/MResultSetMetaData.cxx @@ -175,7 +175,7 @@ sal_Bool SAL_CALL OResultSetMetaData::isSearchable( sal_Int32 column ) throw(SQL if ( !m_pTable || !m_pTable->getConnection() ) { - OSL_ENSURE( false, "OResultSetMetaData::isSearchable: suspicious: called without table or connection!" ); + OSL_FAIL( "OResultSetMetaData::isSearchable: suspicious: called without table or connection!" ); return sal_False; } diff --git a/connectivity/source/drivers/mozab/MServices.cxx b/connectivity/source/drivers/mozab/MServices.cxx index 24be4a1be7..4856d29de7 100644 --- a/connectivity/source/drivers/mozab/MServices.cxx +++ b/connectivity/source/drivers/mozab/MServices.cxx @@ -40,7 +40,6 @@ using namespace connectivity::mozab; using ::rtl::OUString; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; -using ::com::sun::star::registry::XRegistryKey; using ::com::sun::star::lang::XSingleServiceFactory; using ::com::sun::star::lang::XMultiServiceFactory; using ::com::sun::star::mozilla::XMozillaBootstrap; @@ -54,31 +53,6 @@ typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc) rtl_ModuleCount* _pTemp ); -//*************************************************************************************** -// -// Die vorgeschriebene C-Api muss erfuellt werden! -// Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen. -// - -//--------------------------------------------------------------------------------------- -void REGISTER_PROVIDER( - const OUString& aServiceImplName, - const Sequence< OUString>& Services, - const Reference< ::com::sun::star::registry::XRegistryKey > & xKey) -{ - OUString aMainKeyName; - aMainKeyName = OUString( RTL_CONSTASCII_USTRINGPARAM("/")); - aMainKeyName += aServiceImplName; - aMainKeyName += OUString( RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES")); - - Reference< ::com::sun::star::registry::XRegistryKey > xNewKey( xKey->createKey(aMainKeyName) ); - OSL_ENSURE(xNewKey.is(), "MOZAB::component_writeInfo : could not create a registry key !"); - - for (sal_Int32 i=0; i<Services.getLength(); ++i) - xNewKey->createKey(Services[i]); -} - - //--------------------------------------------------------------------------------------- struct ProviderRequest { @@ -128,41 +102,10 @@ component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -//--------------------------------------------------------------------------------------- -extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( - void* /*pServiceManager*/, - void* pRegistryKey - ) -{ - if (pRegistryKey) - try - { - Reference< ::com::sun::star::registry::XRegistryKey > xKey(reinterpret_cast< ::com::sun::star::registry::XRegistryKey*>(pRegistryKey)); - - - REGISTER_PROVIDER( - MozabDriver::getImplementationName_Static(), - MozabDriver::getSupportedServiceNames_Static(), xKey); - - Sequence< ::rtl::OUString > aSNS( 1 ); - aSNS[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")); - REGISTER_PROVIDER( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.mozilla.MozillaBootstrap")), - aSNS, xKey); - - return sal_True; - } - catch (::com::sun::star::registry::InvalidRegistryException& ) - { - OSL_ENSURE(sal_False, "Mozab::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !"); - } - - return sal_False; -} typedef void* (SAL_CALL * OMozillaBootstrap_CreateInstanceFunction)(const Reference< XMultiServiceFactory >& _rxFactory ); ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createMozillaBootstrap(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ) { - const ::rtl::OUString sModuleName = ::rtl::OUString::createFromAscii(SVLIBRARY( "mozabdrv" )); + const ::rtl::OUString sModuleName(RTL_CONSTASCII_USTRINGPARAM(SVLIBRARY( "mozabdrv" ))); // load the dbtools library oslModule s_hModule = osl_loadModuleRelative( @@ -179,7 +122,7 @@ typedef void* (SAL_CALL * OMozillaBootstrap_CreateInstanceFunction)(const Refere if (NULL == s_pCreationFunc) { // did not find the symbol - OSL_ENSURE(sal_False, "MozabDriver::registerClient: could not find the symbol for creating the factory!"); + OSL_FAIL("MozabDriver::registerClient: could not find the symbol for creating the factory!"); osl_unloadModule(s_hModule); s_hModule = NULL; } diff --git a/connectivity/source/drivers/mozab/MStatement.cxx b/connectivity/source/drivers/mozab/MStatement.cxx index e00ab8db2a..d0428c744e 100644 --- a/connectivity/source/drivers/mozab/MStatement.cxx +++ b/connectivity/source/drivers/mozab/MStatement.cxx @@ -255,7 +255,7 @@ OCommonStatement::StatementType OCommonStatement::parseSql( const ::rtl::OUStrin } getOwnConnection()->throwSQLException( STR_QUERY_TOO_COMPLEX, *this ); - OSL_ENSURE( false, "OCommonStatement::parseSql: unreachable!" ); + OSL_FAIL( "OCommonStatement::parseSql: unreachable!" ); return eSelect; } diff --git a/connectivity/source/drivers/mozab/MStatement.hxx b/connectivity/source/drivers/mozab/MStatement.hxx index de1a75d68f..029615ba00 100644 --- a/connectivity/source/drivers/mozab/MStatement.hxx +++ b/connectivity/source/drivers/mozab/MStatement.hxx @@ -199,7 +199,7 @@ namespace connectivity protected: ~OStatement(){} public: - // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + // a constructor, for when the object needs to be returned: OStatement( OConnection* _pConnection) : OCommonStatement( _pConnection){} DECLARE_SERVICE_INFO(); diff --git a/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx b/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx index b50a03d50c..384a7508cb 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx +++ b/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx @@ -97,7 +97,7 @@ void MozillaBootstrap::disposing() //------------------------------------------------------------------------------ rtl::OUString MozillaBootstrap::getImplementationName_Static( ) throw(RuntimeException) { - return rtl::OUString::createFromAscii(MOZAB_MozillaBootstrap_IMPL_NAME); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(MOZAB_MozillaBootstrap_IMPL_NAME)); } //------------------------------------------------------------------------------ Sequence< ::rtl::OUString > MozillaBootstrap::getSupportedServiceNames_Static( ) throw (RuntimeException) @@ -239,7 +239,6 @@ Sequence< ::rtl::OUString > SAL_CALL MozillaBootstrap::getSupportedServiceNames( #include <cppuhelper/factory.hxx> using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; -using ::com::sun::star::registry::XRegistryKey; using ::com::sun::star::lang::XSingleServiceFactory; using ::com::sun::star::lang::XMultiServiceFactory; @@ -252,50 +251,6 @@ component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -//--------------------------------------------------------------------------------------- -void REGISTER_PROVIDER( - const ::rtl::OUString& aServiceImplName, - const Sequence< ::rtl::OUString>& Services, - const Reference< ::com::sun::star::registry::XRegistryKey > & xKey) -{ - ::rtl::OUString aMainKeyName; - aMainKeyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/")); - aMainKeyName += aServiceImplName; - aMainKeyName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES")); - - Reference< ::com::sun::star::registry::XRegistryKey > xNewKey( xKey->createKey(aMainKeyName) ); - OSL_ENSURE(xNewKey.is(), "MOZAB::component_writeInfo : could not create a registry key !"); - - for (sal_Int32 i=0; i<Services.getLength(); ++i) - xNewKey->createKey(Services[i]); -} - -extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( - void* /*pServiceManager*/, - void* pRegistryKey - ) -{ - if (pRegistryKey) - try - { - Reference< ::com::sun::star::registry::XRegistryKey > xKey(reinterpret_cast< ::com::sun::star::registry::XRegistryKey*>(pRegistryKey)); - - Sequence< ::rtl::OUString > aSNS( 1 ); - aSNS[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")); - REGISTER_PROVIDER( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.mozilla.MozillaBootstrap")), - aSNS, xKey); - - return sal_True; - } - catch (::com::sun::star::registry::InvalidRegistryException& ) - { - OSL_ENSURE(sal_False, "Mozab::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !"); - } - - return sal_False; -} - static Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiServiceFactory >& rServiceManager ) { MozillaBootstrap * pBootstrap = reinterpret_cast<MozillaBootstrap*>(OMozillaBootstrap_CreateInstance(rServiceManager)); diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx index 240d8a8a59..e9589a0582 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx +++ b/connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx @@ -52,14 +52,6 @@ using namespace ::com::sun::star::mozilla; namespace { - #if defined(XP_MAC) || defined(XP_MACOSX) || defined(MACOSX) - #define APP_REGISTRY_NAME "Application Registry" - #elif defined(XP_WIN) || defined(XP_OS2) - #define APP_REGISTRY_NAME "registry.dat" - #else - #define APP_REGISTRY_NAME "appreg" - #endif - // ------------------------------------------------------------------- static ::rtl::OUString lcl_getUserDataDirectory() { @@ -67,22 +59,22 @@ namespace ::rtl::OUString aConfigPath; aSecurity.getConfigDir( aConfigPath ); - return aConfigPath + ::rtl::OUString::createFromAscii( "/" ); + return aConfigPath + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); } // ------------------------------------------------------------------- static const char* DefaultProductDir[3][3] = { #if defined(XP_WIN) - { "Mozilla/", NULL, NULL }, + { "Mozilla/SeaMonkey/", NULL, NULL }, { "Mozilla/Firefox/", NULL, NULL }, { "Thunderbird/", "Mozilla/Thunderbird/", NULL } #elif(MACOSX) - { "../Mozilla/", NULL, NULL }, + { "../Mozilla/SeaMonkey/", NULL, NULL }, { "Firefox/", NULL, NULL }, { "../Thunderbird/", NULL, NULL } #else - { ".mozilla/", NULL, NULL }, + { ".mozilla/seamonkey/", NULL, NULL }, { ".mozilla/firefox/", NULL, NULL }, { ".thunderbird/", ".mozilla-thunderbird/", ".mozilla/thunderbird/" } #endif @@ -116,7 +108,7 @@ namespace else { ::rtl::OUString sProductDirCandidate; - const char* pProfileRegistry = ( _product == MozillaProductType_Mozilla ) ? APP_REGISTRY_NAME : "profiles.ini"; + const char* pProfileRegistry = "profiles.ini"; // check all possible candidates for ( size_t i=0; i<3; ++i ) @@ -160,15 +152,5 @@ namespace return lcl_guessProfileRoot( product ); } -#ifndef MINIMAL_PROFILEDISCOVER -// ----------------------------------------------------------------------- -::rtl::OUString getRegistryFileName(MozillaProductType product) -{ - if (product == MozillaProductType_Default) - return ::rtl::OUString(); - - return getRegistryDir(product) + ::rtl::OUString::createFromAscii(APP_REGISTRY_NAME); -} -#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSFolders.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSFolders.hxx index 3ddf002c34..a3a52f68e8 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MNSFolders.hxx +++ b/connectivity/source/drivers/mozab/bootstrap/MNSFolders.hxx @@ -37,9 +37,6 @@ #include <rtl/ustring.hxx> ::rtl::OUString getRegistryDir(::com::sun::star::mozilla::MozillaProductType product); -#ifndef MINIMAL_PROFILEDISCOVER -::rtl::OUString getRegistryFileName(::com::sun::star::mozilla::MozillaProductType product); -#endif #endif diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx index d8f8d65055..b334bf6a85 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx +++ b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.cxx @@ -48,7 +48,7 @@ IniParser::IniParser(OUString const & rIniName) throw(com::sun::star::io::IOExce if (iniUrl.getLength()) fileError = osl_openFile(iniUrl.pData, &handle, osl_File_OpenFlag_Read); } - catch(::com::sun::star::io::IOException e) + catch(::com::sun::star::io::IOException&) { #if OSL_DEBUG_LEVEL > 0 OString file_tmp = OUStringToOString(iniUrl, RTL_TEXTENCODING_ASCII_US); @@ -62,7 +62,7 @@ IniParser::IniParser(OUString const & rIniName) throw(com::sun::star::io::IOExce sal_uInt64 nSize = 0; osl_getFileSize(handle, &nSize); - OUString sectionName = OUString::createFromAscii("no name section"); + OUString sectionName( RTL_CONSTASCII_USTRINGPARAM( "no name section" )); while (true) { sal_uInt64 nPos; @@ -93,7 +93,7 @@ IniParser::IniParser(OUString const & rIniName) throw(com::sun::star::io::IOExce sectionName = OStringToOUString( line.copy(nIndexStart + 1,nIndexEnd - nIndexStart -1).trim(), RTL_TEXTENCODING_ASCII_US ); if (!sectionName.getLength()) - sectionName = OUString::createFromAscii("no name section"); + sectionName = OUString(RTL_CONSTASCII_USTRINGPARAM("no name section")); ini_Section *aSection = &mAllSection[sectionName]; aSection->sName = sectionName; diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx index efe78e8a8a..6cab8e3193 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx +++ b/connectivity/source/drivers/mozab/bootstrap/MNSINIParser.hxx @@ -31,7 +31,6 @@ #include <rtl/ustring.hxx> #include <com/sun/star/io/IOException.hpp> #include <osl/process.h> -using namespace rtl; #include <map> #include <list> @@ -40,6 +39,9 @@ using namespace rtl; #include <stdio.h> #endif +using ::rtl::OUString; +using ::rtl::OString; + struct ini_NameValue { rtl::OUString sName; diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfile.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfile.cxx index 54d4879acb..a711b42230 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MNSProfile.cxx +++ b/connectivity/source/drivers/mozab/bootstrap/MNSProfile.cxx @@ -41,7 +41,8 @@ using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::mozilla; -using namespace rtl; + +using ::rtl::OUString; // Interfaces Needed diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx index dbcd905092..2ae687fdc1 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx +++ b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx @@ -90,9 +90,9 @@ static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CI // Registry Keys -static ::rtl::OUString szProfileSubtreeString=::rtl::OUString::createFromAscii("Profiles"); -static ::rtl::OUString szCurrentProfileString= ::rtl::OUString::createFromAscii("CurrentProfile"); -static ::rtl::OUString szDirectoryString =::rtl::OUString::createFromAscii("directory"); +static ::rtl::OUString szProfileSubtreeString( RTL_CONSTASCII_USTRINGPARAM( "Profiles" )); +static ::rtl::OUString szCurrentProfileString( RTL_CONSTASCII_USTRINGPARAM( "CurrentProfile" )); +static ::rtl::OUString szDirectoryString( RTL_CONSTASCII_USTRINGPARAM( "directory" )); #ifndef MAXPATHLEN #define MAXPATHLEN 1024 @@ -144,12 +144,9 @@ namespace connectivity sal_Int32 ProfileAccess::LoadProductsInfo() { -#ifndef MINIMAL_PROFILEDISCOVER - //load mozilla profiles to m_ProductProfileList - LoadMozillaProfiles(); -#endif - sal_Int32 count=static_cast<sal_Int32>(m_ProductProfileList[MozillaProductType_Mozilla].mProfileList.size()); - + //load SeaMonkey 2 profiles to m_ProductProfileList + sal_Int32 count = LoadXPToolkitProfiles(MozillaProductType_Mozilla); + //load thunderbird profiles to m_ProductProfileList count += LoadXPToolkitProfiles(MozillaProductType_Thunderbird); @@ -158,117 +155,6 @@ namespace connectivity count += LoadXPToolkitProfiles(MozillaProductType_Firefox); return count; } -#ifndef MINIMAL_PROFILEDISCOVER - nsresult ProfileAccess::LoadMozillaProfiles() - { - sal_Int32 index=MozillaProductType_Mozilla; - ProductStruct &m_Product = m_ProductProfileList[index]; - nsresult rv = NS_OK; - - //step 1 : get mozilla registry file - nsCOMPtr<nsILocalFile> localFile; - ::rtl::OUString regDir( getRegistryFileName( MozillaProductType_Mozilla ) ); - // PRUnichar != sal_Unicode in mingw - nsAutoString registryDir(reinterpret_cast_mingw_only<const PRUnichar *>(regDir.getStr())); - rv = NS_NewLocalFile(registryDir, PR_TRUE, - getter_AddRefs(localFile)); - NS_ENSURE_SUCCESS(rv,rv); - PRBool bExist; - rv = localFile->Exists(&bExist); - NS_ENSURE_SUCCESS(rv,rv); - if (!bExist) - return rv; - nsCOMPtr<nsIRegistry> registry(do_CreateInstance(NS_REGISTRY_CONTRACTID, &rv)); - NS_ENSURE_SUCCESS(rv,rv); - //step 2: open mozilla registry file - rv = registry->Open(localFile); - NS_ENSURE_SUCCESS(rv,rv); - - nsCOMPtr<nsIEnumerator> enumKeys; - nsRegistryKey profilesTreeKey; - - //step 3:Enumerator it - rv = registry->GetKey(nsIRegistry::Common, - // PRUnichar != sal_Unicode in mingw - reinterpret_cast_mingw_only<const PRUnichar *>(szProfileSubtreeString.getStr()), - &profilesTreeKey); - if (NS_FAILED(rv)) return rv; - - nsXPIDLString tmpCurrentProfile; - - // Get the current profile - rv = registry->GetString(profilesTreeKey, - // PRUnichar != sal_Unicode in mingw - reinterpret_cast_mingw_only<const PRUnichar *>(szCurrentProfileString.getStr()), - getter_Copies(tmpCurrentProfile)); - - if (tmpCurrentProfile) - { - // PRUnichar != sal_Unicode in mingw - m_Product.setCurrentProfile ( reinterpret_cast_mingw_only<const sal_Unicode *>(NS_STATIC_CAST(const PRUnichar*, tmpCurrentProfile))); - } - - - rv = registry->EnumerateSubtrees( profilesTreeKey, getter_AddRefs(enumKeys)); - NS_ENSURE_SUCCESS(rv,rv); - - rv = enumKeys->First(); - NS_ENSURE_SUCCESS(rv,rv); - - while (NS_OK != enumKeys->IsDone()) - { - nsCOMPtr<nsISupports> base; - - rv = enumKeys->CurrentItem( getter_AddRefs(base) ); - NS_ENSURE_SUCCESS(rv,rv); - rv = enumKeys->Next(); - NS_ENSURE_SUCCESS(rv,rv); - - // Get specific interface. - nsCOMPtr <nsIRegistryNode> node; - nsIID nodeIID = NS_IREGISTRYNODE_IID; - - rv = base->QueryInterface( nodeIID, getter_AddRefs(node)); - if (NS_FAILED(rv)) continue; - - // Get node name. - nsXPIDLString profile; - rv = node->GetName(getter_Copies(profile)); - if (NS_FAILED(rv)) continue; - - nsRegistryKey profKey; - rv = node->GetKey(&profKey); - if (NS_FAILED(rv)) continue; - - - nsCOMPtr<nsILocalFile> tempLocal; - - nsXPIDLString regData; - rv = registry->GetString(profKey, - // PRUnichar != sal_Unicode in mingw - reinterpret_cast_mingw_only<const PRUnichar *>(szDirectoryString.getStr()), - getter_Copies(regData)); - if (NS_FAILED(rv)) continue; - -#if defined(XP_MAC) || defined(XP_MACOSX) || defined(MACOSX) - rv = NS_NewNativeLocalFile(nsCString(), PR_TRUE, getter_AddRefs(tempLocal)); - if (NS_SUCCEEDED(rv)) - rv = tempLocal->SetPersistentDescriptor(NS_LossyConvertUCS2toASCII(regData)); -#else - rv = NS_NewLocalFile(regData, PR_TRUE, getter_AddRefs(tempLocal)); -#endif - //Add found profile to profile lists - if (NS_SUCCEEDED(rv) && tempLocal) - { - // PRUnichar != sal_Unicode in mingw - ProfileStruct* profileItem = new ProfileStruct(MozillaProductType_Mozilla,reinterpret_cast_mingw_only<const sal_Unicode *>(NS_STATIC_CAST(const PRUnichar*, profile)),tempLocal); - m_Product.mProfileList[profileItem->getProfileName()] = profileItem; - } - - } - return rv; - } -#endif //Thunderbird and firefox profiles are saved in profiles.ini sal_Int32 ProfileAccess::LoadXPToolkitProfiles(MozillaProductType product) { @@ -280,13 +166,13 @@ namespace connectivity #endif ::rtl::OUString regDir = getRegistryDir(product); ::rtl::OUString profilesIni( regDir ); - profilesIni += ::rtl::OUString::createFromAscii( "profiles.ini" ); + profilesIni += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("profiles.ini")); IniParser parser( profilesIni ); IniSectionMap &mAllSection = *(parser.getAllSection()); IniSectionMap::iterator iBegin = mAllSection.begin(); IniSectionMap::iterator iEnd = mAllSection.end(); - for(;iBegin != iEnd;iBegin++) + for(;iBegin != iEnd;++iBegin) { ini_Section *aSection = &(*iBegin).second; ::rtl::OUString profileName; @@ -296,35 +182,35 @@ namespace connectivity for(NameValueList::iterator itor=aSection->lList.begin(); itor != aSection->lList.end(); - itor++) + ++itor) { struct ini_NameValue * aValue = &(*itor); - if (aValue->sName.equals(::rtl::OUString::createFromAscii("Name"))) + if (aValue->sName.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name")))) { profileName = aValue->sValue; } - else if (aValue->sName.equals(::rtl::OUString::createFromAscii("IsRelative"))) + else if (aValue->sName.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsRelative")))) { sIsRelative = aValue->sValue; } - else if (aValue->sName.equals(::rtl::OUString::createFromAscii("Path"))) + else if (aValue->sName.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Path")))) { profilePath = aValue->sValue; } - else if (aValue->sName.equals(::rtl::OUString::createFromAscii("Default"))) + else if (aValue->sName.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Default")))) { sIsDefault = aValue->sValue; } } if (profileName.getLength() != 0 || profilePath.getLength() != 0) { +#ifndef MINIMAL_PROFILEDISCOVER sal_Int32 isRelative = 0; if (sIsRelative.getLength() != 0) { isRelative = sIsRelative.toInt32(); } -#ifndef MINIMAL_PROFILEDISCOVER nsCOMPtr<nsILocalFile> rootDir; rv = NS_NewLocalFile(EmptyString(), PR_TRUE, getter_AddRefs(rootDir)); diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx index 1ce1617bad..5a9e61ebf8 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx +++ b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.hxx @@ -115,9 +115,6 @@ namespace connectivity protected: ProductStruct m_ProductProfileList[4]; sal_Int32 LoadProductsInfo(); -#ifndef MINIMAL_PROFILEDISCOVER - nsresult LoadMozillaProfiles(); -#endif sal_Int32 LoadXPToolkitProfiles(MozillaProductType product); #ifndef MINIMAL_PROFILEDISCOVER //used by isProfileLocked diff --git a/connectivity/source/drivers/mozab/bootstrap/makefile.mk b/connectivity/source/drivers/mozab/bootstrap/makefile.mk index 6a4172da20..b44436e488 100644..100755 --- a/connectivity/source/drivers/mozab/bootstrap/makefile.mk +++ b/connectivity/source/drivers/mozab/bootstrap/makefile.mk @@ -78,6 +78,14 @@ SHL1STDLIBS=\ $(SALLIB) \ $(COMPHELPERLIB) +ALLTAR : $(MISC)/mozbootstrap.component + +$(MISC)/mozbootstrap.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt mozbootstrap.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt mozbootstrap.component + .ELSE SLOFILES += \ $(SLO)$/MNSInit.obj \ @@ -90,4 +98,3 @@ SLOFILES += \ # --- Targets ---------------------------------- .INCLUDE : target.mk - diff --git a/connectivity/source/drivers/mozab/bootstrap/mozbootstrap.component b/connectivity/source/drivers/mozab/bootstrap/mozbootstrap.component new file mode 100755 index 0000000000..5da158924a --- /dev/null +++ b/connectivity/source/drivers/mozab/bootstrap/mozbootstrap.component @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.mozilla.MozillaBootstrap"> + <service name="com.sun.star.mozilla.MozillaBootstrap"/> + </implementation> +</component> diff --git a/connectivity/source/drivers/mozab/bootstrap/mozilla_nsinit.h b/connectivity/source/drivers/mozab/bootstrap/mozilla_nsinit.h index e34bc21913..e34bc21913 100644..100755 --- a/connectivity/source/drivers/mozab/bootstrap/mozilla_nsinit.h +++ b/connectivity/source/drivers/mozab/bootstrap/mozilla_nsinit.h diff --git a/connectivity/source/drivers/mozab/bootstrap/mozilla_nsprofile.h b/connectivity/source/drivers/mozab/bootstrap/mozilla_nsprofile.h index 4d65bc3cb5..4d65bc3cb5 100644..100755 --- a/connectivity/source/drivers/mozab/bootstrap/mozilla_nsprofile.h +++ b/connectivity/source/drivers/mozab/bootstrap/mozilla_nsprofile.h diff --git a/connectivity/source/drivers/mozab/bootstrap/mozilla_nsprofiledirserviceprovider.h b/connectivity/source/drivers/mozab/bootstrap/mozilla_nsprofiledirserviceprovider.h index 4bb836ed13..4bb836ed13 100644..100755 --- a/connectivity/source/drivers/mozab/bootstrap/mozilla_nsprofiledirserviceprovider.h +++ b/connectivity/source/drivers/mozab/bootstrap/mozilla_nsprofiledirserviceprovider.h diff --git a/connectivity/source/drivers/mozab/bootstrap/mozilla_profile_discover.h b/connectivity/source/drivers/mozab/bootstrap/mozilla_profile_discover.h index 03198dcab8..03198dcab8 100644..100755 --- a/connectivity/source/drivers/mozab/bootstrap/mozilla_profile_discover.h +++ b/connectivity/source/drivers/mozab/bootstrap/mozilla_profile_discover.h diff --git a/connectivity/source/drivers/mozab/bootstrap/mozilla_profilemanager.h b/connectivity/source/drivers/mozab/bootstrap/mozilla_profilemanager.h index 1579b16947..1579b16947 100644..100755 --- a/connectivity/source/drivers/mozab/bootstrap/mozilla_profilemanager.h +++ b/connectivity/source/drivers/mozab/bootstrap/mozilla_profilemanager.h diff --git a/connectivity/source/drivers/mozab/bootstrap/post_include_windows.h b/connectivity/source/drivers/mozab/bootstrap/post_include_windows.h index a33bd622ac..a33bd622ac 100644..100755 --- a/connectivity/source/drivers/mozab/bootstrap/post_include_windows.h +++ b/connectivity/source/drivers/mozab/bootstrap/post_include_windows.h diff --git a/connectivity/source/drivers/mozab/bootstrap/pre_include_windows.h b/connectivity/source/drivers/mozab/bootstrap/pre_include_windows.h index 792e8a34f4..792e8a34f4 100644..100755 --- a/connectivity/source/drivers/mozab/bootstrap/pre_include_windows.h +++ b/connectivity/source/drivers/mozab/bootstrap/pre_include_windows.h diff --git a/connectivity/source/drivers/mozab/exports.dxp b/connectivity/source/drivers/mozab/exports.dxp index 9630d7e067..f0e1c69934 100644..100755 --- a/connectivity/source/drivers/mozab/exports.dxp +++ b/connectivity/source/drivers/mozab/exports.dxp @@ -1,3 +1,2 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory diff --git a/connectivity/source/drivers/mozab/makefile.mk b/connectivity/source/drivers/mozab/makefile.mk index 0a06f00134..1928961b04 100644..100755 --- a/connectivity/source/drivers/mozab/makefile.mk +++ b/connectivity/source/drivers/mozab/makefile.mk @@ -82,7 +82,7 @@ COMPONENT_CONFIG_SCHEMA=$(TARGET)2.xcs SLOFILES=\ $(SLO)$/MDriver.obj \ $(SLO)$/MServices.obj - + # --- MOZAB BASE Library ----------------------------------- SHL1VERSIONMAP=$(SOLARENV)/src/component.map @@ -184,3 +184,11 @@ $(MISC)$/$(SHL2TARGET).flt: makefile.mk @echo _TI >$@ @echo _real >>$@ + +ALLTAR : $(MISC)/mozab.component + +$(MISC)/mozab.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + mozab.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt mozab.component diff --git a/connectivity/source/drivers/mozab/makefile_mozab.mk b/connectivity/source/drivers/mozab/makefile_mozab.mk index bf1ed5b8ae..c984f121a2 100644..100755 --- a/connectivity/source/drivers/mozab/makefile_mozab.mk +++ b/connectivity/source/drivers/mozab/makefile_mozab.mk @@ -65,7 +65,6 @@ MOZINC = . \ -DXP_WIN32 \ -DOJI \ -DWIN32 \ - -D_X86_ \ -D_WINDOWS \ -DMOZ_XUL \ -DMOZ_REFLOW_PERF \ diff --git a/connectivity/source/drivers/mozab/mozab.component b/connectivity/source/drivers/mozab/mozab.component new file mode 100755 index 0000000000..70f5da3bfe --- /dev/null +++ b/connectivity/source/drivers/mozab/mozab.component @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.mozilla.MozillaBootstrap"> + <service name="com.sun.star.mozilla.MozillaBootstrap"/> + </implementation> + <implementation name="com.sun.star.comp.sdbc.MozabDriver"> + <service name="com.sun.star.sdbc.Driver"/> + </implementation> +</component> diff --git a/connectivity/source/drivers/mozab/mozab.xcu b/connectivity/source/drivers/mozab/mozab.xcu index 837e180ba5..638cbeb2c0 100755..100644 --- a/connectivity/source/drivers/mozab/mozab.xcu +++ b/connectivity/source/drivers/mozab/mozab.xcu @@ -62,7 +62,7 @@ <value>com.sun.star.comp.sdbc.MozabDriver</value> </prop> <prop oor:name="DriverTypeDisplayName" oor:type="xs:string"> - <value xml:lang="en-US">Mozilla Address Book</value> + <value xml:lang="en-US">SeaMonkey Address Book</value> </prop> <node oor:name="Features"> <node oor:name="EscapeDateTime" oor:op="replace"> diff --git a/connectivity/source/drivers/mozab/mozab.xml b/connectivity/source/drivers/mozab/mozab.xml index 33e9219a16..33e9219a16 100644..100755 --- a/connectivity/source/drivers/mozab/mozab.xml +++ b/connectivity/source/drivers/mozab/mozab.xml diff --git a/connectivity/source/drivers/mozab/mozab2.xcu b/connectivity/source/drivers/mozab/mozab2.xcu index 898c099fc7..18cb3c1eaf 100755..100644 --- a/connectivity/source/drivers/mozab/mozab2.xcu +++ b/connectivity/source/drivers/mozab/mozab2.xcu @@ -32,7 +32,7 @@ <value>com.sun.star.comp.sdbc.MozabDriver</value> </prop> <prop oor:name="DriverTypeDisplayName" oor:type="xs:string"> - <value xml:lang="en-US">Mozilla Address Book</value> + <value xml:lang="en-US">SeaMonkey Address Book</value> </prop> <node oor:name="MetaData"> <node oor:name="SupportsBrowsing" oor:op="replace"> diff --git a/connectivity/source/drivers/mozab/mozabdrv.map b/connectivity/source/drivers/mozab/mozabdrv.map index a431a07377..a431a07377 100644..100755 --- a/connectivity/source/drivers/mozab/mozabdrv.map +++ b/connectivity/source/drivers/mozab/mozabdrv.map diff --git a/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx b/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx index 0064cca351..02f580a0f2 100644 --- a/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx +++ b/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx @@ -39,7 +39,7 @@ #include <tools/diagnose_ex.h> -#include <hash_map> +#include <boost/unordered_map.hpp> //........................................................................ namespace connectivity { namespace mozab { @@ -72,7 +72,7 @@ namespace connectivity { namespace mozab { } }; - typedef ::std::hash_map< ::rtl::OString, CardPropertyData, ::rtl::OStringHash > MapPropertiesToAttributes; + typedef ::boost::unordered_map< ::rtl::OString, CardPropertyData, ::rtl::OStringHash > MapPropertiesToAttributes; #define DEF_CARD_ACCESS( PropertyName ) \ &nsIAbCard::Get##PropertyName, &nsIAbCard::Set##PropertyName @@ -188,7 +188,7 @@ namespace connectivity { namespace mozab { // ------------------------------------------------------------------- NS_IMETHODIMP MLdapAttributeMap::GetAttributes(const nsACString & aProperty, PRUint32* aCount, char*** aAttrs) { - OSL_ENSURE( false, "MLdapAttributeMap::GetAttributes: not implemented!" ); + OSL_FAIL( "MLdapAttributeMap::GetAttributes: not implemented!" ); (void)aProperty; (void)aCount; (void)aAttrs; @@ -220,7 +220,7 @@ namespace connectivity { namespace mozab { // ------------------------------------------------------------------- NS_IMETHODIMP MLdapAttributeMap::SetAttributeList(const nsACString & aProperty, const nsACString & aAttributeList, PRBool allowInconsistencies) { - OSL_ENSURE( false, "MLdapAttributeMap::SetAttributeList: not implemented!" ); + OSL_FAIL( "MLdapAttributeMap::SetAttributeList: not implemented!" ); (void)aProperty; (void)aAttributeList; (void)allowInconsistencies; @@ -230,7 +230,7 @@ namespace connectivity { namespace mozab { // ------------------------------------------------------------------- NS_IMETHODIMP MLdapAttributeMap::GetProperty(const nsACString & aAttribute, nsACString & _retval) { - OSL_ENSURE( false, "MLdapAttributeMap::GetProperty: not implemented!" ); + OSL_FAIL( "MLdapAttributeMap::GetProperty: not implemented!" ); (void)aAttribute; (void)_retval; return NS_ERROR_NOT_IMPLEMENTED; @@ -266,7 +266,7 @@ namespace connectivity { namespace mozab { // ------------------------------------------------------------------- NS_IMETHODIMP MLdapAttributeMap::SetFromPrefs(const nsACString & aPrefBranchName) { - OSL_ENSURE( false, "MLdapAttributeMap::SetFromPrefs: not implemented!" ); + OSL_FAIL( "MLdapAttributeMap::SetFromPrefs: not implemented!" ); (void)aPrefBranchName; return NS_ERROR_NOT_IMPLEMENTED; } @@ -396,7 +396,7 @@ namespace connectivity { namespace mozab { _card.SetPreferMailFormat(format); } else - OSL_ENSURE( false, "MLdapAttributeMap::fillCardFromResult: unexpected property without default setters!" ); + OSL_FAIL( "MLdapAttributeMap::fillCardFromResult: unexpected property without default setters!" ); } } } @@ -439,7 +439,7 @@ namespace connectivity { namespace mozab { } } else - OSL_ENSURE( false, "MLdapAttributeMap::fillResultFromCard: unexpected property without default getters!" ); + OSL_FAIL( "MLdapAttributeMap::fillResultFromCard: unexpected property without default getters!" ); } _result.insert( prop->first, resultValue ); diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.cxx b/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.cxx index 92967f77e8..6c2a2f5bc2 100644 --- a/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.cxx +++ b/connectivity/source/drivers/mozab/mozillasrc/MNSTerminateListener.cxx @@ -78,7 +78,7 @@ void MNSTerminateListener::addTerminateListener() if( xFact.is() ) { - Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" ) ), UNO_QUERY ); + Reference< XDesktop > xDesktop( xFact->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), UNO_QUERY ); if( xDesktop.is() ) xDesktop->addTerminateListener(mxTerminateListener); diff --git a/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.cxx b/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.cxx index e6e3944748..38310179d7 100644 --- a/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.cxx +++ b/connectivity/source/drivers/mozab/mozillasrc/MNameMapper.cxx @@ -40,7 +40,6 @@ using namespace connectivity::mozab; -using namespace rtl; bool MNameMapper::ltstr::operator()( const ::rtl::OUString &s1, const ::rtl::OUString &s2) const diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx b/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx index a78b9abed5..1e09198a87 100644 --- a/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx +++ b/connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx @@ -300,7 +300,7 @@ static sal_Int32 generateExpression( MQuery* _aQuery, MQueryExpression* _aExpr, } else { // Should never see this... - OSL_ASSERT("Unknown Expression Type!"); + OSL_FAIL("Unknown Expression Type!"); return( NS_ERROR_UNEXPECTED ); } } @@ -697,7 +697,7 @@ MQuery::setRowValue( ORowSetValue& rValue, sal_Int32 nDBRow,const rtl::OUString& xResEntry->setValue( m_rColumnAlias.getProgrammaticNameOrFallbackToUTF8Alias( aDBColumnName ), rValue.getString() ); break; default: - OSL_ENSURE( sal_False, "invalid data type!" ); + OSL_FAIL( "invalid data type!" ); break; } diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx b/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx index 8015c3a74c..0495bf3cd6 100644 --- a/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx +++ b/connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx @@ -75,9 +75,9 @@ namespace connectivity MQueryExpressionBase( node_type _eNodeType ) : m_eNodeType( _eNodeType ) {} public: - sal_Bool isUnknown( ) { return m_eNodeType == Unknown; } - sal_Bool isStringExpr( ) { return m_eNodeType == StringExpr; } - sal_Bool isExpr( ) { return m_eNodeType == Expr; } + sal_Bool isUnknown( ) const { return m_eNodeType == Unknown; } + sal_Bool isStringExpr( ) const { return m_eNodeType == StringExpr; } + sal_Bool isExpr( ) const { return m_eNodeType == Expr; } }; class MQueryExpressionString : public MQueryExpressionBase { @@ -137,7 +137,7 @@ namespace connectivity { return m_aExprVector; } // All expressions on a peer level use same condition operator - bool_cond getExpressionCondition( ) + bool_cond getExpressionCondition( ) const { return m_aExprCondType; } MQueryExpression() : MQueryExpressionBase( MQueryExpressionBase::Expr ), diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx b/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx index a6b9cbff8f..4ea4daf8fa 100644 --- a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx +++ b/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx @@ -209,7 +209,7 @@ MQueryHelper::next( ) index = m_nIndex; m_aMutex.release(); - result = getByIndex( m_nIndex + 1) ; // Add 1 as Row is numbered from 1 to N + result = getByIndex( index + 1) ; // Add 1 as Row is numbered from 1 to N if ( result ) { m_aMutex.acquire(); diff --git a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx b/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx index 1da8f15464..3d81453f06 100644 --- a/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx +++ b/connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx @@ -38,7 +38,7 @@ #include <comphelper/stl_types.hxx> #include <osl/thread.hxx> -#include <hash_map> +#include <boost/unordered_map.hpp> namespace connectivity { @@ -47,7 +47,7 @@ namespace connectivity class MQueryHelperResultEntry { private: - typedef ::std::hash_map< ::rtl::OString, ::rtl::OUString, ::rtl::OStringHash > FieldMap; + typedef ::boost::unordered_map< ::rtl::OString, ::rtl::OUString, ::rtl::OStringHash > FieldMap; mutable ::osl::Mutex m_aMutex; FieldMap m_Fields; @@ -65,7 +65,7 @@ namespace connectivity void setCard(nsIAbCard *card); nsIAbCard *getCard(); sal_Bool setRowStates(sal_Int32 state){m_RowStates = state; return sal_True;}; - sal_Int32 getRowStates() { return m_RowStates;}; + sal_Int32 getRowStates() const { return m_RowStates;}; }; class MQueryHelper : public nsIAbDirectoryQueryResultListener @@ -96,16 +96,13 @@ namespace connectivity #endif public: - NS_DECL_ISUPPORTS NS_DECL_NSIABDIRECTORYQUERYRESULTLISTENER MQueryHelper(); - virtual ~MQueryHelper(); void reset(); - void rewind(); MQueryHelperResultEntry* next( ); @@ -115,19 +112,15 @@ namespace connectivity const ErrorDescriptor& getError() const { return m_aError; } sal_Bool isError() const; - sal_Bool hasMore() const; - sal_Bool atEnd() const; sal_Bool queryComplete() const; sal_Bool waitForQueryComplete( ); - sal_Bool waitForRow( sal_Int32 rowNum ); sal_Int32 getResultCount() const; - sal_uInt32 getRealCount() const; sal_Int32 createNewCard(); //return Row count number sal_Bool resyncRow(sal_Int32 rowIndex); diff --git a/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx b/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx index 6e4d75831a..42517f5515 100644 --- a/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx +++ b/connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx @@ -39,7 +39,7 @@ using namespace connectivity::mozab; void MTypeConverter::ouStringToNsString(::rtl::OUString const &ous, nsString &nss) { // Convert to ::rtl::OString (utf-8 encoding). - ::rtl::OString os(ous,ous.getLength(), RTL_TEXTENCODING_UTF8); + ::rtl::OString os(rtl::OUStringToOString(ous, RTL_TEXTENCODING_UTF8)); const char *cs = os.getStr(); PRUint32 csLen = os.getLength(); @@ -100,7 +100,7 @@ void MTypeConverter::prUnicharToOUString(PRUnichar const *pru, ::rtl::OUString & char *MTypeConverter::ouStringToCCharStringUtf8(::rtl::OUString const &ous) { // Convert to ::rtl::OString, - ::rtl::OString os(ous,ous.getLength(), RTL_TEXTENCODING_UTF8); + ::rtl::OString os(rtl::OUStringToOString(ous, RTL_TEXTENCODING_UTF8)); const char *cs = os.getStr(); @@ -110,7 +110,7 @@ char *MTypeConverter::ouStringToCCharStringUtf8(::rtl::OUString const &ous) char *MTypeConverter::ouStringToCCharStringAscii(::rtl::OUString const &ous) { // Convert ::rtl::OUString to ::rtl::OString, - ::rtl::OString os(ous,ous.getLength(), RTL_TEXTENCODING_ASCII_US); + ::rtl::OString os(rtl::OUStringToOString(ous, RTL_TEXTENCODING_ASCII_US)); return(strdup(os.getStr())); } @@ -126,7 +126,7 @@ char *MTypeConverter::nsStringToCCharStringAscii(nsString const &nss) ::std::string MTypeConverter::ouStringToStlString(::rtl::OUString const &ous) { // Convert ::rtl::OUString to ::rtl::OString. - ::rtl::OString os(ous,ous.getLength(),RTL_TEXTENCODING_ASCII_US); + ::rtl::OString os(rtl::OUStringToOString(ous,RTL_TEXTENCODING_ASCII_US)); return( ::std::string(os.getStr())); } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/mozab/mozillasrc/makefile.mk b/connectivity/source/drivers/mozab/mozillasrc/makefile.mk index 4c3e5380f4..49c0bd8033 100644..100755 --- a/connectivity/source/drivers/mozab/mozillasrc/makefile.mk +++ b/connectivity/source/drivers/mozab/mozillasrc/makefile.mk @@ -46,7 +46,7 @@ VISIBILITY_HIDDEN=TRUE .IF ("$(SYSTEM_MOZILLA)" == "YES" && "$(WITH_MOZILLA)" == "YES") || "$(WITH_MOZILLA)" == "NO" || "$(OS)" == "OS2" dummy: - @echo " Not building the mozillasrc stuff in OpenOffice.org build" + @echo " Not building the mozillasrc stuff in LibreOffice build" @echo " dependency to Mozilla developer snapshots not feasable at the moment" @echo " see http://bugzilla.mozilla.org/show_bug.cgi?id=135137" .ELSE diff --git a/connectivity/source/drivers/mozab/post_include_mozilla.h b/connectivity/source/drivers/mozab/post_include_mozilla.h index cf365e1008..cf365e1008 100644..100755 --- a/connectivity/source/drivers/mozab/post_include_mozilla.h +++ b/connectivity/source/drivers/mozab/post_include_mozilla.h diff --git a/connectivity/source/drivers/mozab/pre_include_mozilla.h b/connectivity/source/drivers/mozab/pre_include_mozilla.h index 4da60543cb..e518d820dc 100644..100755 --- a/connectivity/source/drivers/mozab/pre_include_mozilla.h +++ b/connectivity/source/drivers/mozab/pre_include_mozilla.h @@ -26,13 +26,6 @@ * ************************************************************************/ -#ifndef BOOL -# define MOZ_BOOL - -# define BOOL mozBOOL -# define Bool mozBooL -#endif - // Turn off DEBUG Assertions #ifdef _DEBUG #define _DEBUG_WAS_DEFINED _DEBUG diff --git a/connectivity/source/drivers/mysql/YColumns.cxx b/connectivity/source/drivers/mysql/YColumns.cxx index 28c9861f61..effe4d3653 100644 --- a/connectivity/source/drivers/mysql/YColumns.cxx +++ b/connectivity/source/drivers/mysql/YColumns.cxx @@ -83,7 +83,7 @@ void OMySQLColumn::construct() Sequence< ::rtl::OUString > SAL_CALL OMySQLColumn::getSupportedServiceNames( ) throw(RuntimeException) { Sequence< ::rtl::OUString > aSupported(1); - aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.Column"); + aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.Column")); return aSupported; } diff --git a/connectivity/source/drivers/mysql/YDriver.cxx b/connectivity/source/drivers/mysql/YDriver.cxx index 4e60c0f015..40b1e171a2 100644 --- a/connectivity/source/drivers/mysql/YDriver.cxx +++ b/connectivity/source/drivers/mysql/YDriver.cxx @@ -108,7 +108,7 @@ namespace connectivity { sal_Bool isOdbcUrl(const ::rtl::OUString& _sUrl) { - return _sUrl.copy(0,16).equalsAscii("sdbc:mysql:odbc:"); + return _sUrl.copy(0,16).equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("sdbc:mysql:odbc:")); } //-------------------------------------------------------------------- sal_Bool isNativeUrl(const ::rtl::OUString& _sUrl) @@ -444,14 +444,14 @@ namespace connectivity //------------------------------------------------------------------------------ rtl::OUString ODriverDelegator::getImplementationName_Static( ) throw(RuntimeException) { - return rtl::OUString::createFromAscii("org.openoffice.comp.drivers.MySQL.Driver"); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.comp.drivers.MySQL.Driver")); } //------------------------------------------------------------------------------ Sequence< ::rtl::OUString > ODriverDelegator::getSupportedServiceNames_Static( ) throw (RuntimeException) { Sequence< ::rtl::OUString > aSNS( 2 ); - aSNS[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.Driver"); - aSNS[1] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.Driver"); + aSNS[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.Driver")); + aSNS[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.Driver")); return aSNS; } //------------------------------------------------------------------ diff --git a/connectivity/source/drivers/mysql/YTable.cxx b/connectivity/source/drivers/mysql/YTable.cxx index e08b488df6..a9c97aaeea 100644 --- a/connectivity/source/drivers/mysql/YTable.cxx +++ b/connectivity/source/drivers/mysql/YTable.cxx @@ -352,7 +352,7 @@ void OMySQLTable::dropDefaultValue(const ::rtl::OUString& _rColName) // ----------------------------------------------------------------------------- ::rtl::OUString OMySQLTable::getAlterTableColumnPart() { - ::rtl::OUString sSql = ::rtl::OUString::createFromAscii("ALTER TABLE "); + ::rtl::OUString sSql( RTL_CONSTASCII_USTRINGPARAM( "ALTER TABLE " )); const ::rtl::OUString sQuote = getMetaData()->getIdentifierQuoteString( ); ::rtl::OUString sComposedName( @@ -366,7 +366,7 @@ void OMySQLTable::executeStatement(const ::rtl::OUString& _rStatement ) { ::rtl::OUString sSQL = _rStatement; if(sSQL.lastIndexOf(',') == (sSQL.getLength()-1)) - sSQL = sSQL.replaceAt(sSQL.getLength()-1,1,::rtl::OUString::createFromAscii(")")); + sSQL = sSQL.replaceAt(sSQL.getLength()-1,1,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(")"))); Reference< XStatement > xStmt = getConnection()->createStatement( ); if ( xStmt.is() ) diff --git a/connectivity/source/drivers/mysql/YTables.cxx b/connectivity/source/drivers/mysql/YTables.cxx index 28858834e1..aac4f5c3f3 100644 --- a/connectivity/source/drivers/mysql/YTables.cxx +++ b/connectivity/source/drivers/mysql/YTables.cxx @@ -157,14 +157,14 @@ void OTables::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName) ::rtl::OUString sCatalog,sSchema,sTable; ::dbtools::qualifiedNameComponents(m_xMetaData,_sElementName,sCatalog,sSchema,sTable,::dbtools::eInDataManipulation); - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DROP "); + ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "DROP " )); Reference<XPropertySet> xProp(xObject,UNO_QUERY); - sal_Bool bIsView = xProp.is() && ::comphelper::getString(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))) == ::rtl::OUString::createFromAscii("VIEW"); + sal_Bool bIsView = xProp.is() && ::comphelper::getString(xProp->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE))) == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VIEW")); if(bIsView) // here we have a view - aSql += ::rtl::OUString::createFromAscii("VIEW "); + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VIEW ")); else - aSql += ::rtl::OUString::createFromAscii("TABLE "); + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE ")); ::rtl::OUString sComposedName( ::dbtools::composeTableName( m_xMetaData, sCatalog, sSchema, sTable, sal_True, ::dbtools::eInDataManipulation ) ); diff --git a/connectivity/source/drivers/mysql/YUser.cxx b/connectivity/source/drivers/mysql/YUser.cxx index 2467c9c7b4..50949d5cab 100644 --- a/connectivity/source/drivers/mysql/YUser.cxx +++ b/connectivity/source/drivers/mysql/YUser.cxx @@ -131,16 +131,16 @@ void OMySQLUser::findPrivilegesAndGrantPrivileges(const ::rtl::OUString& objName if ( xRes.is() ) { - static const ::rtl::OUString sSELECT = ::rtl::OUString::createFromAscii("SELECT"); - static const ::rtl::OUString sINSERT = ::rtl::OUString::createFromAscii("INSERT"); - static const ::rtl::OUString sUPDATE = ::rtl::OUString::createFromAscii("UPDATE"); - static const ::rtl::OUString sDELETE = ::rtl::OUString::createFromAscii("DELETE"); - static const ::rtl::OUString sREAD = ::rtl::OUString::createFromAscii("READ"); - static const ::rtl::OUString sCREATE = ::rtl::OUString::createFromAscii("CREATE"); - static const ::rtl::OUString sALTER = ::rtl::OUString::createFromAscii("ALTER"); - static const ::rtl::OUString sREFERENCE = ::rtl::OUString::createFromAscii("REFERENCE"); - static const ::rtl::OUString sDROP = ::rtl::OUString::createFromAscii("DROP"); - static const ::rtl::OUString sYes = ::rtl::OUString::createFromAscii("YES"); + static const ::rtl::OUString sSELECT( RTL_CONSTASCII_USTRINGPARAM( "SELECT" )); + static const ::rtl::OUString sINSERT( RTL_CONSTASCII_USTRINGPARAM( "INSERT" )); + static const ::rtl::OUString sUPDATE( RTL_CONSTASCII_USTRINGPARAM( "UPDATE" )); + static const ::rtl::OUString sDELETE( RTL_CONSTASCII_USTRINGPARAM( "DELETE" )); + static const ::rtl::OUString sREAD( RTL_CONSTASCII_USTRINGPARAM( "READ" )); + static const ::rtl::OUString sCREATE( RTL_CONSTASCII_USTRINGPARAM( "CREATE" )); + static const ::rtl::OUString sALTER( RTL_CONSTASCII_USTRINGPARAM( "ALTER" )); + static const ::rtl::OUString sREFERENCE( RTL_CONSTASCII_USTRINGPARAM( "REFERENCE" )); + static const ::rtl::OUString sDROP( RTL_CONSTASCII_USTRINGPARAM( "DROP" )); + static const ::rtl::OUString sYes( RTL_CONSTASCII_USTRINGPARAM( "YES" )); nRightsWithGrant = nRights = 0; @@ -238,12 +238,12 @@ void SAL_CALL OMySQLUser::grantPrivileges( const ::rtl::OUString& objName, sal_I if(sPrivs.getLength()) { ::rtl::OUString sGrant; - sGrant += ::rtl::OUString::createFromAscii("GRANT "); + sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GRANT ")); sGrant += sPrivs; - sGrant += ::rtl::OUString::createFromAscii(" ON "); + sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON ")); Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData(); sGrant += ::dbtools::quoteTableName(xMeta,objName,::dbtools::eInDataManipulation); - sGrant += ::rtl::OUString::createFromAscii(" TO "); + sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" TO ")); sGrant += m_Name; Reference<XStatement> xStmt = m_xConnection->createStatement(); @@ -268,12 +268,12 @@ void SAL_CALL OMySQLUser::revokePrivileges( const ::rtl::OUString& objName, sal_ if(sPrivs.getLength()) { ::rtl::OUString sGrant; - sGrant += ::rtl::OUString::createFromAscii("REVOKE "); + sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("REVOKE ")); sGrant += sPrivs; - sGrant += ::rtl::OUString::createFromAscii(" ON "); + sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" ON ")); Reference<XDatabaseMetaData> xMeta = m_xConnection->getMetaData(); sGrant += ::dbtools::quoteTableName(xMeta,objName,::dbtools::eInDataManipulation); - sGrant += ::rtl::OUString::createFromAscii(" FROM "); + sGrant += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" FROM ")); sGrant += m_Name; Reference<XStatement> xStmt = m_xConnection->createStatement(); @@ -289,11 +289,11 @@ void SAL_CALL OMySQLUser::changePassword( const ::rtl::OUString& /*oldPassword*/ ::osl::MutexGuard aGuard(m_aMutex); checkDisposed(OUser_BASE_RBHELPER::rBHelper.bDisposed); ::rtl::OUString sAlterPwd; - sAlterPwd = ::rtl::OUString::createFromAscii("SET PASSWORD FOR "); + sAlterPwd = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SET PASSWORD FOR ")); sAlterPwd += m_Name; - sAlterPwd += ::rtl::OUString::createFromAscii("@\"%\" = PASSWORD('") ; + sAlterPwd += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("@\"%\" = PASSWORD('")) ; sAlterPwd += newPassword; - sAlterPwd += ::rtl::OUString::createFromAscii("')") ; + sAlterPwd += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("')")) ; Reference<XStatement> xStmt = m_xConnection->createStatement(); @@ -308,41 +308,41 @@ void SAL_CALL OMySQLUser::changePassword( const ::rtl::OUString& /*oldPassword*/ { ::rtl::OUString sPrivs; if((nRights & Privilege::INSERT) == Privilege::INSERT) - sPrivs += ::rtl::OUString::createFromAscii("INSERT"); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("INSERT")); if((nRights & Privilege::DELETE) == Privilege::DELETE) { if(sPrivs.getLength()) - sPrivs += ::rtl::OUString::createFromAscii(","); - sPrivs += ::rtl::OUString::createFromAscii("DELETE"); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DELETE")); } if((nRights & Privilege::UPDATE) == Privilege::UPDATE) { if(sPrivs.getLength()) - sPrivs += ::rtl::OUString::createFromAscii(","); - sPrivs += ::rtl::OUString::createFromAscii("UPDATE"); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UPDATE")); } if((nRights & Privilege::ALTER) == Privilege::ALTER) { if(sPrivs.getLength()) - sPrivs += ::rtl::OUString::createFromAscii(","); - sPrivs += ::rtl::OUString::createFromAscii("ALTER"); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ALTER")); } if((nRights & Privilege::SELECT) == Privilege::SELECT) { if(sPrivs.getLength()) - sPrivs += ::rtl::OUString::createFromAscii(","); - sPrivs += ::rtl::OUString::createFromAscii("SELECT"); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SELECT")); } if((nRights & Privilege::REFERENCE) == Privilege::REFERENCE) { if(sPrivs.getLength()) - sPrivs += ::rtl::OUString::createFromAscii(","); - sPrivs += ::rtl::OUString::createFromAscii("REFERENCES"); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); + sPrivs += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("REFERENCES")); } return sPrivs; diff --git a/connectivity/source/drivers/mysql/YUsers.cxx b/connectivity/source/drivers/mysql/YUsers.cxx index 6f69b59e8b..17b46179c9 100644 --- a/connectivity/source/drivers/mysql/YUsers.cxx +++ b/connectivity/source/drivers/mysql/YUsers.cxx @@ -44,7 +44,6 @@ using namespace connectivity; using namespace connectivity::mysql; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; -// using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; @@ -81,18 +80,18 @@ Reference< XPropertySet > OUsers::createDescriptor() // XAppend sdbcx::ObjectType OUsers::appendObject( const ::rtl::OUString& _rForName, const Reference< XPropertySet >& descriptor ) { - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("GRANT USAGE ON * TO "); + ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "GRANT USAGE ON * TO " )); ::rtl::OUString aQuote = m_xConnection->getMetaData()->getIdentifierQuoteString( ); ::rtl::OUString sUserName( _rForName ); aSql += ::dbtools::quoteName(aQuote,sUserName) - + ::rtl::OUString::createFromAscii(" @\"%\" "); + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" @\"%\" ")); ::rtl::OUString sPassword; descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD)) >>= sPassword; if ( sPassword.getLength() ) { - aSql += ::rtl::OUString::createFromAscii(" IDENTIFIED BY '"); + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" IDENTIFIED BY '")); aSql += sPassword; - aSql += ::rtl::OUString::createFromAscii("'"); + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'")); } Reference< XStatement > xStmt = m_xConnection->createStatement( ); @@ -106,7 +105,7 @@ sdbcx::ObjectType OUsers::appendObject( const ::rtl::OUString& _rForName, const // XDrop void OUsers::dropObject(sal_Int32 /*_nPos*/,const ::rtl::OUString _sElementName) { - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("REVOKE ALL ON * FROM "); + ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "REVOKE ALL ON * FROM " )); ::rtl::OUString aQuote = m_xConnection->getMetaData()->getIdentifierQuoteString( ); aSql += ::dbtools::quoteName(aQuote,_sElementName); diff --git a/connectivity/source/drivers/mysql/YViews.cxx b/connectivity/source/drivers/mysql/YViews.cxx index 5d3226577f..8184a7af1d 100644 --- a/connectivity/source/drivers/mysql/YViews.cxx +++ b/connectivity/source/drivers/mysql/YViews.cxx @@ -113,7 +113,7 @@ void OViews::dropObject(sal_Int32 _nPos,const ::rtl::OUString /*_sElementName*/) sal_Bool bIsNew = connectivity::sdbcx::ODescriptor::isNew( xObject ); if (!bIsNew) { - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("DROP VIEW"); + ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "DROP VIEW" )); Reference<XPropertySet> xProp(xObject,UNO_QUERY); aSql += ::dbtools::composeTableName( m_xMetaData, xProp, ::dbtools::eInTableDefinitions, false, false, true ); @@ -136,13 +136,13 @@ void OViews::createView( const Reference< XPropertySet >& descriptor ) { Reference<XConnection> xConnection = static_cast<OMySQLCatalog&>(m_rParent).getConnection(); - ::rtl::OUString aSql = ::rtl::OUString::createFromAscii("CREATE VIEW "); + ::rtl::OUString aSql( RTL_CONSTASCII_USTRINGPARAM( "CREATE VIEW " )); ::rtl::OUString aQuote = xConnection->getMetaData()->getIdentifierQuoteString( ); ::rtl::OUString sSchema,sCommand; aSql += ::dbtools::composeTableName( m_xMetaData, descriptor, ::dbtools::eInTableDefinitions, false, false, true ); - aSql += ::rtl::OUString::createFromAscii(" AS "); + aSql += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" AS ")); descriptor->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_COMMAND)) >>= sCommand; aSql += sCommand; diff --git a/connectivity/source/drivers/mysql/Yservices.cxx b/connectivity/source/drivers/mysql/Yservices.cxx index e3987d90c5..bb4bdf6a47 100644 --- a/connectivity/source/drivers/mysql/Yservices.cxx +++ b/connectivity/source/drivers/mysql/Yservices.cxx @@ -30,13 +30,11 @@ #include "precompiled_connectivity.hxx" #include "mysql/YDriver.hxx" #include <cppuhelper/factory.hxx> -#include <osl/diagnose.h> using namespace connectivity::mysql; using ::rtl::OUString; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; -using ::com::sun::star::registry::XRegistryKey; using ::com::sun::star::lang::XSingleServiceFactory; using ::com::sun::star::lang::XMultiServiceFactory; @@ -49,31 +47,6 @@ typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc) rtl_ModuleCount* _pT ); -//*************************************************************************************** -// -// Die vorgeschriebene C-Api muss erfuellt werden! -// Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen. -// - -//--------------------------------------------------------------------------------------- -void REGISTER_PROVIDER( - const OUString& aServiceImplName, - const Sequence< OUString>& Services, - const Reference< ::com::sun::star::registry::XRegistryKey > & xKey) -{ - OUString aMainKeyName; - aMainKeyName = OUString::createFromAscii("/"); - aMainKeyName += aServiceImplName; - aMainKeyName += OUString::createFromAscii("/UNO/SERVICES"); - - Reference< ::com::sun::star::registry::XRegistryKey > xNewKey( xKey->createKey(aMainKeyName) ); - OSL_ENSURE(xNewKey.is(), "ADABAS::component_writeInfo : could not create a registry key !"); - - for (sal_Int32 i=0; i<Services.getLength(); ++i) - xNewKey->createKey(Services[i]); -} - - //--------------------------------------------------------------------------------------- struct ProviderRequest { @@ -124,31 +97,6 @@ component_getImplementationEnvironment( } //--------------------------------------------------------------------------------------- -extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( - void* /*pServiceManager*/, - void* pRegistryKey - ) -{ - if (pRegistryKey) - try - { - Reference< ::com::sun::star::registry::XRegistryKey > xKey(reinterpret_cast< ::com::sun::star::registry::XRegistryKey*>(pRegistryKey)); - - REGISTER_PROVIDER( - ODriverDelegator::getImplementationName_Static(), - ODriverDelegator::getSupportedServiceNames_Static(), xKey); - - return sal_True; - } - catch (::com::sun::star::registry::InvalidRegistryException& ) - { - OSL_ENSURE(sal_False, "ODBC::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !"); - } - - return sal_False; -} - -//--------------------------------------------------------------------------------------- extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplementationName, void* pServiceManager, diff --git a/connectivity/source/drivers/mysql/exports.dxp b/connectivity/source/drivers/mysql/exports.dxp index 9630d7e067..f0e1c69934 100644..100755 --- a/connectivity/source/drivers/mysql/exports.dxp +++ b/connectivity/source/drivers/mysql/exports.dxp @@ -1,3 +1,2 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory diff --git a/connectivity/source/drivers/mysql/makefile.mk b/connectivity/source/drivers/mysql/makefile.mk index fbb68321cb..453f4b652f 100644..100755 --- a/connectivity/source/drivers/mysql/makefile.mk +++ b/connectivity/source/drivers/mysql/makefile.mk @@ -82,3 +82,11 @@ DEF1EXPORTFILE= exports.dxp .INCLUDE : $(PRJ)$/target.pmk + +ALLTAR : $(MISC)/mysql.component + +$(MISC)/mysql.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + mysql.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt mysql.component diff --git a/connectivity/source/drivers/mysql/mysql.component b/connectivity/source/drivers/mysql/mysql.component new file mode 100755 index 0000000000..ced2297fa0 --- /dev/null +++ b/connectivity/source/drivers/mysql/mysql.component @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="org.openoffice.comp.drivers.MySQL.Driver"> + <service name="com.sun.star.sdbc.Driver"/> + <service name="com.sun.star.sdbcx.Driver"/> + </implementation> +</component> diff --git a/connectivity/source/drivers/mysql/mysql.xcu b/connectivity/source/drivers/mysql/mysql.xcu index 16e3c82031..16e3c82031 100755..100644 --- a/connectivity/source/drivers/mysql/mysql.xcu +++ b/connectivity/source/drivers/mysql/mysql.xcu diff --git a/connectivity/source/drivers/mysql/mysql.xml b/connectivity/source/drivers/mysql/mysql.xml index 93cb83d0ab..93cb83d0ab 100644..100755 --- a/connectivity/source/drivers/mysql/mysql.xml +++ b/connectivity/source/drivers/mysql/mysql.xml diff --git a/connectivity/source/drivers/odbc/OFunctions.cxx b/connectivity/source/drivers/odbc/OFunctions.cxx index 66e10db75d..bc7f21fe25 100644 --- a/connectivity/source/drivers/odbc/OFunctions.cxx +++ b/connectivity/source/drivers/odbc/OFunctions.cxx @@ -101,8 +101,8 @@ T3SQLNativeSql pODBC3SQLNativeSql; sal_Bool LoadFunctions(oslModule pODBCso); // ------------------------------------------------------------------------- -// Dynamisches Laden der DLL/shared lib und Adressen der Funktionen besorgen: -// Liefert sal_True bei Erfolg. +// Take care of Dynamicly loading of the DLL/shared lib and Addresses: +// Returns sal_True at success sal_Bool LoadLibrary_ODBC3(::rtl::OUString &_rPath) { static sal_Bool bLoaded = sal_False; @@ -110,25 +110,21 @@ sal_Bool LoadLibrary_ODBC3(::rtl::OUString &_rPath) if (bLoaded) return sal_True; -#ifdef WIN - _rPath = ::rtl::OUString::createFromAscii("ODBC.DLL"); - -#endif #ifdef WNT - _rPath = ::rtl::OUString::createFromAscii("ODBC32.DLL"); + _rPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODBC32.DLL")); #endif #ifdef UNX #ifdef MACOSX - _rPath = ::rtl::OUString::createFromAscii("libiodbc.dylib"); + _rPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("libiodbc.dylib")); #else - _rPath = ::rtl::OUString::createFromAscii("libodbc.so.1"); + _rPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("libodbc.so.1")); pODBCso = osl_loadModule( _rPath.pData,SAL_LOADMODULE_NOW ); if ( !pODBCso ) - _rPath = ::rtl::OUString::createFromAscii("libodbc.so"); + _rPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("libodbc.so")); #endif /* MACOSX */ #endif #ifdef OS2 - _rPath = ::rtl::OUString::createFromAscii("ODBC"); + _rPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODBC")); #endif if ( !pODBCso ) @@ -137,7 +133,7 @@ sal_Bool LoadLibrary_ODBC3(::rtl::OUString &_rPath) #ifdef OS2 { delete pODBCso; - _rPath = ::rtl::OUString::createFromAscii("WOD402"); + _rPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WOD402")); pODBCso = osl_loadModule( _rPath.pData,SAL_LOADMODULE_NOW ); if( !pODBCso) return sal_False; @@ -153,127 +149,127 @@ sal_Bool LoadLibrary_ODBC3(::rtl::OUString &_rPath) sal_Bool LoadFunctions(oslModule pODBCso) { - if( ( pODBC3SQLAllocHandle = (T3SQLAllocHandle)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLAllocHandle").pData )) == NULL ) + if( ( pODBC3SQLAllocHandle = (T3SQLAllocHandle)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLAllocHandle")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLConnect = (T3SQLConnect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLConnect").pData )) == NULL ) + if( ( pODBC3SQLConnect = (T3SQLConnect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLConnect")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLDriverConnect = (T3SQLDriverConnect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLDriverConnect").pData )) == NULL ) + if( ( pODBC3SQLDriverConnect = (T3SQLDriverConnect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLDriverConnect")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLBrowseConnect = (T3SQLBrowseConnect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLBrowseConnect").pData )) == NULL ) + if( ( pODBC3SQLBrowseConnect = (T3SQLBrowseConnect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLBrowseConnect")).pData )) == NULL ) return sal_False; - if(( pODBC3SQLDataSources = (T3SQLDataSources)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLDataSources").pData )) == NULL ) + if(( pODBC3SQLDataSources = (T3SQLDataSources)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLDataSources")).pData )) == NULL ) return sal_False; - if(( pODBC3SQLDrivers = (T3SQLDrivers)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLDrivers").pData )) == NULL ) + if(( pODBC3SQLDrivers = (T3SQLDrivers)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLDrivers")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLGetInfo = (T3SQLGetInfo)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetInfo").pData )) == NULL ) + if( ( pODBC3SQLGetInfo = (T3SQLGetInfo)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetInfo")).pData )) == NULL ) return sal_False; - if(( pODBC3SQLGetFunctions = (T3SQLGetFunctions)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetFunctions").pData )) == NULL ) + if(( pODBC3SQLGetFunctions = (T3SQLGetFunctions)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetFunctions")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLGetTypeInfo = (T3SQLGetTypeInfo)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetTypeInfo").pData )) == NULL ) + if( ( pODBC3SQLGetTypeInfo = (T3SQLGetTypeInfo)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetTypeInfo")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLSetConnectAttr = (T3SQLSetConnectAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLSetConnectAttr").pData )) == NULL ) + if( ( pODBC3SQLSetConnectAttr = (T3SQLSetConnectAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSetConnectAttr")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLGetConnectAttr = (T3SQLGetConnectAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetConnectAttr").pData )) == NULL ) + if( ( pODBC3SQLGetConnectAttr = (T3SQLGetConnectAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetConnectAttr")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLSetEnvAttr = (T3SQLSetEnvAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLSetEnvAttr").pData )) == NULL ) + if( ( pODBC3SQLSetEnvAttr = (T3SQLSetEnvAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSetEnvAttr")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLGetEnvAttr = (T3SQLGetEnvAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetEnvAttr").pData )) == NULL ) + if( ( pODBC3SQLGetEnvAttr = (T3SQLGetEnvAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetEnvAttr")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLSetStmtAttr = (T3SQLSetStmtAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLSetStmtAttr").pData )) == NULL ) + if( ( pODBC3SQLSetStmtAttr = (T3SQLSetStmtAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSetStmtAttr")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLGetStmtAttr = (T3SQLGetStmtAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetStmtAttr").pData )) == NULL ) + if( ( pODBC3SQLGetStmtAttr = (T3SQLGetStmtAttr)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetStmtAttr")).pData )) == NULL ) return sal_False; - /*if( ( pODBC3SQLSetDescField = (T3SQLSetDescField)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLSetDescField").pData )) == NULL ) + /*if( ( pODBC3SQLSetDescField = (T3SQLSetDescField)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSetDescField")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLGetDescField = (T3SQLGetDescField)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetDescField").pData )) == NULL ) + if( ( pODBC3SQLGetDescField = (T3SQLGetDescField)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetDescField")).pData )) == NULL ) return sal_False;*/ - /*if( ( pODBC3SQLGetDescRec = (T3SQLGetDescRec)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetDescRec").pData )) == NULL ) + /*if( ( pODBC3SQLGetDescRec = (T3SQLGetDescRec)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetDescRec")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLSetDescRec = (T3SQLSetDescRec)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLSetDescRec").pData )) == NULL ) + if( ( pODBC3SQLSetDescRec = (T3SQLSetDescRec)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSetDescRec")).pData )) == NULL ) return sal_False;*/ - if( ( pODBC3SQLPrepare = (T3SQLPrepare)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLPrepare").pData )) == NULL ) + if( ( pODBC3SQLPrepare = (T3SQLPrepare)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLPrepare")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLBindParameter = (T3SQLBindParameter)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLBindParameter").pData )) == NULL ) + if( ( pODBC3SQLBindParameter = (T3SQLBindParameter)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLBindParameter")).pData )) == NULL ) return sal_False; -// if( ( pODBC3SQLGetCursorName = (T3SQLGetCursorName)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetCursorName").pData )) == NULL ) +// if( ( pODBC3SQLGetCursorName = (T3SQLGetCursorName)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetCursorName")).pData )) == NULL ) // return sal_False; - if( ( pODBC3SQLSetCursorName = (T3SQLSetCursorName)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLSetCursorName").pData )) == NULL ) + if( ( pODBC3SQLSetCursorName = (T3SQLSetCursorName)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSetCursorName")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLExecute = (T3SQLExecute)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLExecute").pData )) == NULL ) + if( ( pODBC3SQLExecute = (T3SQLExecute)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLExecute")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLExecDirect = (T3SQLExecDirect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLExecDirect").pData )) == NULL ) + if( ( pODBC3SQLExecDirect = (T3SQLExecDirect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLExecDirect")).pData )) == NULL ) return sal_False; - /*if( ( pODBC3SQLNativeSql = (T3SQLNativeSql)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLNativeSql").pData )) == NULL ) + /*if( ( pODBC3SQLNativeSql = (T3SQLNativeSql)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLNativeSql")).pData )) == NULL ) return sal_False;*/ - if( ( pODBC3SQLDescribeParam = (T3SQLDescribeParam)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLDescribeParam").pData )) == NULL ) + if( ( pODBC3SQLDescribeParam = (T3SQLDescribeParam)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLDescribeParam")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLNumParams = (T3SQLNumParams)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLNumParams").pData )) == NULL ) + if( ( pODBC3SQLNumParams = (T3SQLNumParams)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLNumParams")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLParamData = (T3SQLParamData)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLParamData").pData )) == NULL ) + if( ( pODBC3SQLParamData = (T3SQLParamData)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLParamData")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLPutData = (T3SQLPutData)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLPutData").pData )) == NULL ) + if( ( pODBC3SQLPutData = (T3SQLPutData)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLPutData")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLRowCount = (T3SQLRowCount)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLRowCount").pData )) == NULL ) + if( ( pODBC3SQLRowCount = (T3SQLRowCount)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLRowCount")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLNumResultCols = (T3SQLNumResultCols)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLNumResultCols").pData )) == NULL ) + if( ( pODBC3SQLNumResultCols = (T3SQLNumResultCols)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLNumResultCols")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLDescribeCol = (T3SQLDescribeCol)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLDescribeCol").pData )) == NULL ) + if( ( pODBC3SQLDescribeCol = (T3SQLDescribeCol)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLDescribeCol")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLColAttribute = (T3SQLColAttribute)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLColAttribute").pData )) == NULL ) + if( ( pODBC3SQLColAttribute = (T3SQLColAttribute)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLColAttribute")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLBindCol = (T3SQLBindCol)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLBindCol").pData )) == NULL ) + if( ( pODBC3SQLBindCol = (T3SQLBindCol)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLBindCol")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLFetch = (T3SQLFetch)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLFetch").pData )) == NULL ) + if( ( pODBC3SQLFetch = (T3SQLFetch)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLFetch")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLFetchScroll = (T3SQLFetchScroll)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLFetchScroll").pData )) == NULL ) + if( ( pODBC3SQLFetchScroll = (T3SQLFetchScroll)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLFetchScroll")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLGetData = (T3SQLGetData)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetData").pData )) == NULL ) + if( ( pODBC3SQLGetData = (T3SQLGetData)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetData")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLSetPos = (T3SQLSetPos)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLSetPos").pData )) == NULL ) + if( ( pODBC3SQLSetPos = (T3SQLSetPos)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSetPos")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLBulkOperations = (T3SQLBulkOperations)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLBulkOperations").pData )) == NULL ) + if( ( pODBC3SQLBulkOperations = (T3SQLBulkOperations)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLBulkOperations")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLMoreResults = (T3SQLMoreResults)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLMoreResults").pData )) == NULL ) + if( ( pODBC3SQLMoreResults = (T3SQLMoreResults)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLMoreResults")).pData )) == NULL ) return sal_False; - /*if( ( pODBC3SQLGetDiagField = (T3SQLGetDiagField)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetDiagField").pData )) == NULL ) + /*if( ( pODBC3SQLGetDiagField = (T3SQLGetDiagField)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetDiagField")).pData )) == NULL ) return sal_False;*/ - if( ( pODBC3SQLGetDiagRec = (T3SQLGetDiagRec)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetDiagRec").pData )) == NULL ) + if( ( pODBC3SQLGetDiagRec = (T3SQLGetDiagRec)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetDiagRec")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLColumnPrivileges = (T3SQLColumnPrivileges)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLColumnPrivileges").pData )) == NULL ) + if( ( pODBC3SQLColumnPrivileges = (T3SQLColumnPrivileges)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLColumnPrivileges")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLColumns = (T3SQLColumns)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLColumns").pData )) == NULL ) + if( ( pODBC3SQLColumns = (T3SQLColumns)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLColumns")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLForeignKeys = (T3SQLForeignKeys)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLForeignKeys").pData )) == NULL ) + if( ( pODBC3SQLForeignKeys = (T3SQLForeignKeys)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLForeignKeys")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLPrimaryKeys = (T3SQLPrimaryKeys)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLPrimaryKeys").pData )) == NULL ) + if( ( pODBC3SQLPrimaryKeys = (T3SQLPrimaryKeys)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLPrimaryKeys")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLProcedureColumns = (T3SQLProcedureColumns)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLProcedureColumns").pData )) == NULL ) + if( ( pODBC3SQLProcedureColumns = (T3SQLProcedureColumns)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLProcedureColumns")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLProcedures = (T3SQLProcedures)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLProcedures").pData )) == NULL ) + if( ( pODBC3SQLProcedures = (T3SQLProcedures)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLProcedures")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLSpecialColumns = (T3SQLSpecialColumns)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLSpecialColumns").pData )) == NULL ) + if( ( pODBC3SQLSpecialColumns = (T3SQLSpecialColumns)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLSpecialColumns")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLStatistics = (T3SQLStatistics)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLStatistics").pData )) == NULL ) + if( ( pODBC3SQLStatistics = (T3SQLStatistics)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLStatistics")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLTablePrivileges = (T3SQLTablePrivileges)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLTablePrivileges").pData )) == NULL ) + if( ( pODBC3SQLTablePrivileges = (T3SQLTablePrivileges)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLTablePrivileges")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLTables = (T3SQLTables)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLTables").pData )) == NULL ) + if( ( pODBC3SQLTables = (T3SQLTables)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLTables")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLFreeStmt = (T3SQLFreeStmt)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLFreeStmt").pData )) == NULL ) + if( ( pODBC3SQLFreeStmt = (T3SQLFreeStmt)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLFreeStmt")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLCloseCursor = (T3SQLCloseCursor)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLCloseCursor").pData )) == NULL ) + if( ( pODBC3SQLCloseCursor = (T3SQLCloseCursor)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLCloseCursor")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLCancel = (T3SQLCancel)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLCancel").pData )) == NULL ) + if( ( pODBC3SQLCancel = (T3SQLCancel)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLCancel")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLEndTran = (T3SQLEndTran)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLEndTran").pData )) == NULL ) + if( ( pODBC3SQLEndTran = (T3SQLEndTran)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLEndTran")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLDisconnect = (T3SQLDisconnect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLDisconnect").pData )) == NULL ) + if( ( pODBC3SQLDisconnect = (T3SQLDisconnect)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLDisconnect")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLFreeHandle = (T3SQLFreeHandle)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLFreeHandle").pData )) == NULL ) + if( ( pODBC3SQLFreeHandle = (T3SQLFreeHandle)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLFreeHandle")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLGetCursorName = (T3SQLGetCursorName)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLGetCursorName").pData )) == NULL ) + if( ( pODBC3SQLGetCursorName = (T3SQLGetCursorName)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLGetCursorName")).pData )) == NULL ) return sal_False; - if( ( pODBC3SQLNativeSql = (T3SQLNativeSql)osl_getFunctionSymbol(pODBCso, ::rtl::OUString::createFromAscii("SQLNativeSql").pData )) == NULL ) + if( ( pODBC3SQLNativeSql = (T3SQLNativeSql)osl_getFunctionSymbol(pODBCso, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SQLNativeSql")).pData )) == NULL ) return sal_False; return sal_True; diff --git a/connectivity/source/drivers/odbc/ORealDriver.cxx b/connectivity/source/drivers/odbc/ORealDriver.cxx index 8dd9ab3bfd..12b3b42973 100644 --- a/connectivity/source/drivers/odbc/ORealDriver.cxx +++ b/connectivity/source/drivers/odbc/ORealDriver.cxx @@ -330,7 +330,7 @@ oslGenericFunction ORealObdcDriver::getOdbcFunction(sal_Int32 _nIndex) const pFunction = (oslGenericFunction)pODBC3SQLNativeSql; break; default: - OSL_ENSURE(0,"Function unknown!"); + OSL_FAIL("Function unknown!"); } return pFunction; } @@ -341,20 +341,20 @@ oslGenericFunction ORealObdcDriver::getOdbcFunction(sal_Int32 _nIndex) const return *(new ORealObdcDriver(_rxFactory)); } // ----------------------------------------------------------------------------- -// ODBC Environment (gemeinsam fuer alle Connections): +// ODBC Environment (common for all Connections): SQLHANDLE ORealObdcDriver::EnvironmentHandle(::rtl::OUString &_rPath) { - // Ist (fuer diese Instanz) bereits ein Environment erzeugt worden? + // Is (for this instance) already a Enviroment made? if (!m_pDriverHandle) { SQLHANDLE h = SQL_NULL_HANDLE; - // Environment allozieren + // allocate Environment - // ODBC-DLL jetzt laden: + // load ODBC-DLL now: if (!LoadLibrary_ODBC3(_rPath) || N3SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&h) != SQL_SUCCESS) return SQL_NULL_HANDLE; - // In globaler Struktur merken ... + // Save in global Structure m_pDriverHandle = h; SQLRETURN nError = N3SQLSetEnvAttr(h, SQL_ATTR_ODBC_VERSION,(SQLPOINTER) SQL_OV_ODBC3, SQL_IS_UINTEGER); OSL_UNUSED( nError ); diff --git a/connectivity/source/drivers/odbc/makefile.mk b/connectivity/source/drivers/odbc/makefile.mk index a13837224b..6d701b87c5 100644..100755 --- a/connectivity/source/drivers/odbc/makefile.mk +++ b/connectivity/source/drivers/odbc/makefile.mk @@ -77,3 +77,11 @@ SHL1VERSIONMAP=$(SOLARENV)/src/component.map # --- Targets ---------------------------------- .INCLUDE : $(PRJ)$/target.pmk + +ALLTAR : $(MISC)/odbc.component + +$(MISC)/odbc.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + odbc.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt odbc.component diff --git a/connectivity/source/drivers/odbc/odbc.component b/connectivity/source/drivers/odbc/odbc.component new file mode 100755 index 0000000000..d4e6bc127d --- /dev/null +++ b/connectivity/source/drivers/odbc/odbc.component @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.sdbc.ODBCDriver"> + <service name="com.sun.star.sdbc.Driver"/> + </implementation> +</component> diff --git a/connectivity/source/drivers/odbc/odbc.xcu b/connectivity/source/drivers/odbc/odbc.xcu index f8efe2eed4..f8efe2eed4 100755..100644 --- a/connectivity/source/drivers/odbc/odbc.xcu +++ b/connectivity/source/drivers/odbc/odbc.xcu diff --git a/connectivity/source/drivers/odbc/odbc.xml b/connectivity/source/drivers/odbc/odbc.xml index eae2d3f3e1..eae2d3f3e1 100644..100755 --- a/connectivity/source/drivers/odbc/odbc.xml +++ b/connectivity/source/drivers/odbc/odbc.xml diff --git a/connectivity/source/drivers/odbc/oservices.cxx b/connectivity/source/drivers/odbc/oservices.cxx index eab3c07f30..93a1ccbce1 100644 --- a/connectivity/source/drivers/odbc/oservices.cxx +++ b/connectivity/source/drivers/odbc/oservices.cxx @@ -31,13 +31,11 @@ #include "ORealDriver.hxx" #include "odbc/ODriver.hxx" #include <cppuhelper/factory.hxx> -#include <osl/diagnose.h> using namespace connectivity::odbc; using ::rtl::OUString; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; -using ::com::sun::star::registry::XRegistryKey; using ::com::sun::star::lang::XSingleServiceFactory; using ::com::sun::star::lang::XMultiServiceFactory; @@ -50,31 +48,6 @@ typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc) rtl_ModuleCount* _pTemp ); -//*************************************************************************************** -// -// Die vorgeschriebene C-Api muss erfuellt werden! -// Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen. -// - -//--------------------------------------------------------------------------------------- -void REGISTER_PROVIDER( - const OUString& aServiceImplName, - const Sequence< OUString>& Services, - const Reference< ::com::sun::star::registry::XRegistryKey > & xKey) -{ - OUString aMainKeyName; - aMainKeyName = OUString::createFromAscii("/"); - aMainKeyName += aServiceImplName; - aMainKeyName += OUString::createFromAscii("/UNO/SERVICES"); - - Reference< ::com::sun::star::registry::XRegistryKey > xNewKey( xKey->createKey(aMainKeyName) ); - OSL_ENSURE(xNewKey.is(), "ODBC::component_writeInfo : could not create a registry key !"); - - for (sal_Int32 i=0; i<Services.getLength(); ++i) - xNewKey->createKey(Services[i]); -} - - //--------------------------------------------------------------------------------------- struct ProviderRequest { @@ -125,31 +98,6 @@ component_getImplementationEnvironment( } //--------------------------------------------------------------------------------------- -extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( - void* /*pServiceManager*/, - void* pRegistryKey - ) -{ - if (pRegistryKey) - try - { - Reference< ::com::sun::star::registry::XRegistryKey > xKey(reinterpret_cast< ::com::sun::star::registry::XRegistryKey*>(pRegistryKey)); - - REGISTER_PROVIDER( - ODBCDriver::getImplementationName_Static(), - ODBCDriver::getSupportedServiceNames_Static(), xKey); - - return sal_True; - } - catch (::com::sun::star::registry::InvalidRegistryException& ) - { - OSL_ENSURE(sal_False, "ODBC::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !"); - } - - return sal_False; -} - -//--------------------------------------------------------------------------------------- extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplementationName, void* pServiceManager, diff --git a/connectivity/source/drivers/odbcbase/OConnection.cxx b/connectivity/source/drivers/odbcbase/OConnection.cxx index 1fec1f89ec..3a9a50dbb8 100644 --- a/connectivity/source/drivers/odbcbase/OConnection.cxx +++ b/connectivity/source/drivers/odbcbase/OConnection.cxx @@ -113,7 +113,7 @@ SQLRETURN OConnection::OpenConnection(const ::rtl::OUString& aConnectStr,sal_Int memcpy(szConnStrIn, (SDB_ODBC_CHAR*) aConStr.getStr(), ::std::min<sal_Int32>((sal_Int32)2048,aConStr.getLength())); #ifndef MACOSX - N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_LOGIN_TIMEOUT,(SQLPOINTER)nTimeOut,SQL_IS_UINTEGER); + N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_LOGIN_TIMEOUT,(SQLPOINTER)(sal_IntPtr)nTimeOut,SQL_IS_UINTEGER); // Verbindung aufbauen #endif @@ -161,7 +161,7 @@ SQLRETURN OConnection::OpenConnection(const ::rtl::OUString& aConnectStr,sal_Int { ::rtl::OUString sVersion; OTools::GetInfo(this,m_aConnectionHandle,SQL_DRIVER_ODBC_VER,sVersion,*this,getTextEncoding()); - m_bUseOldDateFormat = sVersion == ::rtl::OUString::createFromAscii("02.50") || sVersion == ::rtl::OUString::createFromAscii("02.00"); + m_bUseOldDateFormat = sVersion == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("02.50")) || sVersion == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("02.00")); } catch(Exception&) { @@ -236,12 +236,12 @@ SQLRETURN OConnection::Construct(const ::rtl::OUString& url,const Sequence< Prop else if(!pBegin->Name.compareToAscii(pUser)) { OSL_VERIFY( pBegin->Value >>= aUID ); - aDSN = aDSN + ::rtl::OUString::createFromAscii(";UID=") + aUID; + aDSN = aDSN + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(";UID=")) + aUID; } else if(!pBegin->Name.compareToAscii(pPwd)) { OSL_VERIFY( pBegin->Value >>= aPWD ); - aDSN = aDSN + ::rtl::OUString::createFromAscii(";PWD=") + aPWD; + aDSN = aDSN + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(";PWD=")) + aPWD; } else if(!pBegin->Name.compareToAscii(pUseCatalog)) { @@ -250,7 +250,7 @@ SQLRETURN OConnection::Construct(const ::rtl::OUString& url,const Sequence< Prop else if(!pBegin->Name.compareToAscii(pSysDrv)) { OSL_VERIFY( pBegin->Value >>= aSysDrvSettings ); - aDSN += ::rtl::OUString::createFromAscii(";"); + aDSN += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(";")); aDSN += aSysDrvSettings; } else if(0 == pBegin->Name.compareToAscii(pCharSet)) @@ -435,7 +435,7 @@ void SAL_CALL OConnection::setTransactionIsolation( sal_Int32 level ) throw(SQLE OTools::ThrowException(this,N3SQLSetConnectAttr(m_aConnectionHandle, SQL_ATTR_TXN_ISOLATION, - (SQLPOINTER)level,SQL_IS_INTEGER), + (SQLPOINTER)(sal_IntPtr)level,SQL_IS_INTEGER), m_aConnectionHandle,SQL_HANDLE_DBC,*this); } // -------------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx b/connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx index ce2b36d9fe..c374447c6f 100644 --- a/connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx +++ b/connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx @@ -62,7 +62,7 @@ ODatabaseMetaData::ODatabaseMetaData(const SQLHANDLE _pHandle,OConnection* _pCon { m_bUseCatalog = !(usesLocalFiles() || usesLocalFilePerTable()); ::rtl::OUString sVersion = getDriverVersion(); - m_bOdbc3 = sVersion != ::rtl::OUString::createFromAscii("02.50") && sVersion != ::rtl::OUString::createFromAscii("02.00"); + m_bOdbc3 = sVersion != ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("02.50")) && sVersion != ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("02.00")); } catch(SQLException& ) { // doesn't matter here @@ -734,13 +734,13 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLE // there exists no possibility to get table types so we have to check static ::rtl::OUString sTableTypes[] = { - ::rtl::OUString::createFromAscii("TABLE"), - ::rtl::OUString::createFromAscii("VIEW"), - ::rtl::OUString::createFromAscii("SYSTEM TABLE"), - ::rtl::OUString::createFromAscii("GLOBAL TEMPORARY"), - ::rtl::OUString::createFromAscii("LOCAL TEMPORARY"), - ::rtl::OUString::createFromAscii("ALIAS"), - ::rtl::OUString::createFromAscii("SYNONYM") + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VIEW")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SYSTEM TABLE")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GLOBAL TEMPORARY")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LOCAL TEMPORARY")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ALIAS")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SYNONYM")) }; sal_Int32 nSize = sizeof(sTableTypes) / sizeof(::rtl::OUString); ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes); @@ -1224,7 +1224,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQL ::rtl::OUString aValue = m_pConnection->getURL(); if ( !aValue.getLength() ) { - aValue = ::rtl::OUString::createFromAscii("sdbc:odbc:"); + aValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:odbc:")); aValue += getURLImpl(); } return aValue; diff --git a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx index 88fd5133b1..99a30de206 100644 --- a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx +++ b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx @@ -795,7 +795,7 @@ void ODatabaseMetaDataResultSet::setFastPropertyValue_NoBroadcast( sal_Int32 nHa case PROPERTY_ID_FETCHSIZE: throw Exception(); default: - OSL_ENSURE(0,"setFastPropertyValue_NoBroadcast: Illegal handle value!"); + OSL_FAIL("setFastPropertyValue_NoBroadcast: Illegal handle value!"); } } // ------------------------------------------------------------------------- @@ -879,10 +879,11 @@ void ODatabaseMetaDataResultSet::openTables(const Any& catalog, const ::rtl::OUS if ( catalog.hasValue() ) aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding); aPKO = ::rtl::OUStringToOString(schemaPattern,m_nTextEncoding); + aPKN = ::rtl::OUStringToOString(tableNamePattern,m_nTextEncoding); const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL, *pPKO = pSchemaPat && pSchemaPat->getLength() ? aPKO.getStr() : NULL, - *pPKN = aPKN = ::rtl::OUStringToOString(tableNamePattern,m_nTextEncoding).getStr(); + *pPKN = aPKN.getStr(); const char *pCOL = NULL; @@ -980,11 +981,13 @@ void ODatabaseMetaDataResultSet::openColumnPrivileges( const Any& catalog, const aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding); aPKO = ::rtl::OUStringToOString(schema,m_nTextEncoding); + aPKN = ::rtl::OUStringToOString(table,m_nTextEncoding); + aCOL = ::rtl::OUStringToOString(columnNamePattern,m_nTextEncoding); const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL, *pPKO = pSchemaPat && pSchemaPat->getLength() ? aPKO.getStr() : NULL, - *pPKN = aPKN = ::rtl::OUStringToOString(table,m_nTextEncoding).getStr(), - *pCOL = aCOL = ::rtl::OUStringToOString(columnNamePattern,m_nTextEncoding).getStr(); + *pPKN = aPKN.getStr(), + *pCOL = aCOL.getStr(); SQLRETURN nRetcode = N3SQLColumnPrivileges(m_aStatementHandle, @@ -1012,11 +1015,13 @@ void ODatabaseMetaDataResultSet::openColumns( const Any& catalog, const ::rtl ::rtl::OString aPKQ,aPKO,aPKN,aCOL; aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding); aPKO = ::rtl::OUStringToOString(schemaPattern,m_nTextEncoding); + aPKN = ::rtl::OUStringToOString(tableNamePattern,m_nTextEncoding); + aCOL = ::rtl::OUStringToOString(columnNamePattern,m_nTextEncoding); const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL, *pPKO = pSchemaPat && pSchemaPat->getLength() && pSchemaPat->getLength() ? aPKO.getStr() : NULL, - *pPKN = aPKN = ::rtl::OUStringToOString(tableNamePattern,m_nTextEncoding).getStr(), - *pCOL = aCOL = ::rtl::OUStringToOString(columnNamePattern,m_nTextEncoding).getStr(); + *pPKN = aPKN.getStr(), + *pCOL = aCOL.getStr(); SQLRETURN nRetcode = N3SQLColumns(m_aStatementHandle, @@ -1078,11 +1083,13 @@ void ODatabaseMetaDataResultSet::openProcedureColumns( const Any& catalog, cons ::rtl::OString aPKQ,aPKO,aPKN,aCOL; aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding); aPKO = ::rtl::OUStringToOString(schemaPattern,m_nTextEncoding); + aPKN = ::rtl::OUStringToOString(procedureNamePattern,m_nTextEncoding); + aCOL = ::rtl::OUStringToOString(columnNamePattern,m_nTextEncoding); const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL, *pPKO = pSchemaPat && pSchemaPat->getLength() ? aPKO.getStr() : NULL, - *pPKN = aPKN = ::rtl::OUStringToOString(procedureNamePattern,m_nTextEncoding).getStr(), - *pCOL = aCOL = ::rtl::OUStringToOString(columnNamePattern,m_nTextEncoding).getStr(); + *pPKN = aPKN.getStr(), + *pCOL = aCOL.getStr(); SQLRETURN nRetcode = N3SQLProcedureColumns(m_aStatementHandle, @@ -1111,10 +1118,11 @@ void ODatabaseMetaDataResultSet::openProcedures(const Any& catalog, const ::rtl: aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding); aPKO = ::rtl::OUStringToOString(schemaPattern,m_nTextEncoding); + aPKN = ::rtl::OUStringToOString(procedureNamePattern,m_nTextEncoding); const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL, *pPKO = pSchemaPat && pSchemaPat->getLength() ? aPKO.getStr() : NULL, - *pPKN = aPKN = ::rtl::OUStringToOString(procedureNamePattern,m_nTextEncoding).getStr(); + *pPKN = aPKN.getStr(); SQLRETURN nRetcode = N3SQLProcedures(m_aStatementHandle, @@ -1140,10 +1148,11 @@ void ODatabaseMetaDataResultSet::openSpecialColumns(sal_Bool _bRowVer,const Any& ::rtl::OString aPKQ,aPKO,aPKN,aCOL; aPKQ = ::rtl::OUStringToOString(comphelper::getString(catalog),m_nTextEncoding); aPKO = ::rtl::OUStringToOString(schema,m_nTextEncoding); + aPKN = ::rtl::OUStringToOString(table,m_nTextEncoding); const char *pPKQ = catalog.hasValue() && aPKQ.getLength() ? aPKQ.getStr() : NULL, *pPKO = pSchemaPat && pSchemaPat->getLength() ? aPKO.getStr() : NULL, - *pPKN = aPKN = ::rtl::OUStringToOString(table,m_nTextEncoding).getStr(); + *pPKN = aPKN.getStr(); SQLRETURN nRetcode = N3SQLSpecialColumns(m_aStatementHandle,_bRowVer ? SQL_ROWVER : SQL_BEST_ROWID, diff --git a/connectivity/source/drivers/odbcbase/ODriver.cxx b/connectivity/source/drivers/odbcbase/ODriver.cxx index c81198ebd6..7be1cf3bba 100644 --- a/connectivity/source/drivers/odbcbase/ODriver.cxx +++ b/connectivity/source/drivers/odbcbase/ODriver.cxx @@ -69,7 +69,7 @@ void ODBCDriver::disposing() //------------------------------------------------------------------------------ rtl::OUString ODBCDriver::getImplementationName_Static( ) throw(RuntimeException) { - return rtl::OUString::createFromAscii("com.sun.star.comp.sdbc.ODBCDriver"); + return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sdbc.ODBCDriver")); // this name is referenced in the configuration and in the odbc.xml // Please take care when changing it. } @@ -79,7 +79,7 @@ typedef Sequence< ::rtl::OUString > SS; SS ODBCDriver::getSupportedServiceNames_Static( ) throw (RuntimeException) { SS aSNS( 1 ); - aSNS[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.Driver"); + aSNS[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.Driver")); return aSNS; } @@ -130,7 +130,7 @@ Reference< XConnection > SAL_CALL ODBCDriver::connect( const ::rtl::OUString& ur sal_Bool SAL_CALL ODBCDriver::acceptsURL( const ::rtl::OUString& url ) throw(SQLException, RuntimeException) { - return (!url.compareTo(::rtl::OUString::createFromAscii("sdbc:odbc:"),10)); + return (!url.compareTo(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:odbc:")),10)); } // -------------------------------------------------------------------------------- Sequence< DriverPropertyInfo > SAL_CALL ODBCDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx b/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx index 2d13dd4e91..233e95cca0 100644 --- a/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx +++ b/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx @@ -32,6 +32,7 @@ #include <stdio.h> #include <string.h> #include <osl/diagnose.h> +#include "diagnose_ex.h" #include "odbc/OPreparedStatement.hxx" #include "odbc/OBoundParam.hxx" #include <com/sun/star/sdbc/DataType.hpp> @@ -596,6 +597,7 @@ void SAL_CALL OPreparedStatement::clearParameters( ) throw(SQLException, Runtim OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); SQLRETURN nRet = N3SQLFreeStmt (m_aStatementHandle, SQL_RESET_PARAMS); nRet = N3SQLFreeStmt (m_aStatementHandle, SQL_UNBIND); + OSL_UNUSED(nRet); } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::clearBatch( ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/odbcbase/OResultSet.cxx b/connectivity/source/drivers/odbcbase/OResultSet.cxx index f33d2ec489..909143b7dd 100644 --- a/connectivity/source/drivers/odbcbase/OResultSet.cxx +++ b/connectivity/source/drivers/odbcbase/OResultSet.cxx @@ -48,6 +48,8 @@ #include "diagnose_ex.h" #include <rtl/logfile.hxx> +#include <o3tl/compat_functional.hxx> + using namespace ::comphelper; using namespace connectivity; using namespace connectivity::odbc; @@ -67,14 +69,14 @@ using namespace com::sun::star::util; // IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.OResultSet","com.sun.star.sdbc.ResultSet"); ::rtl::OUString SAL_CALL OResultSet::getImplementationName( ) throw ( RuntimeException) { - return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.odbc.ResultSet"); + return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.odbc.ResultSet")); } // ------------------------------------------------------------------------- Sequence< ::rtl::OUString > SAL_CALL OResultSet::getSupportedServiceNames( ) throw( RuntimeException) { Sequence< ::rtl::OUString > aSupported(2); - aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.ResultSet"); - aSupported[1] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.ResultSet"); + aSupported[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.ResultSet")); + aSupported[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbcx.ResultSet")); return aSupported; } // ------------------------------------------------------------------------- @@ -318,7 +320,7 @@ TVoidPtr OResultSet::allocBindColumn(sal_Int32 _nType,sal_Int32 _nColumnIndex) aPair = TVoidPtr(reinterpret_cast< sal_Int64 >(new sal_Int8[m_aRow[_nColumnIndex].getSequence().getLength()]),_nType); break; default: - OSL_ENSURE(0,"Unknown type"); + OSL_FAIL("Unknown type"); aPair = TVoidPtr(0,_nType); } return aPair; @@ -1150,7 +1152,7 @@ Any SAL_CALL OResultSet::getBookmark( ) throw( SQLException, RuntimeException) checkDisposed(OResultSet_BASE::rBHelper.bDisposed); TBookmarkPosMap::iterator aFind = ::std::find_if(m_aPosToBookmarks.begin(),m_aPosToBookmarks.end(), - ::std::compose1(::std::bind2nd(::std::equal_to<sal_Int32>(),m_nRowPos),::std::select2nd<TBookmarkPosMap::value_type>())); + ::o3tl::compose1(::std::bind2nd(::std::equal_to<sal_Int32>(),m_nRowPos),::o3tl::select2nd<TBookmarkPosMap::value_type>())); if ( aFind == m_aPosToBookmarks.end() ) { @@ -1366,12 +1368,12 @@ sal_Bool OResultSet::isBookmarkable() const //------------------------------------------------------------------------------ void OResultSet::setFetchDirection(sal_Int32 _par0) { - N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_TYPE,(SQLPOINTER)_par0,SQL_IS_UINTEGER); + N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_TYPE,(SQLPOINTER)(sal_IntPtr)_par0,SQL_IS_UINTEGER); } //------------------------------------------------------------------------------ void OResultSet::setFetchSize(sal_Int32 _par0) { - N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_ARRAY_SIZE,(SQLPOINTER)_par0,SQL_IS_UINTEGER); + N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_ARRAY_SIZE,(SQLPOINTER)(sal_IntPtr)_par0,SQL_IS_UINTEGER); delete m_pRowStatusArray; m_pRowStatusArray = new SQLUSMALLINT[_par0]; N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_STATUS_PTR,m_pRowStatusArray,SQL_IS_POINTER); @@ -1603,7 +1605,7 @@ sal_Bool OResultSet::move(IResultSetHelper::Movement _eCursorPosition, sal_Int32 if ( aIter->second == _nOffset ) return moveToBookmark(makeAny(aIter->first)); } - OSL_ENSURE(0,"Bookmark not found!"); + OSL_FAIL("Bookmark not found!"); } return sal_False; } @@ -1738,7 +1740,7 @@ void OResultSet::fillNeededData(SQLRETURN _nRet) break; } default: - OSL_ENSURE(0,"Not supported at the moment!"); + OSL_FAIL("Not supported at the moment!"); } nRet = N3SQLParamData(m_aStatementHandle,&pColumnIndex); } diff --git a/connectivity/source/drivers/odbcbase/OStatement.cxx b/connectivity/source/drivers/odbcbase/OStatement.cxx index dcf62bf3c6..ec2bd0debe 100644 --- a/connectivity/source/drivers/odbcbase/OStatement.cxx +++ b/connectivity/source/drivers/odbcbase/OStatement.cxx @@ -64,7 +64,7 @@ using namespace ::comphelper; } \ catch(SQLException&) \ { \ - OSL_ENSURE(0,"Exception in odbc catched"); \ + OSL_FAIL("Exception in odbc catched"); \ } #endif @@ -292,7 +292,7 @@ sal_Bool OStatement_Base::lockIfNecessary (const ::rtl::OUString& sql) throw( SQ // Now, look for the FOR UPDATE keywords. If there is any extra white // space between the FOR and UPDATE, this will fail. - sal_Int32 index = sqlStatement.indexOf(::rtl::OUString::createFromAscii(" FOR UPDATE")); + sal_Int32 index = sqlStatement.indexOf(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" FOR UPDATE"))); // We found it. Change our concurrency level to ensure that the // row can be updated. @@ -303,7 +303,7 @@ sal_Bool OStatement_Base::lockIfNecessary (const ::rtl::OUString& sql) throw( SQ try { SQLINTEGER nLock = SQL_CONCUR_LOCK; - THROW_SQL(N3SQLSetStmtAttr(m_aStatementHandle, SQL_CONCURRENCY,(SQLPOINTER)nLock,SQL_IS_UINTEGER)); + THROW_SQL(N3SQLSetStmtAttr(m_aStatementHandle, SQL_CONCURRENCY,(SQLPOINTER)(sal_IntPtr)nLock,SQL_IS_UINTEGER)); } catch (SQLWarning& warn) { @@ -700,6 +700,7 @@ sal_Int32 OStatement_Base::getResultSetType() const sal_uInt32 nValue = SQL_CURSOR_FORWARD_ONLY; SQLRETURN nRetCode = N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_SENSITIVITY,&nValue,SQL_IS_UINTEGER,0); nRetCode = N3SQLGetStmtAttr(m_aStatementHandle,SQL_ATTR_CURSOR_TYPE,&nValue,SQL_IS_UINTEGER,0); + OSL_UNUSED( nRetCode ); switch(nValue) { case SQL_CURSOR_FORWARD_ONLY: @@ -764,14 +765,14 @@ sal_Int32 OStatement_Base::getMaxFieldSize() const void OStatement_Base::setQueryTimeOut(sal_Int32 seconds) { OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); - SQLRETURN nRetCode = N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_QUERY_TIMEOUT,(SQLPOINTER)seconds,SQL_IS_UINTEGER); + SQLRETURN nRetCode = N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_QUERY_TIMEOUT,(SQLPOINTER)(sal_IntPtr)seconds,SQL_IS_UINTEGER); OSL_UNUSED( nRetCode ); } //------------------------------------------------------------------------------ void OStatement_Base::setMaxRows(sal_Int32 _par0) { OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); - SQLRETURN nRetCode = N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_MAX_ROWS, (SQLPOINTER)_par0,SQL_IS_UINTEGER); + SQLRETURN nRetCode = N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_MAX_ROWS, (SQLPOINTER)(sal_IntPtr)_par0,SQL_IS_UINTEGER); OSL_UNUSED( nRetCode ); } //------------------------------------------------------------------------------ @@ -784,7 +785,7 @@ void OStatement_Base::setResultSetConcurrency(sal_Int32 _par0) nSet = SQL_CONCUR_VALUES; OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); - N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_CONCURRENCY,(SQLPOINTER)nSet,SQL_IS_UINTEGER); + N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_CONCURRENCY,(SQLPOINTER)(sal_IntPtr)nSet,SQL_IS_UINTEGER); } //------------------------------------------------------------------------------ @@ -830,27 +831,27 @@ void OStatement_Base::setResultSetType(sal_Int32 _par0) } else nSet = SQL_CURSOR_DYNAMIC; - if(N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_CURSOR_TYPE,(SQLPOINTER)nSet,SQL_IS_UINTEGER) != SQL_SUCCESS) + if(N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_CURSOR_TYPE,(SQLPOINTER)(sal_uIntPtr)nSet,SQL_IS_UINTEGER) != SQL_SUCCESS) { nSet = SQL_CURSOR_KEYSET_DRIVEN; - N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_CURSOR_TYPE,(SQLPOINTER)nSet,SQL_IS_UINTEGER); + N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_CURSOR_TYPE,(SQLPOINTER)(sal_uIntPtr)nSet,SQL_IS_UINTEGER); } nSet = SQL_SENSITIVE; break; default: - OSL_ENSURE( false, "OStatement_Base::setResultSetType: invalid result set type!" ); + OSL_FAIL( "OStatement_Base::setResultSetType: invalid result set type!" ); break; } - N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_CURSOR_SENSITIVITY,(SQLPOINTER)nSet,SQL_IS_UINTEGER); + N3SQLSetStmtAttr(m_aStatementHandle, SQL_ATTR_CURSOR_SENSITIVITY,(SQLPOINTER)(sal_uIntPtr)nSet,SQL_IS_UINTEGER); } //------------------------------------------------------------------------------ void OStatement_Base::setEscapeProcessing( const sal_Bool _bEscapeProc ) { OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); SQLUINTEGER nEscapeProc( _bEscapeProc ? SQL_NOSCAN_OFF : SQL_NOSCAN_ON ); - SQLRETURN nRetCode = N3SQLSetStmtAttr( m_aStatementHandle, SQL_ATTR_NOSCAN, (SQLPOINTER)nEscapeProc, SQL_IS_UINTEGER ); + SQLRETURN nRetCode = N3SQLSetStmtAttr( m_aStatementHandle, SQL_ATTR_NOSCAN, (SQLPOINTER)(sal_uIntPtr)nEscapeProc, SQL_IS_UINTEGER ); (void)nRetCode; } @@ -858,7 +859,7 @@ void OStatement_Base::setEscapeProcessing( const sal_Bool _bEscapeProc ) void OStatement_Base::setFetchDirection(sal_Int32 _par0) { OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); - sal_Int32 nCursType = 0; + sal_IntPtr nCursType = 0; SQLRETURN nRetCode = SQL_SUCCESS; if(_par0 == FetchDirection::FORWARD) { @@ -877,17 +878,18 @@ void OStatement_Base::setFetchSize(sal_Int32 _par0) { OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); - SQLRETURN nRetCode = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_ARRAY_SIZE,(SQLPOINTER)_par0,SQL_IS_UINTEGER); + SQLRETURN nRetCode = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_ARRAY_SIZE,(SQLPOINTER)(sal_IntPtr)_par0,SQL_IS_UINTEGER); delete m_pRowStatusArray; m_pRowStatusArray = new SQLUSMALLINT[_par0]; nRetCode = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_STATUS_PTR,m_pRowStatusArray,SQL_IS_POINTER); + OSL_UNUSED( nRetCode ); } //------------------------------------------------------------------------------ void OStatement_Base::setMaxFieldSize(sal_Int32 _par0) { OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); - N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_MAX_LENGTH,(SQLPOINTER)_par0,SQL_IS_UINTEGER); + N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_MAX_LENGTH,(SQLPOINTER)(sal_IntPtr)_par0,SQL_IS_UINTEGER); } //------------------------------------------------------------------------------ void OStatement_Base::setCursorName(const ::rtl::OUString &_par0) @@ -918,7 +920,7 @@ sal_Bool OStatement_Base::getEscapeProcessing() const void OStatement_Base::setUsingBookmarks(sal_Bool _bUseBookmark) { OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!"); - sal_uInt32 nValue = _bUseBookmark ? SQL_UB_VARIABLE : SQL_UB_OFF; + sal_uIntPtr nValue = _bUseBookmark ? SQL_UB_VARIABLE : SQL_UB_OFF; SQLRETURN nRetCode = N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_USE_BOOKMARKS,(SQLPOINTER)nValue,SQL_IS_UINTEGER); OSL_UNUSED( nRetCode ); } @@ -1046,7 +1048,7 @@ void OStatement_Base::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const A setEscapeProcessing( ::comphelper::getBOOL( rValue ) ); break; default: - OSL_ENSURE( false, "OStatement_Base::setFastPropertyValue_NoBroadcast: what property?" ); + OSL_FAIL( "OStatement_Base::setFastPropertyValue_NoBroadcast: what property?" ); break; } } @@ -1091,7 +1093,7 @@ void OStatement_Base::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const rValue <<= getEscapeProcessing(); break; default: - OSL_ENSURE( false, "OStatement_Base::getFastPropertyValue: what property?" ); + OSL_FAIL( "OStatement_Base::getFastPropertyValue: what property?" ); break; } } diff --git a/connectivity/source/drivers/odbcbase/OTools.cxx b/connectivity/source/drivers/odbcbase/OTools.cxx index f48ac3c08d..8c816a5fb6 100644 --- a/connectivity/source/drivers/odbcbase/OTools.cxx +++ b/connectivity/source/drivers/odbcbase/OTools.cxx @@ -87,7 +87,6 @@ void OTools::bindParameter( OConnection* _pConnection, SQLSMALLINT fSqlType; SQLSMALLINT fCType; SQLLEN nMaxLen = 0; - // void*& pData = pDataBuffer; SQLLEN* pLen = (SQLLEN*)pLenBuffer; SQLULEN nColumnSize=0; SQLSMALLINT nDecimalDigits=0; @@ -101,9 +100,6 @@ void OTools::bindParameter( OConnection* _pConnection, if(fSqlType == SQL_LONGVARCHAR || fSqlType == SQL_LONGVARBINARY) memcpy(pDataBuffer,&nPos,sizeof(nPos)); - // 20.09.2001 OJ: Problems with mysql. mysql returns only CHAR as parameter type - // nRetcode = (*(T3SQLDescribeParam)_pConnection->getOdbcFunction(ODBC3SQLDescribeParam))(_hStmt,(SQLUSMALLINT)nPos,&fSqlType,&nColumnSize,&nDecimalDigits,&nNullable); - nRetcode = (*(T3SQLBindParameter)_pConnection->getOdbcFunction(ODBC3SQLBindParameter))(_hStmt, (SQLUSMALLINT)nPos, SQL_PARAM_INPUT, @@ -141,7 +137,7 @@ void OTools::bindData( SQLSMALLINT _nOdbcType, _nColumnSize = sStr.getLength(); *((rtl::OUString*)_pData) = sStr; - // Zeiger auf Char* + // Pointer on Char* _pData = (sal_Int8*)((rtl::OUString*)_pData)->getStr(); } else @@ -167,7 +163,7 @@ void OTools::bindData( SQLSMALLINT _nOdbcType, _nColumnSize = aString.getLength(); *pLen = _nColumnSize; *((rtl::OUString*)_pData) = aString; - // Zeiger auf Char* + // Pointer on Char* _pData = (sal_Int8*)((rtl::OUString*)_pData)->getStr(); } else @@ -294,23 +290,13 @@ void OTools::bindValue( OConnection* _pConnection, { case SQL_CHAR: case SQL_VARCHAR: - //if(GetODBCConnection()->m_bUserWChar) -// { -// _nMaxLen = rCol.GetPrecision(); -// *pLen = SQL_NTS; -// *((rtl::OUString*)pData) = (rtl::OUString)_aValue; -// -// // Zeiger auf Char* -// pData = (void*)((rtl::OUString*)pData)->getStr(); -// } -// else { ::rtl::OString aString(::rtl::OUStringToOString(*(::rtl::OUString*)_pValue,_nTextEncoding)); *pLen = SQL_NTS; *((::rtl::OString*)_pData) = aString; _nMaxLen = (SQLSMALLINT)aString.getLength(); - // Zeiger auf Char* + // Pointer on Char* _pData = (void*)aString.getStr(); } break; case SQL_BIGINT: @@ -319,21 +305,12 @@ void OTools::bindValue( OConnection* _pConnection, break; case SQL_DECIMAL: case SQL_NUMERIC: - //if(GetODBCConnection()->m_bUserWChar) -// { -// rtl::OUString aString(rtl::OUString(SdbTools::ToString(ODbTypeConversion::toDouble(*pVariable),rCol.GetScale()))); -// *pLen = _nMaxLen; -// *((rtl::OUString*)_pData) = aString; -// // Zeiger auf Char* -// _pData = (void*)((rtl::OUString*)_pData)->getStr(); -// } -// else { ::rtl::OString aString = ::rtl::OString::valueOf(*(double*)_pValue); _nMaxLen = (SQLSMALLINT)aString.getLength(); *pLen = _nMaxLen; *((::rtl::OString*)_pData) = aString; - // Zeiger auf Char* + // Pointer on Char* _pData = (void*)((::rtl::OString*)_pData)->getStr(); } break; case SQL_BIT: @@ -361,14 +338,13 @@ void OTools::bindValue( OConnection* _pConnection, break; case SQL_BINARY: case SQL_VARBINARY: - // if (_pValue == ::getCppuType((const ::com::sun::star::uno::Sequence< sal_Int8 > *)0)) { _pData = (void*)((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getConstArray(); *pLen = ((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getLength(); } break; case SQL_LONGVARBINARY: { - _pData = (void*)(columnIndex); + _pData = (void*)(sal_IntPtr)(columnIndex); sal_Int32 nLen = 0; nLen = ((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getLength(); *pLen = (SQLLEN)SQL_LEN_DATA_AT_EXEC(nLen); @@ -376,7 +352,7 @@ void OTools::bindValue( OConnection* _pConnection, break; case SQL_LONGVARCHAR: { - _pData = (void*)(columnIndex); + _pData = (void*)(sal_IntPtr)(columnIndex); sal_Int32 nLen = 0; nLen = ((::rtl::OUString*)_pValue)->getLength(); *pLen = (SQLLEN)SQL_LEN_DATA_AT_EXEC(nLen); @@ -433,13 +409,12 @@ void OTools::ThrowException(OConnection* _pConnection, case SQL_ERROR: break; - case SQL_INVALID_HANDLE: OSL_ENSURE(0,"SdbODBC3_SetStatus: SQL_INVALID_HANDLE"); + case SQL_INVALID_HANDLE: OSL_FAIL("SdbODBC3_SetStatus: SQL_INVALID_HANDLE"); throw SQLException(); } - - // Zusaetliche Informationen zum letzten ODBC-Funktionsaufruf vorhanden. - // SQLError liefert diese Informationen. + // Additional Information on the latest ODBC-functioncall available + // SQLError provides this Information. RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OTools::ThrowException" ); SDB_ODBC_CHAR szSqlState[5]; @@ -448,12 +423,12 @@ void OTools::ThrowException(OConnection* _pConnection, szErrorMessage[0] = '\0'; SQLSMALLINT pcbErrorMsg = 0; - // Informationen zur letzten Operation: - // wenn hstmt != SQL_NULL_HSTMT ist (Benutzung von SetStatus in SdbCursor, SdbTable, ...), - // dann wird der Status des letzten Statements erfragt, sonst der Status des letzten - // Statements zu dieser Verbindung [was in unserem Fall wahrscheinlich gleichbedeutend ist, - // aber das Reference Manual drueckt sich da nicht so klar aus ...]. - // Entsprechend bei hdbc. + // Information for latest operation: + // when hstmt != SQL_NULL_HSTMT is (Used from SetStatus in SdbCursor, SdbTable, ...), + // then the status of the latest statments will be fetched, without the Status of the last + // Statments of this connection [what in this case will probably be the same, but the Reference + // Manual isn't totally clear in this...]. + // corresponding for hdbc. SQLRETURN n = (*(T3SQLGetDiagRec)_pConnection->getOdbcFunction(ODBC3SQLGetDiagRec))(_nHandleType,_pContext,1, szSqlState, &pfNativeError, @@ -462,7 +437,7 @@ void OTools::ThrowException(OConnection* _pConnection, OSL_ENSURE(n != SQL_INVALID_HANDLE,"SdbODBC3_SetStatus: SQLError returned SQL_INVALID_HANDLE"); OSL_ENSURE(n == SQL_SUCCESS || n == SQL_SUCCESS_WITH_INFO || n == SQL_NO_DATA_FOUND || n == SQL_ERROR,"SdbODBC3_SetStatus: SQLError failed"); - // Zum Return Code von SQLError siehe ODBC 2.0 Programmer's Reference Seite 287ff + // For the Return Code of SQLError see ODBC 2.0 Programmer's Reference Page 287ff throw SQLException( ::rtl::OUString((char *)szErrorMessage,pcbErrorMsg,_nTextEncoding), _xInterface, ::rtl::OUString((char *)szSqlState,5,_nTextEncoding), @@ -481,8 +456,7 @@ Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection, { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "odbc", "Ocke.Janssen@sun.com", "OTools::getBytesValue" ); char aCharArray[2048]; - // Erstmal versuchen, die Daten mit dem kleinen Puffer - // abzuholen: + // First try to fetch the data with the little Buffer: SQLLEN nMaxLen = sizeof aCharArray - 1; // GETDATA(SQL_C_CHAR,aCharArray,nMaxLen); SQLLEN pcbValue = 0; @@ -503,23 +477,19 @@ Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection, --nBytes; Sequence<sal_Int8> aData((sal_Int8*)aCharArray, nBytes); - - // Es handelt sich um Binaerdaten, um einen String, der fuer - // StarView zu lang ist oder der Treiber kann die Laenge der - // Daten nicht im voraus bestimmen - also als MemoryStream - // speichern. + // It is about Binariy Data, a String, that for StarView is to long or + // the driver kan't predict the length of the data - as well as save the + // MemoryStream. while ((pcbValue == SQL_NO_TOTAL) || pcbValue > nMaxLen) { - // Bei Strings wird der Puffer nie ganz ausgenutzt - // (das letzte Byte ist immer ein NULL-Byte, das - // aber bei pcbValue nicht mitgezaehlt wird) + // At Strings the Buffer won't be completly used + // (The last Byte is always a NULL-Byte, however it won't be counted with pcbValue) if (pcbValue != SQL_NO_TOTAL && (pcbValue - nMaxLen) < nMaxLen) nBytes = pcbValue - nMaxLen; else nBytes = nMaxLen; - // Solange eine "truncation"-Warnung vorliegt, weiter Daten abholen - // GETDATA(SQL_C_CHAR,aCharArray, nLen + 1); + // While there is a "truncation"-Warning, proceed with fetching Data. OTools::ThrowException(_pConnection,(*(T3SQLGetData)_pConnection->getOdbcFunction(ODBC3SQLGetData))(_aStatementHandle, (SQLUSMALLINT)columnIndex, SQL_C_BINARY, @@ -553,7 +523,6 @@ Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection, sal_Unicode waCharArray[2048]; // read the unicode data SQLLEN nMaxLen = (sizeof(waCharArray) / sizeof(sal_Unicode)) - 1; - // GETDATA(SQL_C_WCHAR, waCharArray, nMaxLen + sizeof(sal_Unicode)); SQLLEN pcbValue=0; OTools::ThrowException(_pConnection,(*(T3SQLGetData)_pConnection->getOdbcFunction(ODBC3SQLGetData))(_aStatementHandle, @@ -566,8 +535,8 @@ Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection, _bWasNull = pcbValue == SQL_NULL_DATA; if(_bWasNull) return ::rtl::OUString(); - // Bei Fehler bricht der GETDATA-Makro mit return ab, - // bei NULL mit break! + // at failure the GETDATA-Makro will stop with returning, + // at NULL with break! SQLLEN nRealSize = 0; if ( pcbValue > -1 ) nRealSize = pcbValue / sizeof(sal_Unicode); @@ -575,22 +544,19 @@ Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection, waCharArray[nLen] = 0; aData.append(waCharArray,nLen); - // Es handelt sich um Binaerdaten, um einen String, der fuer - // StarView zu lang ist oder der Treiber kann die Laenge der - // Daten nicht im voraus bestimmen - also als MemoryStream - // speichern. + // It is about Binariy Data, a String, that for StarView is to long or + // the driver kan't predict the length of the data - as well as save the + // MemoryStream. while ((pcbValue == SQL_NO_TOTAL ) || nLen > nMaxLen) { - // Bei Strings wird der Puffer nie ganz ausgenutzt - // (das letzte Byte ist immer ein NULL-Byte, das - // aber bei pcbValue nicht mitgezaehlt wird) + // At Strings the Buffer won't be completly used + // (The last Byte is always a NULL-Byte, however it won't be counted with pcbValue) if (pcbValue != SQL_NO_TOTAL && (pcbValue - nMaxLen) < nMaxLen) nLen = pcbValue - nMaxLen; else nLen = nMaxLen; - // Solange eine "truncation"-Warnung vorliegt, weiter Daten abholen - // GETDATA(SQL_C_CHAR,waCharArray, nLen + 1); + // While there is a "truncation"-Warning, proceed with fetching Data. OTools::ThrowException(_pConnection,(*(T3SQLGetData)_pConnection->getOdbcFunction(ODBC3SQLGetData))(_aStatementHandle, (SQLUSMALLINT)columnIndex, SQL_C_WCHAR, @@ -611,10 +577,8 @@ Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection, default: { char aCharArray[2048]; - // Erstmal versuchen, die Daten mit dem kleinen Puffer - // abzuholen: + // First try to fetch the data with the little Buffer: SQLLEN nMaxLen = sizeof aCharArray - 1; - // GETDATA(SQL_C_CHAR,aCharArray,nMaxLen); SQLLEN pcbValue = 0; OTools::ThrowException(_pConnection,(*(T3SQLGetData)_pConnection->getOdbcFunction(ODBC3SQLGetData))(_aStatementHandle, (SQLUSMALLINT)columnIndex, @@ -633,14 +597,12 @@ Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection, --nLen; aData.append(::rtl::OUString((const sal_Char*)aCharArray,nLen, _nTextEncoding)); - // Es handelt sich um Binaerdaten, um einen String, der fuer - // StarView zu lang ist oder der Treiber kann die Laenge der - // Daten nicht im voraus bestimmen - also als MemoryStream - // speichern. + // It is about Binariy Data, a String, that for StarView is to long or + // the driver kan't predict the length of the data - as well as save the + // MemoryStream. while ((pcbValue == SQL_NO_TOTAL) || pcbValue > nMaxLen) { - // Solange eine "truncation"-Warnung vorliegt, weiter Daten abholen - // GETDATA(SQL_C_CHAR,aCharArray, nLen + 1); + // While there is a "truncation"-Warning, proceed with fetching Data. OTools::ThrowException(_pConnection,(*(T3SQLGetData)_pConnection->getOdbcFunction(ODBC3SQLGetData))(_aStatementHandle, (SQLUSMALLINT)columnIndex, SQL_C_CHAR, @@ -656,8 +618,6 @@ Sequence<sal_Int8> OTools::getBytesValue(OConnection* _pConnection, aData.append(::rtl::OUString((const sal_Char*)aCharArray,nLen,_nTextEncoding)); } - // delete all blanks - // aData.EraseTrailingChars(); } } diff --git a/connectivity/source/drivers/odbcbase/makefile.mk b/connectivity/source/drivers/odbcbase/makefile.mk index 85e96ea857..85e96ea857 100644..100755 --- a/connectivity/source/drivers/odbcbase/makefile.mk +++ b/connectivity/source/drivers/odbcbase/makefile.mk |