summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx10
-rw-r--r--connectivity/source/drivers/dbase/DColumns.cxx6
-rw-r--r--connectivity/source/drivers/dbase/DDatabaseMetaData.cxx30
-rw-r--r--connectivity/source/drivers/dbase/DIndex.cxx407
-rw-r--r--connectivity/source/drivers/dbase/DIndexes.cxx60
-rw-r--r--connectivity/source/drivers/dbase/DTables.cxx6
-rw-r--r--connectivity/source/drivers/dbase/dindexnode.cxx25
-rw-r--r--connectivity/source/inc/FDatabaseMetaDataResultSet.hxx7
-rw-r--r--connectivity/source/inc/UStringDescription_Impl.hxx9
-rw-r--r--connectivity/source/inc/dbase/DIndex.hxx14
-rw-r--r--connectivity/source/inc/propertyids.hxx8
-rw-r--r--connectivity/source/sdbcx/VCollection.cxx16
-rw-r--r--connectivity/source/sdbcx/VIndex.cxx7
13 files changed, 327 insertions, 278 deletions
diff --git a/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx b/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx
index bcf99de6b631..e9cc10ea6449 100644
--- a/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx
+++ b/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: FDatabaseMetaDataResultSet.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: oj $ $Date: 2001-03-29 07:05:44 $
+ * last change: $Author: oj $ $Date: 2001-03-30 14:01:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -129,6 +129,7 @@ ODatabaseMetaDataResultSet::ODatabaseMetaDataResultSet()
,m_nRowPos(0)
,m_bBOF(sal_True)
{
+ construct();
}
// -------------------------------------------------------------------------
@@ -151,6 +152,9 @@ void ODatabaseMetaDataResultSet::disposing(void)
::osl::MutexGuard aGuard(m_aMutex);
m_aStatement = NULL;
m_xMetaData = NULL;
+ m_aRowsIter = m_aRows.end();
+ m_aRows.clear();
+ m_aRowsIter = m_aRows.end();
}
// -----------------------------------------------------------------------------
void SAL_CALL ODatabaseMetaDataResultSet::acquire() throw(::com::sun::star::uno::RuntimeException)
@@ -821,4 +825,6 @@ void ODatabaseMetaDataResultSet::setImportedKeysMap()
pMetaData->setImportedKeysMap();
m_xMetaData = pMetaData;
}
+// -----------------------------------------------------------------------------
+
diff --git a/connectivity/source/drivers/dbase/DColumns.cxx b/connectivity/source/drivers/dbase/DColumns.cxx
index 248f7e8188e7..00e610b82bf8 100644
--- a/connectivity/source/drivers/dbase/DColumns.cxx
+++ b/connectivity/source/drivers/dbase/DColumns.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DColumns.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: oj $ $Date: 2001-03-28 11:31:44 $
+ * last change: $Author: oj $ $Date: 2001-03-30 13:57:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -133,7 +133,7 @@ void SAL_CALL ODbaseColumns::dropByIndex( sal_Int32 index ) throw(SQLException,
{
::osl::MutexGuard aGuard(m_rMutex);
if (index < 0 || index >= getCount())
- throw IndexOutOfBoundsException();
+ throw IndexOutOfBoundsException(::rtl::OUString::valueOf(index),*this);
if(!m_pTable->isNew())
{
diff --git a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx
index 21bc450f341e..b66d283609d6 100644
--- a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DDatabaseMetaData.cxx,v $
*
- * $Revision: 1.17 $
+ * $Revision: 1.18 $
*
- * last change: $Author: oj $ $Date: 2001-03-28 11:31:44 $
+ * last change: $Author: oj $ $Date: 2001-03-30 13:57:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -108,14 +108,14 @@
#endif
using namespace connectivity::dbase;
-using namespace connectivity::file;
+using namespace connectivity;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
-ODbaseDatabaseMetaData::ODbaseDatabaseMetaData(OConnection* _pCon) :ODatabaseMetaData(_pCon)
+ODbaseDatabaseMetaData::ODbaseDatabaseMetaData(::connectivity::file::OConnection* _pCon) :ODatabaseMetaData(_pCon)
{
}
// -------------------------------------------------------------------------
@@ -127,7 +127,7 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getTypeInfo( ) throw(S
{
::osl::MutexGuard aGuard( m_aMutex );
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet();
+ ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet();
Reference< XResultSet > xRef = pResult;
pResult->setTypeInfoMap();
ORows aRows;
@@ -211,7 +211,7 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getColumnPrivileges(
{
::osl::MutexGuard aGuard( m_aMutex );
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet();
+ ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet();
Reference< XResultSet > xRef = pResult;
pResult->setColumnPrivilegesMap();
return xRef;
@@ -310,7 +310,7 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getColumns(
}
}
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet();
+ ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet();
Reference< XResultSet > xRef = pResult;
pResult->setColumnsMap();
pResult->setRows(aRows);
@@ -323,7 +323,7 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getVersionColumns(
{
::osl::MutexGuard aGuard( m_aMutex );
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet();
+ ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet();
Reference< XResultSet > xRef = pResult;
pResult->setVersionColumnsMap();
return xRef;
@@ -334,8 +334,8 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getExportedKeys(
{
::osl::MutexGuard aGuard( m_aMutex );
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet();
- Reference< XResultSet > xRef = pResult;
+ ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet();
+ Reference< XResultSet > xRef = pResult;
pResult->setExportedKeysMap();
return xRef;
}
@@ -345,7 +345,7 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getImportedKeys(
{
::osl::MutexGuard aGuard( m_aMutex );
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet();
+ ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet();
Reference< XResultSet > xRef = pResult;
pResult->setImportedKeysMap();
return xRef;
@@ -356,7 +356,7 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getPrimaryKeys(
{
::osl::MutexGuard aGuard( m_aMutex );
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet();
+ ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet();
Reference< XResultSet > xRef = pResult;
pResult->setPrimaryKeysMap();
return xRef;
@@ -437,7 +437,7 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getIndexInfo(
}
}
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet();
+ ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet();
Reference< XResultSet > xRef = pResult;
pResult->setIndexInfoMap();
pResult->setRows(aRows);
@@ -450,7 +450,7 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getBestRowIdentifier(
{
::osl::MutexGuard aGuard( m_aMutex );
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet();
+ ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet();
Reference< XResultSet > xRef = pResult;
pResult->setBestRowIdentifierMap();
return xRef;
@@ -463,7 +463,7 @@ Reference< XResultSet > SAL_CALL ODbaseDatabaseMetaData::getCrossReference(
{
::osl::MutexGuard aGuard( m_aMutex );
- ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet();
+ ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet();
Reference< XResultSet > xRef = pResult;
pResult->setCrossReferenceMap();
return xRef;
diff --git a/connectivity/source/drivers/dbase/DIndex.cxx b/connectivity/source/drivers/dbase/DIndex.cxx
index f7725eb40f40..564a079b130d 100644
--- a/connectivity/source/drivers/dbase/DIndex.cxx
+++ b/connectivity/source/drivers/dbase/DIndex.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DIndex.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: jl $ $Date: 2001-03-21 13:41:12 $
+ * last change: $Author: oj $ $Date: 2001-03-30 13:57:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -105,6 +105,21 @@
#ifndef _COMPHELPER_EXTRACT_HXX_
#include <comphelper/extract.hxx>
#endif
+#ifndef _UNOTOOLS_LOCALFILEHELPER_HXX
+#include <unotools/localfilehelper.hxx>
+#endif
+#ifndef _UNOTOOLS_UCBHELPER_HXX
+#include <unotools/ucbhelper.hxx>
+#endif
+#ifndef _UNTOOLS_UCBSTREAMHELPER_HXX
+#include <unotools/ucbstreamhelper.hxx>
+#endif
+#ifndef _COMPHELPER_TYPES_HXX_
+#include <comphelper/types.hxx>
+#endif
+#ifndef _DBHELPER_DBEXCEPTION_HXX_
+#include <connectivity/dbexception.hxx>
+#endif
// define the properties of this lib
// this file includes the properties for this dll
namespace connectivity
@@ -119,6 +134,7 @@ namespace connectivity
// -------------------------------------------------------------------------
using namespace connectivity;
using namespace ucb;
+using namespace utl;
using namespace cppu;
using namespace connectivity::file;
using namespace connectivity::sdbcx;
@@ -133,7 +149,10 @@ IMPLEMENT_SERVICE_INFO(ODbaseIndex,"com.sun.star.sdbcx.driver.dbase.Index","com.
// -------------------------------------------------------------------------
ODbaseIndex::ODbaseIndex(ODbaseTable* _pTable) : OIndex(_pTable->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers())
, m_pTable(_pTable)
+ ,m_pFileStream(NULL)
{
+ m_aHeader.db_maxkeys = m_aHeader.db_maxkeys = m_aHeader.db_keylen = m_aHeader.db_pagecount = m_aHeader.db_rootpage = 0;
+ m_aHeader.db_name[0] = '\0';
construct();
}
// -------------------------------------------------------------------------
@@ -143,16 +162,27 @@ ODbaseIndex::ODbaseIndex( ODbaseTable* _pTable,
: OIndex(_rName,::rtl::OUString(),_rHeader.db_unique,sal_False,sal_False,_pTable->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers())
, m_aHeader(_rHeader)
, m_pTable(_pTable)
+ ,m_pFileStream(NULL)
{
construct();
}
+// -----------------------------------------------------------------------------
+ODbaseIndex::~ODbaseIndex()
+{
+ closeImpl();
+}
// -------------------------------------------------------------------------
void ODbaseIndex::refreshColumns()
{
::osl::MutexGuard aGuard( m_aMutex );
::std::vector< ::rtl::OUString> aVector;
- aVector.push_back(::rtl::OUString::createFromAscii(m_aHeader.db_name));
+ if(!isNew())
+ {
+ OSL_ENSURE(m_pFileStream,"FileStream is not opened!");
+ OSL_ENSURE(m_aHeader.db_name[0] != '\0',"Invalid name for the column!");
+ aVector.push_back(::rtl::OUString::createFromAscii(m_aHeader.db_name));
+ }
if(m_pColumns)
delete m_pColumns;
@@ -198,32 +228,34 @@ ONDXPagePtr ODbaseIndex::getRoot()
//------------------------------------------------------------------
sal_Bool ODbaseIndex::openIndexFile()
{
- if(!m_aFileStream.IsOpen())
+ if(!m_pFileStream)
{
- INetURLObject aURL;
-
- aURL.SetSmartProtocol(INET_PROT_FILE);
- aURL.SetSmartURL(m_pTable->getEntry(), INetURLObject::ENCODE_ALL);
-
- aURL.setName(m_Name);
- aURL.setExtension(String::CreateFromAscii("ndx"));
-
- // Dir* pDir = m_pTable->getConnection()->getDir();
- // String aPath = pDir->GetName();
- // aPath += m_Name.getStr();
- // DirEntry aEntry(aPath);
- // aEntry.setExtension(String::CreateFromAscii("ndx"));
- m_aFileStream.Open(aURL.getFSysPath(INetURLObject::FSYS_DETECT), STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYWRITE);
-
- m_aFileStream.SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
- m_aFileStream.SetBufferSize(512);
+ ::rtl::OUString sFile = getCompletePath();
+ if(UCBContentHelper::Exists(sFile))
+ {
+ m_pFileStream = UcbStreamHelper::CreateStream(sFile,STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYWRITE);
+ if(!m_pFileStream)
+ m_pFileStream = UcbStreamHelper::CreateStream(sFile,STREAM_READ | STREAM_NOCREATE | STREAM_SHARE_DENYNONE );
+ if(m_pFileStream)
+ {
+ m_pFileStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
+ m_pFileStream->SetBufferSize(512);
+ (*m_pFileStream) >> *this;
+ }
+ }
+ if(!m_pFileStream)
+ {
+ ::rtl::OUString sErrMsg = ::rtl::OUString::createFromAscii("Could not open index: ");
+ sErrMsg += sFile;
+ throw SQLException(sErrMsg,*this,SQLSTATE_GENERAL,1000,Any());
+ }
}
- return m_aFileStream.IsOpen();
+ return m_pFileStream != NULL;
}
//------------------------------------------------------------------
OIndexIterator* ODbaseIndex::createIterator(OBoolOperator* pOp,
- const OOperand* pOperand)
+ const OOperand* pOperand)
{
openIndexFile();
return new OIndexIterator(this, pOp, pOperand);
@@ -231,7 +263,7 @@ OIndexIterator* ODbaseIndex::createIterator(OBoolOperator* pOp,
//------------------------------------------------------------------
BOOL ODbaseIndex::ConvertToKey(ONDXKey* rKey, sal_uInt32 nRec, const ORowSetValue& rValue)
{
- OSL_ENSURE(m_aFileStream.IsOpen(),"FileStream is not opened!");
+ OSL_ENSURE(m_pFileStream,"FileStream is not opened!");
// Sucht ein bestimmten Wert im Index
// Wenn der Index Unique ist, interssiert der Key nicht, sonst ja
try
@@ -248,8 +280,9 @@ BOOL ODbaseIndex::ConvertToKey(ONDXKey* rKey, sal_uInt32 nRec, const ORowSetValu
*rKey = ONDXKey(rValue.getDouble(), nRec );
}
}
- catch (...)
+ catch (Exception&)
{
+ OSL_ASSERT(0);
return FALSE;
}
return TRUE;
@@ -259,7 +292,7 @@ BOOL ODbaseIndex::ConvertToKey(ONDXKey* rKey, sal_uInt32 nRec, const ORowSetValu
BOOL ODbaseIndex::Find(sal_uInt32 nRec, const ORowSetValue& rValue)
{
openIndexFile();
- OSL_ENSURE(m_aFileStream.IsOpen(),"FileStream is not opened!");
+ OSL_ENSURE(m_pFileStream,"FileStream is not opened!");
// Sucht ein bestimmten Wert im Index
// Wenn der Index Unique ist, interssiert der Key nicht, sonst ja
ONDXKey aKey;
@@ -270,7 +303,7 @@ BOOL ODbaseIndex::Find(sal_uInt32 nRec, const ORowSetValue& rValue)
BOOL ODbaseIndex::Insert(sal_uInt32 nRec, const ORowSetValue& rValue)
{
openIndexFile();
- OSL_ENSURE(m_aFileStream.IsOpen(),"FileStream is not opened!");
+ OSL_ENSURE(m_pFileStream,"FileStream is not opened!");
ONDXKey aKey;
// Existiert der Wert bereits
@@ -295,7 +328,7 @@ BOOL ODbaseIndex::Update(sal_uInt32 nRec, const ORowSetValue& rOldValue,
const ORowSetValue& rNewValue)
{
openIndexFile();
- OSL_ENSURE(m_aFileStream.IsOpen(),"FileStream is not opened!");
+ OSL_ENSURE(m_pFileStream,"FileStream is not opened!");
ONDXKey aKey;
if (!ConvertToKey(&aKey, nRec, rNewValue) || (isUnique() && getRoot()->Find(aKey)))
return FALSE;
@@ -307,7 +340,7 @@ BOOL ODbaseIndex::Update(sal_uInt32 nRec, const ORowSetValue& rOldValue,
BOOL ODbaseIndex::Delete(sal_uInt32 nRec, const ORowSetValue& rValue)
{
openIndexFile();
- OSL_ENSURE(m_aFileStream.IsOpen(),"FileStream is not opened!");
+ OSL_ENSURE(m_pFileStream,"FileStream is not opened!");
// Existiert der Wert bereits
// Find immer verwenden um das aktuelle Blatt zu bestimmen
ONDXKey aKey;
@@ -328,9 +361,12 @@ BOOL ODbaseIndex::Delete(sal_uInt32 nRec, const ORowSetValue& rValue)
//------------------------------------------------------------------
void ODbaseIndex::Collect(ONDXPage* pPage)
{
- OSL_ENSURE(m_aFileStream.IsOpen(),"FileStream is not opened!");
+ OSL_ENSURE(m_pFileStream,"FileStream is not opened!");
if (pPage)
+ {
+ pPage->acquire();
m_aCollector.push_back(pPage);
+ }
}
//------------------------------------------------------------------
void ODbaseIndex::Release(BOOL bSave)
@@ -362,15 +398,26 @@ void ODbaseIndex::Release(BOOL bSave)
{
m_aHeader.db_rootpage = m_nRootPage;
m_aHeader.db_pagecount = m_nPageCount;
- m_aFileStream << *this;
+ (*m_pFileStream) << *this;
}
m_nRootPage = m_nPageCount = 0;
m_nCurNode = NODE_NOTFOUND;
+
+ closeImpl();
+}
+// -----------------------------------------------------------------------------
+void ODbaseIndex::closeImpl()
+{
+ if(m_pFileStream)
+ {
+ delete m_pFileStream;
+ m_pFileStream = NULL;
+ }
}
//------------------------------------------------------------------
ONDXPage* ODbaseIndex::CreatePage(sal_uInt32 nPagePos, ONDXPage* pParent, BOOL bLoad)
{
- OSL_ENSURE(m_aFileStream.IsOpen(),"FileStream is not opened!");
+ OSL_ENSURE(m_pFileStream,"FileStream is not opened!");
ONDXPage* pPage;
if (m_aCollector.size())
@@ -384,7 +431,7 @@ ONDXPage* ODbaseIndex::CreatePage(sal_uInt32 nPagePos, ONDXPage* pParent, BOOL b
pPage = new ONDXPage(*this, nPagePos, pParent);
if (bLoad)
- m_aFileStream >> *pPage;
+ (*m_pFileStream) >> *pPage;
return pPage;
}
@@ -417,24 +464,30 @@ SvStream& connectivity::dbase::operator << (SvStream &rStream, ODbaseIndex& rInd
return rStream;
}
// -------------------------------------------------------------------------
-INetURLObject ODbaseIndex::getEntry()
+::rtl::OUString ODbaseIndex::getCompletePath()
{
- INetURLObject aDir = m_pTable->getEntry();
- aDir.setName(m_Name);
- return aDir;
+ ::rtl::OUString sDir = m_pTable->getConnection()->getURL();
+ sDir += STR_DELIMITER;
+ sDir += m_Name;
+ sDir += ::rtl::OUString::createFromAscii(".ndx");
+ return sDir;
}
//------------------------------------------------------------------
void ODbaseIndex::createINFEntry()
{
// inf Datei abgleichen
- String aNDX;
- INetURLObject aEntry(getEntry());
- aEntry.setExtension(String::CreateFromAscii("ndx"));
+ String sEntry = m_Name;
+ sEntry += String::CreateFromAscii(".ndx");
- INetURLObject aInfEntry(m_pTable->getEntry());
- aInfEntry.setExtension(String::CreateFromAscii("inf"));
+ ::rtl::OUString sCfgFile(m_pTable->getConnection()->getURL());
+ sCfgFile += STR_DELIMITER;
+ sCfgFile += m_pTable->getName();
+ sCfgFile += ::rtl::OUString::createFromAscii(".inf");
- Config aInfFile(aInfEntry.getFSysPath(INetURLObject::FSYS_DETECT));
+ String sPhysicalPath;
+ LocalFileHelper::ConvertURLToPhysicalName(sCfgFile,sPhysicalPath);
+
+ Config aInfFile(sPhysicalPath);
aInfFile.SetGroup(dBASE_III_GROUP);
USHORT nSuffix = aInfFile.GetKeyCount();
@@ -454,56 +507,47 @@ void ODbaseIndex::createINFEntry()
}
}
}
- aInfFile.WriteKey(aNewEntry,ByteString(aEntry.GetName(),m_pTable->getConnection()->getTextEncoding()));
+ aInfFile.WriteKey(aNewEntry,ByteString(sEntry,m_pTable->getConnection()->getTextEncoding()));
}
// -------------------------------------------------------------------------
BOOL ODbaseIndex::DropImpl()
{
- if (m_aFileStream.IsOpen())
- m_aFileStream.Close();
-
- INetURLObject aIndexEntry(getEntry());
- aIndexEntry.setExtension(String::CreateFromAscii("ndx"));
+ closeImpl();
- try
+ ::rtl::OUString sPath = getCompletePath();
+ if(UCBContentHelper::Exists(sPath))
{
- Content aContent(aIndexEntry.GetMainURL(),Reference<XCommandEnvironment>());
- aContent.executeCommand( rtl::OUString::createFromAscii( "delete" ),bool2any( sal_True ) );
+ if(!UCBContentHelper::Kill(sPath))
+ throw SQLException(::rtl::OUString::createFromAscii("Could not delete index!"),*m_pTable,SQLSTATE_GENERAL,1000,Any());
}
- catch(Exception&) // a execption is thrown when no file exists
- {
- }
-
-// ULONG nErrorCode = aIndexEntry.Kill();
-// if (nErrorCode != SVSTREAM_OK && nErrorCode != SVSTREAM_FILE_NOT_FOUND)
-// {
-// // aStatus.SetError(nErrorCode,INDEX,aName);
-// return FALSE;
-// }
// InfDatei abgleichen
- String aNDX;
- INetURLObject aEntry( m_pTable->getEntry());
- aEntry.setExtension(String::CreateFromAscii("inf"));
- Config aInfFile(aEntry.getFSysPath(INetURLObject::FSYS_DETECT));
+ ::rtl::OUString sCfgFile(m_pTable->getConnection()->getURL());
+ sCfgFile += STR_DELIMITER;
+ sCfgFile += m_pTable->getName();
+ sCfgFile += ::rtl::OUString::createFromAscii(".inf");
+
+ String sPhysicalPath;
+ String sNDX(sCfgFile);
+ sal_Bool bOk = LocalFileHelper::ConvertURLToPhysicalName(sNDX,sPhysicalPath);
+ OSL_ENSURE(bOk,"Can not convert Config Filename into Physical Name!");
+
+ Config aInfFile(sPhysicalPath);
aInfFile.SetGroup(dBASE_III_GROUP);
USHORT nKeyCnt = aInfFile.GetKeyCount();
ByteString aKeyName;
+ String sEntry = m_Name;
+ sEntry += String::CreateFromAscii(".ndx");
- INetURLObject aEntryToComp(getEntry());
- aEntryToComp.setExtension(String::CreateFromAscii("ndx"));
-
+ // delete entries from the inf file
for (USHORT nKey = 0; nKey < nKeyCnt; nKey++)
{
// Verweist der Key auf ein Indexfile?...
aKeyName = aInfFile.GetKeyName( nKey );
- //...wenn ja, Indexliste der Tabelle hinzufuegen
- if (aEntry.IsCaseSensitive() ? aKeyName.Copy(0,3) == "NDX" : aKeyName.Copy(0,3).EqualsIgnoreCaseAscii("NDX"))
+ if (aKeyName.Copy(0,3) == "ndx")
{
- aEntryToComp.setName(String(aInfFile.ReadKey(aKeyName),m_pTable->getConnection()->getTextEncoding()));
- aEntryToComp.setExtension(String::CreateFromAscii("ndx"));
- if (aEntryToComp == aIndexEntry)
+ if(sEntry == String(aInfFile.ReadKey(aKeyName),m_pTable->getConnection()->getTextEncoding()))
{
aInfFile.DeleteKey(aKeyName);
break;
@@ -517,44 +561,20 @@ BOOL ODbaseIndex::DropImpl()
BOOL ODbaseIndex::CreateImpl()
{
// Anlegen des Index
- INetURLObject aEntry(getEntry());
- aEntry.setExtension(String::CreateFromAscii("ndx"));
-
- Content aContent(aEntry.GetMainURL(),Reference<XCommandEnvironment>());
- try
- {
- if (aContent.isDocument())
- {
- // aStatus.SetError(ERRCODE_IO_ALREADYEXISTS,INDEX,aEntry.GetFull());
- return FALSE;
- }
- }
- catch(Exception&) // a execption is thrown when no file exists
- {
- }
+ ::rtl::OUString sFile = getCompletePath();
+ if(UCBContentHelper::Exists(sFile))
+ throw SQLException(::rtl::OUString::createFromAscii("Object already exists!"),*this,SQLSTATE_SEQUENCE,1000,Any());
// Index ist nur einstufig
- if (m_pColumns->getCount() != 2)
- {
- // aStatus.SetDriverNotCapableError();
- return FALSE;
- }
+ if (m_pColumns->getCount() > 1)
+ throw SQLException(::rtl::OUString::createFromAscii("Not capable! Only one column per index."),*this,SQLSTATE_SEQUENCE,1000,Any());
Reference<XFastPropertySet> xCol;
- ::cppu::extractInterface(xCol,m_pColumns->getByIndex(1));
+ ::cppu::extractInterface(xCol,m_pColumns->getByIndex(0));
// ist die Spalte schon indiziert ?
if (!xCol.is())
- {
-// String aText = String(OResId(STR_STAT_INDEX_COLUMN_NOT_FOUND));
-// aText.SearchAndReplace(String::CreateFromAscii("#"),pColumn->GetName());
-// aText.SearchAndReplace(String::CreateFromAscii("%"),GetTable()->Name());
-// aStatus.Set(SDB_STAT_ERROR,
-// String::CreateFromAscii("01000"),
-// aStatus.CreateErrorMessage(aText),
-// 0, String() );
- return FALSE;
- }
+ throw ::dbtools::FunctionSequenceException(*this);
// else if (pColumn && pColumn->IsIndexed())
// {
// String aText = String(OResId(STR_STAT_INDEX_COLUMN_ALREADY_INDEXED));
@@ -566,67 +586,81 @@ BOOL ODbaseIndex::CreateImpl()
// return FALSE;
// }
- // Anlegen des Indexfiles
- m_aFileStream.Open(aEntry.getFSysPath(INetURLObject::FSYS_DETECT), STREAM_READWRITE | STREAM_SHARE_DENYWRITE | STREAM_TRUNC);
- if (!m_aFileStream.IsOpen())
- return FALSE;
+ // create the index file
+ m_pFileStream = UcbStreamHelper::CreateStream(sFile,STREAM_READWRITE | STREAM_SHARE_DENYWRITE | STREAM_TRUNC);
+ if (!m_pFileStream)
+ throw SQLException(::rtl::OUString::createFromAscii("Could not access index file!"),*this,SQLSTATE_SEQUENCE,1000,Any());
- m_aFileStream.SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
- m_aFileStream.SetBufferSize(512);
+ m_pFileStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
+ m_pFileStream->SetBufferSize(512);
// Zunchst mu das Ergebnis sortiert sein
- Reference<XStatement> xStmt = m_pTable->getConnection()->createStatement();
-
- String aName(getString(xCol->getFastPropertyValue(PROPERTY_ID_NAME)));
-
- String aQuote(m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString());
- String aStatement;
- aStatement.AssignAscii("SELECT ");
- aStatement += aQuote;
- aStatement += aName;
- aStatement += aQuote;
- aStatement.AppendAscii(" FROM ");
- aStatement += aQuote;
- aStatement += m_pTable->getName().getStr();
- aStatement += aQuote;
- aStatement.AppendAscii(" ORDER BY ");
- aStatement += aQuote;
- aStatement += aName;
- aStatement += aQuote;
-
- if (!m_IsUnique) // zusaetzlich sortierung mit der bookmarkspalte
+ Reference<XStatement> xStmt;
+ Reference<XResultSet> xSet;
+ String aName;
+ try
{
- aStatement.AppendAscii(" ,");
+ xStmt = m_pTable->getConnection()->createStatement();
+
+ aName = getString(xCol->getFastPropertyValue(PROPERTY_ID_NAME));
+
+ String aQuote(m_pTable->getConnection()->getMetaData()->getIdentifierQuoteString());
+ String aStatement;
+ aStatement.AssignAscii("SELECT ");
aStatement += aQuote;
- aStatement.AppendAscii("[BOOKMARK]"); // this is a special column
+ aStatement += aName;
aStatement += aQuote;
- }
+ aStatement.AppendAscii(" FROM ");
+ aStatement += aQuote;
+ aStatement += m_pTable->getName().getStr();
+ aStatement += aQuote;
+ aStatement.AppendAscii(" ORDER BY ");
+ aStatement += aQuote;
+ aStatement += aName;
+ aStatement += aQuote;
+
+// if (!m_IsUnique) // zusaetzlich sortierung mit der bookmarkspalte
+// {
+// aStatement.AppendAscii(" ,");
+// aStatement += aQuote;
+// aStatement.AppendAscii("[BOOKMARK]"); // this is a special column
+// aStatement += aQuote;
+// }
- Reference<XResultSet> xSet = xStmt->executeQuery(aStatement);
+ xSet = xStmt->executeQuery(aStatement);
+ }
+ catch(Exception& e)
+ {
+ closeImpl();
+ if(UCBContentHelper::Exists(sFile))
+ UCBContentHelper::Kill(sFile);
+ throw SQLException(::rtl::OUString::createFromAscii("Could not create index!"),*this,SQLSTATE_SEQUENCE,1000,makeAny(e));
+ }
if (!xSet.is())
{
- m_aFileStream.Close();
- try
- {
- aContent.executeCommand( rtl::OUString::createFromAscii( "delete" ),bool2any( sal_True ) );
- }
- catch(Exception&) // a execption is thrown when no file exists
- {
- }
- return FALSE;
+
+ closeImpl();
+ if(UCBContentHelper::Exists(sFile))
+ UCBContentHelper::Kill(sFile);
+ throw SQLException(::rtl::OUString::createFromAscii("Could not create index!"),*this,SQLSTATE_SEQUENCE,1000,Any());
}
// Setzen der Headerinfo
memset(&m_aHeader,0,sizeof(m_aHeader));
- m_aFileStream.SetStreamSize(512);
+ m_pFileStream->SetStreamSize(512);
sal_Int32 nType = 0;
- xCol->getFastPropertyValue(PROPERTY_ID_TYPE) >>= nType;
+ ::vos::ORef<OSQLColumns> aCols = m_pTable->getTableColumns();
+
+ Reference< XPropertySet > xTableCol(*find(aCols->begin(),aCols->end(),aName,::comphelper::UStringMixEqual(isCaseSensitive())));
+
+ xTableCol->getPropertyValue(PROPERTY_TYPE) >>= nType;
m_aHeader.db_keytype = (nType == DataType::VARCHAR || nType == DataType::CHAR) ? 0 : 1;
- m_aHeader.db_keylen = (m_aHeader.db_keytype) ? 8 : (USHORT)getINT32(xCol->getFastPropertyValue(PROPERTY_ID_PRECISION));
+ m_aHeader.db_keylen = (m_aHeader.db_keytype) ? 8 : (USHORT)getINT32(xTableCol->getPropertyValue(PROPERTY_PRECISION));
m_aHeader.db_maxkeys = (512 - 8) / (8 + m_aHeader.db_keylen);
+
ByteString aCol(aName,m_pTable->getConnection()->getTextEncoding());
strcpy(m_aHeader.db_name,aCol.GetBuffer());
m_aHeader.db_unique = m_IsUnique ? 1: 0;
@@ -647,61 +681,48 @@ BOOL ODbaseIndex::CreateImpl()
// ULONG nRowsLeft = pCursor->RowCount();
Reference<XRow> xRow(xSet,UNO_QUERY);
- xSet->last();
- sal_Int32 nRowsLeft = xSet->getRow();
- xSet->beforeFirst();
-
- // Erzeugen der Indexstruktur
- while (xSet->next())
+ if(xSet->last())
{
- // ODbRow& rRow = *pCursor->GetRow();
- // ueberpruefen auf doppelten eintrag
- if (m_IsUnique && m_nCurNode != NODE_NOTFOUND)
+ sal_Int32 nRowsLeft = xSet->getRow();
+ xSet->beforeFirst();
+
+ // Erzeugen der Indexstruktur
+ while (xSet->next())
{
- ONDXKey aKey(m_aHeader.db_keytype ? ORowSetValue(xRow->getDouble(1)) : ORowSetValue(xRow->getString(1)), nType, 0);
- if (aKey == (*m_aCurLeaf)[m_nCurNode].GetKey())
+ // ODbRow& rRow = *pCursor->GetRow();
+ // ueberpruefen auf doppelten eintrag
+ if (m_IsUnique && m_nCurNode != NODE_NOTFOUND)
{
-// String aText = String(OResId(STR_STAT_INDEX_NOT_UNIQUE));
-// aText.SearchAndReplace(String::CreateFromAscii("#"),aName);
-// aStatus.Set(SDB_STAT_ERROR,
-// String::CreateFromAscii("01000"),
-// aStatus.CreateErrorMessage(aText),
-// 0, String() );
- break;
+ ONDXKey aKey(m_aHeader.db_keytype ? ORowSetValue(xRow->getDouble(1)) : ORowSetValue(xRow->getString(1)), nType, 0);
+ if (aKey == (*m_aCurLeaf)[m_nCurNode].GetKey())
+ {
+
+ closeImpl();
+ if(UCBContentHelper::Exists(sFile))
+ UCBContentHelper::Kill(sFile);
+ throw SQLException(::rtl::OUString::createFromAscii("Can not create index values are not unique!"),*this,SQLSTATE_GENERAL,1000,Any());
+ }
}
+ ONDXKey aKey(m_aHeader.db_keytype ? ORowSetValue(xRow->getDouble(1)) : ORowSetValue(xRow->getString(1)), nType, xSet->getRow());
+ ONDXNode aNewNode(aKey);
+ if (!m_aCurLeaf->Insert(aNewNode, --nRowsLeft))
+ break;
+
+ #ifdef DEBUG
+ //DBG_TRACE1("SDB: %s", (const char*)pCursor->Variable(1)->GetString());
+ // PrintTree();
+ #endif
}
- ONDXKey aKey(m_aHeader.db_keytype ? ORowSetValue(xRow->getDouble(1)) : ORowSetValue(xRow->getString(1)), nType, xSet->getRow());
- ONDXNode aNewNode(aKey);
- if (!m_aCurLeaf->Insert(aNewNode, --nRowsLeft))
- break;
-
-#ifdef DEBUG
- //DBG_TRACE1("SDB: %s", (const char*)pCursor->Variable(1)->GetString());
- // PrintTree();
-#endif
}
+ xRow = NULL;
+ ::comphelper::disposeComponent(xSet);
+ ::comphelper::disposeComponent(xStmt);
-// BOOL bResult = !pCursor->IsInRange();
-// if (!bResult)
-// {
-// m_aFileStream.Close();
-// aEntry.Kill();
-// Release(FALSE);
-// }
-// else
-// {
-
- Release();
-// m_aFileStream.Close();
- // den FielStream NICHT schliessen, da per definitionem ein OObject nach dem Kreieren offen ist
-
- // inf Datei abgleichen
- createINFEntry();
-// }
-//
- // pCursor->ReleaseRef();
+ Release();
+ createINFEntry();
return sal_True;
}
+// -----------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/dbase/DIndexes.cxx b/connectivity/source/drivers/dbase/DIndexes.cxx
index edb84ff2bc4b..c3774c6df4bd 100644
--- a/connectivity/source/drivers/dbase/DIndexes.cxx
+++ b/connectivity/source/drivers/dbase/DIndexes.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DIndexes.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: oj $ $Date: 2000-11-03 14:17:57 $
+ * last change: $Author: oj $ $Date: 2001-03-30 13:57:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -68,8 +68,14 @@
#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_
#include "propertyids.hxx"
#endif
+#ifndef _UNTOOLS_UCBSTREAMHELPER_HXX
+#include <unotools/ucbstreamhelper.hxx>
+#endif
+#ifndef _UNOTOOLS_UCBHELPER_HXX
+#include <unotools/ucbhelper.hxx>
+#endif
-
+using namespace utl;
using namespace connectivity::dbase;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
@@ -85,26 +91,31 @@ Reference< XNamed > ODbaseIndexes::createObject(const ::rtl::OUString& _rName)
// Dir* pDir = m_pTable->getConnection()->getDir();
// String aPath = pDir->GetName();
// aPath += _rName.getStr();
- INetURLObject aEntry(m_pTable->getEntry());
- aEntry.setName(_rName);
- aEntry.setExtension(String::CreateFromAscii("ndx"));
- SvFileStream aFileStream;
- aFileStream.Open(aEntry.getFSysPath(INetURLObject::FSYS_DETECT), STREAM_READ | STREAM_NOCREATE| STREAM_SHARE_DENYWRITE);
-
-
- // Anlegen des Indexfiles
- // aFileStream.Open(aEntry.GetFull(), STREAM_READWRITE | STREAM_NOCREATE| STREAM_SHARE_DENYWRITE);
-
- aFileStream.SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
- aFileStream.SetBufferSize(512);
- ODbaseIndex::NDXHeader aHeader;
-
- aFileStream.Seek(0);
- aFileStream.Read(&aHeader,512);
+ ::rtl::OUString sFile = m_pTable->getConnection()->getURL();
+ sFile += STR_DELIMITER;
+ sFile += _rName;
+ sFile += ::rtl::OUString::createFromAscii(".ndx");
+ if(!UCBContentHelper::Exists(sFile))
+ throw SQLException(::rtl::OUString::createFromAscii("Index file doesn't exists!"),*m_pTable,SQLSTATE_GENERAL,1000,Any());
+
+ Reference< XNamed > xRet;
+ SvStream* pFileStream = UcbStreamHelper::CreateStream(sFile,STREAM_READ | STREAM_NOCREATE| STREAM_SHARE_DENYWRITE);
+ if(pFileStream)
+ {
+ pFileStream->SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
+ pFileStream->SetBufferSize(512);
+ ODbaseIndex::NDXHeader aHeader;
- ODbaseIndex* pIndex = new ODbaseIndex(m_pTable,aHeader,_rName);
+ pFileStream->Seek(0);
+ pFileStream->Read(&aHeader,512);
+ delete pFileStream;
- Reference< XNamed > xRet = pIndex;
+ ODbaseIndex* pIndex = new ODbaseIndex(m_pTable,aHeader,_rName);
+ xRet = pIndex;
+ pIndex->openIndexFile();
+ }
+ else
+ throw SQLException(::rtl::OUString::createFromAscii("Could not open index file"),*m_pTable,SQLSTATE_GENERAL,1000,Any());
return xRet;
}
// -------------------------------------------------------------------------
@@ -137,7 +148,7 @@ void SAL_CALL ODbaseIndexes::appendByDescriptor( const Reference< XPropertySet >
{
ODbaseIndex* pIndex = (ODbaseIndex*)xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId());
if(pIndex && pIndex->CreateImpl())
- ODbaseIndexes_BASE::appendByDescriptor(descriptor);
+ ODbaseIndexes_BASE::appendByDescriptor(Reference< XPropertySet >(createObject(aName),UNO_QUERY));
}
}
// -------------------------------------------------------------------------
@@ -150,6 +161,9 @@ void SAL_CALL ODbaseIndexes::dropByName( const ::rtl::OUString& elementName ) th
if( aIter == m_aNameMap.end())
throw NoSuchElementException(elementName,*this);
+ if(!aIter->second.is())
+ aIter->second = createObject(elementName);
+
Reference< XUnoTunnel> xTunnel(aIter->second.get(),UNO_QUERY);
if(xTunnel.is())
{
@@ -164,7 +178,7 @@ void SAL_CALL ODbaseIndexes::dropByIndex( sal_Int32 index ) throw(SQLException,
{
::osl::MutexGuard aGuard(m_rMutex);
if (index < 0 || index >= getCount())
- throw IndexOutOfBoundsException();
+ throw IndexOutOfBoundsException(::rtl::OUString::valueOf(index),*this);
dropByName((*m_aElements[index]).first);
}
diff --git a/connectivity/source/drivers/dbase/DTables.cxx b/connectivity/source/drivers/dbase/DTables.cxx
index ec79921decc5..82b34f7af9e7 100644
--- a/connectivity/source/drivers/dbase/DTables.cxx
+++ b/connectivity/source/drivers/dbase/DTables.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DTables.cxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: oj $ $Date: 2001-03-28 11:32:43 $
+ * last change: $Author: oj $ $Date: 2001-03-30 13:57:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -186,7 +186,7 @@ void SAL_CALL ODbaseTables::dropByIndex( sal_Int32 index ) throw(SQLException, I
{
::osl::MutexGuard aGuard(m_rMutex);
if (index < 0 || index >= getCount())
- throw IndexOutOfBoundsException();
+ throw IndexOutOfBoundsException(::rtl::OUString::valueOf(index),*this);
dropByName((*m_aElements[index]).first);
}
diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx
index d71881c4ac0c..b6bf532b717b 100644
--- a/connectivity/source/drivers/dbase/dindexnode.cxx
+++ b/connectivity/source/drivers/dbase/dindexnode.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dindexnode.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: oj $ $Date: 2001-02-05 12:26:39 $
+ * last change: $Author: oj $ $Date: 2001-03-30 13:57:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -108,17 +108,14 @@ ONDXPage::~ONDXPage()
void ONDXPage::release()
{
if (! osl_decrementInterlockedCount( &m_refCount ))
- {
QueryDelete();
- delete this;
- }
}
//------------------------------------------------------------------
void ONDXPage::QueryDelete()
{
// Ablegen im GarbageCollector
if (IsModified())
- rIndex.m_aFileStream << *this;
+ (*rIndex.m_pFileStream) << *this;
bModified = FALSE;
if (rIndex.UseCollector())
@@ -139,6 +136,8 @@ void ONDXPage::QueryDelete()
(*aParent).Clear();
rIndex.Collect(this);
}
+ else
+ delete this;
// else
// SvRefBase::QueryDelete();
}
@@ -927,18 +926,8 @@ void ONDXNode::Write(SvStream &rStream, const ONDXPage& rPage) const
memset(aNodeData.aData,0x20,rIndex.getHeader().db_keylen);
if (aKey.getValue().hasValue())
{
- // ODBFConnection *pCon = rIndex.GetDBFConnection();
- if (NULL)
- {
- ByteString aText(getString(aKey.getValue()).getStr(), rIndex.m_pTable->getConnection()->getTextEncoding());
- strncpy(aNodeData.aData,aText.GetBuffer(),min(rIndex.getHeader().db_keylen, aText.Len()));
- }
- else
- {
- DBG_ERROR("No Connection");
- ByteString aText(getString(aKey.getValue()).getStr(), rIndex.m_pTable->getConnection()->getTextEncoding());
- strncpy(aNodeData.aData,aText.GetBuffer(),min(rIndex.getHeader().db_keylen, aText.Len()));
- }
+ ByteString aText(getString(aKey.getValue()).getStr(), rIndex.m_pTable->getConnection()->getTextEncoding());
+ strncpy(aNodeData.aData,aText.GetBuffer(),min(rIndex.getHeader().db_keylen, aText.Len()));
}
rStream.Write((BYTE*)aNodeData.aData,rIndex.getHeader().db_keylen);
}
diff --git a/connectivity/source/inc/FDatabaseMetaDataResultSet.hxx b/connectivity/source/inc/FDatabaseMetaDataResultSet.hxx
index 628bd6720a17..6aae2dad4804 100644
--- a/connectivity/source/inc/FDatabaseMetaDataResultSet.hxx
+++ b/connectivity/source/inc/FDatabaseMetaDataResultSet.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: FDatabaseMetaDataResultSet.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: oj $ $Date: 2001-03-29 07:05:46 $
+ * last change: $Author: oj $ $Date: 2001-03-30 14:01:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -152,13 +152,12 @@ namespace connectivity
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
// OPropertySetHelper
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
-
+ ~ODatabaseMetaDataResultSet();
public:
virtual void SAL_CALL acquire() throw(::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException);
// ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird:
ODatabaseMetaDataResultSet();
- ~ODatabaseMetaDataResultSet();
void setRows(const ORows& _rRows) { m_aRows = _rRows; }
diff --git a/connectivity/source/inc/UStringDescription_Impl.hxx b/connectivity/source/inc/UStringDescription_Impl.hxx
index c9afab25063e..2e2ca36346d6 100644
--- a/connectivity/source/inc/UStringDescription_Impl.hxx
+++ b/connectivity/source/inc/UStringDescription_Impl.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: UStringDescription_Impl.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: oj $ $Date: 2001-01-30 15:46:47 $
+ * last change: $Author: oj $ $Date: 2001-03-30 14:01:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -129,6 +129,11 @@ IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ISBOOKMARKABLE);
//============================================================
IMPLEMENT_CONSTASCII_USTRING(ERRORMSG_SEQUENCE);
IMPLEMENT_CONSTASCII_USTRING(SQLSTATE_SEQUENCE);
+IMPLEMENT_CONSTASCII_USTRING(SQLSTATE_GENERAL);
+//============================================================
+//= different
+//============================================================
+IMPLEMENT_CONSTASCII_USTRING(STR_DELIMITER);
#endif // CONNECTIVITY_USTRINGDESCRIPTION_IMPL_HXX
diff --git a/connectivity/source/inc/dbase/DIndex.hxx b/connectivity/source/inc/dbase/DIndex.hxx
index 6ad794364284..951eb211ae9e 100644
--- a/connectivity/source/inc/dbase/DIndex.hxx
+++ b/connectivity/source/inc/dbase/DIndex.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: DIndex.hxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: oj $ $Date: 2001-03-28 11:28:46 $
+ * last change: $Author: oj $ $Date: 2001-03-30 14:01:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -120,7 +120,7 @@ namespace connectivity
};
private:
- SvFileStream m_aFileStream; // Stream zum Lesen/Schreiben des Index
+ SvStream* m_pFileStream; // Stream zum Lesen/Schreiben des Index
NDXHeader m_aHeader;
ONDXPageList m_aCollector; // Pool von nicht mehr bentigten Seiten
ONDXPagePtr m_aRoot, // Wurzel des b+ Baums
@@ -134,14 +134,18 @@ namespace connectivity
BOOL m_bUseCollector : 1; // Verwenden des GarbageCollectors
sal_Bool m_bUnique;
- sal_Bool openIndexFile();
- INetURLObject getEntry();
+ ::rtl::OUString getCompletePath();
+ void closeImpl();
+ protected:
+ ~ODbaseIndex();
public:
DECLARE_CTY_DEFAULTS( ODbaseIndex_BASE);
ODbaseIndex(ODbaseTable* _pTable);
ODbaseIndex(ODbaseTable* _pTable,const NDXHeader& _aHeader,const ::rtl::OUString& _Name);
+
+ sal_Bool openIndexFile();
virtual void refreshColumns();
// com::sun::star::lang::XUnoTunnel
diff --git a/connectivity/source/inc/propertyids.hxx b/connectivity/source/inc/propertyids.hxx
index 15def51ba824..a77ecc6ac1e3 100644
--- a/connectivity/source/inc/propertyids.hxx
+++ b/connectivity/source/inc/propertyids.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: propertyids.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: oj $ $Date: 2001-01-30 15:46:47 $
+ * last change: $Author: oj $ $Date: 2001-03-30 14:01:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -126,6 +126,8 @@ namespace dbtools
// ====================================================
extern const sal_Char* getERRORMSG_SEQUENCE();
extern const sal_Char* getSQLSTATE_SEQUENCE();
+ extern const sal_Char* getSQLSTATE_GENERAL();
+ extern const sal_Char* getSTR_DELIMITER();
}
}
@@ -200,6 +202,8 @@ namespace connectivity
DECLARE_CONSTASCII_USTRING(STAT_INVALID_INDEX,CONNECTIVITY_PROPERTY_NAME_SPACE)
DECLARE_CONSTASCII_USTRING(ERRORMSG_SEQUENCE,CONNECTIVITY_PROPERTY_NAME_SPACE)
DECLARE_CONSTASCII_USTRING(SQLSTATE_SEQUENCE,CONNECTIVITY_PROPERTY_NAME_SPACE)
+ DECLARE_CONSTASCII_USTRING(SQLSTATE_GENERAL,CONNECTIVITY_PROPERTY_NAME_SPACE)
+ DECLARE_CONSTASCII_USTRING(STR_DELIMITER,CONNECTIVITY_PROPERTY_NAME_SPACE)
}
}
diff --git a/connectivity/source/sdbcx/VCollection.cxx b/connectivity/source/sdbcx/VCollection.cxx
index d1e46d5278a6..ca101c2d33fe 100644
--- a/connectivity/source/sdbcx/VCollection.cxx
+++ b/connectivity/source/sdbcx/VCollection.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: VCollection.cxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: oj $ $Date: 2001-03-12 13:51:27 $
+ * last change: $Author: oj $ $Date: 2001-03-30 14:01:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -76,6 +76,10 @@
#ifndef _COMPHELPER_TYPES_HXX_
#include <comphelper/types.hxx>
#endif
+#define CONNECTIVITY_PROPERTY_NAME_SPACE dbtools
+#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_
+#include "propertyids.hxx"
+#endif
using namespace connectivity::sdbcx;
using namespace connectivity;
@@ -266,8 +270,8 @@ void SAL_CALL OCollection::dropByName( const ::rtl::OUString& elementName ) thro
void SAL_CALL OCollection::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException)
{
::osl::MutexGuard aGuard(m_rMutex);
- if(index <0 || index > getCount())
- throw IndexOutOfBoundsException(::rtl::OUString(),*this);
+ if(index <0 || index >= getCount())
+ throw IndexOutOfBoundsException(::rtl::OUString::valueOf(index),*this);
::comphelper::disposeComponent(m_aElements[index]->second);
::rtl::OUString elementName = m_aElements[index]->first;
@@ -281,11 +285,11 @@ void SAL_CALL OCollection::dropByIndex( sal_Int32 index ) throw(SQLException, In
static_cast<XContainerListener*>(aListenerLoop.next())->elementRemoved(aEvent);
}
// -------------------------------------------------------------------------
-sal_Int32 SAL_CALL OCollection::findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
+sal_Int32 SAL_CALL OCollection::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, ::com::sun::star::uno::RuntimeException)
{
ObjectIter aIter = m_aNameMap.find(columnName);
if(aIter == m_aNameMap.end())
- throw ::com::sun::star::sdbc::SQLException();
+ throw SQLException(::rtl::OUString::createFromAscii("Unknown column name!"),*this,connectivity::dbtools::SQLSTATE_GENERAL,1000,makeAny(NoSuchElementException(columnName,*this)) );
return m_aElements.size() - (m_aElements.end() - ::std::find(m_aElements.begin(),m_aElements.end(),aIter)) +1; // because cloumns start at one
}
diff --git a/connectivity/source/sdbcx/VIndex.cxx b/connectivity/source/sdbcx/VIndex.cxx
index a8015e1ca434..e9136a6943a2 100644
--- a/connectivity/source/sdbcx/VIndex.cxx
+++ b/connectivity/source/sdbcx/VIndex.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: VIndex.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: oj $ $Date: 2001-03-02 13:09:17 $
+ * last change: $Author: oj $ $Date: 2001-03-30 14:01:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -123,6 +123,9 @@ sal_Bool SAL_CALL OIndex::supportsService( const ::rtl::OUString& _rServiceName
OIndex::OIndex(sal_Bool _bCase) : ODescriptor_BASE(m_aMutex)
, ODescriptor(ODescriptor_BASE::rBHelper,_bCase,sal_True)
, m_pColumns(NULL)
+ ,m_IsUnique(sal_False)
+ ,m_IsClustered(sal_False)
+ ,m_IsPrimaryKeyIndex(sal_False)
{
}
// -------------------------------------------------------------------------