summaryrefslogtreecommitdiff
path: root/connectivity/source/drivers/odbc
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity/source/drivers/odbc')
-rw-r--r--connectivity/source/drivers/odbc/OConnection.cxx95
-rw-r--r--connectivity/source/drivers/odbc/ODriver.cxx39
-rw-r--r--connectivity/source/drivers/odbc/OFunctions.cxx12
-rw-r--r--connectivity/source/drivers/odbc/OPreparedStatement.cxx295
-rw-r--r--connectivity/source/drivers/odbc/OTools.cxx421
-rw-r--r--connectivity/source/drivers/odbc/makefile.mk68
6 files changed, 690 insertions, 240 deletions
diff --git a/connectivity/source/drivers/odbc/OConnection.cxx b/connectivity/source/drivers/odbc/OConnection.cxx
index 0c72a32fd8be..e1d04f09e942 100644
--- a/connectivity/source/drivers/odbc/OConnection.cxx
+++ b/connectivity/source/drivers/odbc/OConnection.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: OConnection.cxx,v $
*
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
- * last change: $Author: oj $ $Date: 2001-05-04 09:58:44 $
+ * last change: $Author: oj $ $Date: 2001-05-14 11:37:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -102,7 +102,8 @@
#endif
using namespace connectivity::odbc;
-using namespace connectivity::dbtools;
+using namespace connectivity;
+using namespace dbtools;
//------------------------------------------------------------------------------
using namespace com::sun::star::uno;
@@ -219,37 +220,45 @@ SQLRETURN OConnection::Construct(const ::rtl::OUString& url,const Sequence< Prop
::rtl::OUString aDSN(RTL_CONSTASCII_USTRINGPARAM("DSN=")), aUID, aPWD, aSysDrvSettings;
aDSN += url.copy(nLen+1);
+ const char* pUser = "user";
+ const char* pTimeout = "Timeout";
+ const char* pSilent = "Silent";
+ const char* pPwd = "password";
+ const char* pUseCatalog = "UseCatalog";
+ const char* pSysDrv = "SystemDriverSettings";
+ const char* pCharSet = "CharSet";
+
sal_Int32 nTimeout = 20;
sal_Bool bSilent = sal_True;
const PropertyValue *pBegin = info.getConstArray();
const PropertyValue *pEnd = pBegin + info.getLength();
for(;pBegin != pEnd;++pBegin)
{
- if(!pBegin->Name.compareToAscii("Timeout"))
+ if(!pBegin->Name.compareToAscii(pTimeout))
pBegin->Value >>= nTimeout;
- else if(!pBegin->Name.compareToAscii("Silent"))
+ else if(!pBegin->Name.compareToAscii(pSilent))
pBegin->Value >>= bSilent;
- else if(!pBegin->Name.compareToAscii("user"))
+ else if(!pBegin->Name.compareToAscii(pUser))
{
pBegin->Value >>= aUID;
aDSN = aDSN + ::rtl::OUString::createFromAscii(";UID=") + aUID;
}
- else if(!pBegin->Name.compareToAscii("password"))
+ else if(!pBegin->Name.compareToAscii(pPwd))
{
pBegin->Value >>= aPWD;
aDSN = aDSN + ::rtl::OUString::createFromAscii(";PWD=") + aPWD;
}
- else if(!pBegin->Name.compareToAscii("UseCatalog"))
+ else if(!pBegin->Name.compareToAscii(pUseCatalog))
{
m_bUseCatalog = ::cppu::any2bool(pBegin->Value);
}
- else if(!pBegin->Name.compareToAscii("SystemDriverSettings"))
+ else if(!pBegin->Name.compareToAscii(pSysDrv))
{
pBegin->Value >>= aSysDrvSettings;
aDSN += ::rtl::OUString::createFromAscii(";");
aDSN += aSysDrvSettings;
}
- else if(0 == pBegin->Name.compareToAscii("CharSet"))
+ else if(0 == pBegin->Name.compareToAscii(pCharSet))
{
::rtl::OUString sIanaName;
pBegin->Value >>= sIanaName;
@@ -286,8 +295,8 @@ IMPLEMENT_SERVICE_INFO(OConnection, "com.sun.star.sdbc.drivers.odbc.OConnection"
Reference< XStatement > SAL_CALL OConnection::createStatement( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OConnection_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
Reference< XStatement > xReturn = new OStatement(this);
m_aStatements.push_back(WeakReferenceHelper(xReturn));
return xReturn;
@@ -296,8 +305,8 @@ Reference< XStatement > SAL_CALL OConnection::createStatement( ) throw(SQLExcep
Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OConnection_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
if(m_aTypeInfo.empty())
buildTypeInfo();
@@ -309,8 +318,8 @@ Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const ::
Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OConnection_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
return NULL;
}
// --------------------------------------------------------------------------------
@@ -328,8 +337,8 @@ Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall( const ::rtl::
void SAL_CALL OConnection::setAutoCommit( sal_Bool autoCommit ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OConnection_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
OTools::ThrowException(N3SQLSetConnectAttr(m_aConnectionHandle,
SQL_ATTR_AUTOCOMMIT,
@@ -340,8 +349,8 @@ void SAL_CALL OConnection::setAutoCommit( sal_Bool autoCommit ) throw(SQLExcepti
sal_Bool SAL_CALL OConnection::getAutoCommit( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OConnection_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
sal_uInt32 nOption = 0;
OTools::ThrowException(N3SQLGetConnectAttr(m_aConnectionHandle,
@@ -352,8 +361,8 @@ sal_Bool SAL_CALL OConnection::getAutoCommit( ) throw(SQLException, RuntimeExce
void SAL_CALL OConnection::commit( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OConnection_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
OTools::ThrowException(N3SQLEndTran(SQL_HANDLE_DBC,m_aConnectionHandle,SQL_COMMIT),m_aConnectionHandle,SQL_HANDLE_DBC,*this);
}
@@ -361,8 +370,8 @@ void SAL_CALL OConnection::commit( ) throw(SQLException, RuntimeException)
void SAL_CALL OConnection::rollback( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OConnection_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
OTools::ThrowException(N3SQLEndTran(SQL_HANDLE_DBC,m_aConnectionHandle,SQL_ROLLBACK),m_aConnectionHandle,SQL_HANDLE_DBC,*this);
}
@@ -377,8 +386,8 @@ sal_Bool SAL_CALL OConnection::isClosed( ) throw(SQLException, RuntimeException
Reference< XDatabaseMetaData > SAL_CALL OConnection::getMetaData( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OConnection_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
Reference< XDatabaseMetaData > xMetaData = m_xMetaData;
if(!xMetaData.is())
@@ -393,8 +402,8 @@ Reference< XDatabaseMetaData > SAL_CALL OConnection::getMetaData( ) throw(SQLEx
void SAL_CALL OConnection::setReadOnly( sal_Bool readOnly ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OConnection_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
OTools::ThrowException(
N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_ACCESS_MODE,(SQLPOINTER)readOnly,SQL_IS_INTEGER),
@@ -404,19 +413,19 @@ void SAL_CALL OConnection::setReadOnly( sal_Bool readOnly ) throw(SQLException,
sal_Bool SAL_CALL OConnection::isReadOnly( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OConnection_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
::rtl::OUString aValue;
OTools::GetInfo(m_aConnectionHandle,SQL_DATA_SOURCE_READ_ONLY,aValue,*this,getTextEncoding());
- return aValue == ::rtl::OUString::createFromAscii("Y");
+ return !aValue.compareToAscii("Y");
}
// --------------------------------------------------------------------------------
void SAL_CALL OConnection::setCatalog( const ::rtl::OUString& catalog ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OConnection_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
::rtl::OString aCat(::rtl::OUStringToOString(catalog.getStr(),getTextEncoding()));
OTools::ThrowException(
@@ -427,8 +436,8 @@ void SAL_CALL OConnection::setCatalog( const ::rtl::OUString& catalog ) throw(SQ
::rtl::OUString SAL_CALL OConnection::getCatalog( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OConnection_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
sal_Int32 nValueLen;
char pCat[1024];
@@ -442,8 +451,8 @@ void SAL_CALL OConnection::setCatalog( const ::rtl::OUString& catalog ) throw(SQ
void SAL_CALL OConnection::setTransactionIsolation( sal_Int32 level ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OConnection_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
OTools::ThrowException(N3SQLSetConnectAttr(m_aConnectionHandle,
SQL_ATTR_TXN_ISOLATION,
@@ -454,8 +463,8 @@ void SAL_CALL OConnection::setTransactionIsolation( sal_Int32 level ) throw(SQLE
sal_Int32 SAL_CALL OConnection::getTransactionIsolation( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OConnection_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
sal_Int32 nTxn = 0;
SQLINTEGER nValueLen;
@@ -468,8 +477,8 @@ sal_Int32 SAL_CALL OConnection::getTransactionIsolation( ) throw(SQLException,
Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OConnection::getTypeMap( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OConnection_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
return NULL;
}
@@ -483,8 +492,8 @@ void SAL_CALL OConnection::close( ) throw(SQLException, RuntimeException)
{
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OConnection_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OConnection_BASE::rBHelper.bDisposed);
+
}
dispose();
}
diff --git a/connectivity/source/drivers/odbc/ODriver.cxx b/connectivity/source/drivers/odbc/ODriver.cxx
index 11a7d1774b0f..1e44a3043cec 100644
--- a/connectivity/source/drivers/odbc/ODriver.cxx
+++ b/connectivity/source/drivers/odbc/ODriver.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ODriver.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: oj $ $Date: 2000-09-21 09:54:26 $
+ * last change: $Author: oj $ $Date: 2001-05-14 11:34:11 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -75,7 +75,9 @@ using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
// --------------------------------------------------------------------------------
-ODBCDriver::ODBCDriver() : ODriver_BASE(m_aMutex),m_pDriverHandle(SQL_NULL_HANDLE)
+ODBCDriver::ODBCDriver()
+ : ODriver_BASE(m_aMutex)
+ ,m_pDriverHandle(SQL_NULL_HANDLE)
{
}
// --------------------------------------------------------------------------------
@@ -101,10 +103,12 @@ rtl::OUString ODBCDriver::getImplementationName_Static( ) throw(RuntimeExceptio
{
return rtl::OUString::createFromAscii("com.sun.star.sdbc.ODBCDriver");
}
+
+typedef Sequence< ::rtl::OUString > SS;
//------------------------------------------------------------------------------
-Sequence< ::rtl::OUString > ODBCDriver::getSupportedServiceNames_Static( ) throw (RuntimeException)
+SS ODBCDriver::getSupportedServiceNames_Static( ) throw (RuntimeException)
{
- Sequence< ::rtl::OUString > aSNS( 1 );
+ SS aSNS( 1 );
aSNS[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.Driver");
return aSNS;
}
@@ -118,17 +122,17 @@ Sequence< ::rtl::OUString > ODBCDriver::getSupportedServiceNames_Static( ) thro
//------------------------------------------------------------------
sal_Bool SAL_CALL ODBCDriver::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException)
{
- Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
+ SS aSupported(getSupportedServiceNames());
const ::rtl::OUString* pSupported = aSupported.getConstArray();
- for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported)
- if (pSupported->equals(_rServiceName))
- return sal_True;
+ const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
+ for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
+ ;
- return sal_False;
+ return pSupported != pEnd;
}
//------------------------------------------------------------------
-Sequence< ::rtl::OUString > SAL_CALL ODBCDriver::getSupportedServiceNames( ) throw(RuntimeException)
+SS SAL_CALL ODBCDriver::getSupportedServiceNames( ) throw(RuntimeException)
{
return getSupportedServiceNames_Static();
}
@@ -149,7 +153,7 @@ Reference< XConnection > SAL_CALL ODBCDriver::connect( const ::rtl::OUString& ur
}
OConnection* pCon = new OConnection(m_pDriverHandle,this);
pCon->Construct(url,info);
- Reference< XConnection > xCon = pCon;
+ Reference< XConnection > xCon = NULL;
m_xConnections.push_back(WeakReferenceHelper(*pCon));
return xCon;
@@ -158,11 +162,7 @@ Reference< XConnection > SAL_CALL ODBCDriver::connect( const ::rtl::OUString& ur
sal_Bool SAL_CALL ODBCDriver::acceptsURL( const ::rtl::OUString& url )
throw(SQLException, RuntimeException)
{
- if(!url.compareTo(::rtl::OUString::createFromAscii("sdbc:odbc:"),10))
- {
- return sal_True;
- }
- return sal_False;
+ return (!url.compareTo(::rtl::OUString::createFromAscii("sdbc:odbc:"),10));
}
// --------------------------------------------------------------------------------
Sequence< DriverPropertyInfo > SAL_CALL ODBCDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException)
@@ -191,10 +191,7 @@ SQLHANDLE ODBCDriver::EnvironmentHandle(::rtl::OUString &_rPath)
// Environment allozieren
// ODBC-DLL jetzt laden:
- if (!LoadLibrary_ODBC3(_rPath))
- return SQL_NULL_HANDLE;
-
- if (N3SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&h) != SQL_SUCCESS)
+ if (!LoadLibrary_ODBC3(_rPath) || N3SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&h) != SQL_SUCCESS)
return SQL_NULL_HANDLE;
// In globaler Struktur merken ...
diff --git a/connectivity/source/drivers/odbc/OFunctions.cxx b/connectivity/source/drivers/odbc/OFunctions.cxx
index ebc197ba08ff..38cde70951bf 100644
--- a/connectivity/source/drivers/odbc/OFunctions.cxx
+++ b/connectivity/source/drivers/odbc/OFunctions.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: OFunctions.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: oj $ $Date: 2000-09-21 09:54:26 $
+ * last change: $Author: oj $ $Date: 2001-05-14 11:34:11 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -63,6 +63,9 @@
#ifndef _CONNECTIVITY_ODBC_OFUNCTIONS_HXX_
#include "odbc/OFunctions.hxx"
#endif
+#ifndef _OSL_PROCESS_H_
+#include <osl/process.h>
+#endif
// Implib-Definitionen fuer ODBC-DLL/shared library:
@@ -77,8 +80,9 @@ sal_Bool connectivity::LoadLibrary_ADABAS(::rtl::OUString &_rPath)
if (bLoaded)
return sal_True;
- char *pPath =getenv("DBROOT");
- if(pPath)
+ rtl_uString* pPath = NULL;
+ ::rtl::OUString sTemp = ::rtl::OUString::createFromAscii("DBROOT");
+ if(osl_getEnvironment(sTemp.pData,&pPath) == osl_Process_E_None && pPath)
{
#if ( defined(SOLARIS) && defined(SPARC)) || defined(LINUX)
diff --git a/connectivity/source/drivers/odbc/OPreparedStatement.cxx b/connectivity/source/drivers/odbc/OPreparedStatement.cxx
index db6ee38d29b0..7b93ec76faa7 100644
--- a/connectivity/source/drivers/odbc/OPreparedStatement.cxx
+++ b/connectivity/source/drivers/odbc/OPreparedStatement.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: OPreparedStatement.cxx,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: oj $ $Date: 2001-05-02 12:54:55 $
+ * last change: $Author: oj $ $Date: 2001-05-14 11:34:11 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -79,10 +79,6 @@
#ifndef _CONNECTIVITY_ODBC_ORESULTSETMETADATA_HXX_
#include "odbc/OResultSetMetaData.hxx"
#endif
-#define CONNECTIVITY_PROPERTY_NAME_SPACE odbc
-#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_
-#include "propertyids.hxx"
-#endif
#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
#include <cppuhelper/typeprovider.hxx>
#endif
@@ -92,6 +88,9 @@
#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
#include <com/sun/star/lang/DisposedException.hpp>
#endif
+#ifndef _DBHELPER_DBEXCEPTION_HXX_
+#include "connectivity/dbexception.hxx"
+#endif
using namespace connectivity;
using namespace connectivity::odbc;
@@ -147,8 +146,8 @@ Any SAL_CALL OPreparedStatement::queryInterface( const Type & rType ) throw(Runt
Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
if(!isPrepared())
prepareStatement();
@@ -162,8 +161,8 @@ Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( ) thr
void SAL_CALL OPreparedStatement::close( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
// Close/clear our result set
clearMyResultSet ();
@@ -187,11 +186,9 @@ void SAL_CALL OPreparedStatement::close( ) throw(SQLException, RuntimeException
sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
- sal_Bool hasResultSet = sal_False;
- SQLWarning warning;
sal_Bool needData = sal_False;
// Reset warnings
@@ -242,11 +239,6 @@ sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeExc
}
catch (SQLWarning& ex)
{
-
- // Save pointer to warning and save with ResultSet
- // object once it is created.
-
- warning = ex;
}
// Now loop while more data is needed (i.e. a data-at-
@@ -278,19 +270,16 @@ sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeExc
// the SQL statement that was executed. Get the column
// count, and if it is not zero, there is a result set.
- if (getColumnCount () > 0)
- hasResultSet = sal_True;
-
- return hasResultSet;
+ return getColumnCount() > 0;
}
// -------------------------------------------------------------------------
sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
sal_Int32 numRows = -1;
if(!isPrepared())
@@ -316,8 +305,8 @@ sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, Run
void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
if(!isPrepared())
prepareStatement();
@@ -329,8 +318,8 @@ void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const ::r
Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
return (Reference< XConnection >)m_pConnection;
}
// -------------------------------------------------------------------------
@@ -338,8 +327,8 @@ Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQ
Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
Reference< XResultSet > rs = NULL;
if(!isPrepared())
@@ -363,8 +352,8 @@ Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLE
void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
sal_Int32 value = 0;
@@ -378,7 +367,7 @@ void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool
}
// -------------------------------------------------------------------------
#define PREP_BIND_PARAM(_ty,_jt) \
- bindParameter( m_aStatementHandle, \
+ OTools::bindParameter( m_aStatementHandle, \
parameterIndex, \
bindBuf,getLengthBuf(parameterIndex), \
_jt, \
@@ -389,8 +378,8 @@ void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool
void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
if(!isPrepared())
prepareStatement();
@@ -398,7 +387,7 @@ void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x
// a 'permanent' buffer that the bridge will fill in with
// the bound data in native format.
if( !parameterIndex || parameterIndex > numParams)
- throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any());
+ ::dbtools::throwInvalidIndexException(*this);
OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
sal_Int8* bindBuf = allocBindBuf(parameterIndex, 4);
@@ -409,8 +398,8 @@ void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x
void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const Date& aData ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
if(!isPrepared())
prepareStatement();
@@ -419,7 +408,7 @@ void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const Date&
// the bound data in native format.
if( !parameterIndex || parameterIndex > numParams)
- throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any());
+ ::dbtools::throwInvalidIndexException(*this);
sal_Int8* bindBuf = allocBindBuf (parameterIndex, 32);
@@ -433,8 +422,8 @@ void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const Date&
void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const Time& aVal ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
if(!isPrepared())
prepareStatement();
@@ -442,7 +431,7 @@ void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const Time&
// a 'permanent' buffer that the bridge will fill in with
// the bound data in native format.
if( !parameterIndex || parameterIndex > numParams)
- throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any());
+ ::dbtools::throwInvalidIndexException(*this);
sal_Int8* bindBuf = allocBindBuf (parameterIndex, 32);
@@ -455,8 +444,8 @@ void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const Time&
void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const DateTime& aVal ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
if(!isPrepared())
prepareStatement();
@@ -464,7 +453,7 @@ void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const
// a 'permanent' buffer that the bridge will fill in with
// the bound data in native format.
if( !parameterIndex || parameterIndex > numParams)
- throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any());
+ ::dbtools::throwInvalidIndexException(*this);
sal_Int8* bindBuf = allocBindBuf (parameterIndex, 32);
@@ -477,8 +466,8 @@ void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const
void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
if(!isPrepared())
prepareStatement();
@@ -486,7 +475,7 @@ void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x
// a 'permanent' buffer that the bridge will fill in with
// the bound data in native format.
if( !parameterIndex || parameterIndex > numParams)
- throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any());
+ ::dbtools::throwInvalidIndexException(*this);
OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
sal_Int8* bindBuf = allocBindBuf (parameterIndex, 8);
@@ -498,8 +487,8 @@ void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x
void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
if(!isPrepared())
prepareStatement();
@@ -507,7 +496,7 @@ void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x )
// a 'permanent' buffer that the bridge will fill in with
// the bound data in native format.
if( !parameterIndex || parameterIndex > numParams)
- throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any());
+ ::dbtools::throwInvalidIndexException(*this);
OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
sal_Int8* bindBuf = allocBindBuf (parameterIndex, 8);
@@ -518,8 +507,8 @@ void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x )
void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
if(!isPrepared())
prepareStatement();
@@ -527,7 +516,7 @@ void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x
// a 'permanent' buffer that the bridge will fill in with
// the bound data in native format.
if( !parameterIndex || parameterIndex > numParams)
- throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any());
+ ::dbtools::throwInvalidIndexException(*this);
OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
sal_Int8* bindBuf = allocBindBuf (parameterIndex, 4);
@@ -538,8 +527,8 @@ void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x
void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 aVal ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
if(!isPrepared())
prepareStatement();
@@ -548,7 +537,7 @@ void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 a
// the bound data in native format.
if( !parameterIndex || parameterIndex > numParams)
- throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any());
+ ::dbtools::throwInvalidIndexException(*this);
OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
sal_Int8 *bindBuf = allocBindBuf (parameterIndex, 8);
@@ -560,14 +549,14 @@ void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 a
void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
if(!isPrepared())
prepareStatement();
// Get the buffer needed for the length
if( !parameterIndex || parameterIndex > numParams)
- throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any());
+ ::dbtools::throwInvalidIndexException(*this);
sal_Int8* lenBuf = getLengthBuf (parameterIndex);
*(SDWORD*)lenBuf = SQL_NULL_DATA;
@@ -601,8 +590,8 @@ void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 s
void SAL_CALL OPreparedStatement::setClob( sal_Int32 parameterIndex, const Reference< XClob >& x ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
if(!isPrepared())
prepareStatement();
}
@@ -611,8 +600,8 @@ void SAL_CALL OPreparedStatement::setClob( sal_Int32 parameterIndex, const Refer
void SAL_CALL OPreparedStatement::setBlob( sal_Int32 parameterIndex, const Reference< XBlob >& x ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
if(!isPrepared())
prepareStatement();
}
@@ -621,8 +610,8 @@ void SAL_CALL OPreparedStatement::setBlob( sal_Int32 parameterIndex, const Refer
void SAL_CALL OPreparedStatement::setArray( sal_Int32 parameterIndex, const Reference< XArray >& x ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
if(!isPrepared())
prepareStatement();
}
@@ -631,8 +620,8 @@ void SAL_CALL OPreparedStatement::setArray( sal_Int32 parameterIndex, const Refe
void SAL_CALL OPreparedStatement::setRef( sal_Int32 parameterIndex, const Reference< XRef >& x ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
if(!isPrepared())
prepareStatement();
}
@@ -640,9 +629,8 @@ void SAL_CALL OPreparedStatement::setRef( sal_Int32 parameterIndex, const Refere
void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x, sal_Int32 sqlType, sal_Int32 scale ) throw(SQLException, RuntimeException)
{
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
if(!isPrepared())
prepareStatement();
@@ -656,13 +644,9 @@ void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, c
break;
case DataType::VARCHAR:
- setChar (parameterIndex, sqlType, 0, *(::rtl::OUString*) x.getValue());
- break;
-
case DataType::LONGVARCHAR:
setChar (parameterIndex, sqlType, 0, *(::rtl::OUString*) x.getValue());
break;
-
case DataType::BIT:
setBoolean (parameterIndex,*(sal_Bool*) x.getValue());
break;
@@ -684,13 +668,9 @@ void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, c
break;
case DataType::REAL:
- setFloat (parameterIndex, *(float*)x.getValue ());
- break;
-
case DataType::FLOAT:
setFloat (parameterIndex, *(float*)x.getValue ());
break;
-
case DataType::DOUBLE:
setDouble (parameterIndex,*(double*)x.getValue ());
break;
@@ -743,8 +723,8 @@ void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, c
void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
setNull(parameterIndex,sqlType);
}
// -------------------------------------------------------------------------
@@ -752,8 +732,8 @@ void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_I
void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
if(!isPrepared())
prepareStatement();
@@ -764,8 +744,8 @@ void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any
void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
if(!isPrepared())
prepareStatement();
@@ -773,7 +753,7 @@ void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16
// a 'permanent' buffer that the bridge will fill in with
// the bound data in native format.
if( !parameterIndex || parameterIndex > numParams)
- throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any());
+ ::dbtools::throwInvalidIndexException(*this);
OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
sal_Int8* bindBuf = allocBindBuf (parameterIndex, 4);
@@ -784,8 +764,8 @@ void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16
void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
if(!isPrepared())
prepareStatement();
@@ -804,8 +784,8 @@ void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequ
void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
if(!isPrepared())
prepareStatement();
@@ -816,8 +796,8 @@ void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex,
void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
+
if(!isPrepared())
prepareStatement();
@@ -987,6 +967,13 @@ sal_Int32 OPreparedStatement::getParamLength ( sal_Int32 index)
void OPreparedStatement::putParamData (sal_Int32 index) throw(SQLException)
{
+ // Sanity check the parameter index
+ if ((index < 1) ||
+ (index > numParams))
+ {
+ return;
+ }
+
// We'll transfer up to maxLen at a time
sal_Int32 maxLen = MAX_PUT_DATA_LENGTH;
sal_Int32 bufLen;
@@ -995,13 +982,6 @@ void OPreparedStatement::putParamData (sal_Int32 index) throw(SQLException)
Sequence< sal_Int8 > buf(maxLen);
sal_Bool endOfStream = sal_False;
- // Sanity check the parameter index
- if ((index < 1) ||
- (index > numParams))
- {
- return;
- }
-
// Get the information about the input stream
Reference< XInputStream> inputStream = boundParams[index - 1].getInputStream ();
@@ -1009,80 +989,82 @@ void OPreparedStatement::putParamData (sal_Int32 index) throw(SQLException)
sal_Int32 inputStreamType = boundParams[index - 1].getStreamType ();
// Loop while more data from the input stream
-
- while (!endOfStream)
+ try
{
- // Read some data from the input stream
+ while (!endOfStream)
+ {
- try {
+ // Read some data from the input stream
bufLen = inputStream->readBytes(buf,maxLen);
- }
- catch (IOException& ex) {
- // If an I/O exception was generated, turn
- // it into a SQLException
+ // -1 as the number of bytes read indicates that
+ // there is no more data in the input stream
- throw SQLException(ex.Message,*this,::rtl::OUString(),0,Any());
- }
+ if (bufLen == -1)
+ {
- // -1 as the number of bytes read indicates that
- // there is no more data in the input stream
+ // Sanity check to ensure that all the data we said we
+ // had was read. If not, raise an exception
- if (bufLen == -1)
- {
+ if (inputStreamLen != 0)
+ {
+ throw SQLException (::rtl::OUString::createFromAscii("End of InputStream reached before satisfying length specified when InputStream was set"),
+ *this,
+ ::rtl::OUString(),0,Any());
+ }
+ endOfStream = sal_True;
+ break;
+ }
- // Sanity check to ensure that all the data we said we
- // had was read. If not, raise an exception
+ // If we got more bytes than necessary, truncate
+ // the buffer by re-setting the buffer length. Also,
+ // indicate that we don't need to read any more.
- if (inputStreamLen != 0) {
- throw SQLException (::rtl::OUString::createFromAscii("End of InputStream reached before satisfying length specified when InputStream was set"),
- *this,
- ::rtl::OUString(),0,Any());
+ if (bufLen > inputStreamLen)
+ {
+ bufLen = inputStreamLen;
+ endOfStream = sal_True;
}
- endOfStream = sal_True;
- break;
- }
- // If we got more bytes than necessary, truncate
- // the buffer by re-setting the buffer length. Also,
- // indicate that we don't need to read any more.
+ realLen = bufLen;
- if (bufLen > inputStreamLen)
- {
- bufLen = inputStreamLen;
- endOfStream = sal_True;
- }
+ // For UNICODE streams, strip off the high sal_Int8 and set the
+ // number of actual bytes present. It is assumed that
+ // there are 2 bytes present for every UNICODE character - if
+ // not, then that's not our problem
- realLen = bufLen;
+ if (inputStreamType == OBoundParam::UNICODE)
+ {
+ realLen = bufLen / 2;
- // For UNICODE streams, strip off the high sal_Int8 and set the
- // number of actual bytes present. It is assumed that
- // there are 2 bytes present for every UNICODE character - if
- // not, then that's not our problem
+ for (sal_Int32 ii = 0; ii < realLen; ii++)
+ buf[ii] = buf[(ii * 2) + 1];
+ }
- if (inputStreamType == OBoundParam::UNICODE)
- {
- realLen = bufLen / 2;
+ // Put the data
+ OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
- for (sal_Int32 ii = 0; ii < realLen; ii++)
- buf[ii] = buf[(ii * 2) + 1];
- }
+ N3SQLPutData (m_aStatementHandle, buf.getArray(), realLen);
- // Put the data
- OSL_ENSURE(m_aStatementHandle,"StatementHandle is null!");
+ // Decrement the number of bytes still needed
- N3SQLPutData (m_aStatementHandle, buf.getArray(), realLen);
+ inputStreamLen -= bufLen;
- // Decrement the number of bytes still needed
- inputStreamLen -= bufLen;
+ // If there is no more data to be read, exit loop
+ if (inputStreamLen == 0)
+ endOfStream = sal_True;
+ }
+ }
+ catch (const IOException& ex)
+ {
- // If there is no more data to be read, exit loop
+ // If an I/O exception was generated, turn
+ // it into a SQLException
- if (inputStreamLen == 0)
- endOfStream = sal_True;
+ throw SQLException(ex.Message,*this,::rtl::OUString(),0,Any());
}
}
// -------------------------------------------------------------------------
@@ -1095,14 +1077,13 @@ void OPreparedStatement::putParamData (sal_Int32 index) throw(SQLException)
sal_Int32 OPreparedStatement::getPrecision ( sal_Int32 sqlType)
{
::osl::MutexGuard aGuard( m_aMutex );
- if (OStatement_BASE::rBHelper.bDisposed)
- throw DisposedException();
+ checkDisposed(OStatement_BASE::rBHelper.bDisposed);
sal_Int32 prec = -1;
- OTypeInfo aInfo;
- aInfo.nType = sqlType;
if (m_aTypeInfo.size())
{
+ OTypeInfo aInfo;
+ aInfo.nType = sqlType;
TTypeInfoVector::const_iterator aIter = ::std::find(m_aTypeInfo.begin(),m_aTypeInfo.end(),aInfo);
if(aIter != m_aTypeInfo.end())
prec = (*aIter).nPrecision;
@@ -1124,7 +1105,7 @@ void OPreparedStatement::setStream (
throw(SQLException)
{
if( !ParameterIndex || ParameterIndex > numParams)
- throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any());
+ ::dbtools::throwInvalidIndexException(*this);
// Get the buffer needed for the length
sal_Int8* lenBuf = getLengthBuf(ParameterIndex);
@@ -1172,7 +1153,7 @@ void OPreparedStatement::setChar(sal_Int32 parameterIndex,
// ::rtl::OString x1(::rtl::OUStringToOString(x,getConnection()->getTextEncoding()));
if( !parameterIndex || parameterIndex > numParams)
- throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any());
+ ::dbtools::throwInvalidIndexException(*this);
sal_Int8* bindBuf = allocBindBuf (parameterIndex,x.getLength());
@@ -1214,14 +1195,14 @@ void OPreparedStatement::setBinary (sal_Int32 parameterIndex,sal_Int32 SQLtype,
// a 'permanent' buffer that the bridge will fill in with
// the bound data in native format.
if( !parameterIndex || parameterIndex > numParams)
- throw SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,Any());
+ ::dbtools::throwInvalidIndexException(*this);
sal_Int8* bindBuf = allocBindBuf (parameterIndex,x.getLength());
// Get the buffer needed for the length
// sal_Int8* lenBuf = getLengthBuf (parameterIndex);
- bindParameter< Sequence< sal_Int8 > >( m_aStatementHandle,
+ OTools::bindParameter( m_aStatementHandle,
parameterIndex,
bindBuf,getLengthBuf(parameterIndex),
SQLtype,
diff --git a/connectivity/source/drivers/odbc/OTools.cxx b/connectivity/source/drivers/odbc/OTools.cxx
index 6dd66b8d39b5..d4316eb8af58 100644
--- a/connectivity/source/drivers/odbc/OTools.cxx
+++ b/connectivity/source/drivers/odbc/OTools.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: OTools.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: oj $ $Date: 2001-05-04 09:58:44 $
+ * last change: $Author: oj $ $Date: 2001-05-14 11:34:11 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -82,7 +82,424 @@ using namespace com::sun::star::uno;
using namespace com::sun::star::sdbc;
using namespace com::sun::star::util;
+void OTools::getValue( SQLHANDLE _aStatementHandle,
+ sal_Int32 columnIndex,
+ SQLSMALLINT _nType,
+ sal_Bool &_bWasNull,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface,
+ void* _pValue,SQLINTEGER _rSize) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
+{
+ SQLINTEGER pcbValue;
+ OTools::ThrowException(N3SQLGetData(_aStatementHandle,
+ (SQLUSMALLINT)columnIndex,
+ _nType,
+ _pValue,
+ (SQLINTEGER)_rSize,
+ &pcbValue),
+ _aStatementHandle,SQL_HANDLE_STMT,_xInterface,sal_False);
+ _bWasNull = pcbValue == SQL_NULL_DATA;
+}
+// -----------------------------------------------------------------------------
+void OTools::bindParameter(SQLHANDLE _hStmt,
+ sal_Int32 nPos,
+ sal_Int8* pDataBuffer,
+ sal_Int8* pLenBuffer,
+ SQLSMALLINT _nJDBCtype,
+ sal_Bool _bUseWChar,
+ sal_Bool _bUseOldTimeDate,
+ const void* _pValue,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface,
+ rtl_TextEncoding _nTextEncoding)
+ throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
+{
+ SQLRETURN nRetcode;
+ SWORD fSqlType;
+ SWORD fCType;
+ SDWORD nMaxLen = 0;
+ void* pData = pDataBuffer;
+ SDWORD* pLen = (SDWORD*)pLenBuffer;
+ SQLUINTEGER nColumnSize=0;
+ SQLSMALLINT nDecimalDigits=0;
+ SQLSMALLINT nNullable=0;
+
+ OTools::getBindTypes(_bUseWChar,_bUseOldTimeDate,_nJDBCtype,fSqlType,fCType,nColumnSize,nDecimalDigits);
+
+ OTools::bindData(fSqlType,_bUseWChar,pData,pLen,_pValue,_nTextEncoding);
+ if(fSqlType == SQL_LONGVARCHAR || fSqlType == SQL_LONGVARBINARY)
+ memcpy(pData,&nPos,sizeof(nPos));
+
+ nRetcode = N3SQLDescribeParam(_hStmt,(SQLUSMALLINT)nPos,&fSqlType,&nColumnSize,&nDecimalDigits,&nNullable);
+
+ nRetcode = N3SQLBindParameter(_hStmt,
+ (SQLUSMALLINT)nPos,
+ SQL_PARAM_INPUT,
+ fCType,
+ fSqlType,
+ nColumnSize,
+ nDecimalDigits,
+ pData,
+ nMaxLen,
+ pLen);
+
+ OTools::ThrowException(nRetcode,_hStmt,SQL_HANDLE_STMT,_xInterface);
+}
+// -----------------------------------------------------------------------------
+void OTools::bindData( SWORD fSqlType,
+ sal_Bool _bUseWChar,
+ void *&_pData,
+ SDWORD*& pLen,
+ const void* _pValue,
+ rtl_TextEncoding _nTextEncoding)
+{
+ SDWORD nMaxLen = 0;
+
+ switch (fSqlType)
+ {
+ case SQL_CHAR:
+ case SQL_VARCHAR:
+ if(_bUseWChar)
+ {
+ *pLen = SQL_NTS;
+ *((rtl::OUString*)_pData) = *(::rtl::OUString*)_pValue;
+
+ // Zeiger auf Char*
+ _pData = (void*)((rtl::OUString*)_pData)->getStr();
+ }
+ else
+ {
+ ::rtl::OString aString(::rtl::OUStringToOString(*(::rtl::OUString*)_pValue,_nTextEncoding));
+ *pLen = SQL_NTS;
+ memcpy(_pData,aString.getStr(),aString.getLength());
+ ((sal_Int8*)_pData)[aString.getLength()] = '\0';
+ } break;
+
+ case SQL_BIGINT:
+ case SQL_DECIMAL:
+ case SQL_NUMERIC:
+ if(_bUseWChar)
+ {
+ ::rtl::OUString aString = rtl::OUString::valueOf(*(double*)_pValue);
+ nMaxLen = aString.getLength();
+ *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 = aString.getLength();
+ *pLen = nMaxLen;
+ memcpy(_pData,aString.getStr(),aString.getLength());
+ ((sal_Int8*)_pData)[aString.getLength()] = '\0';
+ } break;
+ case SQL_BIT:
+ *((sal_Int8*)_pData) = *(sal_Int8*)_pValue;
+ *pLen = sizeof(sal_Int8);
+ break;
+ case SQL_TINYINT:
+ case SQL_SMALLINT:
+ *((sal_Int16*)_pData) = *(sal_Int16*)_pValue;
+ *pLen = sizeof(sal_Int16);
+ break;
+ case SQL_INTEGER:
+ *((sal_Int32*)_pData) = *(sal_Int32*)_pValue;
+ *pLen = sizeof(sal_Int32);
+ break;
+ case SQL_REAL:
+ *((float*)_pData) = *(float*)_pValue;
+ *pLen = sizeof(float);
+ break;
+ case SQL_DOUBLE:
+ *((double*)_pData) = *(double*)_pValue;
+ *pLen = sizeof(double);
+ break;
+ case SQL_BINARY:
+ case SQL_VARBINARY:
+ _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:
+ {
+ sal_Int32 nLen = 0;
+ nLen = ((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getLength();
+ *pLen = (SDWORD)SQL_LEN_DATA_AT_EXEC(nLen);
+ }
+ break;
+ case SQL_LONGVARCHAR:
+ {
+ _pData = 0;//(void*)&rCol;
+ sal_Int32 nLen = 0;
+ if(_bUseWChar)
+ nLen = sizeof(sal_Unicode) * ((::rtl::OUString*)_pValue)->getLength();
+ else
+ {
+ ::rtl::OString aString(::rtl::OUStringToOString(*(::rtl::OUString*)_pValue,_nTextEncoding));
+ nLen = aString.getLength();
+ }
+ *pLen = (SDWORD)SQL_LEN_DATA_AT_EXEC(nLen);
+ } break;
+ case SQL_DATE:
+ *(DATE_STRUCT*)_pData = *(DATE_STRUCT*)_pValue;
+ *pLen = (SDWORD)sizeof(DATE_STRUCT);
+ break;
+ case SQL_TIME:
+ *(TIME_STRUCT*)_pData = *(TIME_STRUCT*)_pValue;
+ *pLen = (SDWORD)sizeof(TIME_STRUCT);
+ break;
+ case SQL_TIMESTAMP:
+ *(TIMESTAMP_STRUCT*)_pData = *(TIMESTAMP_STRUCT*)_pValue;
+ *pLen = (SDWORD)sizeof(TIMESTAMP_STRUCT);
+ break;
+ }
+}
// -------------------------------------------------------------------------
+void OTools::bindValue( SQLHANDLE _aStatementHandle,
+ sal_Int32 columnIndex,
+ SQLSMALLINT _nType,
+ SQLSMALLINT _nMaxLen,
+ SQLSMALLINT _nScale,
+ const void* _pValue,
+ void* _pData,
+ SQLINTEGER *pLen,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface,
+ rtl_TextEncoding _nTextEncoding) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
+{
+ SQLRETURN nRetcode;
+ SWORD fSqlType;
+ SWORD fCType;
+
+ switch(_nType)
+ {
+ case SQL_CHAR: //if(GetODBCConnection()->m_bUserWChar)
+ // {
+// fCType = SQL_C_WCHAR;
+// fSqlType = SQL_WCHAR;
+// }
+ // else
+ {
+ fCType = SQL_C_CHAR;
+ fSqlType = SQL_CHAR;
+ }
+ break;
+ case SQL_VARCHAR: //if(GetODBCConnection()->m_bUserWChar)
+// {
+// fCType = SQL_C_WCHAR;
+// fSqlType = SQL_WVARCHAR;
+// }
+// else
+ {
+ fCType = SQL_C_CHAR;
+ fSqlType = SQL_VARCHAR;
+ }
+ break;
+ case SQL_LONGVARCHAR: //if(GetODBCConnection()->m_bUserWChar)
+// {
+// fCType = SQL_C_WCHAR;
+// fSqlType = SQL_WLONGVARCHAR;
+// }
+// else
+ {
+ fCType = SQL_C_CHAR;
+ fSqlType = SQL_LONGVARCHAR;
+ }
+ break;
+ case SQL_DECIMAL: fCType = SQL_C_CHAR;//GetODBCConnection()->m_bUserWChar ? SQL_C_WCHAR : SQL_C_CHAR;
+ fSqlType = SQL_DECIMAL; break;
+ case SQL_NUMERIC: fCType = SQL_C_CHAR;//GetODBCConnection()->m_bUserWChar ? SQL_C_WCHAR : SQL_C_CHAR;
+ fSqlType = SQL_NUMERIC; break;
+ case SQL_BIT: fCType = SQL_C_TINYINT;
+ fSqlType = SQL_INTEGER; break;
+ case SQL_TINYINT: fCType = SQL_C_SHORT;
+ fSqlType = SQL_TINYINT; break;
+ case SQL_SMALLINT: fCType = SQL_C_SHORT;
+ fSqlType = SQL_SMALLINT; break;
+ case SQL_INTEGER: fCType = SQL_C_LONG;
+ fSqlType = SQL_INTEGER; break;
+ case SQL_BIGINT: fCType = SQL_C_CHAR;//GetODBCConnection()->m_bUserWChar ? SQL_C_WCHAR : SQL_C_CHAR;
+ fSqlType = SQL_BIGINT; break;
+ case SQL_REAL: fCType = SQL_C_FLOAT;
+ fSqlType = SQL_REAL; break;
+ case SQL_DOUBLE: fCType = SQL_C_DOUBLE;
+ fSqlType = SQL_DOUBLE; break;
+ case SQL_BINARY: fCType = SQL_C_BINARY;
+ fSqlType = SQL_BINARY; break;
+ case SQL_VARBINARY:
+ fCType = SQL_C_BINARY;
+ fSqlType = SQL_VARBINARY; break;
+ case SQL_LONGVARBINARY: fCType = SQL_C_BINARY;
+ fSqlType = SQL_LONGVARBINARY; break;
+ case SQL_DATE:
+ // if(((SdbODBC3Connection*)GetODBCConnection())->m_bUseOldTimeDate)
+ {
+ fCType = SQL_C_DATE;
+ fSqlType = SQL_DATE;
+ }
+// else
+// {
+// fCType = SQL_C_TYPE_DATE;
+// fSqlType = SQL_TYPE_DATE;
+// }
+ break;
+ case SQL_TIME:
+ // if(((SdbODBC3Connection*)GetODBCConnection())->m_bUseOldTimeDate)
+ {
+ fCType = SQL_C_TIME;
+ fSqlType = SQL_TIME;
+ }
+// else
+// {
+// fCType = SQL_C_TYPE_TIME;
+// fSqlType = SQL_TYPE_TIME;
+// }
+ break;
+ case SQL_TIMESTAMP:
+ // if(((SdbODBC3Connection*)GetODBCConnection())->m_bUseOldTimeDate)
+ {
+ fCType = SQL_C_TIMESTAMP;
+ fSqlType = SQL_TIMESTAMP;
+ }
+// else
+// {
+// fCType = SQL_C_TYPE_TIMESTAMP;
+// fSqlType = SQL_TYPE_TIMESTAMP;
+// }
+ break;
+ default: fCType = SQL_C_BINARY;
+ fSqlType = SQL_LONGVARBINARY; break;
+ }
+
+ if (columnIndex != 0 && !_pValue)
+ {
+ *pLen = SQL_NULL_DATA;
+ nRetcode = N3SQLBindCol(_aStatementHandle,
+ columnIndex,
+ fCType,
+ _pData,
+ _nMaxLen,
+ pLen
+ );
+ }
+ else
+ {
+ try
+ {
+ switch (_nType)
+ {
+ 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 = aString.getLength();
+
+ // Zeiger auf Char*
+ _pData = (void*)aString.getStr();
+ } break;
+ case SQL_BIGINT:
+ 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 = aString.getLength();
+ *pLen = _nMaxLen;
+ *((::rtl::OString*)_pData) = aString;
+ // Zeiger auf Char*
+ _pData = (void*)((::rtl::OString*)_pData)->getStr();
+ } break;
+ case SQL_BIT:
+ *((sal_Int8*)_pData) = *(sal_Int8*)_pValue;
+ *pLen = sizeof(sal_Int8);
+ break;
+ case SQL_TINYINT:
+ case SQL_SMALLINT:
+ *((sal_Int16*)_pData) = *(sal_Int16*)_pValue;
+ *pLen = sizeof(sal_Int16);
+ break;
+ case SQL_INTEGER:
+ *((sal_Int32*)_pData) = *(sal_Int32*)_pValue;
+ *pLen = sizeof(sal_Int32);
+ break;
+ case SQL_REAL:
+ *((float*)_pData) = *(float*)_pValue;
+ *pLen = sizeof(float);
+ break;
+ case SQL_DOUBLE:
+ *((double*)_pData) = *(double*)_pValue;
+ *pLen = sizeof(double);
+ 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:
+ {
+ sal_Int32 nLen = 0;
+ nLen = ((const ::com::sun::star::uno::Sequence< sal_Int8 > *)_pValue)->getLength();
+ *pLen = (SDWORD)SQL_LEN_DATA_AT_EXEC(nLen);
+ }
+ break;
+ case SQL_LONGVARCHAR:
+ {
+ sal_Int32 nLen = 0;
+ nLen = ((::rtl::OUString*)_pValue)->getLength();
+ *pLen = (SDWORD)SQL_LEN_DATA_AT_EXEC(nLen);
+ } break;
+ case SQL_DATE:
+ *pLen = sizeof(DATE_STRUCT);
+ *((DATE_STRUCT*)_pData) = *(DATE_STRUCT*)_pValue;
+ break;
+ case SQL_TIME:
+ *pLen = sizeof(TIME_STRUCT);
+ *((TIME_STRUCT*)_pData) = *(TIME_STRUCT*)_pValue;
+ break;
+ case SQL_TIMESTAMP:
+ *pLen = sizeof(TIMESTAMP_STRUCT);
+ *((TIMESTAMP_STRUCT*)_pData) = *(TIMESTAMP_STRUCT*)_pValue;
+ }
+ }
+ catch ( ... )
+ {
+ }
+// SQLINTEGER *pLen = &aLen;
+// bindData< T >(fSqlType,sal_False,_pData,pLen,_pValue);
+
+
+ nRetcode = N3SQLBindCol(_aStatementHandle,
+ columnIndex,
+ fCType,
+ _pData,
+ _nMaxLen,
+ pLen
+ );
+ }
+
+ OTools::ThrowException(nRetcode,_aStatementHandle,SQL_HANDLE_STMT,_xInterface);
+}
+// -----------------------------------------------------------------------------
void OTools::ThrowException(SQLRETURN _rRetCode,SQLHANDLE _pContext,SQLSMALLINT _nHandleType,const Reference< XInterface >& _xInterface,sal_Bool _bNoFound,rtl_TextEncoding _nTextEncoding) throw(SQLException, RuntimeException)
{
switch(_rRetCode)
diff --git a/connectivity/source/drivers/odbc/makefile.mk b/connectivity/source/drivers/odbc/makefile.mk
index 8b1806f101ea..bebf64345dc1 100644
--- a/connectivity/source/drivers/odbc/makefile.mk
+++ b/connectivity/source/drivers/odbc/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.8 $
+# $Revision: 1.9 $
#
-# last change: $Author: oj $ $Date: 2001-03-19 09:35:29 $
+# last change: $Author: oj $ $Date: 2001-05-14 11:34:11 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -63,9 +63,13 @@
PRJ=..$/..$/..
PRJINC=..$/..
PRJNAME=connectivity
-TARGET=odbc
+TARGET=odbcbase
+TARGET2=odbc
+USE_LDUMP2=TRUE
+USE_DEFFILE=TRUE
ENABLE_EXCEPTIONS=TRUE
+LDUMP=ldump2.exe
# --- Settings ----------------------------------
.IF "$(DBGUTIL_OJ)"!=""
@@ -77,7 +81,6 @@ ENVCFLAGS+=/FR$(SLO)$/
# --- Files -------------------------------------
-
SLOFILES=\
$(SLO)$/OPreparedStatement.obj \
$(SLO)$/OStatement.obj \
@@ -88,12 +91,13 @@ SLOFILES=\
$(SLO)$/ODatabaseMetaData.obj \
$(SLO)$/ODriver.obj \
$(SLO)$/OFunctions.obj \
- $(SLO)$/oservices.obj \
$(SLO)$/OConnection.obj
-# --- Library -----------------------------------
+
+
+# --- ODBC BASE Library -----------------------------------
-SHL1TARGET= $(ODBC_TARGET)$(ODBC_MAJOR)
+SHL1TARGET= $(ODBC2_TARGET)$(ODBC2_MAJOR)
SHL1OBJS=$(SLOFILES)
SHL1STDLIBS=\
$(CPPULIB) \
@@ -104,21 +108,59 @@ SHL1STDLIBS=\
$(DBTOOLSLIB) \
$(COMPHELPERLIB)
-.IF "$(COMPHELPERLIB)" == ""
-SHL1STDLIBS+= icomphelp2.lib
-.ENDIF
-
SHL1DEPN=
-SHL1IMPLIB= i$(ODBC_TARGET)
+SHL1IMPLIB= i$(ODBC2_TARGET)
SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
-DEF1EXPORTFILE= exports.dxp
+DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt \
+ $(SLB)$/$(TARGET).lib
+DEFLIB1NAME=$(TARGET)
+
+# --- ODBC Library -----------------------------------
+# --- Files -------------------------------------
+SLO2FILES=\
+ $(SLO)$/oservices.obj
+
+# --- ODBC Library -----------------------------------
+SHL2TARGET= $(ODBC_TARGET)$(ODBC_MAJOR)
+SHL2OBJS=$(SLO2FILES)
+SHL2STDLIBS=\
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(VOSLIB) \
+ $(OSLLIB) \
+ $(SALLIB) \
+ $(DBTOOLSLIB) \
+ $(ODBCBASELIB) \
+ $(COMPHELPERLIB)
+
+.IF "$(ODBCBASELIB)" == ""
+SHL2STDLIBS+= iodbcbase.lib
+.ENDIF
+
+SHL2DEPN=
+SHL2IMPLIB= i$(ODBC_TARGET)
+
+SHL2DEF= $(MISC)$/$(SHL2TARGET).def
+
+DEF2NAME= $(SHL2TARGET)
+DEF2EXPORTFILE= exports.dxp
# --- Targets ----------------------------------
.INCLUDE : target.mk
+# --- filter file ------------------------------
+
+.IF "$(depend)"==""
+
+$(MISC)$/$(SHL1TARGET).flt: makefile.mk
+ @echo ------------------------------
+ @echo CLEAR_THE_FILE > $@
+ @echo _TI >>$@
+ @echo _real >>$@
+.ENDIF