summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--connectivity/source/drivers/ado/ACallableStatement.cxx16
-rw-r--r--connectivity/source/drivers/ado/ACatalog.cxx6
-rw-r--r--connectivity/source/drivers/ado/AColumn.cxx240
-rw-r--r--connectivity/source/drivers/ado/AColumns.cxx18
-rw-r--r--connectivity/source/drivers/ado/AConnection.cxx13
-rw-r--r--connectivity/source/drivers/ado/ADatabaseMetaData.cxx221
-rw-r--r--connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx270
-rw-r--r--connectivity/source/drivers/ado/ADatabaseMetaDataResultSetMetaData.cxx7
-rw-r--r--connectivity/source/drivers/ado/ADriver.cxx10
-rw-r--r--connectivity/source/drivers/ado/AIndex.cxx73
-rw-r--r--connectivity/source/drivers/ado/AIndexes.cxx15
-rw-r--r--connectivity/source/drivers/ado/AKey.cxx121
-rw-r--r--connectivity/source/drivers/ado/AKeys.cxx23
-rw-r--r--connectivity/source/drivers/ado/APreparedStatement.cxx58
-rw-r--r--connectivity/source/drivers/ado/AResultSet.cxx98
-rw-r--r--connectivity/source/drivers/ado/AResultSetMetaData.cxx6
-rw-r--r--connectivity/source/drivers/ado/AStatement.cxx6
-rw-r--r--connectivity/source/drivers/ado/ATable.cxx134
-rw-r--r--connectivity/source/drivers/ado/ATables.cxx17
-rw-r--r--connectivity/source/drivers/ado/AUsers.cxx7
-rw-r--r--connectivity/source/drivers/ado/AView.cxx14
-rw-r--r--connectivity/source/drivers/ado/AViews.cxx9
-rw-r--r--connectivity/source/drivers/ado/adoimp.cxx78
-rw-r--r--connectivity/source/drivers/ado/makefile.mk6
-rw-r--r--connectivity/source/inc/ado/ACallableStatement.hxx56
-rw-r--r--connectivity/source/inc/ado/ACollection.hxx11
-rw-r--r--connectivity/source/inc/ado/AColumn.hxx29
-rw-r--r--connectivity/source/inc/ado/AColumns.hxx26
-rw-r--r--connectivity/source/inc/ado/AConnection.hxx13
-rw-r--r--connectivity/source/inc/ado/AIndex.hxx19
-rw-r--r--connectivity/source/inc/ado/AIndexes.hxx16
-rw-r--r--connectivity/source/inc/ado/AKey.hxx25
-rw-r--r--connectivity/source/inc/ado/AKeyColumns.hxx16
-rw-r--r--connectivity/source/inc/ado/AKeys.hxx13
-rw-r--r--connectivity/source/inc/ado/APreparedStatement.hxx92
-rw-r--r--connectivity/source/inc/ado/AStatement.hxx6
-rw-r--r--connectivity/source/inc/ado/ATable.hxx20
-rw-r--r--connectivity/source/inc/ado/ATables.hxx17
-rw-r--r--connectivity/source/inc/ado/Aolevariant.hxx540
-rw-r--r--connectivity/source/inc/ado/Aolewrap.hxx16
-rw-r--r--connectivity/source/inc/ado/Awrapado.hxx207
-rw-r--r--connectivity/source/inc/ado/Awrapadox.hxx130
-rw-r--r--connectivity/source/inc/ado/adoimp.hxx8
43 files changed, 1564 insertions, 1162 deletions
diff --git a/connectivity/source/drivers/ado/ACallableStatement.cxx b/connectivity/source/drivers/ado/ACallableStatement.cxx
index 487cf29f4fca..100655ad4435 100644
--- a/connectivity/source/drivers/ado/ACallableStatement.cxx
+++ b/connectivity/source/drivers/ado/ACallableStatement.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ACallableStatement.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:31:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -75,13 +75,13 @@ IMPLEMENT_SERVICE_INFO(OCallableStatement,"com.sun.star.sdbcx.ACallableStatement
#define GET_PARAM() \
ADOParameter* pParam = NULL; \
- m_pParameters->get_Item(OLEVariant(columnIndex-1),&pParam); \
+ m_pParameters->get_Item(OLEVariant(sal_Int32(columnIndex-1)),&pParam); \
if(pParam) \
pParam->get_Value(&m_aValue);
//**************************************************************
//************ Class: java.sql.CallableStatement
//**************************************************************
-OCallableStatement::OCallableStatement( OConnection* _pConnection,const ::std::vector<connectivity::OTypeInfo>& _TypeInfo,const ::rtl::OUString& sql )
+OCallableStatement::OCallableStatement( OConnection* _pConnection,const OTypeInfoMap& _TypeInfo,const ::rtl::OUString& sql )
: OPreparedStatement( _pConnection, _TypeInfo, sql )
{
m_Command.put_CommandType(adCmdStoredProc);
@@ -152,7 +152,7 @@ sal_Int32 SAL_CALL OCallableStatement::getInt( sal_Int32 columnIndex ) throw(SQL
sal_Int64 SAL_CALL OCallableStatement::getLong( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
GET_PARAM()
- return (sal_Int64)m_aValue.getCurrency();
+ return (sal_Int64)m_aValue.getCurrency().int64;
}
// -------------------------------------------------------------------------
@@ -193,7 +193,7 @@ sal_Int16 SAL_CALL OCallableStatement::getShort( sal_Int32 columnIndex ) throw(S
void SAL_CALL OCallableStatement::registerOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(SQLException, RuntimeException)
{
ADOParameter* pParam = NULL;
- m_pParameters->get_Item(OLEVariant(parameterIndex-1),&pParam);
+ m_pParameters->get_Item(OLEVariant(sal_Int32(parameterIndex-1)),&pParam);
if(pParam)
{
pParam->put_Type(ADOS::MapJdbc2ADOType(sqlType));
@@ -204,12 +204,12 @@ void SAL_CALL OCallableStatement::registerOutParameter( sal_Int32 parameterIndex
void SAL_CALL OCallableStatement::registerNumericOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, sal_Int32 scale ) throw(SQLException, RuntimeException)
{
ADOParameter* pParam = NULL;
- m_pParameters->get_Item(OLEVariant(parameterIndex-1),&pParam);
+ m_pParameters->get_Item(OLEVariant(sal_Int32(parameterIndex-1)),&pParam);
if(pParam)
{
pParam->put_Type(ADOS::MapJdbc2ADOType(sqlType));
pParam->put_Direction(adParamOutput);
- pParam->put_NumericScale(scale);
+ pParam->put_NumericScale((sal_Int8)scale);
}
}
// -------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/ado/ACatalog.cxx b/connectivity/source/drivers/ado/ACatalog.cxx
index 1f78d41c2e32..1ab7671026ff 100644
--- a/connectivity/source/drivers/ado/ACatalog.cxx
+++ b/connectivity/source/drivers/ado/ACatalog.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ACatalog.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:31:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -125,7 +125,7 @@ void OCatalog::refreshTables()
if(m_pTables)
delete m_pTables;
- m_pTables = new OTables(*this,m_aMutex,aVector,pTables,m_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers());
+ m_pTables = new OTables(this,m_aMutex,aVector,pTables,m_pConnection->getMetaData()->storesMixedCaseQuotedIdentifiers());
}
// -------------------------------------------------------------------------
void OCatalog::refreshViews()
diff --git a/connectivity/source/drivers/ado/AColumn.cxx b/connectivity/source/drivers/ado/AColumn.cxx
index 5a8145049ed8..211dabd09ac1 100644
--- a/connectivity/source/drivers/ado/AColumn.cxx
+++ b/connectivity/source/drivers/ado/AColumn.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AColumn.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: oj $ $Date: 2000-11-03 14:09:51 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:31:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -62,6 +62,9 @@
#ifndef _CONNECTIVITY_ADO_COLUMN_HXX_
#include "ado/AColumn.hxx"
#endif
+#ifndef _CONNECTIVITY_ADO_ACONNECTION_HXX_
+#include "ado/AConnection.hxx"
+#endif
#ifndef _CONNECTIVITY_ADO_AWRAPADO_HXX_
#include "ado/Awrapado.hxx"
#endif
@@ -71,10 +74,16 @@
#ifndef _COMPHELPER_SEQUENCE_HXX_
#include <comphelper/sequence.hxx>
#endif
+#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
+#include <com/sun/star/sdbc/ColumnValue.hpp>
+#endif
#define CONNECTIVITY_PROPERTY_NAME_SPACE ado
#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_
#include "propertyids.hxx"
#endif
+#ifndef _COMPHELPER_EXTRACT_HXX_
+#include <comphelper/extract.hxx>
+#endif
using namespace connectivity::ado;
using namespace com::sun::star::uno;
@@ -102,61 +111,24 @@ void WpADOColumn::Create()
}
}
// -------------------------------------------------------------------------
-OAdoColumn::OAdoColumn(sal_Bool _bCase,_ADOColumn* _pColumn) : connectivity::sdbcx::OColumn(_bCase)
+OAdoColumn::OAdoColumn(sal_Bool _bCase,OConnection* _pConnection,_ADOColumn* _pColumn)
+ : connectivity::sdbcx::OColumn(::rtl::OUString(),::rtl::OUString(),::rtl::OUString(),0,0,0,0,sal_False,sal_False,sal_False,_bCase)
+ ,m_pConnection(_pConnection)
{
- if(_pColumn)
- m_aColumn = WpADOColumn(_pColumn);
- else
- m_aColumn.Create();
+ construct();
+ OSL_ENSURE(_pColumn,"Column can not be null!");
+ m_aColumn = WpADOColumn(_pColumn);
+ fillPropertyValues();
}
// -------------------------------------------------------------------------
-OAdoColumn::OAdoColumn( const ::rtl::OUString& _Name,
- const ::rtl::OUString& _TypeName,
- const ::rtl::OUString& _DefaultValue,
- sal_Int32 _IsNullable,
- sal_Int32 _Precision,
- sal_Int32 _Scale,
- sal_Int32 _Type,
- sal_Bool _IsAutoIncrement,
- sal_Bool _IsCurrency,
- sal_Bool _bCase
- ) : connectivity::sdbcx::OColumn(_Name,
- _TypeName,
- _DefaultValue,
- _IsNullable,
- _Precision,
- _Scale,
- _Type,
- _IsAutoIncrement,
- sal_False,_IsCurrency,_bCase)
+OAdoColumn::OAdoColumn(sal_Bool _bCase,OConnection* _pConnection)
+ : connectivity::sdbcx::OColumn(_bCase)
+ ,m_pConnection(_pConnection)
{
m_aColumn.Create();
- m_aColumn.put_Name(_Name);
- m_aColumn.put_Type(ADOS::MapJdbc2ADOType(_Type));
- m_aColumn.put_Precision(_Precision);
- if(_IsNullable)
- m_aColumn.put_Attributes(adColNullable);
- {
- ADOProperties* pProps = m_aColumn.get_Properties();
- pProps->AddRef();
- ADOProperty* pProp = NULL;
- pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("AutoIncrement")),&pProp);
- WpADOProperty aProp(pProp);
- if(pProp)
- aProp.PutValue(_IsAutoIncrement);
- pProps->Release();
- }
- {
- ADOProperties* pProps = m_aColumn.get_Properties();
- pProps->AddRef();
- ADOProperty* pProp = NULL;
- pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("Default")),&pProp);
- WpADOProperty aProp(pProp);
- if(pProp)
- aProp.PutValue(_DefaultValue);
- pProps->Release();
- }
+ construct();
}
+
//--------------------------------------------------------------------------
Sequence< sal_Int8 > OAdoColumn::getUnoTunnelImplementationId()
{
@@ -182,14 +154,31 @@ sal_Int64 OAdoColumn::getSomething( const Sequence< sal_Int8 > & rId ) throw (Ru
return OColumn_ADO::getSomething(rId);
}
+// -------------------------------------------------------------------------
+void OAdoColumn::construct()
+{
+ sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY;
+
+ registerProperty(PROPERTY_ISASCENDING, PROPERTY_ID_ISASCENDING, nAttrib,&m_IsAscending, ::getBooleanCppuType());
+ registerProperty(PROPERTY_RELATEDCOLUMN, PROPERTY_ID_RELATEDCOLUMN, nAttrib,&m_ReferencedColumn, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
+}
// -----------------------------------------------------------------------------
void OAdoColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)throw (Exception)
{
if(m_aColumn.IsValid())
{
-
switch(nHandle)
{
+ case PROPERTY_ID_ISASCENDING:
+ m_aColumn.put_SortOrder(::cppu::any2bool(rValue) ? adSortAscending : adSortDescending);
+ break;
+ case PROPERTY_ID_RELATEDCOLUMN:
+ {
+ ::rtl::OUString aVal;
+ rValue >>= aVal;
+ m_aColumn.put_RelatedColumn(aVal);
+ }
+ break;
case PROPERTY_ID_NAME:
{
::rtl::OUString aVal;
@@ -205,7 +194,7 @@ void OAdoColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& r
}
break;
case PROPERTY_ID_TYPENAME:
- // rValue <<= getResultSetType();
+ // rValue <<= m_pTable->getCatalog()->getConnection()->getTypeInfo()->find();
break;
case PROPERTY_ID_PRECISION:
{
@@ -218,7 +207,7 @@ void OAdoColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& r
{
sal_Int32 nVal=0;
rValue >>= nVal;
- m_aColumn.put_NumericScale(nVal);
+ m_aColumn.put_NumericScale((sal_Int8)nVal);
}
break;
case PROPERTY_ID_ISNULLABLE:
@@ -229,13 +218,6 @@ void OAdoColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& r
m_aColumn.put_Attributes(adColNullable);
}
break;
- case PROPERTY_ID_ISASCENDING:
- {
- sal_Bool _b;
- rValue >>= _b;
- m_aColumn.put_SortOrder( _b ? adSortAscending : adSortDescending);
- }
- break;
case PROPERTY_ID_ISROWVERSION:
break;
case PROPERTY_ID_ISAUTOINCREMENT:
@@ -275,113 +257,53 @@ void OAdoColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& r
}
break;
case PROPERTY_ID_ISCURRENCY:
- {
- ADOProperties* pProps = m_aColumn.get_Properties();
- pProps->AddRef();
- ADOProperty* pProp = NULL;
- pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("Fixed Length")),&pProp);
- WpADOProperty aProp(pProp);
- if(pProp)
- aProp.PutValue(getBOOL(rValue));
- pProps->Release();
- }
+ m_aColumn.put_Type(adCurrency);
break;
}
}
+ OColumn_ADO::setFastPropertyValue_NoBroadcast(nHandle,rValue);
}
// -------------------------------------------------------------------------
-void OAdoColumn::getFastPropertyValue(
- Any& rValue,
- sal_Int32 nHandle
- ) const
+void OAdoColumn::fillPropertyValues()
{
if(m_aColumn.IsValid())
{
- switch(nHandle)
+ m_IsAscending = m_aColumn.get_SortOrder() == adSortAscending;
+ m_ReferencedColumn = m_aColumn.get_RelatedColumn();
+ m_Name = m_aColumn.get_Name();
+ m_Type = ADOS::MapADOType2Jdbc(m_aColumn.get_Type());
{
- case PROPERTY_ID_NAME:
- rValue <<= m_aColumn.get_Name();
- break;
- case PROPERTY_ID_TYPE:
- rValue <<= ADOS::MapADOType2Jdbc(m_aColumn.get_Type());
- break;
- case PROPERTY_ID_TYPENAME:
- // rValue <<= getResultSetType();
- break;
- case PROPERTY_ID_PRECISION:
- rValue <<= m_aColumn.get_Precision();
- break;
- case PROPERTY_ID_SCALE:
- rValue <<= m_aColumn.get_NumericScale();
- break;
- case PROPERTY_ID_ISNULLABLE:
- {
- sal_Bool _b = m_aColumn.get_Attributes() == adColNullable;
- rValue <<= Any(&_b, ::getBooleanCppuType());
- }
- break;
- case PROPERTY_ID_ISASCENDING:
- {
- sal_Bool _b = m_aColumn.get_SortOrder() == adSortAscending;
- rValue <<= Any(&_b, ::getBooleanCppuType());
- }
- case PROPERTY_ID_ISAUTOINCREMENT:
- {
- ADOProperties* pProps = m_aColumn.get_Properties();
- pProps->AddRef();
- ADOProperty* pProp = NULL;
- pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("AutoIncrement")),&pProp);
- WpADOProperty aProp(pProp);
- if(pProp)
- {
- sal_Bool b = aProp.GetValue();
- rValue <<= Any(&b, ::getBooleanCppuType());
- }
- pProps->Release();
- }
- break;
- case PROPERTY_ID_ISROWVERSION:
- // rValue <<= getResultSetType();
- break;
- case PROPERTY_ID_DESCRIPTION:
- {
- ADOProperties* pProps = m_aColumn.get_Properties();
- pProps->AddRef();
- ADOProperty* pProp = NULL;
- pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("Description")),&pProp);
- WpADOProperty aProp(pProp);
- if(pProp)
- rValue <<= (::rtl::OUString)aProp.GetValue();
- pProps->Release();
- }
- break;
- case PROPERTY_ID_DEFAULTVALUE:
- {
- ADOProperties* pProps = m_aColumn.get_Properties();
- pProps->AddRef();
- ADOProperty* pProp = NULL;
- pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("Default")),&pProp);
- WpADOProperty aProp(pProp);
- if(pProp)
- rValue <<= (::rtl::OUString)aProp.GetValue();
- pProps->Release();
- }
- break;
- case PROPERTY_ID_ISCURRENCY:
- {
- ADOProperties* pProps = m_aColumn.get_Properties();
- pProps->AddRef();
- ADOProperty* pProp = NULL;
- pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("Fixed Length")),&pProp);
- WpADOProperty aProp(pProp);
- if(pProp)
- {
- sal_Bool bVal = aProp.GetValue();
- rValue <<= Any(&bVal,getBooleanCppuType());
- }
- pProps->Release();
- }
- break;
+ const OTypeInfoMap* pTypeInfo = m_pConnection->getTypeInfo();
+ OTypeInfoMap::const_iterator aFind = pTypeInfo->find(ADOS::MapADOType2Jdbc(m_aColumn.get_Type()));
+ if(aFind != pTypeInfo->end())
+ m_TypeName = aFind->second.aTypeName;
+ }
+ m_Precision = m_aColumn.get_Precision();
+ m_Scale = m_aColumn.get_NumericScale();
+ m_IsNullable = (m_aColumn.get_Attributes() == adColNullable) ? ColumnValue::NULLABLE : ColumnValue::NO_NULLS;
+ m_IsCurrency = (m_aColumn.get_Type() == adCurrency);
+ // fill some specific props
+ {
+ ADOProperties* pProps = m_aColumn.get_Properties();
+ if(pProps)
+ {
+ pProps->AddRef();
+ ADOProperty* pProp = NULL;
+ pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("AutoIncrement")),&pProp);
+ WpADOProperty aProp(pProp);
+ if(pProp)
+ m_IsAutoIncrement = aProp.GetValue();
+
+ pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("Description")),&pProp);
+ aProp = pProp;
+ if(pProp)
+ m_Description = (::rtl::OUString)aProp.GetValue();
+ pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("Default")),&pProp);
+ aProp = pProp;
+ if(pProp)
+ m_DefaultValue = (::rtl::OUString)aProp.GetValue();
+ pProps->Release();
+ }
}
}
}
diff --git a/connectivity/source/drivers/ado/AColumns.cxx b/connectivity/source/drivers/ado/AColumns.cxx
index aeb25026cb36..4c2a6f2f2fac 100644
--- a/connectivity/source/drivers/ado/AColumns.cxx
+++ b/connectivity/source/drivers/ado/AColumns.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AColumns.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: oj $ $Date: 2001-03-30 14:07:20 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:31:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -77,7 +77,10 @@
#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
#include <com/sun/star/sdbc/ColumnValue.hpp>
#endif
-
+#define CONNECTIVITY_PROPERTY_NAME_SPACE ado
+#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_
+#include "propertyids.hxx"
+#endif
using namespace connectivity::ado;
using namespace connectivity;
using namespace com::sun::star::uno;
@@ -93,7 +96,7 @@ Reference< XNamed > OColumns::createObject(const ::rtl::OUString& _rName)
ADOColumn* pColumn = NULL;
m_pCollection->get_Item(OLEVariant(_rName),&pColumn);
- Reference< XNamed > xRet = new OAdoColumn(isCaseSensitive(),pColumn);
+ Reference< XNamed > xRet = new OAdoColumn(isCaseSensitive(),m_pConnection,pColumn);
return xRet;
}
@@ -106,7 +109,7 @@ void OColumns::impl_refresh() throw(RuntimeException)
// -------------------------------------------------------------------------
Reference< XPropertySet > OColumns::createEmptyObject()
{
- OAdoColumn* pNew = new OAdoColumn(isCaseSensitive());
+ OAdoColumn* pNew = new OAdoColumn(isCaseSensitive(),m_pConnection);
return pNew;
}
// -------------------------------------------------------------------------
@@ -119,7 +122,10 @@ void SAL_CALL OColumns::appendByDescriptor( const Reference< XPropertySet >& des
if(xTunnel.is())
{
OAdoColumn* pColumn = (OAdoColumn*)xTunnel->getSomething(OAdoColumn::getUnoTunnelImplementationId());
- m_pCollection->Append(OLEVariant(pColumn->getColumnImpl()));
+ if(pColumn)
+ m_pCollection->Append(OLEVariant(pColumn->getColumnImpl()));
+ else
+ throw SQLException(::rtl::OUString::createFromAscii("Could not append column!"),*this,SQLSTATE_GENERAL,1000,Any());
}
OCollection_TYPE::appendByDescriptor(descriptor);
diff --git a/connectivity/source/drivers/ado/AConnection.cxx b/connectivity/source/drivers/ado/AConnection.cxx
index 37bccd6a28a9..639796e4b662 100644
--- a/connectivity/source/drivers/ado/AConnection.cxx
+++ b/connectivity/source/drivers/ado/AConnection.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AConnection.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: jl $ $Date: 2001-03-21 13:40:22 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:31:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -203,11 +203,12 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV
WpADOProperty aProp(pProp);
if(pProp)
{
- aProp.PutValue(OLEVariant(VARIANT_TRUE));
+ aProp.PutValue(OLEVariant(sal_True));
OLEVariant aVar = aProp.GetValue();
}
pProps->Release();
}
+ buildTypeInfo();
//bErg = TRUE;
}
else
@@ -272,7 +273,7 @@ Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall( const ::rtl::
WpADOProperty aProp(pProp);
if(pProp)
{
- pProp->put_Value(OLEVariant(VARIANT_TRUE));
+ pProp->put_Value(OLEVariant(sal_True));
WpADOCommand aCommand;
aCommand.Create();
aCommand.put_ActiveConnection((IDispatch*)*m_pAdoConnection);
@@ -506,7 +507,7 @@ void OConnection::buildTypeInfo() throw( SQLException)
aInfo.nMinimumScale = xRow->getShort (14);
aInfo.nType = xRow->getShort (2);
aInfo.nSearchType = xRow->getShort (9);
- aInfo.nNumPrecRadix = xRow->getInt (18);
+ aInfo.nNumPrecRadix = (sal_Int16)xRow->getInt (18);
aInfo.bCurrency = xRow->getBoolean (11);
aInfo.bAutoIncrement = xRow->getBoolean (12);
@@ -518,7 +519,7 @@ void OConnection::buildTypeInfo() throw( SQLException)
// in the Hashtable if we don't already have an
// entry for this SQL type.
- m_aTypeInfo.push_back(aInfo);
+ m_aTypeInfo.insert(OTypeInfoMap::value_type(aInfo.nType,aInfo));
}
// Close the result set/statement.
diff --git a/connectivity/source/drivers/ado/ADatabaseMetaData.cxx b/connectivity/source/drivers/ado/ADatabaseMetaData.cxx
index 70a6789cebb1..15a1e57f21b7 100644
--- a/connectivity/source/drivers/ado/ADatabaseMetaData.cxx
+++ b/connectivity/source/drivers/ado/ADatabaseMetaData.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ADatabaseMetaData.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: jl $ $Date: 2001-03-21 13:40:22 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:31:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -82,6 +82,9 @@
#ifndef _CONNECTIVITY_ADO_ADOIMP_HXX_
#include "ado/adoimp.hxx"
#endif
+#ifndef _CONNECTIVITY_FDATABASEMETADATARESULTSET_HXX_
+#include "FDatabaseMetaDataResultSet.hxx"
+#endif
using namespace connectivity;
using namespace connectivity::ado;
@@ -90,6 +93,66 @@ using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
+
+const int JET_ENGINETYPE_UNKNOWN = 0;
+const int JET_ENGINETYPE_JET10 = 1;
+const int JET_ENGINETYPE_JET11 = 2;
+const int JET_ENGINETYPE_JET20 = 3;
+const int JET_ENGINETYPE_JET3X = 4;
+const int JET_ENGINETYPE_JET4X = 5;
+const int JET_ENGINETYPE_DBASE3 = 10;
+const int JET_ENGINETYPE_DBASE4 = 11;
+const int JET_ENGINETYPE_DBASE5 = 12;
+const int JET_ENGINETYPE_EXCEL30 = 20;
+const int JET_ENGINETYPE_EXCEL40 = 21;
+const int JET_ENGINETYPE_EXCEL50 = 22;
+const int JET_ENGINETYPE_EXCEL80 = 23;
+const int JET_ENGINETYPE_EXCEL90 = 24;
+const int JET_ENGINETYPE_EXCHANGE4 = 30;
+const int JET_ENGINETYPE_LOTUSWK1 = 40;
+const int JET_ENGINETYPE_LOTUSWK3 = 41;
+const int JET_ENGINETYPE_LOTUSWK4 = 42;
+const int JET_ENGINETYPE_PARADOX3X = 50;
+const int JET_ENGINETYPE_PARADOX4X = 51;
+const int JET_ENGINETYPE_PARADOX5X = 52;
+const int JET_ENGINETYPE_PARADOX7X = 53;
+const int JET_ENGINETYPE_TEXT1X = 60;
+const int JET_ENGINETYPE_HTML1X = 70;
+
+sal_Bool isJetEngine(sal_Int32 _nEngineType)
+{
+ sal_Bool bRet = sal_False;
+ switch(_nEngineType)
+ {
+ case JET_ENGINETYPE_UNKNOWN:
+ case JET_ENGINETYPE_JET10:
+ case JET_ENGINETYPE_JET11:
+ case JET_ENGINETYPE_JET20:
+ case JET_ENGINETYPE_JET3X:
+ case JET_ENGINETYPE_JET4X:
+ case JET_ENGINETYPE_DBASE3:
+ case JET_ENGINETYPE_DBASE4:
+ case JET_ENGINETYPE_DBASE5:
+ case JET_ENGINETYPE_EXCEL30:
+ case JET_ENGINETYPE_EXCEL40:
+ case JET_ENGINETYPE_EXCEL50:
+ case JET_ENGINETYPE_EXCEL80:
+ case JET_ENGINETYPE_EXCEL90:
+ case JET_ENGINETYPE_EXCHANGE4:
+ case JET_ENGINETYPE_LOTUSWK1:
+ case JET_ENGINETYPE_LOTUSWK3:
+ case JET_ENGINETYPE_LOTUSWK4:
+ case JET_ENGINETYPE_PARADOX3X:
+ case JET_ENGINETYPE_PARADOX4X:
+ case JET_ENGINETYPE_PARADOX5X:
+ case JET_ENGINETYPE_PARADOX7X:
+ case JET_ENGINETYPE_TEXT1X:
+ case JET_ENGINETYPE_HTML1X:
+ bRet = sal_True;
+ break;
+ }
+ return bRet;
+}
// using namespace connectivity;
ODatabaseMetaData::ODatabaseMetaData(OConnection* _pCon)
@@ -168,7 +231,7 @@ sal_Bool ODatabaseMetaData::isCapable(sal_uInt32 _nId) throw(SQLException, Runti
sal_Int32 ODatabaseMetaData::getInt32Property(const ::rtl::OUString& _aProperty) throw(SQLException, RuntimeException)
{
WpOLEAppendCollection<ADOProperties, ADOProperty, WpADOProperty> aProps(m_pADOConnection->get_Properties());
- ADOS::ThrowException(*m_pADOConnection,*this);
+ // ADOS::ThrowException(*m_pADOConnection,*this);
OSL_ENSURE(aProps.IsValid(),"There are no properties at the connection");
ADO_PROP(_aProperty);
sal_Int32 nValue(0);
@@ -573,7 +636,8 @@ sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength( ) throw(SQLExcept
// -------------------------------------------------------------------------
sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException)
{
- return getInt32Property(::rtl::OUString::createFromAscii("Max Columns in Index"));
+ // return getInt32Property(::rtl::OUString::createFromAscii("Max Columns in Index"));
+ return 0;
}
// -------------------------------------------------------------------------
sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException)
@@ -818,49 +882,89 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getBestRowIdentifier(
Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(SQLException, RuntimeException)
{
- // Create elements used in the array
- HRESULT hr = S_OK;
- SAFEARRAYBOUND rgsabound[1];
- SAFEARRAY *psa = NULL;
- OLEVariant varCriteria[5];
-
- // Create SafeArray Bounds and initialize the array
- rgsabound[0].lLbound = 0;
- rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
- psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
-
- sal_Int32 nPos=0;
- if(catalog.hasValue())
- varCriteria[nPos].setString(getString(catalog));
-
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
- if(schemaPattern.toChar() != '%')
- varCriteria[nPos].setString(schemaPattern);
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
-
- if(tableNamePattern.toChar() != '%')
- varCriteria[nPos].setString(tableNamePattern);
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
-
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// GRANTOR
- hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// GRANTEE
-
- OLEVariant vtEmpty;
- vtEmpty.setNoArg();
-
- // Initialize and fill the SafeArray
- OLEVariant vsa;
- vsa.setArray(psa,VT_VARIANT);
-
- ADORecordset *pRecordset = NULL;
- m_pADOConnection->OpenSchema(adSchemaTablePrivileges,vsa,vtEmpty,&pRecordset);
- ADOS::ThrowException(*m_pADOConnection,*this);
+ sal_Int32 nEngineType = getInt32Property(::rtl::OUString::createFromAscii("Jet OLEDB:Engine Type"));
Reference< XResultSet > xRef = NULL;
-
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
- pResult->setTablePrivilegesMap();
- xRef = pResult;
+ if(!isJetEngine(nEngineType))
+ { // the jet provider doesn't support this method
+ // Create elements used in the array
+ HRESULT hr = S_OK;
+ SAFEARRAYBOUND rgsabound[1];
+ SAFEARRAY *psa = NULL;
+ OLEVariant varCriteria[5];
+
+ // Create SafeArray Bounds and initialize the array
+ rgsabound[0].lLbound = 0;
+ rgsabound[0].cElements = sizeof varCriteria / sizeof varCriteria[0];
+ psa = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
+
+ sal_Int32 nPos=0;
+ if(catalog.hasValue())
+ varCriteria[nPos].setString(getString(catalog));
+
+ hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_CATALOG
+ if(schemaPattern.toChar() != '%')
+ varCriteria[nPos].setString(schemaPattern);
+ hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_SCHEMA
+
+ if(tableNamePattern.toChar() != '%')
+ varCriteria[nPos].setString(tableNamePattern);
+ hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// TABLE_NAME
+
+ hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// GRANTOR
+ hr = SafeArrayPutElement(psa,&nPos,&varCriteria[nPos]);nPos++;// GRANTEE
+
+ OLEVariant vtEmpty;
+ vtEmpty.setNoArg();
+
+ // Initialize and fill the SafeArray
+ OLEVariant vsa;
+ vsa.setArray(psa,VT_VARIANT);
+
+ ADORecordset *pRecordset = NULL;
+ m_pADOConnection->OpenSchema(adSchemaTablePrivileges,vsa,vtEmpty,&pRecordset);
+ ADOS::ThrowException(*m_pADOConnection,*this);
+
+ ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset);
+ pResult->setTablePrivilegesMap();
+ xRef = pResult;
+ }
+ else
+ {
+ ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet();
+ xRef = pResult;
+ pResult->setTablePrivilegesMap();
+ ORows aRows;
+ ORow aRow(8);
+ aRow[0] = ORowSetValue();
+ aRow[1] = ORowSetValue();
+ aRow[2] = ORowSetValue(tableNamePattern);
+ aRow[3] = ORowSetValue();
+ aRow[4] = ORowSetValue();
+ aRow[5] = ORowSetValue(getUserName());
+ aRow[6] = ORowSetValue(::rtl::OUString::createFromAscii("SELECT"));
+ aRow[7] = ORowSetValue(::rtl::OUString::createFromAscii("NO"));
+ // bound row
+ ORow::iterator aIter = aRow.begin();
+ for(;aIter != aRow.end();++aIter)
+ aIter->setBound(sal_True);
+ aRows.push_back(aRow);
+ aRow[6] = ORowSetValue(::rtl::OUString::createFromAscii("INSERT"));
+ aRows.push_back(aRow);
+ aRow[6] = ORowSetValue(::rtl::OUString::createFromAscii("DELETE"));
+ aRows.push_back(aRow);
+ aRow[6] = ORowSetValue(::rtl::OUString::createFromAscii("UPDATE"));
+ aRows.push_back(aRow);
+ aRow[6] = ORowSetValue(::rtl::OUString::createFromAscii("CREATE"));
+ aRows.push_back(aRow);
+ aRow[6] = ORowSetValue(::rtl::OUString::createFromAscii("READ"));
+ aRows.push_back(aRow);
+ aRow[6] = ORowSetValue(::rtl::OUString::createFromAscii("ALTER"));
+ aRows.push_back(aRow);
+ aRow[6] = ORowSetValue(::rtl::OUString::createFromAscii("DROP"));
+ aRows.push_back(aRow);
+ pResult->setRows(aRows);
+ }
return xRef;
}
@@ -931,7 +1035,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLExc
// -------------------------------------------------------------------------
sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
{
- return (getInt32Property(::rtl::OUString::createFromAscii("Quoted Identifier Case Sensitivity")) & DBPROPVAL_IC_LOWER) == DBPROPVAL_IC_LOWER ;
+ return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_LOWER) == DBPROPVAL_IC_LOWER ;
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException)
@@ -941,7 +1045,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLExc
// -------------------------------------------------------------------------
sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
{
- return (getInt32Property(::rtl::OUString::createFromAscii("Quoted Identifier Case Sensitivity")) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED ;
+ return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED ;
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException)
@@ -951,7 +1055,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLExc
// -------------------------------------------------------------------------
sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException)
{
- return (getInt32Property(::rtl::OUString::createFromAscii("Quoted Identifier Case Sensitivity")) & DBPROPVAL_IC_UPPER) == DBPROPVAL_IC_UPPER ;
+ return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_UPPER) == DBPROPVAL_IC_UPPER ;
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException)
@@ -992,7 +1096,8 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLExc
// -------------------------------------------------------------------------
::rtl::OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException)
{
- return getStringProperty(::rtl::OUString::createFromAscii("Special Characters"));
+ // return getStringProperty(::rtl::OUString::createFromAscii("Special Characters"));
+ return ::rtl::OUString();
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException)
@@ -1106,17 +1211,20 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInTableDefinitions( ) throw
// -------------------------------------------------------------------------
sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInTableDefinitions( ) throw(SQLException, RuntimeException)
{
- return (getInt32Property(::rtl::OUString::createFromAscii("Catalog Usage")) & DBPROPVAL_CU_TABLE_DEFINITION) == DBPROPVAL_CU_TABLE_DEFINITION;
+ // return (getInt32Property(::rtl::OUString::createFromAscii("Catalog Usage")) & DBPROPVAL_CU_TABLE_DEFINITION) == DBPROPVAL_CU_TABLE_DEFINITION;
+ return sal_False;
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException)
{
- return (getInt32Property(::rtl::OUString::createFromAscii("Catalog Usage")) & DBPROPVAL_CU_INDEX_DEFINITION) == DBPROPVAL_CU_INDEX_DEFINITION;
+ // return (getInt32Property(::rtl::OUString::createFromAscii("Catalog Usage")) & DBPROPVAL_CU_INDEX_DEFINITION) == DBPROPVAL_CU_INDEX_DEFINITION;
+ return sal_False;
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInDataManipulation( ) throw(SQLException, RuntimeException)
{
- return (getInt32Property(::rtl::OUString::createFromAscii("Catalog Usage")) & DBPROPVAL_CU_DML_STATEMENTS) == DBPROPVAL_CU_DML_STATEMENTS;
+ // return (getInt32Property(::rtl::OUString::createFromAscii("Catalog Usage")) & DBPROPVAL_CU_DML_STATEMENTS) == DBPROPVAL_CU_DML_STATEMENTS;
+ return sal_False;
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException)
@@ -1311,7 +1419,8 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(
// -------------------------------------------------------------------------
sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException)
{
- return (getInt32Property(::rtl::OUString::createFromAscii("Catalog Usage")) & DBPROPVAL_CU_PRIVILEGE_DEFINITION) == DBPROPVAL_CU_PRIVILEGE_DEFINITION;
+ // return (getInt32Property(::rtl::OUString::createFromAscii("Catalog Usage")) & DBPROPVAL_CU_PRIVILEGE_DEFINITION) == DBPROPVAL_CU_PRIVILEGE_DEFINITION;
+ return sal_False;
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException)
@@ -1497,17 +1606,17 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLExce
// -------------------------------------------------------------------------
sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException)
{
- return getInt32Property(::rtl::OUString::createFromAscii("Max Columns in Group By"));
+ return getInt32Property(::rtl::OUString::createFromAscii("Max Columns in GROUP BY"));
}
// -------------------------------------------------------------------------
sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException)
{
- return getInt32Property(::rtl::OUString::createFromAscii("Max Columns in Order by"));
+ return getInt32Property(::rtl::OUString::createFromAscii("Max Columns in ORDER BY"));
}
// -------------------------------------------------------------------------
sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException)
{
- return getInt32Property(::rtl::OUString::createFromAscii("Max Columns in Select"));
+ return 0; // getInt32Property(::rtl::OUString::createFromAscii("Max Columns in Select"));
}
// -------------------------------------------------------------------------
sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException)
diff --git a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx
index aac0486b0c55..b68abc80dd42 100644
--- a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx
+++ b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ADatabaseMetaDataResultSet.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: jl $ $Date: 2001-03-21 13:40:22 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:31:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,9 @@
*
************************************************************************/
-
+#ifndef _COMPHELPER_SEQUENCE_HXX_
+#include <comphelper/sequence.hxx>
+#endif
#ifndef _CONNECTIVITY_ADO_ADATABASEMETADATARESULTSET_HXX_
#include "ado/ADatabaseMetaDataResultSet.hxx"
#endif
@@ -100,15 +102,17 @@
#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
#include <cppuhelper/typeprovider.hxx>
#endif
-#ifndef _COMPHELPER_SEQUENCE_HXX_
-#include <comphelper/sequence.hxx>
+#ifndef _COMPHELPER_SEQSTREAM_HXX
+#include <comphelper/seqstream.hxx>
#endif
+
#include <oledb.h>
using namespace connectivity::ado;
using namespace cppu;
+using namespace ::comphelper;
//------------------------------------------------------------------------------
using namespace ::com::sun::star::lang;
using namespace com::sun::star::uno;
@@ -131,7 +135,7 @@ ODatabaseMetaDataResultSet::ODatabaseMetaDataResultSet(ADORecordset* _pRecordSet
m_pRecordSet->AddRef();
VARIANT_BOOL bIsAtBOF;
m_pRecordSet->get_BOF(&bIsAtBOF);
- m_bOnFirstAfterOpen = !(sal_Bool)bIsAtBOF;
+ m_bOnFirstAfterOpen = bIsAtBOF != VARIANT_TRUE;
}
else
m_bOnFirstAfterOpen = sal_False;
@@ -189,6 +193,7 @@ sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::findColumn( const ::rtl::OUString
break;
return i;
}
+#define BLOCK_SIZE 256
// -------------------------------------------------------------------------
Reference< ::com::sun::star::io::XInputStream > SAL_CALL ODatabaseMetaDataResultSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
@@ -199,7 +204,38 @@ Reference< ::com::sun::star::io::XInputStream > SAL_CALL ODatabaseMetaDataResult
throw SQLException();
columnIndex = mapColumn(columnIndex);
- return NULL;
+ ADO_GETFIELD(columnIndex);
+ if((aField.GetAttributes() & adFldLong) == adFldLong)
+ {
+ //Copy the data only upto the Actual Size of Field.
+ sal_Int32 nSize = aField.GetActualSize();
+ Sequence<sal_Int8> aData(nSize);
+ long index = 0;
+ while(index < nSize)
+ {
+ m_aValue = aField.GetChunk(BLOCK_SIZE);
+ if(m_aValue.isNull())
+ break;
+ UCHAR chData;
+ for(long index2 = 0;index2 < BLOCK_SIZE;++index2)
+ {
+ HRESULT hr = ::SafeArrayGetElement(m_aValue.parray,&index2,&chData);
+ if(SUCCEEDED(hr))
+ {
+ //Take BYTE by BYTE and advance Memory Location
+ aData.getArray()[index++] = chData;
+ }
+ else
+ break;
+ }
+ }
+ return index ? Reference< ::com::sun::star::io::XInputStream >(new SequenceInputStream(aData)) : Reference< ::com::sun::star::io::XInputStream >();
+ }
+ // else we ask for a bytesequence
+ aField.get_Value(m_aValue);
+ if(m_aValue.isNull())
+ return NULL;
+ return new SequenceInputStream(m_aValue);
}
// -------------------------------------------------------------------------
Reference< ::com::sun::star::io::XInputStream > SAL_CALL ODatabaseMetaDataResultSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
@@ -225,7 +261,10 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::getBoolean( sal_Int32 columnIndex
columnIndex = mapColumn(columnIndex);
ADO_GETFIELD(columnIndex);
- aField.get_Value(m_aValue); return m_aValue;
+ aField.get_Value(m_aValue);
+ if(m_aValue.isNull())
+ return sal_False;
+ return m_aValue;
}
// -------------------------------------------------------------------------
@@ -240,10 +279,13 @@ sal_Int8 SAL_CALL ODatabaseMetaDataResultSet::getByte( sal_Int32 columnIndex ) t
columnIndex = mapColumn(columnIndex);
ADO_GETFIELD(columnIndex);
aField.get_Value(m_aValue);
+ if(m_aValue.isNull())
+ return 0;
if(m_aValueRange.size() && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end())
- return (*m_aValueRangeIter).second[(sal_Int32)m_aValue];
+ return (sal_Int8)(*m_aValueRangeIter).second[(sal_Int32)m_aValue];
else if(m_aStrValueRange.size() && (m_aStrValueRangeIter = m_aStrValueRange.find(columnIndex)) != m_aStrValueRange.end())
- return (*m_aStrValueRangeIter).second[m_aValue];
+ return (sal_Int8)(*m_aStrValueRangeIter).second[m_aValue];
+
return m_aValue;
}
// -------------------------------------------------------------------------
@@ -259,6 +301,8 @@ Sequence< sal_Int8 > SAL_CALL ODatabaseMetaDataResultSet::getBytes( sal_Int32 co
columnIndex = mapColumn(columnIndex);
ADO_GETFIELD(columnIndex);
aField.get_Value(m_aValue);
+ if(m_aValue.isNull())
+ return Sequence< sal_Int8 >();
return m_aValue;
}
// -------------------------------------------------------------------------
@@ -274,6 +318,8 @@ Sequence< sal_Int8 > SAL_CALL ODatabaseMetaDataResultSet::getBytes( sal_Int32 co
columnIndex = mapColumn(columnIndex);
ADO_GETFIELD(columnIndex);
aField.get_Value(m_aValue);
+ if(m_aValue.isNull())
+ return ::com::sun::star::util::Date();
return m_aValue;
}
// -------------------------------------------------------------------------
@@ -289,6 +335,8 @@ double SAL_CALL ODatabaseMetaDataResultSet::getDouble( sal_Int32 columnIndex ) t
columnIndex = mapColumn(columnIndex);
ADO_GETFIELD(columnIndex);
aField.get_Value(m_aValue);
+ if(m_aValue.isNull())
+ return 0;
return m_aValue;
}
// -------------------------------------------------------------------------
@@ -304,6 +352,8 @@ float SAL_CALL ODatabaseMetaDataResultSet::getFloat( sal_Int32 columnIndex ) thr
columnIndex = mapColumn(columnIndex);
ADO_GETFIELD(columnIndex);
aField.get_Value(m_aValue);
+ if(m_aValue.isNull())
+ return 0;
return m_aValue;
}
// -------------------------------------------------------------------------
@@ -319,10 +369,14 @@ sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::getInt( sal_Int32 columnIndex ) t
columnIndex = mapColumn(columnIndex);
ADO_GETFIELD(columnIndex);
aField.get_Value(m_aValue);
+ if(m_aValue.isNull())
+ return 0;
+
if(m_aValueRange.size() && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end())
return (*m_aValueRangeIter).second[(sal_Int32)m_aValue];
else if(m_aStrValueRange.size() && (m_aStrValueRangeIter = m_aStrValueRange.find(columnIndex)) != m_aStrValueRange.end())
return (*m_aStrValueRangeIter).second[m_aValue];
+
return m_aValue;
}
// -------------------------------------------------------------------------
@@ -443,10 +497,14 @@ sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex )
columnIndex = mapColumn(columnIndex);
ADO_GETFIELD(columnIndex);
aField.get_Value(m_aValue);
+ if(m_aValue.isNull())
+ return 0;
+
if(m_aValueRange.size() && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end())
- return (*m_aValueRangeIter).second[(sal_Int32)m_aValue];
+ return (sal_Int16)(*m_aValueRangeIter).second[(sal_Int32)m_aValue];
else if(m_aStrValueRange.size() && (m_aStrValueRangeIter = m_aStrValueRange.find(columnIndex)) != m_aStrValueRange.end())
- return (*m_aStrValueRangeIter).second[m_aValue];
+ return (sal_Int16)(*m_aStrValueRangeIter).second[m_aValue];
+
return m_aValue;
}
// -------------------------------------------------------------------------
@@ -462,9 +520,11 @@ sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex )
columnIndex = mapColumn(columnIndex);
ADO_GETFIELD(columnIndex);
aField.get_Value(m_aValue);
-
+ if(m_aValue.isNull())
+ return ::rtl::OUString();
if(m_aIntValueRange.size() && (m_aIntValueRangeIter = m_aIntValueRange.find(columnIndex)) != m_aIntValueRange.end())
return (*m_aIntValueRangeIter).second[m_aValue];
+
return m_aValue;
}
@@ -481,7 +541,10 @@ sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex )
columnIndex = mapColumn(columnIndex);
ADO_GETFIELD(columnIndex);
- aField.get_Value(m_aValue); return m_aValue;
+ aField.get_Value(m_aValue);
+ if(m_aValue.isNull())
+ return ::com::sun::star::util::Time();
+ return m_aValue;
}
// -------------------------------------------------------------------------
@@ -496,7 +559,10 @@ sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex )
columnIndex = mapColumn(columnIndex);
ADO_GETFIELD(columnIndex);
- aField.get_Value(m_aValue); return m_aValue;
+ aField.get_Value(m_aValue);
+ if(m_aValue.isNull())
+ return ::com::sun::star::util::DateTime();
+ return m_aValue;
}
// -------------------------------------------------------------------------
@@ -508,9 +574,9 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isAfterLast( ) throw(SQLException
if(!m_pRecordSet)
throw SQLException();
- sal_Int16 bIsAtEOF;
+ VARIANT_BOOL bIsAtEOF;
m_pRecordSet->get_EOF(&bIsAtEOF);
- return bIsAtEOF;
+ return bIsAtEOF == VARIANT_TRUE;
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isFirst( ) throw(SQLException, RuntimeException)
@@ -701,9 +767,9 @@ sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isBeforeFirst( ) throw(SQLExcepti
if(!m_pRecordSet)
return sal_True;
- sal_Int16 bIsAtBOF;
+ VARIANT_BOOL bIsAtBOF;
m_pRecordSet->get_BOF(&bIsAtBOF);
- return bIsAtBOF;
+ return bIsAtBOF == VARIANT_TRUE;
}
// -------------------------------------------------------------------------
@@ -974,49 +1040,46 @@ void ODatabaseMetaDataResultSet::setColumnsMap()
m_aColMapping.push_back(11);
::std::map<sal_Int32,sal_Int32> aMap;
- aMap[DBTYPE_EMPTY] = DataType::SQLNULL;
- aMap[DBTYPE_NULL] = DataType::SQLNULL;
- aMap[DBTYPE_I2] = DataType::SMALLINT;
- aMap[DBTYPE_I4] = DataType::INTEGER;
- aMap[DBTYPE_R4] = DataType::FLOAT;
- aMap[DBTYPE_R8] = DataType::DOUBLE;
- aMap[DBTYPE_CY] = DataType::BIGINT;
- aMap[DBTYPE_DATE] = DataType::DATE;
- aMap[DBTYPE_BSTR] = DataType::VARCHAR;
- aMap[DBTYPE_IDISPATCH] = DataType::OBJECT;
- aMap[DBTYPE_ERROR] = DataType::OTHER;
- aMap[DBTYPE_BOOL] = DataType::BIT;
- aMap[DBTYPE_VARIANT] = DataType::STRUCT;
- aMap[DBTYPE_IUNKNOWN] = DataType::OTHER;
- aMap[DBTYPE_DECIMAL] = DataType::DECIMAL;
- aMap[DBTYPE_UI1] = DataType::TINYINT;
- aMap[DBTYPE_ARRAY] = DataType::ARRAY;
- aMap[DBTYPE_BYREF] = DataType::REF;
- aMap[DBTYPE_I1] = DataType::CHAR;
- aMap[DBTYPE_UI2] = DataType::SMALLINT;
- aMap[DBTYPE_UI4] = DataType::INTEGER;
-
- // aMap[The] = ;
- // aMap[in] = ;
- aMap[DBTYPE_I8] = DataType::BIGINT;
- aMap[DBTYPE_UI8] = DataType::BIGINT;
- aMap[DBTYPE_GUID] = DataType::OTHER;
- aMap[DBTYPE_VECTOR] = DataType::OTHER;
- aMap[DBTYPE_FILETIME] = DataType::OTHER;
- aMap[DBTYPE_RESERVED] = DataType::OTHER;
-
- // aMap[The] = ;
- aMap[DBTYPE_BYTES] = DataType::VARBINARY;
- aMap[DBTYPE_STR] = DataType::LONGVARCHAR;
- aMap[DBTYPE_WSTR] = DataType::LONGVARCHAR;
- aMap[DBTYPE_NUMERIC] = DataType::NUMERIC;
- aMap[DBTYPE_UDT] = DataType::OTHER;
- aMap[DBTYPE_DBDATE] = DataType::DATE;
- aMap[DBTYPE_DBTIME] = DataType::TIME;
- aMap[DBTYPE_DBTIMESTAMP] = DataType::TIMESTAMP;
- aMap[DBTYPE_HCHAPTER] = DataType::OTHER;
- aMap[DBTYPE_PROPVARIANT] = DataType::OTHER;
- aMap[DBTYPE_VARNUMERIC] = DataType::NUMERIC;
+ aMap[adEmpty] = ADOS::MapADOType2Jdbc(adEmpty);
+ aMap[adTinyInt] = ADOS::MapADOType2Jdbc(adTinyInt);
+ aMap[adSmallInt] = ADOS::MapADOType2Jdbc(adSmallInt);
+ aMap[adInteger] = ADOS::MapADOType2Jdbc(adInteger);
+ aMap[adBigInt] = ADOS::MapADOType2Jdbc(adBigInt);
+ aMap[adUnsignedTinyInt] = ADOS::MapADOType2Jdbc(adUnsignedTinyInt);
+ aMap[adUnsignedSmallInt]= ADOS::MapADOType2Jdbc(adUnsignedSmallInt);
+ aMap[adUnsignedInt] = ADOS::MapADOType2Jdbc(adUnsignedInt);
+ aMap[adUnsignedBigInt] = ADOS::MapADOType2Jdbc(adUnsignedBigInt);
+ aMap[adSingle] = ADOS::MapADOType2Jdbc(adSingle);
+ aMap[adDouble] = ADOS::MapADOType2Jdbc(adDouble);
+ aMap[adCurrency] = ADOS::MapADOType2Jdbc(adCurrency);
+ aMap[adDecimal] = ADOS::MapADOType2Jdbc(adDecimal);
+ aMap[adNumeric] = ADOS::MapADOType2Jdbc(adNumeric);
+ aMap[adBoolean] = ADOS::MapADOType2Jdbc(adBoolean);
+ aMap[adError] = ADOS::MapADOType2Jdbc(adError);
+ aMap[adUserDefined] = ADOS::MapADOType2Jdbc(adUserDefined);
+ aMap[adVariant] = ADOS::MapADOType2Jdbc(adVariant);
+ aMap[adIDispatch] = ADOS::MapADOType2Jdbc(adIDispatch);
+ aMap[adIUnknown] = ADOS::MapADOType2Jdbc(adIUnknown);
+ aMap[adGUID] = ADOS::MapADOType2Jdbc(adGUID);
+ aMap[adDate] = ADOS::MapADOType2Jdbc(adDate);
+ aMap[adDBDate] = ADOS::MapADOType2Jdbc(adDBDate);
+ aMap[adDBTime] = ADOS::MapADOType2Jdbc(adDBTime);
+ aMap[adDBTimeStamp] = ADOS::MapADOType2Jdbc(adDBTimeStamp);
+ aMap[adBSTR] = ADOS::MapADOType2Jdbc(adBSTR);
+ aMap[adChar] = ADOS::MapADOType2Jdbc(adChar);
+ aMap[adVarChar] = ADOS::MapADOType2Jdbc(adVarChar);
+ aMap[adLongVarChar] = ADOS::MapADOType2Jdbc(adLongVarChar);
+ aMap[adWChar] = ADOS::MapADOType2Jdbc(adWChar);
+ aMap[adVarWChar] = ADOS::MapADOType2Jdbc(adVarWChar);
+ aMap[adLongVarWChar] = ADOS::MapADOType2Jdbc(adLongVarWChar);
+ aMap[adBinary] = ADOS::MapADOType2Jdbc(adBinary);
+ aMap[adVarBinary] = ADOS::MapADOType2Jdbc(adVarBinary);
+ aMap[adLongVarBinary] = ADOS::MapADOType2Jdbc(adLongVarBinary);
+ aMap[adChapter] = ADOS::MapADOType2Jdbc(adChapter);
+ aMap[adFileTime] = ADOS::MapADOType2Jdbc(adFileTime);
+ aMap[adPropVariant] = ADOS::MapADOType2Jdbc(adPropVariant);
+ aMap[adVarNumeric] = ADOS::MapADOType2Jdbc(adVarNumeric);
+ aMap[adArray] = ADOS::MapADOType2Jdbc(adArray);
m_aValueRange[12] = aMap;
@@ -1230,49 +1293,46 @@ void ODatabaseMetaDataResultSet::setTypeInfoMap()
m_aStrValueRange[18] = aMap1;
::std::map<sal_Int32,sal_Int32> aMap;
- aMap[DBTYPE_EMPTY] = DataType::SQLNULL;
- aMap[DBTYPE_NULL] = DataType::SQLNULL;
- aMap[DBTYPE_I2] = DataType::SMALLINT;
- aMap[DBTYPE_I4] = DataType::INTEGER;
- aMap[DBTYPE_R4] = DataType::FLOAT;
- aMap[DBTYPE_R8] = DataType::DOUBLE;
- aMap[DBTYPE_CY] = DataType::BIGINT;
- aMap[DBTYPE_DATE] = DataType::DATE;
- aMap[DBTYPE_BSTR] = DataType::VARCHAR;
- aMap[DBTYPE_IDISPATCH] = DataType::OBJECT;
- aMap[DBTYPE_ERROR] = DataType::OTHER;
- aMap[DBTYPE_BOOL] = DataType::BIT;
- aMap[DBTYPE_VARIANT] = DataType::STRUCT;
- aMap[DBTYPE_IUNKNOWN] = DataType::OTHER;
- aMap[DBTYPE_DECIMAL] = DataType::DECIMAL;
- aMap[DBTYPE_UI1] = DataType::TINYINT;
- aMap[DBTYPE_ARRAY] = DataType::ARRAY;
- aMap[DBTYPE_BYREF] = DataType::REF;
- aMap[DBTYPE_I1] = DataType::CHAR;
- aMap[DBTYPE_UI2] = DataType::SMALLINT;
- aMap[DBTYPE_UI4] = DataType::INTEGER;
-
- // aMap[The] = ;
- // aMap[in] = ;
- aMap[DBTYPE_I8] = DataType::BIGINT;
- aMap[DBTYPE_UI8] = DataType::BIGINT;
- aMap[DBTYPE_GUID] = DataType::OTHER;
- aMap[DBTYPE_VECTOR] = DataType::OTHER;
- aMap[DBTYPE_FILETIME] = DataType::OTHER;
- aMap[DBTYPE_RESERVED] = DataType::OTHER;
-
- // aMap[The] = ;
- aMap[DBTYPE_BYTES] = DataType::VARBINARY;
- aMap[DBTYPE_STR] = DataType::LONGVARCHAR;
- aMap[DBTYPE_WSTR] = DataType::LONGVARCHAR;
- aMap[DBTYPE_NUMERIC] = DataType::NUMERIC;
- aMap[DBTYPE_UDT] = DataType::OTHER;
- aMap[DBTYPE_DBDATE] = DataType::DATE;
- aMap[DBTYPE_DBTIME] = DataType::TIME;
- aMap[DBTYPE_DBTIMESTAMP] = DataType::TIMESTAMP;
- aMap[DBTYPE_HCHAPTER] = DataType::OTHER;
- aMap[DBTYPE_PROPVARIANT] = DataType::OTHER;
- aMap[DBTYPE_VARNUMERIC] = DataType::NUMERIC;
+ aMap[adEmpty] = ADOS::MapADOType2Jdbc(adEmpty);
+ aMap[adTinyInt] = ADOS::MapADOType2Jdbc(adTinyInt);
+ aMap[adSmallInt] = ADOS::MapADOType2Jdbc(adSmallInt);
+ aMap[adInteger] = ADOS::MapADOType2Jdbc(adInteger);
+ aMap[adBigInt] = ADOS::MapADOType2Jdbc(adBigInt);
+ aMap[adUnsignedTinyInt] = ADOS::MapADOType2Jdbc(adUnsignedTinyInt);
+ aMap[adUnsignedSmallInt]= ADOS::MapADOType2Jdbc(adUnsignedSmallInt);
+ aMap[adUnsignedInt] = ADOS::MapADOType2Jdbc(adUnsignedInt);
+ aMap[adUnsignedBigInt] = ADOS::MapADOType2Jdbc(adUnsignedBigInt);
+ aMap[adSingle] = ADOS::MapADOType2Jdbc(adSingle);
+ aMap[adDouble] = ADOS::MapADOType2Jdbc(adDouble);
+ aMap[adCurrency] = ADOS::MapADOType2Jdbc(adCurrency);
+ aMap[adDecimal] = ADOS::MapADOType2Jdbc(adDecimal);
+ aMap[adNumeric] = ADOS::MapADOType2Jdbc(adNumeric);
+ aMap[adBoolean] = ADOS::MapADOType2Jdbc(adBoolean);
+ aMap[adError] = ADOS::MapADOType2Jdbc(adError);
+ aMap[adUserDefined] = ADOS::MapADOType2Jdbc(adUserDefined);
+ aMap[adVariant] = ADOS::MapADOType2Jdbc(adVariant);
+ aMap[adIDispatch] = ADOS::MapADOType2Jdbc(adIDispatch);
+ aMap[adIUnknown] = ADOS::MapADOType2Jdbc(adIUnknown);
+ aMap[adGUID] = ADOS::MapADOType2Jdbc(adGUID);
+ aMap[adDate] = ADOS::MapADOType2Jdbc(adDate);
+ aMap[adDBDate] = ADOS::MapADOType2Jdbc(adDBDate);
+ aMap[adDBTime] = ADOS::MapADOType2Jdbc(adDBTime);
+ aMap[adDBTimeStamp] = ADOS::MapADOType2Jdbc(adDBTimeStamp);
+ aMap[adBSTR] = ADOS::MapADOType2Jdbc(adBSTR);
+ aMap[adChar] = ADOS::MapADOType2Jdbc(adChar);
+ aMap[adVarChar] = ADOS::MapADOType2Jdbc(adVarChar);
+ aMap[adLongVarChar] = ADOS::MapADOType2Jdbc(adLongVarChar);
+ aMap[adWChar] = ADOS::MapADOType2Jdbc(adWChar);
+ aMap[adVarWChar] = ADOS::MapADOType2Jdbc(adVarWChar);
+ aMap[adLongVarWChar] = ADOS::MapADOType2Jdbc(adLongVarWChar);
+ aMap[adBinary] = ADOS::MapADOType2Jdbc(adBinary);
+ aMap[adVarBinary] = ADOS::MapADOType2Jdbc(adVarBinary);
+ aMap[adLongVarBinary] = ADOS::MapADOType2Jdbc(adLongVarBinary);
+ aMap[adChapter] = ADOS::MapADOType2Jdbc(adChapter);
+ aMap[adFileTime] = ADOS::MapADOType2Jdbc(adFileTime);
+ aMap[adPropVariant] = ADOS::MapADOType2Jdbc(adPropVariant);
+ aMap[adVarNumeric] = ADOS::MapADOType2Jdbc(adVarNumeric);
+ aMap[adArray] = ADOS::MapADOType2Jdbc(adArray);
m_aValueRange[2] = aMap;
diff --git a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSetMetaData.cxx b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSetMetaData.cxx
index a6c7fcc66c88..315256501c67 100644
--- a/connectivity/source/drivers/ado/ADatabaseMetaDataResultSetMetaData.cxx
+++ b/connectivity/source/drivers/ado/ADatabaseMetaDataResultSetMetaData.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ADatabaseMetaDataResultSetMetaData.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: oj $ $Date: 2000-10-24 16:11:26 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:31:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -369,8 +369,9 @@ sal_Int32 ODatabaseMetaDataResultSetMetaData::MapADOType2Jdbc(DataTypeEnum eType
case adUnsignedTinyInt:
case adTinyInt: return DataType::TINYINT; break;
default:
- ;
+ OSL_ENSURE(0,"MapADOType2Jdbc: Unknown Type!");
}
+ return DataType::VARCHAR;
}
// -------------------------------------------------------------------------
void ODatabaseMetaDataResultSetMetaData::setColumnPrivilegesMap()
diff --git a/connectivity/source/drivers/ado/ADriver.cxx b/connectivity/source/drivers/ado/ADriver.cxx
index f0b8ce81a1bf..afa14420073d 100644
--- a/connectivity/source/drivers/ado/ADriver.cxx
+++ b/connectivity/source/drivers/ado/ADriver.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ADriver.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:14:20 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:31:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -65,9 +65,9 @@
#ifndef _CONNECTIVITY_ADO_ACONNECTION_HXX_
#include "ado/AConnection.hxx"
#endif
-#ifndef _CONNECTIVITY_ADO_AWRAPADOX_HXX_
-#include "ado/Awrapadox.hxx"
-#endif
+//#ifndef _CONNECTIVITY_ADO_AWRAPADOX_HXX_
+//#include "ado/Awrapadox.hxx"
+//#endif
#ifndef _CONNECTIVITY_ADO_AWRAPADO_HXX_
#include "ado/Awrapado.hxx"
#endif
diff --git a/connectivity/source/drivers/ado/AIndex.cxx b/connectivity/source/drivers/ado/AIndex.cxx
index c6406615cd78..9cdb61d8108f 100644
--- a/connectivity/source/drivers/ado/AIndex.cxx
+++ b/connectivity/source/drivers/ado/AIndex.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AIndex.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: oj $ $Date: 2000-11-03 14:09:51 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:31:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -81,6 +81,9 @@
#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_
#include "propertyids.hxx"
#endif
+#ifndef _COMPHELPER_EXTRACT_HXX_
+#include <comphelper/extract.hxx>
+#endif
using namespace connectivity::ado;
using namespace com::sun::star::uno;
@@ -109,38 +112,27 @@ void WpADOIndex::Create()
}
}
// -------------------------------------------------------------------------
-OAdoIndex::OAdoIndex(sal_Bool _bCase, ADOIndex* _pIndex) : OIndex_ADO(_bCase)
+OAdoIndex::OAdoIndex(sal_Bool _bCase,OConnection* _pConnection,ADOIndex* _pIndex)
+ : OIndex_ADO(::rtl::OUString(),::rtl::OUString(),sal_False,sal_False,sal_False,_bCase)
+ ,m_pConnection(_pConnection)
{
construct();
- if(_pIndex)
- m_aIndex = WpADOIndex(_pIndex);
- else
- m_aIndex.Create();
+ m_aIndex = WpADOIndex(_pIndex);
+ fillPropertyValues();
refreshColumns();
}
// -------------------------------------------------------------------------
-OAdoIndex::OAdoIndex( const ::rtl::OUString& _Name,
- const ::rtl::OUString& _Catalog,
- sal_Bool _isUnique,
- sal_Bool _isPrimaryKeyIndex,
- sal_Bool _isClustered,
- sal_Bool _bCase
- ) : OIndex_ADO(_Name,
- _Catalog,
- _isUnique,
- _isPrimaryKeyIndex,
- _isClustered,_bCase)
+OAdoIndex::OAdoIndex(sal_Bool _bCase,OConnection* _pConnection)
+ : OIndex_ADO(_bCase)
+ ,m_pConnection(_pConnection)
{
construct();
m_aIndex.Create();
- m_aIndex.put_Name(_Name);
- m_aIndex.put_Unique(_isUnique);
- m_aIndex.put_PrimaryKey(_isPrimaryKeyIndex);
- m_aIndex.put_Clustered(_isClustered);
refreshColumns();
}
+
// -------------------------------------------------------------------------
void OAdoIndex::refreshColumns()
@@ -167,7 +159,7 @@ void OAdoIndex::refreshColumns()
}
if(m_pColumns)
delete m_pColumns;
- m_pColumns = new OColumns(*this,m_aMutex,aVector,pColumns,isCaseSensitive());
+ m_pColumns = new OColumns(*this,m_aMutex,aVector,pColumns,isCaseSensitive(),m_pConnection);
}
// -------------------------------------------------------------------------
@@ -200,7 +192,6 @@ void SAL_CALL OAdoIndex::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,cons
{
if(m_aIndex.IsValid())
{
-
switch(nHandle)
{
case PROPERTY_ID_NAME:
@@ -228,39 +219,17 @@ void SAL_CALL OAdoIndex::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,cons
break;
}
}
+ OIndex_ADO::setFastPropertyValue_NoBroadcast(nHandle,rValue);
}
// -------------------------------------------------------------------------
-void SAL_CALL OAdoIndex::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
+void OAdoIndex::fillPropertyValues()
{
if(m_aIndex.IsValid())
{
- switch(nHandle)
- {
- case PROPERTY_ID_NAME:
- rValue <<= m_aIndex.get_Name();
- break;
- case PROPERTY_ID_CATALOG:
- // rValue <<= getResultSetType();
- break;
- case PROPERTY_ID_ISUNIQUE:
- {
- sal_Bool _b = m_aIndex.get_Unique();
- rValue <<= Any(&_b, ::getBooleanCppuType());
- }
- break;
- case PROPERTY_ID_ISPRIMARYKEYINDEX:
- {
- sal_Bool _b = m_aIndex.get_PrimaryKey();
- rValue <<= Any(&_b, ::getBooleanCppuType());
- }
- break;
- case PROPERTY_ID_ISCLUSTERED:
- {
- sal_Bool _b = m_aIndex.get_Clustered();
- rValue <<= Any(&_b, ::getBooleanCppuType());
- }
- break;
- }
+ m_Name = m_aIndex.get_Name();
+ m_IsUnique = m_aIndex.get_Unique();
+ m_IsPrimaryKeyIndex = m_aIndex.get_PrimaryKey();
+ m_IsClustered = m_aIndex.get_Clustered();
}
}
// -----------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/ado/AIndexes.cxx b/connectivity/source/drivers/ado/AIndexes.cxx
index ac5593641657..9f8baa47ab91 100644
--- a/connectivity/source/drivers/ado/AIndexes.cxx
+++ b/connectivity/source/drivers/ado/AIndexes.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AIndexes.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: oj $ $Date: 2001-03-30 14:07:20 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:31:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -92,7 +92,7 @@ Reference< XNamed > OIndexes::createObject(const ::rtl::OUString& _rName)
ADOIndex* pIndex = NULL;
m_pCollection->get_Item(OLEVariant(_rName),&pIndex);
- Reference< XNamed > xRet = new OAdoIndex(isCaseSensitive(),pIndex);
+ Reference< XNamed > xRet = new OAdoIndex(isCaseSensitive(),m_pConnection,pIndex);
return xRet;
}
@@ -104,7 +104,7 @@ void OIndexes::impl_refresh() throw(RuntimeException)
// -------------------------------------------------------------------------
Reference< XPropertySet > OIndexes::createEmptyObject()
{
- OAdoIndex* pNew = new OAdoIndex(isCaseSensitive());
+ OAdoIndex* pNew = new OAdoIndex(isCaseSensitive(),m_pConnection);
return pNew;
}
// -------------------------------------------------------------------------
@@ -117,8 +117,11 @@ void SAL_CALL OIndexes::appendByDescriptor( const Reference< XPropertySet >& des
if(xTunnel.is())
{
OAdoIndex* pIndex = (OAdoIndex*)xTunnel->getSomething(OAdoIndex:: getUnoTunnelImplementationId());
- m_pCollection->Append(OLEVariant(getString(descriptor->getPropertyValue(PROPERTY_NAME))),
- OLEVariant(pIndex->getImpl()));
+ if(pIndex)
+ m_pCollection->Append(OLEVariant(getString(descriptor->getPropertyValue(PROPERTY_NAME))),
+ OLEVariant(pIndex->getImpl()));
+ else
+ throw SQLException(::rtl::OUString::createFromAscii("Could not append index!"),*this,SQLSTATE_GENERAL,1000,Any());
}
OCollection_TYPE::appendByDescriptor(descriptor);
diff --git a/connectivity/source/drivers/ado/AKey.cxx b/connectivity/source/drivers/ado/AKey.cxx
index c9edfdcde560..59d15c79ed43 100644
--- a/connectivity/source/drivers/ado/AKey.cxx
+++ b/connectivity/source/drivers/ado/AKey.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AKey.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: oj $ $Date: 2000-11-03 14:09:51 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:31:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -77,6 +77,9 @@
#ifndef _COM_SUN_STAR_SDBC_KEYRULE_HPP_
#include <com/sun/star/sdbc/KeyRule.hpp>
#endif
+#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_
+#include <com/sun/star/sdbcx/KeyType.hpp>
+#endif
#ifndef _CONNECTIVITY_ADO_COLUMNS_HXX_
#include "ado/AColumns.hxx"
#endif
@@ -89,6 +92,7 @@ using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
+using namespace com::sun::star::sdbcx;
// -------------------------------------------------------------------------
void WpADOKey::Create()
@@ -111,36 +115,22 @@ void WpADOKey::Create()
}
}
// -------------------------------------------------------------------------
-OAdoKey::OAdoKey(sal_Bool _bCase, ADOKey* _pKey) : OKey_ADO(_bCase)
+OAdoKey::OAdoKey(sal_Bool _bCase,OConnection* _pConnection, ADOKey* _pKey)
+ : OKey_ADO(_bCase)
+ ,m_pConnection(_pConnection)
{
construct();
- if(_pKey)
- m_aKey = WpADOKey(_pKey);
- else
- m_aKey.Create();
-
+ m_aKey = WpADOKey(_pKey);
+ fillPropertyValues();
refreshColumns();
}
// -------------------------------------------------------------------------
-OAdoKey::OAdoKey( const ::rtl::OUString& _Name,
- const ::rtl::OUString& _ReferencedTable,
- sal_Int32 _Type,
- sal_Int32 _UpdateRule,
- sal_Int32 _DeleteRule,
- sal_Bool _bCase
- ) : OKey_ADO(_Name,
- _ReferencedTable,
- _Type,
- _UpdateRule,
- _DeleteRule,_bCase)
+OAdoKey::OAdoKey(sal_Bool _bCase,OConnection* _pConnection)
+ : OKey_ADO(_bCase)
+ ,m_pConnection(_pConnection)
{
construct();
m_aKey.Create();
- m_aKey.put_Name(_Name);
- m_aKey.put_UpdateRule(Map2Rule(_UpdateRule));
- m_aKey.put_DeleteRule(Map2Rule(_DeleteRule));
- m_aKey.put_RelatedTable(_ReferencedTable);
- m_aKey.put_Type((KeyTypeEnum)_Type);
refreshColumns();
}
@@ -168,7 +158,7 @@ void OAdoKey::refreshColumns()
}
}
- m_pColumns = new OColumns(*this,m_aMutex,aVector,pColumns,isCaseSensitive());
+ m_pColumns = new OColumns(*this,m_aMutex,aVector,pColumns,isCaseSensitive(),m_pConnection);
}
// -------------------------------------------------------------------------
Sequence< sal_Int8 > OAdoKey::getUnoTunnelImplementationId()
@@ -200,7 +190,6 @@ void OAdoKey::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rVal
{
if(m_aKey.IsValid())
{
-
switch(nHandle)
{
case PROPERTY_ID_NAME:
@@ -214,7 +203,7 @@ void OAdoKey::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rVal
{
sal_Int32 nVal=0;
rValue >>= nVal;
- m_aKey.put_Type((KeyTypeEnum)nVal);
+ m_aKey.put_Type(Map2KeyRule(nVal));
}
break;
case PROPERTY_ID_REFERENCEDTABLE:
@@ -240,30 +229,18 @@ void OAdoKey::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rVal
break;
}
}
+ OKey_ADO::setFastPropertyValue_NoBroadcast(nHandle,rValue);
}
// -------------------------------------------------------------------------
-void OAdoKey::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
+void OAdoKey::fillPropertyValues()
{
if(m_aKey.IsValid())
{
- switch(nHandle)
- {
- case PROPERTY_ID_NAME:
- rValue <<= m_aKey.get_Name();
- break;
- case PROPERTY_ID_TYPE:
- rValue <<= (sal_Int32)m_aKey.get_Type();
- break;
- case PROPERTY_ID_REFERENCEDTABLE:
- rValue <<= m_aKey.get_RelatedTable();
- break;
- case PROPERTY_ID_UPDATERULE:
- rValue <<= MapRule(m_aKey.get_UpdateRule());
- break;
- case PROPERTY_ID_DELETERULE:
- rValue <<= MapRule(m_aKey.get_DeleteRule());
- break;
- }
+ m_Type = MapKeyRule(m_aKey.get_Type());
+ m_Name = m_aKey.get_Name();
+ m_ReferencedTable = m_aKey.get_RelatedTable();
+ m_UpdateRule = MapRule(m_aKey.get_UpdateRule());
+ m_DeleteRule = MapRule(m_aKey.get_DeleteRule());
}
}
// -------------------------------------------------------------------------
@@ -273,16 +250,16 @@ sal_Int32 OAdoKey::MapRule(const RuleEnum& _eNum) const
switch(_eNum)
{
case adRICascade:
- eNum = KeyRule::CASCADE;
+ eNum = KeyRule::CASCADE;
break;
case adRISetNull:
- eNum = KeyRule::SET_NULL;
+ eNum = KeyRule::SET_NULL;
break;
case adRINone:
- eNum = KeyRule::NO_ACTION;
+ eNum = KeyRule::NO_ACTION;
break;
case adRISetDefault:
- eNum = KeyRule::SET_DEFAULT;
+ eNum = KeyRule::SET_DEFAULT;
break;
}
return eNum;
@@ -293,21 +270,57 @@ RuleEnum OAdoKey::Map2Rule(const sal_Int32& _eNum) const
RuleEnum eNum = adRINone;
switch(_eNum)
{
- case KeyRule::CASCADE:
+ case KeyRule::CASCADE:
eNum = adRICascade;
break;
- case KeyRule::SET_NULL:
+ case KeyRule::SET_NULL:
eNum = adRISetNull;
break;
- case KeyRule::NO_ACTION:
+ case KeyRule::NO_ACTION:
eNum = adRINone;
break;
- case KeyRule::SET_DEFAULT:
+ case KeyRule::SET_DEFAULT:
eNum = adRISetDefault;
break;
}
return eNum;
}
+// -------------------------------------------------------------------------
+sal_Int32 OAdoKey::MapKeyRule(const KeyTypeEnum& _eNum) const
+{
+ sal_Int32 nKeyType = KeyType::PRIMARY;
+ switch(_eNum)
+ {
+ case adKeyPrimary:
+ nKeyType = KeyType::PRIMARY;
+ break;
+ case adKeyForeign:
+ nKeyType = KeyType::FOREIGN;
+ break;
+ case adKeyUnique:
+ nKeyType = KeyType::UNIQUE;
+ break;
+ }
+ return nKeyType;
+}
+// -------------------------------------------------------------------------
+KeyTypeEnum OAdoKey::Map2KeyRule(const sal_Int32& _eNum) const
+{
+ KeyTypeEnum eNum;
+ switch(_eNum)
+ {
+ case KeyType::PRIMARY:
+ eNum = adKeyPrimary;
+ break;
+ case KeyType::FOREIGN:
+ eNum = adKeyForeign;
+ break;
+ case KeyType::UNIQUE:
+ eNum = adKeyUnique;
+ break;
+ }
+ return eNum;
+}
// -----------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/ado/AKeys.cxx b/connectivity/source/drivers/ado/AKeys.cxx
index f3b246e2a236..f59de10e8205 100644
--- a/connectivity/source/drivers/ado/AKeys.cxx
+++ b/connectivity/source/drivers/ado/AKeys.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AKeys.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: oj $ $Date: 2001-03-30 14:07:20 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:31:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -95,7 +95,7 @@ Reference< XNamed > OKeys::createObject(const ::rtl::OUString& _rName)
ADOKey* pKey = NULL;
m_pCollection->get_Item(OLEVariant(_rName),&pKey);
- Reference< XNamed > xRet = new OAdoKey(isCaseSensitive(),pKey);
+ Reference< XNamed > xRet = new OAdoKey(isCaseSensitive(),m_pConnection,pKey);
return xRet;
}
@@ -107,7 +107,7 @@ void OKeys::impl_refresh() throw(RuntimeException)
// -------------------------------------------------------------------------
Reference< XPropertySet > OKeys::createEmptyObject()
{
- OAdoKey* pNew = new OAdoKey(isCaseSensitive());
+ OAdoKey* pNew = new OAdoKey(isCaseSensitive(),m_pConnection);
return pNew;
}
// -------------------------------------------------------------------------
@@ -120,12 +120,17 @@ void SAL_CALL OKeys::appendByDescriptor( const Reference< XPropertySet >& descri
if(xTunnel.is())
{
OAdoKey* pKey = (OAdoKey*)xTunnel->getSomething(OAdoKey:: getUnoTunnelImplementationId());
- // To pass as column parameter to Key's Apppend method
- OLEVariant vOptional;
- vOptional.vt = VT_ERROR;
- vOptional.scode = DISP_E_PARAMNOTFOUND;
+ if(pKey)
+ {
+ // To pass as column parameter to Key's Apppend method
+ OLEVariant vOptional;
+ vOptional.vt = VT_ERROR;
+ vOptional.scode = DISP_E_PARAMNOTFOUND;
- m_pCollection->Append(OLEVariant(pKey->getImpl()),(KeyTypeEnum)getINT32(descriptor->getPropertyValue(PROPERTY_TYPE)),vOptional);
+ m_pCollection->Append(OLEVariant(pKey->getImpl()),(KeyTypeEnum)getINT32(descriptor->getPropertyValue(PROPERTY_TYPE)),vOptional);
+ }
+ else
+ throw SQLException(::rtl::OUString::createFromAscii("Could not append key!"),*this,SQLSTATE_GENERAL,1000,Any());
}
OCollection_TYPE::appendByDescriptor(descriptor);
diff --git a/connectivity/source/drivers/ado/APreparedStatement.cxx b/connectivity/source/drivers/ado/APreparedStatement.cxx
index 5f94e50731ce..7a131f7a785f 100644
--- a/connectivity/source/drivers/ado/APreparedStatement.cxx
+++ b/connectivity/source/drivers/ado/APreparedStatement.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: APreparedStatement.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: oj $ $Date: 2001-01-09 12:39:08 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:31:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -97,8 +97,9 @@ using namespace com::sun::star::util;
IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbcx.APreparedStatement","com.sun.star.sdbc.PreparedStatement");
-OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const ::std::vector<OTypeInfo>& _TypeInfo,const ::rtl::OUString& sql)
- : OStatement_Base( _pConnection ),m_aTypeInfo(_TypeInfo)
+OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const OTypeInfoMap& _TypeInfo,const ::rtl::OUString& sql)
+ : OStatement_Base( _pConnection )
+ ,m_aTypeInfo(_TypeInfo)
{
osl_incrementInterlockedCount( &m_refCount );
@@ -144,8 +145,7 @@ Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( ) thr
// -------------------------------------------------------------------------
void OPreparedStatement::disposing()
{
- if(m_RecordSet.IsValid())
- m_RecordSet.Close();
+ m_xMetaData = NULL;
if(m_pParameters)
m_pParameters->Release();
OStatement_Base::disposing();
@@ -179,7 +179,7 @@ sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeExc
// Reset the statement handle, warning and saved Resultset
- reset();
+ // reset();
// Call SQLExecute
@@ -235,9 +235,13 @@ void OPreparedStatement::setParameter(sal_Int32 parameterIndex, const DataTypeEn
else
{
ADOParameter* pParam = NULL;
- m_pParameters->get_Item(OLEVariant(parameterIndex-1),&pParam);
+ m_pParameters->get_Item(OLEVariant(sal_Int32(parameterIndex-1)),&pParam);
+ WpADOParameter aParam(pParam);
if(pParam)
- pParam->put_Value(_Val);
+ {
+ ::rtl::OUString sParam = aParam.GetName();
+ CHECK_RETURN(aParam.PutValue(_Val));
+ }
}
ADOS::ThrowException(*m_pConnection->getConnection(),*this);
}
@@ -264,22 +268,30 @@ Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLE
if (OStatement_BASE::rBHelper.bDisposed)
throw DisposedException();
- WpADORecordset aSet;
- aSet.Create();
+ // first clear the old things
+ m_xMetaData = NULL;
+ disposeResultSet();
+ if(m_RecordSet.IsValid())
+ m_RecordSet.Close();
+ m_RecordSet.clear();
+
+
+ // the create the new onces
+ m_RecordSet.Create();
OLEVariant aCmd;
aCmd.setIDispatch(m_Command);
OLEVariant aCon;
aCon.setNoArg();
- CHECK_RETURN(aSet.put_CacheSize(m_nFetchSize))
- CHECK_RETURN(aSet.put_MaxRecords(m_nMaxRows))
- CHECK_RETURN(aSet.Open(aCmd,aCon,m_eCursorType,m_eLockType,adOpenUnspecified))
+ CHECK_RETURN(m_RecordSet.put_CacheSize(m_nFetchSize))
+ CHECK_RETURN(m_RecordSet.put_MaxRecords(m_nMaxRows))
+ CHECK_RETURN(m_RecordSet.Open(aCmd,aCon,m_eCursorType,m_eLockType,adOpenUnspecified))
- CHECK_RETURN(aSet.get_CacheSize(m_nFetchSize))
- CHECK_RETURN(aSet.get_MaxRecords(m_nMaxRows))
- CHECK_RETURN(aSet.get_CursorType(m_eCursorType))
- CHECK_RETURN(aSet.get_LockType(m_eLockType))
+ CHECK_RETURN(m_RecordSet.get_CacheSize(m_nFetchSize))
+ CHECK_RETURN(m_RecordSet.get_MaxRecords(m_nMaxRows))
+ CHECK_RETURN(m_RecordSet.get_CursorType(m_eCursorType))
+ CHECK_RETURN(m_RecordSet.get_LockType(m_eLockType))
- OResultSet* pSet = new OResultSet(aSet,this);
+ OResultSet* pSet = new OResultSet(m_RecordSet,this);
Reference< XResultSet > pRs = pSet;
m_xResultSet = WeakReference<XResultSet>(pRs);
@@ -408,6 +420,12 @@ 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)
{
+ if(x.is())
+ {
+ Sequence< sal_Int8 > aData;
+ x->readBytes(aData,length);
+ setBytes(parameterIndex,aData);
+ }
}
// -------------------------------------------------------------------------
@@ -443,5 +461,7 @@ Sequence< sal_Int32 > SAL_CALL OPreparedStatement::executeBatch( ) throw(SQLExc
{
return Sequence< sal_Int32 > ();
}
+// -----------------------------------------------------------------------------
+
diff --git a/connectivity/source/drivers/ado/AResultSet.cxx b/connectivity/source/drivers/ado/AResultSet.cxx
index fff13003030c..1d41c9b764eb 100644
--- a/connectivity/source/drivers/ado/AResultSet.cxx
+++ b/connectivity/source/drivers/ado/AResultSet.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AResultSet.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: jl $ $Date: 2001-03-21 13:40:22 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:31:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -103,6 +103,13 @@
#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
#include <com/sun/star/beans/PropertyAttribute.hpp>
#endif
+#ifndef _COMPHELPER_SEQSTREAM_HXX
+#include <comphelper/seqstream.hxx>
+#endif
+#ifndef _COMPHELPER_SEQSTREAM_HXX
+#include <comphelper/seqstream.hxx>
+#endif
+
#include <oledb.h>
@@ -158,7 +165,7 @@ OResultSet::OResultSet(ADORecordset* _pRecordSet,OStatement_Base* pStmt) : ORes
m_pRecordSet->AddRef();
VARIANT_BOOL bIsAtBOF;
CHECK_RETURN(m_pRecordSet->get_BOF(&bIsAtBOF))
- m_bOnFirstAfterOpen = !(sal_Bool)bIsAtBOF;
+ m_bOnFirstAfterOpen = bIsAtBOF != VARIANT_TRUE;
osl_decrementInterlockedCount( &m_refCount );
}
// -------------------------------------------------------------------------
@@ -176,7 +183,7 @@ OResultSet::OResultSet(ADORecordset* _pRecordSet) : OResultSet_BASE(m_aMutex)
m_pRecordSet->AddRef();
VARIANT_BOOL bIsAtBOF;
CHECK_RETURN(m_pRecordSet->get_BOF(&bIsAtBOF))
- m_bOnFirstAfterOpen = !(sal_Bool)bIsAtBOF;
+ m_bOnFirstAfterOpen = bIsAtBOF != VARIANT_TRUE;
osl_decrementInterlockedCount( &m_refCount );
// allocBuffer();
}
@@ -232,13 +239,46 @@ sal_Int32 SAL_CALL OResultSet::findColumn( const ::rtl::OUString& columnName ) t
break;
return i;
}
+#define BLOCK_SIZE 256
// -------------------------------------------------------------------------
Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
if (OResultSet_BASE::rBHelper.bDisposed)
throw DisposedException();
- return NULL;
+ ADO_GETFIELD(columnIndex);
+ if((aField.GetAttributes() & adFldLong) == adFldLong)
+ {
+ //Copy the data only upto the Actual Size of Field.
+ sal_Int32 nSize = aField.GetActualSize();
+ Sequence<sal_Int8> aData(nSize);
+ long index = 0;
+ while(index < nSize)
+ {
+ m_aValue = aField.GetChunk(BLOCK_SIZE);
+ if(m_aValue.isNull())
+ break;
+ UCHAR chData;
+ for(long index2 = 0;index2 < BLOCK_SIZE;++index2)
+ {
+ HRESULT hr = ::SafeArrayGetElement(m_aValue.parray,&index2,&chData);
+ if(SUCCEEDED(hr))
+ {
+ //Take BYTE by BYTE and advance Memory Location
+ aData.getArray()[index++] = chData;
+ }
+ else
+ break;
+ }
+ }
+
+ return new ::comphelper::SequenceInputStream(aData);
+ }
+ // else we ask for a bytesequence
+ aField.get_Value(m_aValue);
+ if(m_aValue.isNull())
+ return NULL;
+ return new ::comphelper::SequenceInputStream(m_aValue);
}
// -------------------------------------------------------------------------
Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
@@ -257,6 +297,8 @@ sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLExcep
throw DisposedException();
ADO_GETFIELD(columnIndex);
aField.get_Value(m_aValue);
+ if(m_aValue.isNull())
+ return sal_False;
return m_aValue;
}
// -------------------------------------------------------------------------
@@ -268,6 +310,8 @@ sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 columnIndex ) throw(SQLExceptio
throw DisposedException();
ADO_GETFIELD(columnIndex);
aField.get_Value(m_aValue);
+ if(m_aValue.isNull())
+ return 0;
return m_aValue;
}
// -------------------------------------------------------------------------
@@ -279,6 +323,8 @@ Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) thro
throw DisposedException();
ADO_GETFIELD(columnIndex);
aField.get_Value(m_aValue);
+ if(m_aValue.isNull())
+ return Sequence< sal_Int8 >();
return m_aValue;
}
// -------------------------------------------------------------------------
@@ -291,6 +337,8 @@ Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) thro
ADO_GETFIELD(columnIndex);
aField.get_Value(m_aValue);
+ if(m_aValue.isNull())
+ return ::com::sun::star::util::Date();
return m_aValue;
}
// -------------------------------------------------------------------------
@@ -303,6 +351,8 @@ double SAL_CALL OResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLExceptio
ADO_GETFIELD(columnIndex);
aField.get_Value(m_aValue);
+ if(m_aValue.isNull())
+ return 0;
return m_aValue;
}
// -------------------------------------------------------------------------
@@ -315,6 +365,8 @@ float SAL_CALL OResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException,
ADO_GETFIELD(columnIndex);
aField.get_Value(m_aValue);
+ if(m_aValue.isNull())
+ return 0;
return m_aValue;
}
// -------------------------------------------------------------------------
@@ -327,6 +379,8 @@ sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 columnIndex ) throw(SQLExceptio
ADO_GETFIELD(columnIndex);
aField.get_Value(m_aValue);
+ if(m_aValue.isNull())
+ return 0;
return m_aValue;
}
// -------------------------------------------------------------------------
@@ -351,6 +405,8 @@ sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 columnIndex ) throw(SQLExcepti
throw DisposedException();
ADO_GETFIELD(columnIndex);
+ if(m_aValue.isNull())
+ return 0;
return sal_Int64(0);
}
// -------------------------------------------------------------------------
@@ -409,6 +465,8 @@ sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLExcept
ADO_GETFIELD(columnIndex);
aField.get_Value(m_aValue);
+ if(m_aValue.isNull())
+ return 0;
return m_aValue;
}
// -------------------------------------------------------------------------
@@ -421,6 +479,8 @@ sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLExcept
ADO_GETFIELD(columnIndex);
m_aValue = aField.get_Value();
+ if(m_aValue.isNull())
+ return ::rtl::OUString();
return m_aValue;
}
@@ -435,6 +495,8 @@ sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLExcept
ADO_GETFIELD(columnIndex);
aField.get_Value(m_aValue);
+ if(m_aValue.isNull())
+ return ::com::sun::star::util::Time();
return m_aValue;
}
// -------------------------------------------------------------------------
@@ -448,6 +510,8 @@ sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLExcept
ADO_GETFIELD(columnIndex);
aField.get_Value(m_aValue);
+ if(m_aValue.isNull())
+ return ::com::sun::star::util::DateTime();
return m_aValue;
}
// -------------------------------------------------------------------------
@@ -458,9 +522,9 @@ sal_Bool SAL_CALL OResultSet::isAfterLast( ) throw(SQLException, RuntimeExcepti
if (OResultSet_BASE::rBHelper.bDisposed)
throw DisposedException();
- sal_Int16 bIsAtEOF;
+ VARIANT_BOOL bIsAtEOF;
CHECK_RETURN(m_pRecordSet->get_EOF(&bIsAtEOF))
- return bIsAtEOF;
+ return bIsAtEOF == VARIANT_TRUE;
}
// -------------------------------------------------------------------------
sal_Bool SAL_CALL OResultSet::isFirst( ) throw(SQLException, RuntimeException)
@@ -556,7 +620,7 @@ sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, Runt
if(bCheck = SUCCEEDED(m_pRecordSet->MoveLast()))
{
while(++row < 0 && bCheck)
- bCheck = m_pRecordSet->MovePrevious();
+ bCheck = SUCCEEDED(m_pRecordSet->MovePrevious());
}
}
else
@@ -649,9 +713,9 @@ sal_Bool SAL_CALL OResultSet::isBeforeFirst( ) throw(SQLException, RuntimeExcep
throw DisposedException();
OSL_ENSURE(!m_nRowPos,"OResultSet::isBeforeFirst: Error in setting m_nRowPos!");
- sal_Int16 bIsAtBOF;
+ VARIANT_BOOL bIsAtBOF;
m_pRecordSet->get_BOF(&bIsAtBOF);
- return bIsAtBOF;
+ return bIsAtBOF == VARIANT_TRUE;
}
// -------------------------------------------------------------------------
@@ -675,7 +739,7 @@ sal_Bool SAL_CALL OResultSet::next( ) throw(SQLException, RuntimeException)
{
VARIANT_BOOL bIsAtEOF;
CHECK_RETURN(m_pRecordSet->get_EOF(&bIsAtEOF))
- bRet = !(sal_Bool)bIsAtEOF;
+ bRet = bIsAtEOF != VARIANT_TRUE;
++m_nRowPos;
}
else
@@ -955,7 +1019,7 @@ Any SAL_CALL OResultSet::getBookmark( ) throw(SQLException, RuntimeException)
if (OResultSet_BASE::rBHelper.bDisposed)
throw DisposedException();
- if(m_nRowPos < m_aBookmarks.size()) // this bookmark was already fetched
+ if(m_nRowPos < (sal_Int32)m_aBookmarks.size()) // this bookmark was already fetched
return makeAny(sal_Int32(m_nRowPos-1));
OLEVariant aVar;
@@ -973,8 +1037,8 @@ sal_Bool SAL_CALL OResultSet::moveToBookmark( const Any& bookmark ) throw(SQLExc
sal_Int32 nPos;
bookmark >>= nPos;
- OSL_ENSURE(nPos >= 0 && nPos < m_aBookmarks.size(),"Invalid Index for vector");
- if(nPos < 0 || nPos >= m_aBookmarks.size())
+ OSL_ENSURE(nPos >= 0 && nPos < (sal_Int32)m_aBookmarks.size(),"Invalid Index for vector");
+ if(nPos < 0 || nPos >= (sal_Int32)m_aBookmarks.size())
throw SQLException();
return SUCCEEDED(m_pRecordSet->Move(0,m_aBookmarks[nPos]));
@@ -989,8 +1053,8 @@ sal_Bool SAL_CALL OResultSet::moveRelativeToBookmark( const Any& bookmark, sal_I
sal_Int32 nPos;
bookmark >>= nPos;
nPos += rows;
- OSL_ENSURE(nPos >= 0 && nPos < m_aBookmarks.size(),"Invalid Index for vector");
- if(nPos < 0 || nPos >= m_aBookmarks.size())
+ OSL_ENSURE(nPos >= 0 && nPos < (sal_Int32)m_aBookmarks.size(),"Invalid Index for vector");
+ if(nPos < 0 || nPos >= (sal_Int32)m_aBookmarks.size())
throw SQLException();
return SUCCEEDED(m_pRecordSet->Move(rows,m_aBookmarks[nPos]));
}
@@ -1008,7 +1072,7 @@ sal_Int32 SAL_CALL OResultSet::compareBookmarks( const Any& first, const Any& se
if(nPos1 == nPos2) // they should be equal
return sal_True;
- OSL_ENSURE((nPos1 >= 0 && nPos1 < m_aBookmarks.size()) || (nPos1 >= 0 && nPos2 < m_aBookmarks.size()),"Invalid Index for vector");
+ OSL_ENSURE((nPos1 >= 0 && nPos1 < (sal_Int32)m_aBookmarks.size()) || (nPos1 >= 0 && nPos2 < (sal_Int32)m_aBookmarks.size()),"Invalid Index for vector");
CompareEnum eNum;
m_pRecordSet->CompareBookmarks(m_aBookmarks[nPos1],m_aBookmarks[nPos2],&eNum);
diff --git a/connectivity/source/drivers/ado/AResultSetMetaData.cxx b/connectivity/source/drivers/ado/AResultSetMetaData.cxx
index 1d0750b46f94..d9580947c215 100644
--- a/connectivity/source/drivers/ado/AResultSetMetaData.cxx
+++ b/connectivity/source/drivers/ado/AResultSetMetaData.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AResultSetMetaData.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: oj $ $Date: 2000-10-24 16:11:26 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:31:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -171,7 +171,7 @@ sal_Bool SAL_CALL OResultSetMetaData::isCurrency( sal_Int32 column ) throw(SQLEx
ADO_GETFIELD(column);
if(aField.IsValid())
{
- return (aField.GetAttributes() & adFldFixed) == adFldFixed;
+ return ((aField.GetAttributes() & adFldFixed) == adFldFixed) && (aField.GetADOType() == adCurrency);
}
return sal_False;
}
diff --git a/connectivity/source/drivers/ado/AStatement.cxx b/connectivity/source/drivers/ado/AStatement.cxx
index d444ae60c306..c57762865075 100644
--- a/connectivity/source/drivers/ado/AStatement.cxx
+++ b/connectivity/source/drivers/ado/AStatement.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AStatement.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: oj $ $Date: 2000-10-24 16:11:26 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:31:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -293,7 +293,7 @@ sal_Int32 OStatement_Base::getPrecision ( sal_Int32 sqlType)
sal_Int32 prec = -1;
OTypeInfo aInfo;
- aInfo.nType = sqlType;
+ aInfo.nType = (sal_Int16)sqlType;
if (m_aTypeInfo.size())
{
::std::vector<OTypeInfo>::const_iterator aIter = ::std::find(m_aTypeInfo.begin(),m_aTypeInfo.end(),aInfo);
diff --git a/connectivity/source/drivers/ado/ATable.cxx b/connectivity/source/drivers/ado/ATable.cxx
index fedd82e7a898..51b88916b236 100644
--- a/connectivity/source/drivers/ado/ATable.cxx
+++ b/connectivity/source/drivers/ado/ATable.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ATable.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: oj $ $Date: 2001-04-04 09:08:24 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:31:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -134,54 +134,25 @@ void WpADOTable::Create()
}
}
// -------------------------------------------------------------------------
-OAdoTable::OAdoTable(sal_Bool _bCase,_ADOTable* _pTable) : OTable_TYPEDEF(_bCase)
+OAdoTable::OAdoTable(sal_Bool _bCase,OCatalog* _pCatalog,_ADOTable* _pTable)
+ : OTable_TYPEDEF(_bCase,::rtl::OUString(),::rtl::OUString())
+ ,m_pCatalog(_pCatalog)
{
construct();
- if(_pTable)
- m_aTable = WpADOTable(_pTable);
- else
- m_aTable.Create();
+ m_aTable = WpADOTable(_pTable);
+ fillPropertyValues();
refreshColumns();
refreshKeys();
refreshIndexes();
}
-// -------------------------------------------------------------------------
-OAdoTable::OAdoTable(sal_Bool _bCase, const ::rtl::OUString& _Name,
- const ::rtl::OUString& _Type,
- const ::rtl::OUString& _Description ,
- const ::rtl::OUString& _SchemaName,
- const ::rtl::OUString& _CatalogName
- ) : OTable_TYPEDEF(_bCase,_Name,
- _Type,
- _Description,
- _SchemaName,
- _CatalogName)
+// -----------------------------------------------------------------------------
+OAdoTable::OAdoTable(sal_Bool _bCase,OCatalog* _pCatalog)
+ : OTable_TYPEDEF(_bCase)
+ ,m_pCatalog(_pCatalog)
{
construct();
m_aTable.Create();
- m_aTable.put_Name(_Name);
- {
- ADOProperties* pProps = m_aTable.get_Properties();
- pProps->AddRef();
- ADOProperty* pProp = NULL;
- pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("Type")),&pProp);
- WpADOProperty aProp(pProp);
- if(pProp)
- aProp.PutValue(_Type);
- pProps->Release();
- }
- {
- ADOProperties* pProps = m_aTable.get_Properties();
- pProps->AddRef();
- ADOProperty* pProp = NULL;
- pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("Description")),&pProp);
- WpADOProperty aProp(pProp);
- if(pProp)
- aProp.PutValue(_Description);
- pProps->Release();
- }
-
refreshColumns();
refreshKeys();
@@ -211,7 +182,7 @@ void OAdoTable::refreshColumns()
}
}
- m_pColumns = new OColumns(*this,m_aMutex,aVector,pColumns,isCaseSensitive());
+ m_pColumns = new OColumns(*this,m_aMutex,aVector,pColumns,isCaseSensitive(),m_pCatalog->getConnection());
}
// -------------------------------------------------------------------------
void OAdoTable::refreshKeys()
@@ -237,7 +208,7 @@ void OAdoTable::refreshKeys()
}
}
- m_pKeys = new OKeys(*this,m_aMutex,aVector,pKeys,isCaseSensitive());
+ m_pKeys = new OKeys(*this,m_aMutex,aVector,pKeys,isCaseSensitive(),m_pCatalog->getConnection());
}
// -------------------------------------------------------------------------
void OAdoTable::refreshIndexes()
@@ -263,7 +234,7 @@ void OAdoTable::refreshIndexes()
}
}
- m_pIndexes = new OIndexes(*this,m_aMutex,aVector,pIndexes,isCaseSensitive());
+ m_pIndexes = new OIndexes(*this,m_aMutex,aVector,pIndexes,isCaseSensitive(),m_pCatalog->getConnection());
}
//--------------------------------------------------------------------------
Sequence< sal_Int8 > OAdoTable::getUnoTunnelImplementationId()
@@ -312,8 +283,13 @@ void SAL_CALL OAdoTable::alterColumnByName( const ::rtl::OUString& colName, cons
if(xTunnel.is())
{
OAdoColumn* pColumn = (OAdoColumn*)xTunnel->getSomething(OAdoColumn:: getUnoTunnelImplementationId());
- m_aTable.get_Columns()->Delete(OLEVariant(colName));
- m_aTable.get_Columns()->Append(OLEVariant(pColumn->getColumnImpl()));
+ if(pColumn)
+ {
+ m_aTable.get_Columns()->Delete(OLEVariant(colName));
+ m_aTable.get_Columns()->Append(OLEVariant(pColumn->getColumnImpl()));
+ }
+ else
+ throw SQLException(::rtl::OUString::createFromAscii("Could not alter column by name!"),*this,SQLSTATE_GENERAL,1000,Any());
}
refreshColumns();
@@ -330,8 +306,13 @@ void SAL_CALL OAdoTable::alterColumnByIndex( sal_Int32 index, const Reference< X
if(xTunnel.is())
{
OAdoColumn* pColumn = (OAdoColumn*)xTunnel->getSomething(OAdoColumn:: getUnoTunnelImplementationId());
- m_aTable.get_Columns()->Delete(OLEVariant(index));
- m_aTable.get_Columns()->Append(OLEVariant(pColumn->getColumnImpl()));
+ if(pColumn)
+ {
+ m_aTable.get_Columns()->Delete(OLEVariant(index));
+ m_aTable.get_Columns()->Append(OLEVariant(pColumn->getColumnImpl()));
+ }
+ else
+ throw SQLException(::rtl::OUString::createFromAscii("Could not alter column by index!"),*this,SQLSTATE_GENERAL,1000,Any());
}
}
// -------------------------------------------------------------------------
@@ -374,42 +355,32 @@ void OAdoTable::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rV
throw Exception();
}
}
+ OTable_TYPEDEF::setFastPropertyValue_NoBroadcast(nHandle,rValue);
}
// -------------------------------------------------------------------------
-void OAdoTable::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
+void OAdoTable::fillPropertyValues()
{
if(m_aTable.IsValid())
{
- switch(nHandle)
+ m_Name = m_aTable.get_Name();
+ m_Type = m_aTable.get_Type();
{
- case PROPERTY_ID_NAME:
- rValue <<= m_aTable.get_Name();
- break;
- case PROPERTY_ID_TYPE:
- rValue <<= m_aTable.get_Type();
- break;
- case PROPERTY_ID_CATALOGNAME:
- {
- WpADOCatalog aCat(m_aTable.get_ParentCatalog());
- if(aCat.IsValid())
- rValue <<= aCat.GetObjectOwner(m_aTable.get_Name(),adPermObjTable);
- }
- break;
- case PROPERTY_ID_SCHEMANAME:
- // rValue <<= m_aTable.get_Type();
- break;
- case PROPERTY_ID_DESCRIPTION:
- {
- ADOProperties* pProps = m_aTable.get_Properties();
- pProps->AddRef();
- ADOProperty* pProp = NULL;
- pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("Description")),&pProp);
- WpADOProperty aProp(pProp);
- if(pProp)
- rValue <<= (::rtl::OUString)aProp.GetValue();
- pProps->Release();
- }
- break;
+ WpADOCatalog aCat(m_aTable.get_ParentCatalog());
+ if(aCat.IsValid())
+ m_CatalogName = aCat.GetObjectOwner(m_aTable.get_Name(),adPermObjTable);
+ }
+ {
+ ADOProperties* pProps = m_aTable.get_Properties();
+ if(pProps)
+ {
+ pProps->AddRef();
+ ADOProperty* pProp = NULL;
+ pProps->get_Item(OLEVariant(::rtl::OUString::createFromAscii("Description")),&pProp);
+ WpADOProperty aProp(pProp);
+ if(pProp)
+ m_Description = aProp.GetValue();
+ pProps->Release();
+ }
}
}
}
@@ -418,13 +389,10 @@ void OAdoTable::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
{
OLEVariant _rVar;
_rVar.setNoArg();
- BSTR aBSTR;
- BSTR sStr1 = SysAllocString(_rName.getStr());
+ OLEString aBSTR;
+ OLEString sStr1(_rName);
pInterface->GetObjectOwner(sStr1,_eNum,_rVar,&aBSTR);
- SysFreeString(sStr1);
- rtl::OUString sRetStr((sal_Unicode*)aBSTR);
- SysFreeString(aBSTR);
- return sRetStr;
+ return aBSTR;
}
// -----------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/ado/ATables.cxx b/connectivity/source/drivers/ado/ATables.cxx
index 8825781c41c1..018b477ba474 100644
--- a/connectivity/source/drivers/ado/ATables.cxx
+++ b/connectivity/source/drivers/ado/ATables.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ATables.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: oj $ $Date: 2001-03-30 14:07:20 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:31:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -86,6 +86,10 @@
#ifndef _CONNECTIVITY_ADO_BCONNECTION_HXX_
#include "ado/AConnection.hxx"
#endif
+#define CONNECTIVITY_PROPERTY_NAME_SPACE ado
+#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_
+#include "propertyids.hxx"
+#endif
using namespace connectivity::ado;
using namespace com::sun::star::uno;
@@ -102,7 +106,7 @@ Reference< XNamed > OTables::createObject(const ::rtl::OUString& _rName)
ADOTable* pTable = NULL;
m_pCollection->get_Item(OLEVariant(_rName),&pTable);
- Reference< XNamed > xRet = new OAdoTable(isCaseSensitive(),pTable);
+ Reference< XNamed > xRet = new OAdoTable(isCaseSensitive(),m_pCatalog,pTable);
return xRet;
}
@@ -114,7 +118,7 @@ void OTables::impl_refresh( ) throw(RuntimeException)
// -------------------------------------------------------------------------
Reference< XPropertySet > OTables::createEmptyObject()
{
- OAdoTable* pNew = new OAdoTable(isCaseSensitive());
+ OAdoTable* pNew = new OAdoTable(isCaseSensitive(),m_pCatalog);
return pNew;
}
// -------------------------------------------------------------------------
@@ -127,7 +131,10 @@ void SAL_CALL OTables::appendByDescriptor( const Reference< XPropertySet >& desc
if(xTunnel.is())
{
OAdoTable* pTable = (OAdoTable*)xTunnel->getSomething(OAdoTable:: getUnoTunnelImplementationId());
- m_pCollection->Append(OLEVariant(pTable->getImpl()));
+ if(pTable)
+ m_pCollection->Append(OLEVariant(pTable->getImpl()));
+ else
+ throw SQLException(::rtl::OUString::createFromAscii("Could not append table!"),*this,SQLSTATE_GENERAL,1000,Any());
}
OCollection_TYPE::appendByDescriptor(descriptor);
diff --git a/connectivity/source/drivers/ado/AUsers.cxx b/connectivity/source/drivers/ado/AUsers.cxx
index 23ca857dfb63..c717b2387f7b 100644
--- a/connectivity/source/drivers/ado/AUsers.cxx
+++ b/connectivity/source/drivers/ado/AUsers.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AUsers.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: oj $ $Date: 2001-03-30 14:07:20 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:33:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -78,6 +78,7 @@
#include "connectivity/sdbcx/IRefreshable.hxx"
#endif
+
using namespace connectivity::ado;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
@@ -115,7 +116,7 @@ void SAL_CALL OUsers::appendByDescriptor( const Reference< XPropertySet >& descr
{
OUserExtend* pUser = (OUserExtend*)xTunnel->getSomething(OUserExtend::getUnoTunnelImplementationId());
if(pUser)
- m_pCollection->Append(OLEVariant(pUser->getImpl()),(BSTR)pUser->getPassword().getStr());
+ m_pCollection->Append(OLEVariant(pUser->getImpl()),OLEString(pUser->getPassword()));
}
OCollection_TYPE::appendByDescriptor(descriptor);
diff --git a/connectivity/source/drivers/ado/AView.cxx b/connectivity/source/drivers/ado/AView.cxx
index 7e7baa34b33b..f1f0fec9a8d3 100644
--- a/connectivity/source/drivers/ado/AView.cxx
+++ b/connectivity/source/drivers/ado/AView.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AView.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: oj $ $Date: 2000-11-03 14:09:51 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:31:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -80,6 +80,7 @@
#ifndef _COMPHELPER_SEQUENCE_HXX_
#include <comphelper/sequence.hxx>
#endif
+
// -------------------------------------------------------------------------
using namespace connectivity::ado;
using namespace com::sun::star::uno;
@@ -195,14 +196,15 @@ void OAdoView::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
if(!aVar.isNull() && !aVar.isEmpty())
{
ADOCommand* pCom = (ADOCommand*)aVar.getIDispatch();
- BSTR aBSTR; pCom->get_CommandText(&aBSTR);
- ::rtl::OUString sRetStr(aBSTR);
- SysFreeString(aBSTR);
- rValue <<= sRetStr;
+ OLEString aBSTR;
+ pCom->get_CommandText(&aBSTR);
+ rValue <<= (::rtl::OUString) aBSTR;
}
}
break;
}
}
}
+// -----------------------------------------------------------------------------
+
diff --git a/connectivity/source/drivers/ado/AViews.cxx b/connectivity/source/drivers/ado/AViews.cxx
index b97c68c0aff7..b6b4ae4ee3b3 100644
--- a/connectivity/source/drivers/ado/AViews.cxx
+++ b/connectivity/source/drivers/ado/AViews.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AViews.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: oj $ $Date: 2001-03-30 14:07:20 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:31:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -128,7 +128,10 @@ void SAL_CALL OViews::appendByDescriptor( const Reference< XPropertySet >& descr
if(xTunnel.is())
{
OAdoView* pView = (OAdoView*)xTunnel->getSomething(OAdoView:: getUnoTunnelImplementationId());
- m_pCollection->Append((BSTR)getString(descriptor->getPropertyValue(PROPERTY_NAME)).getStr(),(IDispatch *)pView->getImpl());
+ if(pView)
+ m_pCollection->Append(OLEString(getString(descriptor->getPropertyValue(PROPERTY_NAME))),(IDispatch *)pView->getImpl());
+ else
+ throw SQLException(::rtl::OUString::createFromAscii("Could not append view!"),*this,SQLSTATE_GENERAL,1000,Any());
}
OCollection_TYPE::appendByDescriptor(descriptor);
diff --git a/connectivity/source/drivers/ado/adoimp.cxx b/connectivity/source/drivers/ado/adoimp.cxx
index 546d449aaaac..4293b79fb5e9 100644
--- a/connectivity/source/drivers/ado/adoimp.cxx
+++ b/connectivity/source/drivers/ado/adoimp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: adoimp.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: jl $ $Date: 2001-03-21 13:40:22 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:31:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -159,71 +159,87 @@ void ADOS::ThrowException(ADOConnection* _pAdoCon,const Reference< XInterface >&
// -------------------------------------------------------------------------
sal_Int32 ADOS::MapADOType2Jdbc(DataTypeEnum eType)
{
+ sal_Int32 nType;
switch (eType)
{
case adUnsignedSmallInt:
- case adSmallInt: return DataType::SMALLINT; break;
+ case adSmallInt: nType = DataType::SMALLINT; break;
case adUnsignedInt:
- case adInteger: return DataType::INTEGER; break;
+ case adInteger: nType = DataType::INTEGER; break;
case adUnsignedBigInt:
- case adBigInt: return DataType::BIGINT; break;
- case adSingle: return DataType::FLOAT; break;
- case adDouble: return DataType::DOUBLE; break;
- case adCurrency: return DataType::DOUBLE; break;
+ case adBigInt: nType = DataType::BIGINT; break;
+ case adSingle: nType = DataType::FLOAT; break;
+ case adDouble: nType = DataType::DOUBLE; break;
+ case adCurrency: nType = DataType::DOUBLE; break;
case adVarNumeric:
- case adNumeric: return DataType::NUMERIC; break;
- case adDecimal: return DataType::DECIMAL; break;
+ case adNumeric: nType = DataType::NUMERIC; break;
+ case adDecimal: nType = DataType::DECIMAL; break;
case adDate:
- case adDBDate: return DataType::DATE; break;
- case adDBTime: return DataType::TIME; break;
- case adDBTimeStamp: return DataType::TIMESTAMP; break;
- case adBoolean: return DataType::BIT; break;
+ case adDBDate: nType = DataType::DATE; break;
+ case adDBTime: nType = DataType::TIME; break;
+ case adDBTimeStamp: nType = DataType::TIMESTAMP; break;
+ case adBoolean: nType = DataType::BIT; break;
+ case adArray: nType = DataType::ARRAY; break;
case adBinary:
- case adGUID: return DataType::BINARY; break;
+ case adGUID: nType = DataType::BINARY; break;
case adBSTR:
case adVarWChar:
- case adVarChar: return DataType::VARCHAR; break;
- case adLongVarWChar:
- case adLongVarChar: return DataType::LONGVARCHAR; break;
- case adVarBinary: return DataType::VARBINARY; break;
- case adLongVarBinary: return DataType::LONGVARBINARY; break;
case adWChar:
- case adChar: return DataType::CHAR; break;
+ case adVarChar: nType = DataType::VARCHAR; break;
+ case adLongVarWChar:
+ case adLongVarChar: nType = DataType::LONGVARCHAR; break;
+ case adVarBinary: nType = DataType::VARBINARY; break;
+ case adLongVarBinary: nType = DataType::LONGVARBINARY;break;
+ case adChar: nType = DataType::CHAR; break;
case adUnsignedTinyInt:
- case adTinyInt: return DataType::TINYINT; break;
+ case adTinyInt: nType = DataType::TINYINT; break;
+ case adEmpty: nType = DataType::SQLNULL; break;
+ case adUserDefined:
+ case adPropVariant:
+ case adFileTime:
+ case adChapter:
+ case adIDispatch:
+ case adIUnknown:
+ case adError:
+ case adVariant:
+ nType = DataType::OTHER; break;
default:
+ OSL_ENSURE(0,"MapADOType2Jdbc: Unknown Type!");
;
}
- return DataType::TINYINT;
+ return nType;
}
// -------------------------------------------------------------------------
DataTypeEnum ADOS::MapJdbc2ADOType(sal_Int32 _nType)
{
switch (_nType)
{
- case DataType::SMALLINT: return adSmallInt; break;
+ case DataType::SMALLINT: return adSmallInt; break;
case DataType::INTEGER: return adInteger; break;
case DataType::BIGINT: return adBigInt; break;
- case DataType::FLOAT: return adSingle; break;
+ case DataType::FLOAT: return adSingle; break;
case DataType::DOUBLE: return adDouble; break;
case DataType::NUMERIC: return adNumeric; break;
case DataType::DECIMAL: return adDecimal; break;
- case DataType::DATE: return adDBDate; break;
- case DataType::TIME: return adDBTime; break;
- case DataType::TIMESTAMP: return adDBTimeStamp; break;
+ case DataType::DATE: return adDBDate; break;
+ case DataType::TIME: return adDBTime; break;
+ case DataType::TIMESTAMP: return adDBTimeStamp; break;
case DataType::BIT: return adBoolean; break;
case DataType::BINARY: return adBinary; break;
case DataType::VARCHAR: return adVarWChar; break;
case DataType::LONGVARCHAR: return adLongVarWChar; break;
- case DataType::VARBINARY: return adVarBinary; break;
- case DataType::LONGVARBINARY: return adLongVarBinary; break;
- case DataType::CHAR: return adWChar; break;
+ case DataType::VARBINARY: return adVarBinary; break;
+ case DataType::LONGVARBINARY: return adLongVarBinary; break;
+ case DataType::CHAR: return adWChar; break;
case DataType::TINYINT: return adTinyInt; break;
default:
+ OSL_ENSURE(0,"MapADOType2Jdbc: Unknown Type!");
;
}
return adEmpty;
}
+// -----------------------------------------------------------------------------
+
diff --git a/connectivity/source/drivers/ado/makefile.mk b/connectivity/source/drivers/ado/makefile.mk
index fdf5d21c52b5..fef8eba5cf21 100644
--- a/connectivity/source/drivers/ado/makefile.mk
+++ b/connectivity/source/drivers/ado/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.4 $
+# $Revision: 1.5 $
#
-# last change: $Author: oj $ $Date: 2001-03-19 09:35:27 $
+# last change: $Author: oj $ $Date: 2001-04-12 12:31:30 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -80,6 +80,7 @@ ENVCFLAGS+=/FR$(SLO)$/
# --- Files -------------------------------------
SLOFILES=\
+ $(SLO)$/ADatabaseMetaData.obj \
$(SLO)$/AColumn.obj \
$(SLO)$/AColumns.obj \
$(SLO)$/AIndex.obj \
@@ -100,7 +101,6 @@ SLOFILES=\
$(SLO)$/ADatabaseMetaDataResultSet.obj \
$(SLO)$/AResultSet.obj \
$(SLO)$/AConnection.obj \
- $(SLO)$/ADatabaseMetaData.obj \
$(SLO)$/AStatement.obj \
$(SLO)$/APreparedStatement.obj \
$(SLO)$/AResultSetMetaData.obj \
diff --git a/connectivity/source/inc/ado/ACallableStatement.hxx b/connectivity/source/inc/ado/ACallableStatement.hxx
index 7009ba80a151..df06557f8915 100644
--- a/connectivity/source/inc/ado/ACallableStatement.hxx
+++ b/connectivity/source/inc/ado/ACallableStatement.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ACallableStatement.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:32:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -84,8 +84,8 @@ namespace connectivity
//**************************************************************
class OCallableStatement : public OPreparedStatement,
- public ::com::sun::star::sdbc::XRow,
- public ::com::sun::star::sdbc::XOutParameters
+ public ::com::sun::star::sdbc::XRow,
+ public ::com::sun::star::sdbc::XOutParameters
{
OLEVariant m_aValue;
public:
@@ -93,34 +93,34 @@ namespace connectivity
DECLARE_SERVICE_INFO();
virtual ~OCallableStatement() {} ;
// ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird:
- OCallableStatement( OConnection* _pConnection,const ::std::vector<OTypeInfo>& _TypeInfo,const ::rtl::OUString& sql );
+ OCallableStatement( OConnection* _pConnection,const OTypeInfoMap& _TypeInfo,const ::rtl::OUString& sql );
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
// XRow
- virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
// XOutParameters
- virtual void SAL_CALL registerOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL registerNumericOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL registerOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL registerNumericOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
};
}
}
diff --git a/connectivity/source/inc/ado/ACollection.hxx b/connectivity/source/inc/ado/ACollection.hxx
index 13d5c91de160..4930e61f4cf6 100644
--- a/connectivity/source/inc/ado/ACollection.hxx
+++ b/connectivity/source/inc/ado/ACollection.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ACollection.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:32:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -220,10 +220,9 @@ namespace connectivity
SimT* pIdx = NULL;
m_pCollection->get_Item(aVar,&pIdx);
pIdx->AddRef();
- BSTR aBSTR;
- pIdx->get_Name(&aBSTR);
- (*pStringArray) = (sal_Unicode*)aBSTR;
- SysFreeString(aBSTR);
+ _bstr_t sBSTR;
+ pIdx->get_Name(&sBSTR);
+ (*pStringArray) = (sal_Unicode*)sBSTR;
pIdx->Release();
++pStringArray;
}
diff --git a/connectivity/source/inc/ado/AColumn.hxx b/connectivity/source/inc/ado/AColumn.hxx
index f19552863681..5feb4333cff5 100644
--- a/connectivity/source/inc/ado/AColumn.hxx
+++ b/connectivity/source/inc/ado/AColumn.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AColumn.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: oj $ $Date: 2000-11-03 13:44:21 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:32:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -73,34 +73,29 @@ namespace connectivity
{
namespace ado
{
+ class OConnection;
typedef sdbcx::OColumn OColumn_ADO;
class OAdoColumn : public OColumn_ADO
{
WpADOColumn m_aColumn;
+ OConnection* m_pConnection;
+ ::rtl::OUString m_ReferencedColumn;
+ sal_Bool m_IsAscending;
+
+ void fillPropertyValues();
protected:
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
sal_Int32 nHandle,
const ::com::sun::star::uno::Any& rValue
)
throw (::com::sun::star::uno::Exception);
- virtual void SAL_CALL getFastPropertyValue(
- ::com::sun::star::uno::Any& rValue,
- sal_Int32 nHandle) const;
public:
DECLARE_CTY_DEFAULTS( OColumn_ADO);
- OAdoColumn(sal_Bool _bCase,_ADOColumn* _pColumn = NULL);
- OAdoColumn(const ::rtl::OUString& _Name,
- const ::rtl::OUString& _TypeName,
- const ::rtl::OUString& _DefaultValue,
- sal_Int32 _IsNullable,
- sal_Int32 _Precision,
- sal_Int32 _Scale,
- sal_Int32 _Type,
- sal_Bool _IsAutoIncrement,
- sal_Bool _IsCurrency,
- sal_Bool _bCase);
-
+ OAdoColumn(sal_Bool _bCase,OConnection* _pConnection,_ADOColumn* _pColumn);
+ OAdoColumn(sal_Bool _bCase,OConnection* _pConnection);
+ // ODescriptor
+ virtual void construct();
// com::sun::star::lang::XUnoTunnel
virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
diff --git a/connectivity/source/inc/ado/AColumns.hxx b/connectivity/source/inc/ado/AColumns.hxx
index 0be84e819525..487129958618 100644
--- a/connectivity/source/inc/ado/AColumns.hxx
+++ b/connectivity/source/inc/ado/AColumns.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AColumns.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:32:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -79,21 +79,25 @@ namespace connectivity
{
namespace ado
{
-
+ class OConnection;
class OColumns : public sdbcx::OCollection
{
protected:
- ADOColumns* m_pCollection;
+ ADOColumns* m_pCollection;
+ OConnection* m_pConnection;
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName);
- virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName);
+ virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject();
public:
OColumns( ::cppu::OWeakObject& _rParent,
::osl::Mutex& _rMutex,
const ::std::vector< ::rtl::OUString> &_rVector,
- ADOColumns* _pCollection,sal_Bool _bCase) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector)
+ ADOColumns* _pCollection,
+ sal_Bool _bCase,
+ OConnection* _pConnection) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector)
,m_pCollection(_pCollection)
+ ,m_pConnection(_pConnection)
{
if(m_pCollection)
m_pCollection->AddRef();
@@ -106,10 +110,10 @@ namespace connectivity
}
// XAppend
- virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException);
// XDrop
- virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL dropByIndex( sal_Int32 index ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL dropByName( const ::rtl::OUString& elementName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL dropByIndex( sal_Int32 index ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
};
}
}
diff --git a/connectivity/source/inc/ado/AConnection.hxx b/connectivity/source/inc/ado/AConnection.hxx
index 12e7a54b0a38..6a95e829e971 100644
--- a/connectivity/source/inc/ado/AConnection.hxx
+++ b/connectivity/source/inc/ado/AConnection.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AConnection.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: oj $ $Date: 2000-11-03 13:44:21 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:32:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -104,23 +104,25 @@ namespace connectivity
::com::sun::star::lang::XServiceInfo> OConnection_BASE;
class WpADOConnection;
class ODriver;
+ typedef ::std::multimap<sal_Int32, ::connectivity::OTypeInfo> OTypeInfoMap;
+
class OConnection : public OConnection_BASE,
public connectivity::OSubComponent<OConnection>
{
friend class connectivity::OSubComponent<OConnection>;
- ::osl::Mutex m_aMutex;
+ ::osl::Mutex m_aMutex;
protected:
//====================================================================
// Data attributes
//====================================================================
- ::std::vector<connectivity::OTypeInfo> m_aTypeInfo; // vector containing an entry
+ OTypeInfoMap m_aTypeInfo; // vector containing an entry
// for each row returned by
// DatabaseMetaData.getTypeInfo.
::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData;
- connectivity::OWeakRefArray m_aStatements; // vector containing a list
+ connectivity::OWeakRefArray m_aStatements; // vector containing a list
// of all the Statement objects
// for this Connection
::com::sun::star::uno::WeakReference< ::com::sun::star::sdbcx::XTablesSupplier> m_xCatalog;
@@ -176,6 +178,7 @@ namespace connectivity
//
WpADOConnection* getConnection() { return m_pAdoConnection; }
void setCatalog(const ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbcx::XTablesSupplier>& _xCat) { m_xCatalog = _xCat; }
+ const OTypeInfoMap* getTypeInfo() const { return &m_aTypeInfo;}
};
}
}
diff --git a/connectivity/source/inc/ado/AIndex.hxx b/connectivity/source/inc/ado/AIndex.hxx
index fb3125827859..50017075a536 100644
--- a/connectivity/source/inc/ado/AIndex.hxx
+++ b/connectivity/source/inc/ado/AIndex.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AIndex.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: oj $ $Date: 2000-11-03 13:44:21 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:32:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -78,26 +78,21 @@ namespace connectivity
{
typedef sdbcx::OIndex OIndex_ADO;
+ class OConnection;
class OAdoIndex : public OIndex_ADO
{
WpADOIndex m_aIndex;
+ OConnection* m_pConnection;
protected:
- virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue,sal_Int32 nHandle) const;
+ void fillPropertyValues();
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const ::com::sun::star::uno::Any& rValue)throw (::com::sun::star::uno::Exception);
public:
virtual void refreshColumns();
public:
DECLARE_CTY_DEFAULTS( OIndex_ADO);
- OAdoIndex(sal_Bool _bCase, ADOIndex* _pIndex=NULL);
- OAdoIndex( const ::rtl::OUString& _Name,
- const ::rtl::OUString& _Catalog,
- sal_Bool _isUnique,
- sal_Bool _isPrimaryKeyIndex,
- sal_Bool _isClustered,
- sal_Bool _bCase
- );
-
+ OAdoIndex(sal_Bool _bCase, OConnection* _pConnection,ADOIndex* _pIndex);
+ OAdoIndex(sal_Bool _bCase, OConnection* _pConnection);
// com::sun::star::lang::XUnoTunnel
virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
diff --git a/connectivity/source/inc/ado/AIndexes.hxx b/connectivity/source/inc/ado/AIndexes.hxx
index d16c61cfac8a..999be17faf15 100644
--- a/connectivity/source/inc/ado/AIndexes.hxx
+++ b/connectivity/source/inc/ado/AIndexes.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AIndexes.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: oj $ $Date: 2000-11-03 13:44:21 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:32:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -75,9 +75,11 @@ namespace connectivity
{
namespace ado
{
+ class OConnection;
class OIndexes : public sdbcx::OCollection
{
- ADOIndexes* m_pCollection;
+ ADOIndexes* m_pCollection;
+ OConnection* m_pConnection;
protected:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName);
virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
@@ -86,8 +88,12 @@ namespace connectivity
OIndexes(::cppu::OWeakObject& _rParent,
::osl::Mutex& _rMutex,
const ::std::vector< ::rtl::OUString> &_rVector,
- ADOIndexes* _pCollection,sal_Bool _bCase) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector)
- ,m_pCollection(_pCollection)
+ ADOIndexes* _pCollection,
+ sal_Bool _bCase,
+ OConnection* _pConnection)
+ : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector)
+ , m_pCollection(_pCollection)
+ , m_pConnection(_pConnection)
{
if(m_pCollection)
m_pCollection->AddRef();
diff --git a/connectivity/source/inc/ado/AKey.hxx b/connectivity/source/inc/ado/AKey.hxx
index 1dedfd8f4b51..1c8beea75c5d 100644
--- a/connectivity/source/inc/ado/AKey.hxx
+++ b/connectivity/source/inc/ado/AKey.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AKey.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: oj $ $Date: 2000-11-03 13:44:21 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:32:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -78,33 +78,34 @@ namespace connectivity
{
typedef sdbcx::OKey OKey_ADO;
+ class OConnection;
class OAdoKey : public OKey_ADO
{
- WpADOKey m_aKey;
+ WpADOKey m_aKey;
+ OConnection* m_pConnection;
protected:
- virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue,sal_Int32 nHandle) const;
+ void fillPropertyValues();
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const ::com::sun::star::uno::Any& rValue)throw (::com::sun::star::uno::Exception);
public:
virtual void refreshColumns();
public:
DECLARE_CTY_DEFAULTS( OKey_ADO);
- OAdoKey(sal_Bool _bCase, ADOKey* _pKey=NULL);
- OAdoKey( const ::rtl::OUString& _Name,
- const ::rtl::OUString& _ReferencedTable,
- sal_Int32 _Type,
- sal_Int32 _UpdateRule,
- sal_Int32 _DeleteRule,
- sal_Bool _bCase
- );
+ OAdoKey(sal_Bool _bCase,OConnection* _pConnection,ADOKey* _pKey);
+ OAdoKey(sal_Bool _bCase,OConnection* _pConnection);
// com::sun::star::lang::XUnoTunnel
virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
WpADOKey getImpl() const { return m_aKey;}
+ // map the update/delete rules
RuleEnum Map2Rule(const sal_Int32& _eNum) const;
sal_Int32 MapRule(const RuleEnum& _eNum) const;
+
+ // map the keytypes
+ sal_Int32 MapKeyRule(const KeyTypeEnum& _eNum) const;
+ KeyTypeEnum Map2KeyRule(const sal_Int32& _eNum) const;
};
}
}
diff --git a/connectivity/source/inc/ado/AKeyColumns.hxx b/connectivity/source/inc/ado/AKeyColumns.hxx
index 85b322c28c12..a37551025917 100644
--- a/connectivity/source/inc/ado/AKeyColumns.hxx
+++ b/connectivity/source/inc/ado/AKeyColumns.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AKeyColumns.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:14:24 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:32:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,16 +59,16 @@
*
************************************************************************/
-#ifndef _CONNECTIVITY_ADABAS_KEYCOLUMNS_HXX_
-#define _CONNECTIVITY_ADABAS_KEYCOLUMNS_HXX_
+#ifndef _CONNECTIVITY_ADO_KEYCOLUMNS_HXX_
+#define _CONNECTIVITY_ADO_KEYCOLUMNS_HXX_
-#ifndef _CONNECTIVITY_ADABAS_COLUMNS_HXX_
-#include "adabas/BColumns.hxx"
+#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_
+#include "connectivity/sdbcx/VCollection.hxx"
#endif
namespace connectivity
{
- namespace adabas
+ namespace ado
{
class OKeyColumns : public OColumns
{
@@ -87,5 +87,5 @@ namespace connectivity
};
}
}
-#endif // _CONNECTIVITY_ADABAS_KEYCOLUMNS_HXX_
+#endif // _CONNECTIVITY_ADO_KEYCOLUMNS_HXX_
diff --git a/connectivity/source/inc/ado/AKeys.hxx b/connectivity/source/inc/ado/AKeys.hxx
index 1b83b93dca17..569e4770aa09 100644
--- a/connectivity/source/inc/ado/AKeys.hxx
+++ b/connectivity/source/inc/ado/AKeys.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AKeys.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: oj $ $Date: 2000-11-03 13:44:21 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:32:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -73,9 +73,11 @@ namespace connectivity
{
namespace ado
{
+ class OConnection;
class OKeys : public sdbcx::OCollection
{
- ADOKeys* m_pCollection;
+ ADOKeys* m_pCollection;
+ OConnection* m_pConnection;
protected:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName);
@@ -85,8 +87,11 @@ namespace connectivity
OKeys(::cppu::OWeakObject& _rParent,
::osl::Mutex& _rMutex,
const ::std::vector< ::rtl::OUString> &_rVector,
- ADOKeys* _pCollection,sal_Bool _bCase) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector)
+ ADOKeys* _pCollection,
+ sal_Bool _bCase,
+ OConnection* _pConnection) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector)
,m_pCollection(_pCollection)
+ ,m_pConnection(_pConnection)
{
if(m_pCollection)
m_pCollection->AddRef();
diff --git a/connectivity/source/inc/ado/APreparedStatement.hxx b/connectivity/source/inc/ado/APreparedStatement.hxx
index 9062b5234e3e..81a53dec8f9d 100644
--- a/connectivity/source/inc/ado/APreparedStatement.hxx
+++ b/connectivity/source/inc/ado/APreparedStatement.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: APreparedStatement.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: oj $ $Date: 2001-01-09 12:39:19 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:32:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -93,11 +93,11 @@ namespace connectivity
{
class OPreparedStatement : public OStatement_Base,
- public ::com::sun::star::sdbc::XPreparedStatement,
- public ::com::sun::star::sdbc::XParameters,
- public ::com::sun::star::sdbc::XPreparedBatchExecution,
- public ::com::sun::star::sdbc::XResultSetMetaDataSupplier,
- public ::com::sun::star::lang::XServiceInfo
+ public ::com::sun::star::sdbc::XPreparedStatement,
+ public ::com::sun::star::sdbc::XParameters,
+ public ::com::sun::star::sdbc::XPreparedBatchExecution,
+ public ::com::sun::star::sdbc::XResultSetMetaDataSupplier,
+ public ::com::sun::star::lang::XServiceInfo
{
void setParameter(sal_Int32 parameterIndex, const DataTypeEnum& _eType,const sal_Int32& _nSize,const OLEVariant& _Val)
@@ -106,61 +106,57 @@ namespace connectivity
//====================================================================
// Data attributes
//====================================================================
-
- int numParams; // Number of parameter markers
- // for the prepared statement
-
- ::std::vector<OTypeInfo> m_aTypeInfo;
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > m_xMetaData;
- ADOParameters* m_pParameters;
+ const OTypeInfoMap& m_aTypeInfo;
+ ADOParameters* m_pParameters;
public:
DECLARE_CTY_DEFAULTS(OStatement_Base);
DECLARE_SERVICE_INFO();
// ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird:
- OPreparedStatement( OConnection* _pConnection,const ::std::vector<OTypeInfo>& _TypeInfo,const ::rtl::OUString& sql);
+ OPreparedStatement( OConnection* _pConnection,const OTypeInfoMap& _TypeInfo,const ::rtl::OUString& sql);
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
//XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
// XPreparedStatement
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL executeUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL executeUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
// XParameters
- virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL clearParameters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clearParameters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
// XPreparedBatchExecution
- virtual void SAL_CALL addBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
// XCloseable
- virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
// XResultSetMetaDataSupplier
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
// OComponentHelper
virtual void SAL_CALL disposing(void);
};
diff --git a/connectivity/source/inc/ado/AStatement.hxx b/connectivity/source/inc/ado/AStatement.hxx
index 3061dba9d37c..ebd5b9b3720b 100644
--- a/connectivity/source/inc/ado/AStatement.hxx
+++ b/connectivity/source/inc/ado/AStatement.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: AStatement.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: oj $ $Date: 2000-10-25 11:24:41 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:32:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -134,7 +134,7 @@ namespace connectivity
friend class connectivity::OSubComponent< OStatement_Base>;
friend class OResultSet;
- ::com::sun::star::sdbc::SQLWarning m_aLastWarning;
+ ::com::sun::star::sdbc::SQLWarning m_aLastWarning;
protected:
::std::list< ::rtl::OUString> m_aBatchList;
diff --git a/connectivity/source/inc/ado/ATable.hxx b/connectivity/source/inc/ado/ATable.hxx
index 8859ea9e5e6a..71d00e68c5a9 100644
--- a/connectivity/source/inc/ado/ATable.hxx
+++ b/connectivity/source/inc/ado/ATable.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ATable.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: oj $ $Date: 2000-11-03 13:44:21 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:32:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -68,6 +68,9 @@
#ifndef _CONNECTIVITY_ADO_AWRAPADOX_HXX_
#include "ado/Awrapadox.hxx"
#endif
+#ifndef _CONNECTIVITY_ADO_CATALOG_HXX_
+#include "ado/ACatalog.hxx"
+#endif
namespace connectivity
{
@@ -78,9 +81,10 @@ namespace connectivity
class OAdoTable : public OTable_TYPEDEF
{
WpADOTable m_aTable;
+ OCatalog* m_pCatalog;
protected:
- virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue,sal_Int32 nHandle) const;
+ void fillPropertyValues();
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const ::com::sun::star::uno::Any& rValue)throw (::com::sun::star::uno::Exception);
public:
@@ -90,12 +94,9 @@ namespace connectivity
public:
DECLARE_CTY_DEFAULTS( OTable_TYPEDEF);
- OAdoTable(sal_Bool _bCase, _ADOTable* _pTable=NULL);
- OAdoTable(sal_Bool _bCase, const ::rtl::OUString& _Name,
- const ::rtl::OUString& _Type,
- const ::rtl::OUString& _Description = ::rtl::OUString(),
- const ::rtl::OUString& _SchemaName = ::rtl::OUString(),
- const ::rtl::OUString& _CatalogName = ::rtl::OUString());
+ OAdoTable(sal_Bool _bCase,OCatalog* _pCatalog,_ADOTable* _pTable);
+ OAdoTable(sal_Bool _bCase,OCatalog* _pCatalog);
+
::rtl::OUString SAL_CALL getName() { return m_Name; }
const ::rtl::OUString& getSchema() const { return m_SchemaName; }
@@ -113,6 +114,7 @@ namespace connectivity
sal_Bool create() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
WpADOTable getImpl() const { return m_aTable;}
+ OCatalog* getCatalog() const { return m_pCatalog; }
};
}
}
diff --git a/connectivity/source/inc/ado/ATables.hxx b/connectivity/source/inc/ado/ATables.hxx
index c8cc4ddabafd..012542e60ade 100644
--- a/connectivity/source/inc/ado/ATables.hxx
+++ b/connectivity/source/inc/ado/ATables.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ATables.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: oj $ $Date: 2000-11-03 13:44:21 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:32:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -67,24 +67,31 @@
#ifndef _CONNECTIVITY_ADO_AWRAPADOX_HXX_
#include "ado/Awrapadox.hxx"
#endif
+#ifndef _CONNECTIVITY_ADO_CATALOG_HXX_
+#include "ado/ACatalog.hxx"
+#endif
namespace connectivity
{
namespace ado
{
+ class OCatalog;
class OTables : public sdbcx::OCollection
{
- ADOTables* m_pCollection;
+ ADOTables* m_pCollection;
+ OCatalog* m_pCatalog;
protected:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > createObject(const ::rtl::OUString& _rName);
virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createEmptyObject();
void setComments(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
public:
- OTables(::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,
+ OTables(OCatalog* _pParent, ::osl::Mutex& _rMutex,
const ::std::vector< ::rtl::OUString> &_rVector,
- ADOTables* _pCollection,sal_Bool _bCase) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector)
+ ADOTables* _pCollection,
+ sal_Bool _bCase) : sdbcx::OCollection(*_pParent,_bCase,_rMutex,_rVector)
,m_pCollection(_pCollection)
+ ,m_pCatalog(_pParent)
{
if(m_pCollection)
m_pCollection->AddRef();
diff --git a/connectivity/source/inc/ado/Aolevariant.hxx b/connectivity/source/inc/ado/Aolevariant.hxx
index d6e1059780e1..bbf33da51d3a 100644
--- a/connectivity/source/inc/ado/Aolevariant.hxx
+++ b/connectivity/source/inc/ado/Aolevariant.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: Aolevariant.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: jl $ $Date: 2001-03-21 13:45:07 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:32:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -64,6 +64,7 @@
#ifndef _SAL_TYPES_H_
#include <sal/types.h>
#endif
+#include <oaidl.h>
#ifndef _RTL_USTRING_HXX_
#include <rtl/ustring.hxx>
#endif
@@ -77,11 +78,66 @@
#ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_
#include <com/sun/star/uno/Sequence.h>
#endif
+#ifndef _COM_SUN_STAR_SDBC_SQLEXCEPTION_HPP_
+#include <com/sun/star/sdbc/SQLException.hpp>
+#endif
namespace connectivity
{
namespace ado
{
+ class OLEString
+ {
+ BSTR m_sStr;
+ public:
+ OLEString()
+ :m_sStr(NULL)
+ {
+ }
+ OLEString(const BSTR& _sBStr)
+ :m_sStr(_sBStr)
+ {
+ }
+ OLEString(const ::rtl::OUString& _sBStr)
+ {
+ m_sStr = ::SysAllocString(_sBStr);
+ }
+ ~OLEString()
+ {
+ if(m_sStr)
+ ::SysFreeString(m_sStr);
+ }
+ OLEString& operator=(const ::rtl::OUString& _rSrc)
+ {
+ if(m_sStr)
+ ::SysFreeString(m_sStr);
+ m_sStr = ::SysAllocString(_rSrc);
+ return *this;
+ }
+ OLEString& operator=(const BSTR& _rSrc)
+ {
+ if(m_sStr)
+ ::SysFreeString(m_sStr);
+ m_sStr = _rSrc;
+ return *this;
+ }
+ operator ::rtl::OUString() const
+ {
+ return (m_sStr != NULL) ? ::rtl::OUString(m_sStr,::SysStringLen(m_sStr)) : ::rtl::OUString();
+ }
+ operator BSTR() const
+ {
+ return m_sStr;
+ }
+ BSTR* operator &()
+ {
+ return &m_sStr;
+ }
+ sal_Int32 length() const
+ {
+ return (m_sStr != NULL) ? ::SysStringLen(m_sStr) : 0;
+ }
+ };
class OLEVariant : public ::tagVARIANT
{
@@ -92,39 +148,77 @@ namespace connectivity
::VariantInit(this);
::VariantCopy(this, const_cast<VARIANT*>(&varSrc));
}
- OLEVariant(const OLEVariant& varSrc) { VariantInit(this);
- VariantCopy(this, const_cast<VARIANT*>(static_cast<const VARIANT*>(&varSrc)));}
+ OLEVariant(const OLEVariant& varSrc)
+ {
+ ::VariantInit(this);
+ ::VariantCopy(this, const_cast<VARIANT*>(static_cast<const VARIANT*>(&varSrc)));
+ }
+
+ OLEVariant(sal_Bool x) { VariantInit(this); vt = VT_BOOL; boolVal = (x ? VARIANT_TRUE : VARIANT_FALSE);}
+ OLEVariant(sal_Int8 n) { VariantInit(this); vt = VT_I1; bVal = n;}
+ OLEVariant(sal_Int16 n) { VariantInit(this); vt = VT_I2; intVal = n;}
OLEVariant(sal_Int32 n) { VariantInit(this); vt = VT_I4; lVal = n;}
- OLEVariant(const rtl::OUString& us) { VariantInit(this); vt = VT_BSTR; bstrVal = SysAllocString(us);}
- ~OLEVariant() { VariantClear(this); } // clears all the memory that was allocated before
+ OLEVariant(sal_Int64 x) { VariantInit(this); vt = VT_I8; llVal = x;}
+
+ OLEVariant(const rtl::OUString& us)
+ {
+ ::VariantInit(this);
+ vt = VT_BSTR;
+ bstrVal = SysAllocString(us);
+ }
+ ~OLEVariant()
+ {
+ ::VariantClear(this);
+ } // clears all the memory that was allocated before
OLEVariant(const ::com::sun::star::util::Date& x )
{
- VariantInit(this); vt = VT_R8;
- dblVal = ::dbtools::DBTypeConversion::toDouble(x);
+ VariantInit(this);
+ vt = VT_R8;
+ dblVal = ::dbtools::DBTypeConversion::toDouble(x);
}
OLEVariant(const ::com::sun::star::util::Time& x )
{
- VariantInit(this); vt = VT_R8;
- dblVal = ::dbtools::DBTypeConversion::toDouble(x);
+ VariantInit(this);
+ vt = VT_R8;
+ dblVal = ::dbtools::DBTypeConversion::toDouble(x);
}
OLEVariant(const ::com::sun::star::util::DateTime& x )
{
- VariantInit(this); vt = VT_R8;
- dblVal = ::dbtools::DBTypeConversion::toDouble(x);
+ VariantInit(this);
+ vt = VT_R8;
+ dblVal = ::dbtools::DBTypeConversion::toDouble(x);
+ }
+ OLEVariant(float x)
+ {
+ VariantInit(this);
+ vt = VT_R4;
+ fltVal = x;
+ }
+ OLEVariant(double x)
+ {
+ VariantInit(this);
+ vt = VT_R8;
+ dblVal = x;
}
+
+
OLEVariant(IDispatch* pDispInterface)
- { VariantInit(this); vt = VT_DISPATCH; pdispVal = pDispInterface;}
+ {
+ VariantInit(this);
+ vt = VT_DISPATCH;
+ pdispVal = pDispInterface;
+ }
- OLEVariant(const ::com::sun::star::uno::Sequence< sal_Int8 >& x)
+ OLEVariant(const ::com::sun::star::uno::Sequence< sal_Int8 >& x)
{
- VariantInit(this); vt = VT_ARRAY|VT_UI1;
- parray = SafeArrayCreateVector(VT_UI1, 0, x.getLength());
+ VariantInit(this);
+ vt = VT_ARRAY|VT_UI1;
+ parray = SafeArrayCreateVector(VT_UI1, 0, x.getLength());
const sal_Int8* pBegin = x.getConstArray();
const sal_Int8* pEnd = pBegin + x.getLength();
for(sal_Int32 i=0;pBegin != pEnd;++i,++pBegin)
SafeArrayPutElement(parray,&i,&pBegin);
-
}
OLEVariant& operator=(const OLEVariant& varSrc)
@@ -158,8 +252,8 @@ namespace connectivity
void setDate(DATE d) { VariantClear(this); vt = VT_DATE; date = d;}
void setChar(unsigned char a) { VariantClear(this); vt = VT_UI1; bVal = a;}
void setCurrency(double aCur) { VariantClear(this); vt = VT_CY; set(aCur*10000);}
- void setBool(sal_Bool b) { VariantClear(this); vt = VT_BOOL; boolVal = b ? -1:0;}
- void setString(const rtl::OUString& us){ VariantClear(this); vt = VT_BSTR; bstrVal = SysAllocString(us);}
+ void setBool(sal_Bool b) { VariantClear(this); vt = VT_BOOL; boolVal = b ? VARIANT_TRUE : VARIANT_FALSE;}
+ void setString(const rtl::OUString& us){ VariantClear(this); vt = VT_BSTR; bstrVal = ::SysAllocString(us);}
void setNoArg() { VariantClear(this); vt = VT_ERROR; scode = DISP_E_PARAMNOTFOUND;}
void setIDispatch(IDispatch* pDispInterface)
@@ -178,199 +272,319 @@ namespace connectivity
sal_Bool isEmpty() const { return (vt == VT_EMPTY); }
VARTYPE getType() const { return vt; }
+ void ChangeType(VARTYPE vartype, const OLEVariant* pSrc);
- operator rtl::OUString()
- {
- if(vt == VT_NULL)
- return rtl::OUString();
- if (vt != VT_BSTR) VariantChangeType(this, this, NULL, VT_BSTR);
- return rtl::OUString((sal_Unicode*)bstrVal);
- }
- rtl::OUString getString()
- {
- return (rtl::OUString)*this;
- }
- operator sal_Bool() { return getBool(); }
- operator sal_Int32() { return getInt32(); }
- operator sal_Int16() { return getInt16(); }
- operator sal_Int8() { return getInt8(); }
- operator float() { return getFloat(); }
- operator double() { return getDouble(); }
- operator ::com::sun::star::util::Date()
+ operator ::rtl::OUString() const;
+
+ operator sal_Bool() const { return getBool(); }
+ operator sal_Int8() const { return getInt8(); }
+ operator sal_Int16() const { return getInt16(); }
+ operator sal_Int32() const { return getInt32(); }
+ operator float() const { return getFloat(); }
+ operator double() const { return getDouble(); }
+
+ operator ::com::sun::star::uno::Sequence< sal_Int8 >() const;
+ operator ::com::sun::star::util::Date() const
{
return connectivity::DateConversion::toDate(date,::com::sun::star::util::Date(30,12,1899));
}
- operator ::com::sun::star::util::Time()
+ operator ::com::sun::star::util::Time() const
{
return connectivity::DateConversion::toTime(date);
}
- operator ::com::sun::star::util::DateTime()
+ operator ::com::sun::star::util::DateTime()const
{
return connectivity::DateConversion::toDateTime(date,::com::sun::star::util::Date(30,12,1899));
}
- sal_Bool getBool()
- {
- if (vt != VT_BOOL) VariantChangeType(this, this, NULL, VT_BOOL);
- return boolVal ? sal_True : sal_False;
- };
+ ::rtl::OUString getString() const;
+ sal_Bool getBool() const;
+ IUnknown* getIUnknown() const;
+ IDispatch* getIDispatch() const;
+ sal_uInt8 getByte() const;
+ sal_Int16 getInt16() const;
+ sal_Int8 getInt8() const;
+ sal_Int32 getInt32() const;
+ sal_uInt32 getUInt32() const;
+ float getFloat() const;
+ double getDouble() const;
+ double getDate() const;
+ CY getCurrency() const;
+ SAFEARRAY* getUI1SAFEARRAYPtr() const;
- IUnknown* getIUnknown()
+ inline static VARIANT_BOOL VariantBool(sal_Bool bEinBoolean)
{
- if (vt != VT_UNKNOWN) VariantChangeType(this, this, NULL, VT_UNKNOWN);
- return (IUnknown*) punkVal;
-
+ return (bEinBoolean ? VARIANT_TRUE : VARIANT_FALSE);
}
- IDispatch* getIDispatch()
+ private:
+ void CHS()
{
- if (vt != VT_DISPATCH) VariantChangeType(this,this, NULL, VT_DISPATCH);
- return (IDispatch*) pdispVal;
-
+ cyVal.Lo ^= (sal_uInt32)-1;
+ cyVal.Hi ^= -1;
+ cyVal.Lo++;
+ if( !cyVal.Lo )
+ cyVal.Hi++;
}
-
- sal_uInt8 getByte()
+ void set(double n)
{
- if (vt != VT_UI1) VariantChangeType(this, this, NULL, VT_UI1);
- return (sal_uInt8) bVal;
+ if( n >= 0 )
+ {
+ cyVal.Hi = (sal_Int32)(n / (double)4294967296.0);
+ cyVal.Lo = (sal_uInt32)(n - ((double)cyVal.Hi * (double)4294967296.0));
+ }
+ else {
+ cyVal.Hi = (sal_Int32)(-n / (double)4294967296.0);
+ cyVal.Lo = (sal_uInt32)(-n - ((double)cyVal.Hi * (double)4294967296.0));
+ CHS();
+ }
}
- sal_Int16 getInt16()
- {
- if (vt != VT_I2) VariantChangeType(this, this, NULL, VT_I2);
- return (sal_Int16) iVal;
- }
+ };
+ // -----------------------------------------------------------------------------
+ // inline implementaion
+ // cast operator
+ inline OLEVariant::operator rtl::OUString() const
+ {
+ if (V_VT(this) == VT_BSTR)
+ return V_BSTR(this);
- sal_Int8 getInt8()
- {
- if (vt != VT_UI1) VariantChangeType(this, this, NULL, VT_UI1);
- return (sal_Int8) iVal;
- }
- sal_Int32 getInt32()
- {
- if (vt != VT_I4) VariantChangeType(this, this, NULL, VT_I4);
- return (sal_Int32) lVal;
- }
+ OLEVariant varDest;
- sal_Int32 getUInt32()
- {
- if (vt != VT_UI4) VariantChangeType(this, this, NULL, VT_UI4);
- return (sal_uInt32) lVal;
- }
+ varDest.ChangeType(VT_BSTR, this);
- float getFloat()
+ return V_BSTR(&varDest);
+ }
+ // -----------------------------------------------------------------------------
+ inline OLEVariant::operator ::com::sun::star::uno::Sequence< sal_Int8 >() const
+ {
+ ::com::sun::star::uno::Sequence< sal_Int8 > aRet;
+ if(V_VT(this) == VT_BSTR)
{
- if (vt != VT_R4) VariantChangeType(this, this, NULL, VT_R4);
- return (float) fltVal;
+ OLEString sStr(V_BSTR(this));
+ aRet = ::com::sun::star::uno::Sequence<sal_Int8>(reinterpret_cast<const sal_Int8*>((const wchar_t*)sStr),sizeof(sal_Unicode)*sStr.length());
}
-
- double getDouble()
+ else
{
- if (vt != VT_R8) VariantChangeType(this, this, NULL, VT_R8);
- return (double) dblVal;
- }
+ SAFEARRAY* pArray = getUI1SAFEARRAYPtr();
- double getDate()
- {
- if (vt != VT_DATE) VariantChangeType(this, this, NULL, VT_DATE);
- return (double) date;
+ if(pArray)
+ {
+ HRESULT hresult1,hresult2;
+ long lBound,uBound;
+ // Verify that the SafeArray is the proper shape.
+ hresult1 = ::SafeArrayGetLBound(pArray, 1, &lBound);
+ hresult2 = ::SafeArrayGetUBound(pArray, 1, &uBound);
+ if(SUCCEEDED(hresult1) && SUCCEEDED(hresult2))
+ {
+ long nIndex = 0;
+ long nCount = uBound-lBound+1;
+ aRet.realloc(nCount);
+ for(long i=0;i<nCount;++i)
+ {
+ ::SafeArrayGetElement(pArray,&nIndex,(void*)aRet.getArray()[i]);
+ }
+ }
+ }
}
- double getCurrency()
+ return aRet;
+ }
+ // -----------------------------------------------------------------------------
+ inline ::rtl::OUString OLEVariant::getString() const
+ {
+ return (rtl::OUString)*this;
+ }
+ // -----------------------------------------------------------------------------
+ inline sal_Bool OLEVariant::getBool() const
+ {
+ if (V_VT(this) == VT_BOOL)
+ return V_BOOL(this) == VARIANT_TRUE ? sal_True : sal_False;
+
+ OLEVariant varDest;
+
+ varDest.ChangeType(VT_BOOL, this);
+
+ return V_BOOL(&varDest) == VARIANT_TRUE ? sal_True : sal_False;
+ }
+ // -----------------------------------------------------------------------------
+ inline IUnknown* OLEVariant::getIUnknown() const
+ {
+ if (V_VT(this) == VT_UNKNOWN)
{
- if (vt != VT_CY) VariantChangeType(this, this, NULL, VT_CY);
- double toRet = ((double)cyVal.Hi*(double)4294967296.0 + (double)cyVal.Lo) / 10000;
- return toRet;
+ V_UNKNOWN(this)->AddRef();
+ return V_UNKNOWN(this);
}
- SAFEARRAY* getUI1SAFEARRAYPtr()
+ OLEVariant varDest;
+
+ varDest.ChangeType(VT_UNKNOWN, this);
+
+ V_UNKNOWN(&varDest)->AddRef();
+ return V_UNKNOWN(&varDest);
+ }
+ // -----------------------------------------------------------------------------
+ inline IDispatch* OLEVariant::getIDispatch() const
+ {
+ if (V_VT(this) == VT_DISPATCH)
{
- if (vt != (VT_ARRAY|VT_UI1))
- VariantChangeType(this,this, NULL, VT_ARRAY|VT_UI1);
- return (parray);
+ V_DISPATCH(this)->AddRef();
+ return V_DISPATCH(this);
}
- // static methods
+ OLEVariant varDest;
- // ACHTUNG! Der zurueckgegebene UnicodeString mu vom
- // Rufer mit delete[] freigegeben werden!!!!
- inline static OLECHAR* UniCodeFromC(const char* pText)
- {
+ varDest.ChangeType(VT_DISPATCH, this);
- int nLength = strlen(pText)+1;
- OLECHAR* aReturnString = new OLECHAR[nLength];
+ V_DISPATCH(&varDest)->AddRef();
+ return V_DISPATCH(&varDest);
+ }
+ // -----------------------------------------------------------------------------
+ inline sal_uInt8 OLEVariant::getByte() const
+ {
+ if (V_VT(this) == VT_UI1)
+ return V_UI1(this);
- MultiByteToWideChar(CP_ACP, //ANSI Code Page
- MB_PRECOMPOSED,
- pText,
- nLength,
- (OLECHAR*) aReturnString,
- nLength);
+ OLEVariant varDest;
- return aReturnString;
+ varDest.ChangeType(VT_UI1, this);
- }
+ return V_UI1(&varDest);
+ }
+ // -----------------------------------------------------------------------------
+ inline sal_Int16 OLEVariant::getInt16() const
+ {
+ if (V_VT(this) == VT_I2)
+ return V_I2(this);
- // Der zurueckgegebene BSTR muss noch mit
- // SysFreeString() wieder freigegeben werden!
- // inline static BSTR BSTRFromC(const char* pText)
- // {
- // OLECHAR* pUniString = UniCodeFromC(pText);
- // BSTR aBSTR = SysAllocString(pUniString);
- // delete[] pUniString;
- // return aBSTR;
- // }
+ OLEVariant varDest;
- inline static VARIANT_BOOL VariantBool(sal_Bool bEinBoolean)
- {
- return (VARIANT_BOOL) (bEinBoolean? -1:0);
- }
-
- // static String StringFromBSTR(BSTR& aBSTR)
- // {
- // sal_uInt16 nLength = SysStringLen(aBSTR);
- // String sRetString;
- // char* pBuf = sRetString.AllocStrBuf(nLength);
- //
- // WideCharToMultiByte(CP_ACP, //ANSI Code Page
- // WC_COMPOSITECHECK,
- // aBSTR,
- // nLength,
- // pBuf,
- // nLength,
- // NULL, NULL);
- //
- // return sRetString;
- // }
- private:
- void CHS()
- {
- cyVal.Lo ^= (sal_uInt32)-1;
- cyVal.Hi ^= -1;
- cyVal.Lo++;
- if( !cyVal.Lo )
- cyVal.Hi++;
- }
+ varDest.ChangeType(VT_I2, this);
- void set(double n)
+ return V_I2(&varDest);
+ }
+ // -----------------------------------------------------------------------------
+ inline sal_Int8 OLEVariant::getInt8() const
+ {
+ if (V_VT(this) == VT_I1)
+ return V_I1(this);
+
+ OLEVariant varDest;
+
+ varDest.ChangeType(VT_I1, this);
+
+ return V_I1(&varDest);
+ }
+ // -----------------------------------------------------------------------------
+ inline sal_Int32 OLEVariant::getInt32() const
+ {
+ if (V_VT(this) == VT_I4)
+ return V_I4(this);
+
+ OLEVariant varDest;
+
+ varDest.ChangeType(VT_I4, this);
+
+ return V_I4(&varDest);
+ }
+ // -----------------------------------------------------------------------------
+ inline sal_uInt32 OLEVariant::getUInt32() const
+ {
+ if (V_VT(this) == VT_UI4)
+ return V_UI4(this);
+
+ OLEVariant varDest;
+
+ varDest.ChangeType(VT_UI4, this);
+
+ return V_UI4(&varDest);
+ }
+ // -----------------------------------------------------------------------------
+ inline float OLEVariant::getFloat() const
+ {
+ if (V_VT(this) == VT_R4)
+ return V_R4(this);
+
+ OLEVariant varDest;
+
+ varDest.ChangeType(VT_R4, this);
+
+ return V_R4(&varDest);
+ }
+ // -----------------------------------------------------------------------------
+ inline double OLEVariant::getDouble() const
+ {
+ if (V_VT(this) == VT_R8)
+ return V_R8(this);
+
+ OLEVariant varDest;
+
+ varDest.ChangeType(VT_R8, this);
+
+ return V_R8(&varDest);
+ }
+ // -----------------------------------------------------------------------------
+ inline double OLEVariant::getDate() const
+ {
+ if (V_VT(this) == VT_DATE)
+ return V_DATE(this);
+
+ OLEVariant varDest;
+
+ varDest.ChangeType(VT_DATE, this);
+
+ return V_DATE(&varDest);
+ }
+ // -----------------------------------------------------------------------------
+ inline CY OLEVariant::getCurrency() const
+ {
+ if (V_VT(this) == VT_CY)
+ return V_CY(this);
+
+ OLEVariant varDest;
+
+ varDest.ChangeType(VT_CY, this);
+
+ return V_CY(&varDest);
+ }
+ // -----------------------------------------------------------------------------
+ inline SAFEARRAY* OLEVariant::getUI1SAFEARRAYPtr() const
+ {
+ if (V_VT(this) == (VT_ARRAY|VT_UI1))
+ return V_ARRAY(this);
+
+ OLEVariant varDest;
+
+ varDest.ChangeType((VT_ARRAY|VT_UI1), this);
+
+ return V_ARRAY(&varDest);
+ }
+ // -----------------------------------------------------------------------------
+ // -----------------------------------------------------------------------------
+ // -----------------------------------------------------------------------------
+ // -----------------------------------------------------------------------------
+ // -----------------------------------------------------------------------------
+ inline void OLEVariant::ChangeType(VARTYPE vartype, const OLEVariant* pSrc)
+ {
+ //
+ // If pDest is NULL, convert type in place
+ //
+ if (pSrc == NULL)
+ pSrc = this;
+
+ if ((this != pSrc) || (vartype != V_VT(this)))
{
- if( n >= 0 )
- {
- cyVal.Hi = (sal_Int32)(n / (double)4294967296.0);
- cyVal.Lo = (sal_uInt32)(n - ((double)cyVal.Hi * (double)4294967296.0));
- }
- else {
- cyVal.Hi = (sal_Int32)(-n / (double)4294967296.0);
- cyVal.Lo = (sal_uInt32)(-n - ((double)cyVal.Hi * (double)4294967296.0));
- CHS();
- }
+ if(FAILED(::VariantChangeType(static_cast<VARIANT*>(this),
+ const_cast<VARIANT*>(static_cast<const VARIANT*>(pSrc)),
+ 0, vartype)))
+ throw ::com::sun::star::sdbc::SQLException(::rtl::OUString::createFromAscii("Could convert type!"),NULL,::rtl::OUString(),1000,::com::sun::star::uno::Any());
}
-
- };
+ }
}
}
+
#endif // _CONNECTIVITY_ADO_AOLEVARIANT_HXX_
diff --git a/connectivity/source/inc/ado/Aolewrap.hxx b/connectivity/source/inc/ado/Aolewrap.hxx
index 2d31b9e5631d..5991810ca410 100644
--- a/connectivity/source/inc/ado/Aolewrap.hxx
+++ b/connectivity/source/inc/ado/Aolewrap.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: Aolewrap.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: jl $ $Date: 2001-03-21 13:45:31 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:32:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -64,6 +64,10 @@
#ifndef _OSL_DIAGNOSE_H_
#include <osl/diagnose.h>
#endif
+#ifndef _OSL_THREAD_H_
+#include <osl/thread.h>
+#endif
+
namespace connectivity
{
@@ -218,7 +222,13 @@ namespace connectivity
inline WrapT GetItem(const ::rtl::OUString& sStr) const
{
T* pT;
- if (FAILED(pInterface->get_Item(OLEVariant(sStr), &pT))) return WrapT(NULL);
+ if (FAILED(pInterface->get_Item(OLEVariant(sStr), &pT)))
+ {
+ ::rtl::OString sTemp("Unknown Item: ");
+ sTemp += ::rtl::OString(sStr.getStr(),sStr.getLength(),osl_getThreadTextEncoding());
+ OSL_ENSURE(0,sTemp);
+ return WrapT(NULL);
+ }
return WrapT(pT);
}
};
diff --git a/connectivity/source/inc/ado/Awrapado.hxx b/connectivity/source/inc/ado/Awrapado.hxx
index a85e77d66a80..b64eb45e6071 100644
--- a/connectivity/source/inc/ado/Awrapado.hxx
+++ b/connectivity/source/inc/ado/Awrapado.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: Awrapado.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: oj $ $Date: 2001-04-04 09:08:48 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:32:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -61,19 +61,17 @@
#ifndef _CONNECTIVITY_ADO_AWRAPADO_HXX_
#define _CONNECTIVITY_ADO_AWRAPADO_HXX_
-#include <tools/prewin.h>
// Includes fuer ADO
#include <oledb.h>
//#include <objbase.h>
//#include <initguid.h>
//#include <mapinls.h>
-#include <ocidl.h>
+// #include <ocidl.h>
#ifndef _ADOINT_H_
#include <adoint.h>
#endif
-#include <tools/postwin.h>
#ifndef _CONNECTIVITY_ADO_ADOIMP_HXX_
#include "ado/adoimp.hxx"
@@ -123,17 +121,16 @@ namespace connectivity
inline rtl::OUString GetConnectionString() const
{
- BSTR aBSTR; pInterface->get_ConnectionString(&aBSTR);
- rtl::OUString sRetStr((sal_Unicode*)aBSTR);
- SysFreeString(aBSTR);
- return sRetStr;
+ OLEString aBSTR;
+ pInterface->get_ConnectionString(&aBSTR);
+ return aBSTR;
}
inline sal_Bool PutConnectionString(const ::rtl::OUString &aCon) const
{
- BSTR bstr = SysAllocString(aCon.getStr());
+ OLEString bstr(aCon);
sal_Bool bErg = SUCCEEDED(pInterface->put_ConnectionString(bstr));
- SysFreeString(bstr);
+
return bErg;
}
@@ -168,15 +165,14 @@ namespace connectivity
inline sal_Bool Execute(const ::rtl::OUString& _CommandText,OLEVariant& RecordsAffected,long Options, WpADORecordset** ppiRset)
{
- BSTR sStr1 = SysAllocString(_CommandText.getStr());
+ OLEString sStr1(_CommandText);
sal_Bool bErg = SUCCEEDED(pInterface->Execute(sStr1,&RecordsAffected,Options,(_ADORecordset**)ppiRset));
- SysFreeString(sStr1);
return bErg;
}
inline sal_Bool BeginTrans()
{
- sal_Int32 nIso;
+ sal_Int32 nIso=0;
return SUCCEEDED(pInterface->BeginTrans(&nIso));
}
@@ -192,13 +188,10 @@ namespace connectivity
inline sal_Bool Open(const ::rtl::OUString& ConnectionString, const ::rtl::OUString& UserID,const ::rtl::OUString& Password,long Options)
{
- BSTR sStr1 = SysAllocString(ConnectionString.getStr());
- BSTR sStr2 = SysAllocString(UserID.getStr());
- BSTR sStr3 = SysAllocString(Password.getStr());
+ OLEString sStr1(ConnectionString);
+ OLEString sStr2(UserID);
+ OLEString sStr3(Password);
sal_Bool bErg = SUCCEEDED(pInterface->Open(sStr1,sStr2,sStr3,Options));
- SysFreeString(sStr1);
- SysFreeString(sStr2);
- SysFreeString(sStr3);
return bErg;
}
@@ -209,22 +202,21 @@ namespace connectivity
inline ::rtl::OUString GetDefaultDatabase() const
{
- BSTR aBSTR; pInterface->get_DefaultDatabase(&aBSTR);
- ::rtl::OUString sRetStr(aBSTR);
- SysFreeString(aBSTR); return sRetStr;
+ OLEString aBSTR; pInterface->get_DefaultDatabase(&aBSTR);
+ return aBSTR;
}
inline sal_Bool PutDefaultDatabase(const ::rtl::OUString& _bstr)
{
- BSTR bstr = SysAllocString(_bstr.getStr());
+ OLEString bstr(_bstr);
sal_Bool bErg = SUCCEEDED(pInterface->put_DefaultDatabase(bstr));
- SysFreeString(bstr);
+
return bErg;
}
inline IsolationLevelEnum get_IsolationLevel() const
{
- IsolationLevelEnum eNum;
+ IsolationLevelEnum eNum=adXactUnspecified;
pInterface->get_IsolationLevel(&eNum);
return eNum;
}
@@ -236,7 +228,7 @@ namespace connectivity
inline sal_Int32 get_Attributes() const
{
- sal_Int32 nRet;
+ sal_Int32 nRet=0;
pInterface->get_Attributes(&nRet);
return nRet;
}
@@ -248,7 +240,7 @@ namespace connectivity
inline CursorLocationEnum get_CursorLocation() const
{
- CursorLocationEnum eNum;
+ CursorLocationEnum eNum=adUseNone;
pInterface->get_CursorLocation(&eNum);
return eNum;
}
@@ -260,7 +252,7 @@ namespace connectivity
inline ConnectModeEnum get_Mode() const
{
- ConnectModeEnum eNum;
+ ConnectModeEnum eNum=adModeUnknown;
pInterface->get_Mode(&eNum);
return eNum;
}
@@ -273,22 +265,19 @@ namespace connectivity
inline ::rtl::OUString get_Provider() const
{
- BSTR aBSTR; pInterface->get_Provider(&aBSTR);
- ::rtl::OUString sRetStr(aBSTR);
- SysFreeString(aBSTR); return sRetStr;
+ OLEString aBSTR; pInterface->get_Provider(&aBSTR);
+ return aBSTR;
}
inline sal_Bool put_Provider(const ::rtl::OUString& _bstr)
{
- BSTR bstr = SysAllocString(_bstr.getStr());
- sal_Bool bErg = SUCCEEDED(pInterface->put_Provider(bstr));
- SysFreeString(bstr);
- return bErg;
+ OLEString bstr(_bstr);
+ return SUCCEEDED(pInterface->put_Provider(bstr));
}
inline sal_Int32 get_State() const
{
- sal_Int32 nRet;
+ sal_Int32 nRet=0;
pInterface->get_State(&nRet);
return nRet;
}
@@ -300,10 +289,9 @@ namespace connectivity
inline ::rtl::OUString get_Version() const
{
- BSTR aBSTR;
+ OLEString aBSTR;
pInterface->get_Version(&aBSTR);
- ::rtl::OUString sRetStr(aBSTR);
- SysFreeString(aBSTR); return sRetStr;
+ return aBSTR;
}
};
@@ -348,7 +336,7 @@ namespace connectivity
if( !FAILED( hr ) )
{
pIUnknown->AddRef();
- ADOCommand* pCommand;
+ ADOCommand* pCommand=NULL;
hr = pIUnknown->CreateInstanceLic( pOuter,
NULL,
@@ -367,29 +355,28 @@ namespace connectivity
inline sal_Int32 get_State() const
{
- sal_Int32 nRet;
+ sal_Int32 nRet=0;
pInterface->get_State(&nRet);
return nRet;
}
inline ::rtl::OUString get_CommandText() const
{
- BSTR aBSTR; pInterface->get_CommandText(&aBSTR);
- ::rtl::OUString sRetStr(aBSTR);
- SysFreeString(aBSTR); return sRetStr;
+ OLEString aBSTR; pInterface->get_CommandText(&aBSTR);
+ return aBSTR;
}
inline sal_Bool put_CommandText(const ::rtl::OUString &aCon)
{
- BSTR bstr = SysAllocString(aCon.getStr());
+ OLEString bstr(aCon);
sal_Bool bErg = SUCCEEDED(pInterface->put_CommandText(bstr));
- SysFreeString(bstr);
+
return bErg;
}
inline sal_Int32 get_CommandTimeout() const
{
- sal_Int32 nRet;
+ sal_Int32 nRet=0;
pInterface->get_CommandTimeout(&nRet);
return nRet;
}
@@ -401,7 +388,7 @@ namespace connectivity
inline sal_Bool get_Prepared() const
{
- VARIANT_BOOL bPrepared;
+ VARIANT_BOOL bPrepared = VARIANT_FALSE;
pInterface->get_Prepared(&bPrepared);
return bPrepared == VARIANT_TRUE;
}
@@ -419,15 +406,15 @@ namespace connectivity
inline ADOParameter* CreateParameter(const ::rtl::OUString &_bstr,DataTypeEnum Type,ParameterDirectionEnum Direction,long nSize,const OLEVariant &Value)
{
ADOParameter* pPara = NULL;
- BSTR bstr = SysAllocString(_bstr.getStr());
- sal_Bool bErg = SUCCEEDED(pInterface->CreateParameter(_bstr.getLength() ? bstr : NULL,Type,Direction,nSize,Value,&pPara));
- SysFreeString(bstr);
+ OLEString bstr(_bstr);
+ sal_Bool bErg = SUCCEEDED(pInterface->CreateParameter(bstr,Type,Direction,nSize,Value,&pPara));
+
return bErg ? pPara : NULL;
}
inline ADOParameters* get_Parameters() const
{
- ADOParameters* pPara;
+ ADOParameters* pPara=NULL;
pInterface->get_Parameters(&pPara);
return pPara;
}
@@ -439,7 +426,7 @@ namespace connectivity
inline CommandTypeEnum get_CommandType( ) const
{
- CommandTypeEnum eNum;
+ CommandTypeEnum eNum=adCmdUnspecified;
pInterface->get_CommandType(&eNum);
return eNum;
}
@@ -447,16 +434,16 @@ namespace connectivity
// gibt den Namen des Feldes zur"ueck
inline ::rtl::OUString GetName() const
{
- BSTR aBSTR; pInterface->get_Name(&aBSTR);
- ::rtl::OUString sRetStr(aBSTR);
- SysFreeString(aBSTR); return sRetStr;
+ OLEString aBSTR;
+ pInterface->get_Name(&aBSTR);
+ return aBSTR;
}
inline sal_Bool put_Name(const ::rtl::OUString& _Name)
{
- BSTR bstr = SysAllocString(_Name.getStr());
+ OLEString bstr(_Name);
sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
- SysFreeString(bstr);
+
return bErg;
}
inline sal_Bool Cancel()
@@ -483,28 +470,32 @@ namespace connectivity
inline ::rtl::OUString GetDescription() const
{
- BSTR aBSTR; pInterface->get_Description(&aBSTR);
- ::rtl::OUString sRetStr(aBSTR);
- SysFreeString(aBSTR); return sRetStr;
+ OLEString aBSTR;
+ pInterface->get_Description(&aBSTR);
+ return aBSTR;
}
- inline ::rtl::OUString GetSource() const {BSTR aBSTR; pInterface->get_Source(&aBSTR);
- ::rtl::OUString sRetStr(aBSTR);
- SysFreeString(aBSTR); return sRetStr;}
+ inline ::rtl::OUString GetSource() const
+ {
+ OLEString aBSTR;
+ pInterface->get_Source(&aBSTR);
+ return aBSTR;
+ }
inline sal_Int32 GetNumber() const {sal_Int32 nErrNr; pInterface->get_Number(&nErrNr);
return nErrNr;}
inline ::rtl::OUString GetSQLState() const
{
- BSTR aBSTR; pInterface->get_SQLState(&aBSTR);
- ::rtl::OUString sRetStr(aBSTR);
- SysFreeString(aBSTR); return sRetStr;
+ OLEString aBSTR;
+ pInterface->get_SQLState(&aBSTR);
+ return aBSTR;
}
inline sal_Int32 GetNativeError() const
{
- sal_Int32 nErrNr; pInterface->get_NativeError(&nErrNr);
+ sal_Int32 nErrNr=0;
+ pInterface->get_NativeError(&nErrNr);
return nErrNr;
}
};
@@ -535,13 +526,15 @@ namespace connectivity
inline sal_Int32 GetActualSize() const
{
- sal_Int32 nActualSize; pInterface->get_ActualSize(&nActualSize);
+ sal_Int32 nActualSize=0;
+ pInterface->get_ActualSize(&nActualSize);
return nActualSize;
}
inline sal_Int32 GetAttributes() const
{
- sal_Int32 eADOSFieldAttributes; pInterface->get_Attributes(&eADOSFieldAttributes);
+ sal_Int32 eADOSFieldAttributes=0;
+ pInterface->get_Attributes(&eADOSFieldAttributes);
return eADOSFieldAttributes;
}
@@ -554,7 +547,7 @@ namespace connectivity
inline sal_Int32 GetDefinedSize() const
{
- sal_Int32 nDefinedSize;
+ sal_Int32 nDefinedSize=0;
pInterface->get_DefinedSize(&nDefinedSize);
return nDefinedSize;
}
@@ -562,14 +555,15 @@ namespace connectivity
// gibt den Namen des Feldes zur"ueck
inline ::rtl::OUString GetName() const
{
- BSTR aBSTR; pInterface->get_Name(&aBSTR);
- ::rtl::OUString sRetStr(aBSTR);
- SysFreeString(aBSTR); return sRetStr;
+ OLEString aBSTR;
+ pInterface->get_Name(&aBSTR);
+ return aBSTR;
}
inline DataTypeEnum GetADOType() const
{
- DataTypeEnum eType; pInterface->get_Type(&eType);
+ DataTypeEnum eType=adEmpty;
+ pInterface->get_Type(&eType);
return eType;
}
@@ -593,13 +587,15 @@ namespace connectivity
inline sal_Int32 GetPrecision() const
{
- sal_uInt8 eType; pInterface->get_Precision(&eType);
+ sal_uInt8 eType=0;
+ pInterface->get_Precision(&eType);
return eType;
}
inline sal_Int32 GetNumericScale() const
{
- sal_uInt8 eType; pInterface->get_NumericScale(&eType);
+ sal_uInt8 eType=0;
+ pInterface->get_NumericScale(&eType);
return eType;
}
@@ -705,20 +701,22 @@ namespace connectivity
inline ::rtl::OUString GetName() const
{
- BSTR aBSTR; pInterface->get_Name(&aBSTR);
- ::rtl::OUString sRetStr(aBSTR);
- SysFreeString(aBSTR); return sRetStr;
+ OLEString aBSTR;
+ pInterface->get_Name(&aBSTR);
+ return aBSTR;
}
inline DataTypeEnum GetADOType() const
{
- DataTypeEnum eType; pInterface->get_Type(&eType);
+ DataTypeEnum eType=adEmpty;
+ pInterface->get_Type(&eType);
return eType;
}
inline sal_Int32 GetAttributes() const
{
- sal_Int32 eADOSFieldAttributes; pInterface->get_Attributes(&eADOSFieldAttributes);
+ sal_Int32 eADOSFieldAttributes=0;
+ pInterface->get_Attributes(&eADOSFieldAttributes);
return eADOSFieldAttributes;
}
@@ -792,7 +790,7 @@ namespace connectivity
inline LockTypeEnum GetLockType()
{
- LockTypeEnum eType;
+ LockTypeEnum eType=adLockUnspecified;
pInterface->get_LockType(&eType);
return eType;
}
@@ -816,14 +814,14 @@ namespace connectivity
inline sal_Bool Supports( /* [in] */ CursorOptionEnum CursorOptions)
{
- VARIANT_BOOL bSupports;
+ VARIANT_BOOL bSupports=VARIANT_FALSE;
pInterface->Supports(CursorOptions,&bSupports);
- return (sal_Bool) bSupports;
+ return bSupports == VARIANT_TRUE;
}
PositionEnum get_AbsolutePosition()
{
- PositionEnum aTemp;
+ PositionEnum aTemp=adPosUnknown;
pInterface->get_AbsolutePosition(&aTemp);
return aTemp;
}
@@ -852,7 +850,7 @@ namespace connectivity
CompareEnum CompareBookmarks(const OLEVariant& left,const OLEVariant& right)
{
- CompareEnum eNum;
+ CompareEnum eNum=adCompareNotComparable;
pInterface->CompareBookmarks(left,right,&eNum);
return eNum;
}
@@ -865,7 +863,7 @@ namespace connectivity
inline ADOFields* GetFields() const
{
- ADOFields* pFields;
+ ADOFields* pFields=NULL;
pInterface->get_Fields(&pFields);
return pFields;
}
@@ -879,16 +877,16 @@ namespace connectivity
inline sal_Bool IsAtBOF() const
{
- VARIANT_BOOL bIsAtBOF;
+ VARIANT_BOOL bIsAtBOF=VARIANT_FALSE;
pInterface->get_BOF(&bIsAtBOF);
- return (sal_Bool) bIsAtBOF;
+ return bIsAtBOF == VARIANT_TRUE;
}
inline sal_Bool IsAtEOF() const
{
- VARIANT_BOOL bIsAtEOF;
+ VARIANT_BOOL bIsAtEOF=VARIANT_FALSE;
pInterface->get_EOF(&bIsAtEOF);
- return (sal_Bool) bIsAtEOF;
+ return bIsAtEOF == VARIANT_TRUE;
}
inline sal_Bool Delete(AffectEnum eNum)
@@ -986,37 +984,44 @@ namespace connectivity
{WpOLEBase<ADOParameter>::operator=(rhs); return *this;}
//////////////////////////////////////////////////////////////////////
- inline ::rtl::OUString GetName() const {BSTR aBSTR; pInterface->get_Name(&aBSTR);
- ::rtl::OUString sRetStr(aBSTR);
- SysFreeString(aBSTR); return sRetStr;}
+ inline ::rtl::OUString GetName() const
+ {
+ OLEString aBSTR;
+ pInterface->get_Name(&aBSTR);
+ return aBSTR;
+ }
inline DataTypeEnum GetADOType() const
{
- DataTypeEnum eType; pInterface->get_Type(&eType);
+ DataTypeEnum eType=adEmpty;
+ pInterface->get_Type(&eType);
return eType;
}
inline sal_Int32 GetAttributes() const
{
- sal_Int32 eADOSFieldAttributes; pInterface->get_Attributes(&eADOSFieldAttributes);
+ sal_Int32 eADOSFieldAttributes=0;
+ pInterface->get_Attributes(&eADOSFieldAttributes);
return eADOSFieldAttributes;
}
inline sal_Int32 GetPrecision() const
{
- sal_uInt8 eType; pInterface->get_Precision(&eType);
+ sal_uInt8 eType=0;
+ pInterface->get_Precision(&eType);
return eType;
}
inline sal_Int32 GetNumericScale() const
{
- sal_uInt8 eType; pInterface->get_NumericScale(&eType);
+ sal_uInt8 eType=0;
+ pInterface->get_NumericScale(&eType);
return eType;
}
inline ParameterDirectionEnum get_Direction() const
{
- ParameterDirectionEnum alParmDirection;
+ ParameterDirectionEnum alParmDirection=adParamUnknown;
pInterface->get_Direction(&alParmDirection);
return alParmDirection;
}
diff --git a/connectivity/source/inc/ado/Awrapadox.hxx b/connectivity/source/inc/ado/Awrapadox.hxx
index b7f4d3f82326..38ffd2dd0398 100644
--- a/connectivity/source/inc/ado/Awrapadox.hxx
+++ b/connectivity/source/inc/ado/Awrapadox.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: Awrapadox.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: oj $ $Date: 2001-04-04 09:08:48 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:32:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -63,7 +63,6 @@
#define _CONNECTIVITY_ADO_AWRAPADOX_HXX_
// Includes fuer ADO
-#include <tools/prewin.h>
//#include <oledb.h>
//#include <objbase.h>
//#include <initguid.h>
@@ -107,7 +106,7 @@ typedef struct _ADOTable Table;
#ifndef _ADOCTINT_H_
#include <ado/adoctint.h>
#endif
-#include <tools/postwin.h>
+
#ifndef _CONNECTIVITY_ADO_AOLEWRAP_HXX_
#include "ado/Aolewrap.hxx"
@@ -134,23 +133,31 @@ namespace connectivity
::rtl::OUString get_Name() const
{
- BSTR aBSTR;
+ OLEString aBSTR;
pInterface->get_Name(&aBSTR);
- rtl::OUString sRetStr((sal_Unicode*)aBSTR);
- SysFreeString(aBSTR);
- return sRetStr;
+ return aBSTR;
+ }
+ ::rtl::OUString get_RelatedColumn() const
+ {
+ OLEString aBSTR;
+ pInterface->get_RelatedColumn(&aBSTR);
+ return aBSTR;
}
void put_Name(const ::rtl::OUString& _rName)
{
- BSTR bstr = SysAllocString(_rName.getStr());
+ OLEString bstr(_rName);
sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
- SysFreeString(bstr);
+ }
+ void put_RelatedColumn(const ::rtl::OUString& _rName)
+ {
+ OLEString bstr(_rName);
+ sal_Bool bErg = SUCCEEDED(pInterface->put_RelatedColumn(bstr));
}
DataTypeEnum get_Type() const
{
- DataTypeEnum eNum;
+ DataTypeEnum eNum = adVarChar;
pInterface->get_Type(&eNum);
return eNum;
}
@@ -179,14 +186,14 @@ namespace connectivity
return nPrec;
}
- void put_NumericScale(sal_Int32 _nScale)
+ void put_NumericScale(sal_Int8 _nScale)
{
pInterface->put_NumericScale(_nScale);
}
SortOrderEnum get_SortOrder() const
{
- SortOrderEnum nPrec;
+ SortOrderEnum nPrec=adSortAscending;
pInterface->get_SortOrder(&nPrec);
return nPrec;
}
@@ -198,7 +205,7 @@ namespace connectivity
ColumnAttributesEnum get_Attributes() const
{
- ColumnAttributesEnum eNum;
+ ColumnAttributesEnum eNum=adColNullable;
pInterface->get_Attributes(&eNum);
return eNum;
}
@@ -228,23 +235,21 @@ namespace connectivity
::rtl::OUString get_Name() const
{
- BSTR aBSTR;
+ OLEString aBSTR;
pInterface->get_Name(&aBSTR);
- rtl::OUString sRetStr((sal_Unicode*)aBSTR);
- SysFreeString(aBSTR);
- return sRetStr;
+ return aBSTR;
}
void put_Name(const ::rtl::OUString& _rName)
{
- BSTR bstr = SysAllocString(_rName.getStr());
+ OLEString bstr(_rName);
sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
- SysFreeString(bstr);
+
}
KeyTypeEnum get_Type() const
{
- KeyTypeEnum eNum;
+ KeyTypeEnum eNum=adKeyPrimary;
pInterface->get_Type(&eNum);
return eNum;
}
@@ -256,23 +261,21 @@ namespace connectivity
::rtl::OUString get_RelatedTable() const
{
- BSTR aBSTR;
+ OLEString aBSTR;
pInterface->get_RelatedTable(&aBSTR);
- rtl::OUString sRetStr((sal_Unicode*)aBSTR);
- SysFreeString(aBSTR);
- return sRetStr;
+ return aBSTR;
}
void put_RelatedTable(const ::rtl::OUString& _rName)
{
- BSTR bstr = SysAllocString(_rName.getStr());
+ OLEString bstr(_rName);
sal_Bool bErg = SUCCEEDED(pInterface->put_RelatedTable(bstr));
- SysFreeString(bstr);
+
}
RuleEnum get_DeleteRule() const
{
- RuleEnum eNum;
+ RuleEnum eNum = adRINone;
pInterface->get_DeleteRule(&eNum);
return eNum;
}
@@ -284,7 +287,7 @@ namespace connectivity
RuleEnum get_UpdateRule() const
{
- RuleEnum eNum;
+ RuleEnum eNum = adRINone;
pInterface->get_UpdateRule(&eNum);
return eNum;
}
@@ -314,23 +317,21 @@ namespace connectivity
::rtl::OUString get_Name() const
{
- BSTR aBSTR;
+ OLEString aBSTR;
pInterface->get_Name(&aBSTR);
- rtl::OUString sRetStr((sal_Unicode*)aBSTR);
- SysFreeString(aBSTR);
- return sRetStr;
+ return aBSTR;
}
void put_Name(const ::rtl::OUString& _rName)
{
- BSTR bstr = SysAllocString(_rName.getStr());
+ OLEString bstr(_rName);
sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
- SysFreeString(bstr);
+
}
sal_Bool get_Clustered() const
{
- VARIANT_BOOL eNum;
+ VARIANT_BOOL eNum = VARIANT_FALSE;
pInterface->get_Clustered(&eNum);
return eNum == VARIANT_TRUE;
}
@@ -342,7 +343,7 @@ namespace connectivity
sal_Bool get_Unique() const
{
- VARIANT_BOOL eNum;
+ VARIANT_BOOL eNum = VARIANT_FALSE;
pInterface->get_Unique(&eNum);
return eNum == VARIANT_TRUE;
}
@@ -354,7 +355,7 @@ namespace connectivity
sal_Bool get_PrimaryKey() const
{
- VARIANT_BOOL eNum;
+ VARIANT_BOOL eNum = VARIANT_FALSE;
pInterface->get_PrimaryKey(&eNum);
return eNum == VARIANT_TRUE;
}
@@ -437,27 +438,23 @@ namespace connectivity
::rtl::OUString get_Name() const
{
- BSTR aBSTR;
+ OLEString aBSTR;
pInterface->get_Name(&aBSTR);
- rtl::OUString sRetStr((sal_Unicode*)aBSTR);
- SysFreeString(aBSTR);
- return sRetStr;
+ return aBSTR;
}
void put_Name(const ::rtl::OUString& _rName)
{
- BSTR bstr = SysAllocString(_rName.getStr());
+ OLEString bstr(_rName);
sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
- SysFreeString(bstr);
+
}
::rtl::OUString get_Type() const
{
- BSTR aBSTR;
+ OLEString aBSTR;
pInterface->get_Type(&aBSTR);
- rtl::OUString sRetStr((sal_Unicode*)aBSTR);
- SysFreeString(aBSTR);
- return sRetStr;
+ return aBSTR;
}
ADOColumns* get_Columns() const
@@ -508,11 +505,9 @@ namespace connectivity
::rtl::OUString get_Name() const
{
- BSTR aBSTR;
+ OLEString aBSTR;
pInterface->get_Name(&aBSTR);
- rtl::OUString sRetStr((sal_Unicode*)aBSTR);
- SysFreeString(aBSTR);
- return sRetStr;
+ return aBSTR;
}
void get_Command(OLEVariant& _rVar) const
@@ -538,25 +533,23 @@ namespace connectivity
::rtl::OUString get_Name() const
{
- BSTR aBSTR;
+ OLEString aBSTR;
pInterface->get_Name(&aBSTR);
- rtl::OUString sRetStr((sal_Unicode*)aBSTR);
- SysFreeString(aBSTR);
- return sRetStr;
+ return aBSTR;
}
void put_Name(const ::rtl::OUString& _rName)
{
- BSTR bstr = SysAllocString(_rName.getStr());
+ OLEString bstr(_rName);
sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
- SysFreeString(bstr);
+
}
RightsEnum GetPermissions(
/* [in] */ const OLEVariant& Name,
/* [in] */ ObjectTypeEnum ObjectType)
{
- RightsEnum Rights;
+ RightsEnum Rights=adRightNone;
OLEVariant ObjectTypeId;
ObjectTypeId.setNoArg();
pInterface->GetPermissions(Name,ObjectType,ObjectTypeId,&Rights);
@@ -594,28 +587,23 @@ namespace connectivity
::rtl::OUString get_Name() const
{
- BSTR aBSTR;
+ OLEString aBSTR;
pInterface->get_Name(&aBSTR);
- rtl::OUString sRetStr((sal_Unicode*)aBSTR);
- SysFreeString(aBSTR);
- return sRetStr;
+ return aBSTR;
}
void put_Name(const ::rtl::OUString& _rName)
{
- BSTR bstr = SysAllocString(_rName.getStr());
+ OLEString bstr(_rName);
sal_Bool bErg = SUCCEEDED(pInterface->put_Name(bstr));
- SysFreeString(bstr);
+
}
sal_Bool ChangePassword(const ::rtl::OUString& _rPwd,const ::rtl::OUString& _rNewPwd)
{
- BSTR sStr1 = SysAllocString(_rPwd.getStr());
- BSTR sStr2 = SysAllocString(_rNewPwd.getStr());
+ OLEString sStr1(_rPwd);
+ OLEString sStr2(_rNewPwd);
sal_Bool bErg = SUCCEEDED(pInterface->ChangePassword(sStr1,sStr2));
- SysFreeString(sStr1);
- SysFreeString(sStr2);
-
return bErg;
}
@@ -630,7 +618,7 @@ namespace connectivity
/* [in] */ const OLEVariant& Name,
/* [in] */ ObjectTypeEnum ObjectType)
{
- RightsEnum Rights;
+ RightsEnum Rights=adRightNone;
OLEVariant ObjectTypeId;
ObjectTypeId.setNoArg();
pInterface->GetPermissions(Name,ObjectType,ObjectTypeId,&Rights);
diff --git a/connectivity/source/inc/ado/adoimp.hxx b/connectivity/source/inc/ado/adoimp.hxx
index bc05046dce9a..af351c6a3e3d 100644
--- a/connectivity/source/inc/ado/adoimp.hxx
+++ b/connectivity/source/inc/ado/adoimp.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: adoimp.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:14:25 $
+ * last change: $Author: oj $ $Date: 2001-04-12 12:32:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -136,9 +136,11 @@ namespace connectivity
ADOFields* pFields = NULL; \
m_pRecordSet->get_Fields(&pFields); \
WpOLEAppendCollection<ADOFields, ADOField, WpADOField> aFields(pFields); \
+ if(Name <= 0 || Name > aFields.GetItemCount()) \
+ throw ::com::sun::star::sdbc::SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,::com::sun::star::uno::Any()); \
WpADOField aField(aFields.GetItem(Name-1)); \
if(!aField.IsValid()) \
- throw ::com::sun::star::sdbc::SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,::com::sun::star::uno::Any());
+ throw ::com::sun::star::sdbc::SQLException(STAT_INVALID_INDEX,*this,::rtl::OUString::createFromAscii("07009"),0,::com::sun::star::uno::Any());
#endif //_CONNECTIVITY_ADO_ADOIMP_HXX_