summaryrefslogtreecommitdiff
path: root/connectivity/source/drivers/odbcbase
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity/source/drivers/odbcbase')
-rw-r--r--connectivity/source/drivers/odbcbase/OConnection.cxx14
-rw-r--r--connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx23
-rw-r--r--connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx33
-rw-r--r--connectivity/source/drivers/odbcbase/ODriver.cxx8
-rw-r--r--connectivity/source/drivers/odbcbase/OPreparedStatement.cxx5
-rw-r--r--connectivity/source/drivers/odbcbase/OResultSet.cxx38
-rw-r--r--connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx2
-rw-r--r--connectivity/source/drivers/odbcbase/OStatement.cxx54
-rw-r--r--connectivity/source/drivers/odbcbase/OTools.cxx114
-rwxr-xr-x[-rw-r--r--]connectivity/source/drivers/odbcbase/makefile.mk4
10 files changed, 143 insertions, 152 deletions
diff --git a/connectivity/source/drivers/odbcbase/OConnection.cxx b/connectivity/source/drivers/odbcbase/OConnection.cxx
index 0c79db546b3f..891eabc7d5eb 100644
--- a/connectivity/source/drivers/odbcbase/OConnection.cxx
+++ b/connectivity/source/drivers/odbcbase/OConnection.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -112,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
@@ -160,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&)
{
@@ -235,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))
{
@@ -249,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))
@@ -434,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);
}
// --------------------------------------------------------------------------------
@@ -668,3 +669,4 @@ void OConnection::freeStatementHandle(SQLHANDLE& _pHandle)
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx b/connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx
index dc9349732084..c0d8383eb1a7 100644
--- a/connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx
+++ b/connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,9 +30,7 @@
#include "precompiled_connectivity.hxx"
#include "odbc/ODatabaseMetaData.hxx"
#include "odbc/OTools.hxx"
-#ifndef _CONNECTIVITY_ODBC_ORESULTSET_HXX_
#include "odbc/ODatabaseMetaDataResultSet.hxx"
-#endif
#include "FDatabaseMetaDataResultSet.hxx"
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/ResultSetType.hpp>
@@ -63,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
@@ -735,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);
@@ -1225,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;
@@ -1741,3 +1740,5 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& /*catalo
return NULL;
}
// -----------------------------------------------------------------------------
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
index 828d0f6b7c3e..6df4f2c0275a 100644
--- a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
+++ b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -29,9 +30,7 @@
#include "precompiled_connectivity.hxx"
#include "TConnection.hxx"
-#ifndef _CONNECTIVITY_ADO_ADATABASEMETADATARESULTSET_HXX_
#include "odbc/ODatabaseMetaDataResultSet.hxx"
-#endif
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/KeyRule.hpp>
#include <com/sun/star/sdbc/ProcedureResult.hpp>
@@ -796,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!");
}
}
// -------------------------------------------------------------------------
@@ -880,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;
@@ -982,11 +982,13 @@ void ODatabaseMetaDataResultSet::openColumnPrivileges( const Any& catalog, cons
if ( catalog.hasValue() )
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,
@@ -1015,11 +1017,13 @@ void ODatabaseMetaDataResultSet::openColumns( const Any& catalog,
if ( catalog.hasValue() )
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,
@@ -1082,11 +1086,13 @@ void ODatabaseMetaDataResultSet::openProcedureColumns( const Any& catalog,
if ( catalog.hasValue() )
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,
@@ -1116,10 +1122,11 @@ void ODatabaseMetaDataResultSet::openProcedures(const Any& catalog, const ::rtl:
if ( catalog.hasValue() )
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,
@@ -1146,10 +1153,11 @@ void ODatabaseMetaDataResultSet::openSpecialColumns(sal_Bool _bRowVer,const Any&
if ( catalog.hasValue() )
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,
@@ -1329,3 +1337,4 @@ SWORD ODatabaseMetaDataResultSet::impl_getColumnType_nothrow(sal_Int32 columnInd
return aFind->second;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbcbase/ODriver.cxx b/connectivity/source/drivers/odbcbase/ODriver.cxx
index 015e63d960af..0e8a49065f95 100644
--- a/connectivity/source/drivers/odbcbase/ODriver.cxx
+++ b/connectivity/source/drivers/odbcbase/ODriver.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -68,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.
}
@@ -78,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;
}
@@ -129,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)
@@ -227,3 +228,4 @@ sal_Int32 SAL_CALL ODBCDriver::getMinorVersion( ) throw(RuntimeException)
//-----------------------------------------------------------------------------
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx b/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx
index 758b2fb38def..3b45903ee1b2 100644
--- a/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx
+++ b/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -31,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>
@@ -595,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)
@@ -971,3 +974,5 @@ OResultSet* OPreparedStatement::createResulSet()
return pReturn;
}
// -----------------------------------------------------------------------------
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbcbase/OResultSet.cxx b/connectivity/source/drivers/odbcbase/OResultSet.cxx
index 24c7b4a3a892..e588085e2c38 100644
--- a/connectivity/source/drivers/odbcbase/OResultSet.cxx
+++ b/connectivity/source/drivers/odbcbase/OResultSet.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -47,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;
@@ -66,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;
}
// -------------------------------------------------------------------------
@@ -119,7 +122,7 @@ OResultSet::OResultSet(SQLHANDLE _pStatementHandle ,OStatement_Base* pStmt) :
m_pRowStatusArray = new SQLUSMALLINT[1]; // the default value
N3SQLSetStmtAttr(m_aStatementHandle,SQL_ATTR_ROW_STATUS_PTR,m_pRowStatusArray,SQL_IS_POINTER);
}
- catch(Exception&)
+ catch(const Exception&)
{ // we don't want our result destroy here
}
SQLINTEGER nCurType = 0;
@@ -131,7 +134,7 @@ OResultSet::OResultSet(SQLHANDLE _pStatementHandle ,OStatement_Base* pStmt) :
(nValueLen & SQL_CA2_CRC_EXACT) != SQL_CA2_CRC_EXACT)
m_pSkipDeletedSet = new OSkipDeletedSet(this);
}
- catch(Exception&)
+ catch(const Exception&)
{ // we don't want our result destroy here
}
try
@@ -140,7 +143,7 @@ OResultSet::OResultSet(SQLHANDLE _pStatementHandle ,OStatement_Base* pStmt) :
OTools::GetInfo(m_pStatement->getOwnConnection(),m_aConnectionHandle,SQL_GETDATA_EXTENSIONS,nValueLen,NULL);
m_bFetchData = !((SQL_GD_ANY_ORDER & nValueLen) == SQL_GD_ANY_ORDER && nCurType != SQL_CURSOR_FORWARD_ONLY);
}
- catch(Exception&)
+ catch(const Exception&)
{ // we don't want our result destroy here
m_bFetchData = sal_True;
}
@@ -152,7 +155,7 @@ OResultSet::OResultSet(SQLHANDLE _pStatementHandle ,OStatement_Base* pStmt) :
m_bUseFetchScroll = ( N3SQLGetFunctions(m_aConnectionHandle,SQL_API_SQLFETCHSCROLL,&nSupported) == SQL_SUCCESS && nSupported == 1 );
}
}
- catch(Exception&)
+ catch(const Exception&)
{
m_bUseFetchScroll = sal_False;
}
@@ -317,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;
@@ -543,7 +546,7 @@ sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 columnIndex ) throw(SQLExcepti
const ORowSetValue& aValue = getValue(columnIndex,SQL_C_SBIGINT,&nRet,sizeof nRet);
return (&aValue == &m_aEmptyValue) ? nRet : (sal_Int64)aValue;
}
- catch(SQLException&)
+ catch(const SQLException&)
{
nRet = getString(columnIndex).toInt64();
}
@@ -870,7 +873,7 @@ void SAL_CALL OResultSet::insertRow( ) throw(SQLException, RuntimeException)
{
OTools::ThrowException(m_pStatement->getOwnConnection(),nRet,m_aStatementHandle,SQL_HANDLE_STMT,*this);
}
- catch(SQLException e)
+ catch(const SQLException&)
{
nRet = unbind();
throw;
@@ -1149,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() )
{
@@ -1257,7 +1260,7 @@ Sequence< sal_Int32 > SAL_CALL OResultSet::deleteRows( const Sequence< Any >&
*pRet = 1;
}
}
- catch(SQLException&)
+ catch(const SQLException&)
{
*pRet = 0;
}
@@ -1348,7 +1351,7 @@ sal_Bool OResultSet::isBookmarkable() const
break;
}
}
- catch(Exception&)
+ catch(const Exception&)
{
return sal_False;
}
@@ -1368,7 +1371,7 @@ void OResultSet::setFetchDirection(sal_Int32 _par0)
OSL_ENSURE(_par0>0,"Illegal fetch direction!");
if ( _par0 > 0 )
{
- 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);
}
}
//------------------------------------------------------------------------------
@@ -1377,7 +1380,7 @@ void OResultSet::setFetchSize(sal_Int32 _par0)
OSL_ENSURE(_par0>0,"Illegal fetch size!");
if ( _par0 > 0 )
{
- 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];
@@ -1611,7 +1614,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;
}
@@ -1746,7 +1749,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);
}
@@ -1762,3 +1765,4 @@ SWORD OResultSet::impl_getColumnType_nothrow(sal_Int32 columnIndex)
return aFind->second;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx b/connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx
index 7a47a36545a2..1eb6796c5b08 100644
--- a/connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx
+++ b/connectivity/source/drivers/odbcbase/OResultSetMetaData.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -314,3 +315,4 @@ sal_Bool SAL_CALL OResultSetMetaData::isWritable( sal_Int32 column ) throw(SQLEx
}
// -------------------------------------------------------------------------
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbcbase/OStatement.cxx b/connectivity/source/drivers/odbcbase/OStatement.cxx
index 1ffe2b0ffbca..f31cb2646efa 100644
--- a/connectivity/source/drivers/odbcbase/OStatement.cxx
+++ b/connectivity/source/drivers/odbcbase/OStatement.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -61,9 +62,9 @@ using namespace ::comphelper;
{ \
THROW_SQL(nRetCode); \
} \
- catch(SQLException&) \
+ catch(const SQLException&) \
{ \
- OSL_ENSURE(0,"Exception in odbc catched"); \
+ OSL_FAIL("Exception in odbc caught"); \
}
#endif
@@ -268,7 +269,7 @@ SQLLEN OStatement_Base::getRowCount () throw( SQLException)
try {
THROW_SQL(N3SQLRowCount(m_aStatementHandle,&numRows));
}
- catch (SQLException&)
+ catch (const SQLException&)
{
}
return numRows;
@@ -291,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.
@@ -302,9 +303,9 @@ 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)
+ catch (const SQLWarning& warn)
{
// Catch any warnings and place on the warning stack
setWarning (warn);
@@ -345,7 +346,7 @@ sal_Int32 OStatement_Base::getColumnCount () throw( SQLException)
try {
THROW_SQL(N3SQLNumResultCols(m_aStatementHandle,&numCols));
}
- catch (SQLException&)
+ catch (const SQLException&)
{
}
return numCols;
@@ -379,7 +380,7 @@ sal_Bool SAL_CALL OStatement_Base::execute( const ::rtl::OUString& sql ) throw(S
try {
THROW_SQL(N3SQLExecDirect(m_aStatementHandle, (SDB_ODBC_CHAR*)aSql.getStr(),aSql.getLength()));
}
- catch (SQLWarning& ex) {
+ catch (const SQLWarning& ex) {
// Save pointer to warning and save with ResultSet
// object once it is created.
@@ -616,7 +617,7 @@ sal_Bool SAL_CALL OStatement_Base::getMoreResults( ) throw(SQLException, Runtim
try {
hasResultSet = N3SQLMoreResults(m_aStatementHandle) == SQL_SUCCESS;
}
- catch (SQLWarning &ex) {
+ catch (const SQLWarning &ex) {
// Save pointer to warning and save with ResultSet
// object once it is created.
@@ -699,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:
@@ -763,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 );
}
//------------------------------------------------------------------------------
@@ -783,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);
}
//------------------------------------------------------------------------------
@@ -829,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;
}
@@ -857,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)
{
@@ -878,19 +880,19 @@ void OStatement_Base::setFetchSize(sal_Int32 _par0)
OSL_ENSURE(_par0>0,"Illegal fetch size!");
if ( _par0 > 0 )
{
-
- 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)
@@ -921,7 +923,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 );
}
@@ -1049,7 +1051,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;
}
}
@@ -1094,7 +1096,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;
}
}
@@ -1149,10 +1151,12 @@ SQLUINTEGER OStatement_Base::getCursorProperties(SQLINTEGER _nCursorType,sal_Boo
OTools::GetInfo(getOwnConnection(),getConnectionHandle(),nAskFor,nValueLen,NULL);
}
- catch(Exception&)
+ catch(const Exception&)
{ // we don't want our result destroy here
nValueLen = 0;
}
return nValueLen;
}
// -----------------------------------------------------------------------------
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbcbase/OTools.cxx b/connectivity/source/drivers/odbcbase/OTools.cxx
index d598de8bc12d..4416c0461bc0 100644
--- a/connectivity/source/drivers/odbcbase/OTools.cxx
+++ b/connectivity/source/drivers/odbcbase/OTools.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -86,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;
@@ -100,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,
@@ -140,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
@@ -166,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
@@ -293,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:
@@ -318,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:
@@ -360,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);
@@ -375,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);
@@ -432,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];
@@ -447,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,
@@ -461,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),
@@ -480,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;
@@ -502,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,
@@ -552,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,
@@ -565,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);
@@ -574,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,
@@ -610,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,
@@ -632,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,
@@ -655,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();
}
}
@@ -944,3 +905,4 @@ void OTools::getBindTypes(sal_Bool _bUseWChar,
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/odbcbase/makefile.mk b/connectivity/source/drivers/odbcbase/makefile.mk
index 798517c8f948..85e96ea857d6 100644..100755
--- a/connectivity/source/drivers/odbcbase/makefile.mk
+++ b/connectivity/source/drivers/odbcbase/makefile.mk
@@ -66,8 +66,8 @@ SHL1STDLIBS=\
$(COMPHELPERLIB) \
$(CPPUHELPERLIB) \
$(CPPULIB) \
- $(VOSLIB) \
- $(SALLIB)
+ $(SALLIB) \
+ $(SALHELPERLIB)
SHL1DEPN=
SHL1IMPLIB= i$(ODBC2_TARGET)