ucb change

This commit is contained in:
Ocke Janssen 2000-09-20 05:52:26 +00:00
parent d88f970275
commit 1788e529f5
8 changed files with 113 additions and 101 deletions

View file

@ -2,9 +2,9 @@
* *
* $RCSfile: DDatabaseMetaData.cxx,v $ * $RCSfile: DDatabaseMetaData.cxx,v $
* *
* $Revision: 1.1.1.1 $ * $Revision: 1.2 $
* *
* last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ * last change: $Author: oj $ $Date: 2000-09-20 06:52:26 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@ -42,7 +42,7 @@
* License at http://www.openoffice.org/license.html. * License at http://www.openoffice.org/license.html.
* *
* Software provided under this License is provided on an "AS IS" basis, * Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and * See the License for the specific provisions governing your rights and
@ -59,6 +59,7 @@
* *
************************************************************************/ ************************************************************************/
#ifndef _CONNECTIVITY_DBASE_ODATABASEMETADATA_HXX_ #ifndef _CONNECTIVITY_DBASE_ODATABASEMETADATA_HXX_
#include "dbase/DDatabaseMetaData.hxx" #include "dbase/DDatabaseMetaData.hxx"
#endif #endif
@ -86,9 +87,6 @@
#ifndef _URLOBJ_HXX //autogen wg. INetURLObject #ifndef _URLOBJ_HXX //autogen wg. INetURLObject
#include <tools/urlobj.hxx> #include <tools/urlobj.hxx>
#endif #endif
//#ifndef _FSYS_HXX //autogen
//#include <tools/fsys.hxx>
//#endif
#ifndef _CONNECTIVITY_FILE_ADATABASEMETADATARESULTSET_HXX_ #ifndef _CONNECTIVITY_FILE_ADATABASEMETADATARESULTSET_HXX_
#include "file/FDatabaseMetaDataResultSet.hxx" #include "file/FDatabaseMetaDataResultSet.hxx"
#endif #endif

View file

@ -2,9 +2,9 @@
* *
* $RCSfile: DIndex.cxx,v $ * $RCSfile: DIndex.cxx,v $
* *
* $Revision: 1.1.1.1 $ * $Revision: 1.2 $
* *
* last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ * last change: $Author: oj $ $Date: 2000-09-20 06:52:26 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@ -42,7 +42,7 @@
* License at http://www.openoffice.org/license.html. * License at http://www.openoffice.org/license.html.
* *
* Software provided under this License is provided on an "AS IS" basis, * Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and * See the License for the specific provisions governing your rights and
@ -83,9 +83,6 @@
#ifndef _CONNECTIVITY_DBASE_INDEXITER_HXX_ #ifndef _CONNECTIVITY_DBASE_INDEXITER_HXX_
#include "dbase/DIndexIter.hxx" #include "dbase/DIndexIter.hxx"
#endif #endif
//#ifndef _FSYS_HXX //autogen
//#include <tools/fsys.hxx>
//#endif
#ifndef _CONFIG_HXX //autogen #ifndef _CONFIG_HXX //autogen
#include <vcl/config.hxx> #include <vcl/config.hxx>
#endif #endif
@ -210,6 +207,7 @@ sal_Bool ODbaseIndex::openIndexFile()
if(!m_aFileStream.IsOpen()) if(!m_aFileStream.IsOpen())
{ {
INetURLObject aURL; INetURLObject aURL;
aURL.SetSmartProtocol(INET_PROT_FILE); aURL.SetSmartProtocol(INET_PROT_FILE);
aURL.SetSmartURL(m_pTable->getEntry(), INetURLObject::ENCODE_ALL); aURL.SetSmartURL(m_pTable->getEntry(), INetURLObject::ENCODE_ALL);
@ -221,7 +219,7 @@ sal_Bool ODbaseIndex::openIndexFile()
// aPath += m_Name.getStr(); // aPath += m_Name.getStr();
// DirEntry aEntry(aPath); // DirEntry aEntry(aPath);
// aEntry.setExtension(String::CreateFromAscii("ndx")); // aEntry.setExtension(String::CreateFromAscii("ndx"));
m_aFileStream.Open(aURL.GetMainURL(), STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYWRITE); m_aFileStream.Open(aURL.getFSysPath(INetURLObject::FSYS_DETECT), STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYWRITE);
m_aFileStream.SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN); m_aFileStream.SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
m_aFileStream.SetBufferSize(512); m_aFileStream.SetBufferSize(512);
@ -445,7 +443,7 @@ void ODbaseIndex::createINFEntry()
INetURLObject aInfEntry(m_pTable->getEntry()); INetURLObject aInfEntry(m_pTable->getEntry());
aInfEntry.setExtension(String::CreateFromAscii("inf")); aInfEntry.setExtension(String::CreateFromAscii("inf"));
Config aInfFile(aInfEntry.GetMainURL()); Config aInfFile(aInfEntry.getFSysPath(INetURLObject::FSYS_DETECT));
aInfFile.SetGroup(dBASE_III_GROUP); aInfFile.SetGroup(dBASE_III_GROUP);
USHORT nSuffix = aInfFile.GetKeyCount(); USHORT nSuffix = aInfFile.GetKeyCount();
@ -491,7 +489,7 @@ BOOL ODbaseIndex::DropImpl()
INetURLObject aEntry( m_pTable->getEntry()); INetURLObject aEntry( m_pTable->getEntry());
aEntry.setExtension(String::CreateFromAscii("inf")); aEntry.setExtension(String::CreateFromAscii("inf"));
Config aInfFile(aEntry.GetMainURL()); Config aInfFile(aEntry.getFSysPath(INetURLObject::FSYS_DETECT));
aInfFile.SetGroup(dBASE_III_GROUP); aInfFile.SetGroup(dBASE_III_GROUP);
USHORT nKeyCnt = aInfFile.GetKeyCount(); USHORT nKeyCnt = aInfFile.GetKeyCount();
ByteString aKeyName; ByteString aKeyName;
@ -566,7 +564,7 @@ BOOL ODbaseIndex::CreateImpl()
// } // }
// Anlegen des Indexfiles // Anlegen des Indexfiles
m_aFileStream.Open(aEntry.GetMainURL(), STREAM_READWRITE | STREAM_SHARE_DENYWRITE | STREAM_TRUNC); m_aFileStream.Open(aEntry.getFSysPath(INetURLObject::FSYS_DETECT), STREAM_READWRITE | STREAM_SHARE_DENYWRITE | STREAM_TRUNC);
if (!m_aFileStream.IsOpen()) if (!m_aFileStream.IsOpen())
return FALSE; return FALSE;

View file

@ -2,9 +2,9 @@
* *
* $RCSfile: DIndexes.cxx,v $ * $RCSfile: DIndexes.cxx,v $
* *
* $Revision: 1.1.1.1 $ * $Revision: 1.2 $
* *
* last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ * last change: $Author: oj $ $Date: 2000-09-20 06:52:26 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@ -42,7 +42,7 @@
* License at http://www.openoffice.org/license.html. * License at http://www.openoffice.org/license.html.
* *
* Software provided under this License is provided on an "AS IS" basis, * Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and * See the License for the specific provisions governing your rights and
@ -61,9 +61,6 @@
#ifndef _CONNECTIVITY_DBASE_INDEXES_HXX_ #ifndef _CONNECTIVITY_DBASE_INDEXES_HXX_
#include "dbase/DIndexes.hxx" #include "dbase/DIndexes.hxx"
#endif #endif
//#ifndef _FSYS_HXX //autogen
//#include <tools/fsys.hxx>
//#endif
#ifndef _CONNECTIVITY_DBASE_INDEX_HXX_ #ifndef _CONNECTIVITY_DBASE_INDEX_HXX_
#include "dbase/DIndex.hxx" #include "dbase/DIndex.hxx"
#endif #endif
@ -88,7 +85,7 @@ Reference< XNamed > ODbaseIndexes::createObject(const ::rtl::OUString& _rName)
aEntry.setName(_rName); aEntry.setName(_rName);
aEntry.setExtension(String::CreateFromAscii("ndx")); aEntry.setExtension(String::CreateFromAscii("ndx"));
SvFileStream aFileStream; SvFileStream aFileStream;
aFileStream.Open(aEntry.GetMainURL(), STREAM_READ | STREAM_NOCREATE| STREAM_SHARE_DENYWRITE); aFileStream.Open(aEntry.getFSysPath(INetURLObject::FSYS_DETECT), STREAM_READ | STREAM_NOCREATE| STREAM_SHARE_DENYWRITE);
// Anlegen des Indexfiles // Anlegen des Indexfiles

View file

@ -2,9 +2,9 @@
* *
* $RCSfile: DTable.cxx,v $ * $RCSfile: DTable.cxx,v $
* *
* $Revision: 1.1.1.1 $ * $Revision: 1.2 $
* *
* last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ * last change: $Author: oj $ $Date: 2000-09-20 06:52:26 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@ -42,7 +42,7 @@
* License at http://www.openoffice.org/license.html. * License at http://www.openoffice.org/license.html.
* *
* Software provided under this License is provided on an "AS IS" basis, * Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and * See the License for the specific provisions governing your rights and
@ -323,9 +323,9 @@ ODbaseTable::ODbaseTable(ODbaseConnection* _pConnection,
// Content aContent(aURL.GetMainURL()); // Content aContent(aURL.GetMainURL());
m_aFileStream.Open(aURL.GetMainURL(), STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYWRITE); m_aFileStream.Open(aURL.getFSysPath(INetURLObject::FSYS_DETECT), STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYWRITE);
if(!m_aFileStream.IsOpen()) if(!m_aFileStream.IsOpen())
m_aFileStream.Open(aURL.GetMainURL(), STREAM_READ | STREAM_NOCREATE | STREAM_SHARE_DENYNONE ); m_aFileStream.Open(aURL.getFSysPath(INetURLObject::FSYS_DETECT), STREAM_READ | STREAM_NOCREATE | STREAM_SHARE_DENYNONE );
if(m_aFileStream.IsOpen()) if(m_aFileStream.IsOpen())
{ {
@ -344,7 +344,7 @@ ODbaseTable::ODbaseTable(ODbaseConnection* _pConnection,
// Wenn die Memodatei nicht gefunden wird, werden die Daten trotzdem angezeigt // Wenn die Memodatei nicht gefunden wird, werden die Daten trotzdem angezeigt
// allerdings koennen keine Updates durchgefuehrt werden // allerdings koennen keine Updates durchgefuehrt werden
// jedoch die Operation wird ausgefuehrt // jedoch die Operation wird ausgefuehrt
m_aMemoStream.Open(aURL.GetMainURL(), STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYWRITE); m_aMemoStream.Open(aURL.getFSysPath(INetURLObject::FSYS_DETECT), STREAM_READWRITE | STREAM_NOCREATE | STREAM_SHARE_DENYWRITE);
if (m_aMemoStream.IsOpen()) if (m_aMemoStream.IsOpen())
ReadMemoHeader(); ReadMemoHeader();
@ -439,14 +439,19 @@ BOOL ODbaseTable::ReadMemoHeader()
return TRUE; return TRUE;
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
::rtl::OUString ODbaseTable::getEntry() String ODbaseTable::getEntry()
{ {
::rtl::OUString aURL; ::rtl::OUString aURL;
Reference< XResultSet > xDir = m_pConnection->getDir(); Reference< XResultSet > xDir = m_pConnection->getDir()->getStaticResultSet();
Reference< XRow> xRow(xDir,UNO_QUERY); Reference< XRow> xRow(xDir,UNO_QUERY);
::rtl::OUString aName;
sal_Int32 nLen = m_pConnection->getExtension().Len()+1;
xDir->beforeFirst();
while(xDir->next()) while(xDir->next())
{ {
if(xRow->getString(1) == m_Name) aName = xRow->getString(1);
aName = aName.replaceAt(aName.getLength()-nLen,nLen,::rtl::OUString());
if(aName == m_Name)
{ {
Reference< XContentAccess > xContentAccess( xDir, UNO_QUERY ); Reference< XContentAccess > xContentAccess( xDir, UNO_QUERY );
aURL = xContentAccess->queryContentIdentfierString(); aURL = xContentAccess->queryContentIdentfierString();
@ -454,7 +459,7 @@ BOOL ODbaseTable::ReadMemoHeader()
} }
} }
xDir->beforeFirst(); // move back to before first record xDir->beforeFirst(); // move back to before first record
return aURL; return aURL.getStr();
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
void ODbaseTable::refreshColumns() void ODbaseTable::refreshColumns()
@ -482,7 +487,7 @@ void ODbaseTable::refreshIndexes()
aURL.setExtension(String::CreateFromAscii("inf")); aURL.setExtension(String::CreateFromAscii("inf"));
Config aInfFile(aURL.GetMainURL()); Config aInfFile(aURL.getFSysPath(INetURLObject::FSYS_DETECT));
aInfFile.SetGroup(dBASE_III_GROUP); aInfFile.SetGroup(dBASE_III_GROUP);
sal_Int32 nKeyCnt = aInfFile.GetKeyCount(); sal_Int32 nKeyCnt = aInfFile.GetKeyCount();
ByteString aKeyName; ByteString aKeyName;
@ -950,7 +955,7 @@ BOOL ODbaseTable::CreateImpl()
{ {
// Hack fuer Bug #30609 , nur wenn das File existiert und die Laenge > 0 gibt es einen Fehler // Hack fuer Bug #30609 , nur wenn das File existiert und die Laenge > 0 gibt es einen Fehler
SvFileStream m_aFileStream; SvFileStream m_aFileStream;
m_aFileStream.Open(aURL.GetMainURL(),STREAM_STD_READ); m_aFileStream.Open(aURL.getFSysPath(INetURLObject::FSYS_DETECT),STREAM_STD_READ);
if (m_aFileStream.IsOpen() && m_aFileStream.Seek(STREAM_SEEK_TO_END)) if (m_aFileStream.IsOpen() && m_aFileStream.Seek(STREAM_SEEK_TO_END))
{ {
@ -1015,7 +1020,7 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo)
bCreateMemo = FALSE; bCreateMemo = FALSE;
Date aDate; // aktuelles Datum Date aDate; // aktuelles Datum
m_aFileStream.Open(aFile.GetMainURL(), STREAM_READWRITE | STREAM_SHARE_DENYWRITE | STREAM_TRUNC); m_aFileStream.Open(aFile.getFSysPath(INetURLObject::FSYS_DETECT), STREAM_READWRITE | STREAM_SHARE_DENYWRITE | STREAM_TRUNC);
if (!m_aFileStream.IsOpen()) if (!m_aFileStream.IsOpen())
return FALSE; return FALSE;
@ -1200,7 +1205,7 @@ BOOL ODbaseTable::CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo)
BOOL ODbaseTable::CreateMemoFile(const INetURLObject& aFile) BOOL ODbaseTable::CreateMemoFile(const INetURLObject& aFile)
{ {
// Makro zum Filehandling fürs Erzeugen von Tabellen // Makro zum Filehandling fürs Erzeugen von Tabellen
m_aMemoStream.Open(aFile.GetMainURL(), STREAM_READWRITE | STREAM_SHARE_DENYWRITE); m_aMemoStream.Open(aFile.getFSysPath(INetURLObject::FSYS_DETECT), STREAM_READWRITE | STREAM_SHARE_DENYWRITE);
if (!m_aMemoStream.IsOpen()) if (!m_aMemoStream.IsOpen())
return FALSE; return FALSE;
@ -1856,6 +1861,4 @@ BOOL ODbaseTable::WriteBuffer()
long nPos = m_aHeader.db_kopf + (long)(m_nFilePos-1) * m_aHeader.db_slng; long nPos = m_aHeader.db_kopf + (long)(m_nFilePos-1) * m_aHeader.db_slng;
m_aFileStream.Seek(nPos); m_aFileStream.Seek(nPos);
return m_aFileStream.Write((char*) m_pBuffer, m_aHeader.db_slng) > 0; return m_aFileStream.Write((char*) m_pBuffer, m_aHeader.db_slng) > 0;
} }

View file

@ -2,9 +2,9 @@
* *
* $RCSfile: FConnection.cxx,v $ * $RCSfile: FConnection.cxx,v $
* *
* $Revision: 1.1.1.1 $ * $Revision: 1.2 $
* *
* last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ * last change: $Author: oj $ $Date: 2000-09-20 06:51:53 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@ -160,7 +160,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV
INetURLObject aURL; INetURLObject aURL;
aURL.SetSmartProtocol(INET_PROT_FILE); aURL.SetSmartProtocol(INET_PROT_FILE);
aURL.SetURL(aDSN, INetURLObject::ENCODE_ALL); aURL.SetSmartURL(aDSN);
// String aFileName = aURL.PathToFileName(); // String aFileName = aURL.PathToFileName();
@ -178,7 +178,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV
Reference< ::com::sun::star::frame::XConfigManager > xSofficeIni( Reference< ::com::sun::star::frame::XConfigManager > xSofficeIni(
m_pDriver->getFactory()->createInstance(rtl::OUString::createFromAscii("com.sun.star.config.SpecialConfigManager")), UNO_QUERY); m_pDriver->getFactory()->createInstance(rtl::OUString::createFromAscii("com.sun.star.config.SpecialConfigManager")), UNO_QUERY);
aFileName = xSofficeIni->substituteVariables(aDSN); aFileName = xSofficeIni->substituteVariables(aFileName);
} }
::rtl::OUString aExt; ::rtl::OUString aExt;
@ -190,9 +190,18 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV
pBegin->Value >>= aExt; pBegin->Value >>= aExt;
} }
m_aFilenameExtension = aExt; if(aExt.len())
m_aFilenameExtension = aExt;
::ucb::Content aFile(aFileName,Reference< ::com::sun::star::ucb::XCommandEnvironment >()); ::ucb::Content aFile;
try
{
aFile = ::ucb::Content(aFileName,Reference< ::com::sun::star::ucb::XCommandEnvironment >());
}
catch(::ucb::ContentCreationException &e)
{
e;
}
// if (aFileStat.IsKind(FSYS_KIND_WILD)) // if (aFileStat.IsKind(FSYS_KIND_WILD))
// { // {
@ -211,7 +220,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV
if (aFile.isFolder()) if (aFile.isFolder())
{ {
m_xDir = aFile.createCursor(aProps, ::ucb::INCLUDE_DOCUMENTS_ONLY ); m_xDir = aFile.createDynamicCursor(aProps, ::ucb::INCLUDE_DOCUMENTS_ONLY );
m_xContent = aFile.get(); m_xContent = aFile.get();
} }
else if (aFile.isDocument()) else if (aFile.isDocument())
@ -221,7 +230,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV
m_xContent = xParent; m_xContent = xParent;
::ucb::Content aParent(xIdent->getContentIdentifier(),Reference< XCommandEnvironment >()); ::ucb::Content aParent(xIdent->getContentIdentifier(),Reference< XCommandEnvironment >());
m_xDir = aParent.createCursor(aProps, ::ucb::INCLUDE_DOCUMENTS_ONLY ); m_xDir = aParent.createDynamicCursor(aProps, ::ucb::INCLUDE_DOCUMENTS_ONLY );
} }
else else
throw SQLException(); throw SQLException();

View file

@ -2,9 +2,9 @@
* *
* $RCSfile: FDatabaseMetaData.cxx,v $ * $RCSfile: FDatabaseMetaData.cxx,v $
* *
* $Revision: 1.1.1.1 $ * $Revision: 1.2 $
* *
* last change: $Author: hr $ $Date: 2000-09-18 16:14:21 $ * last change: $Author: oj $ $Date: 2000-09-20 06:51:53 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@ -80,9 +80,15 @@
#ifndef _COM_SUN_STAR_UCB_SEARCHCOMMANDARGUMENT_HPP_ #ifndef _COM_SUN_STAR_UCB_SEARCHCOMMANDARGUMENT_HPP_
#include <com/sun/star/ucb/SearchCommandArgument.hpp> #include <com/sun/star/ucb/SearchCommandArgument.hpp>
#endif #endif
#ifndef _COM_SUN_STAR_UCB_XSORTEDDYNAMICRESULTSETFACTORY_HPP_
#include <com/sun/star/ucb/XSortedDynamicResultSetFactory.hpp>
#endif
#ifndef _URLOBJ_HXX //autogen wg. INetURLObject #ifndef _URLOBJ_HXX //autogen wg. INetURLObject
#include <tools/urlobj.hxx> #include <tools/urlobj.hxx>
#endif #endif
#ifndef _CONNECTIVITY_FILE_ODRIVER_HXX_
#include "file/FDriver.hxx"
#endif
using namespace com::sun::star::ucb; using namespace com::sun::star::ucb;
using namespace connectivity::file; using namespace connectivity::file;
@ -184,70 +190,66 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(); ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet();
Reference< XResultSet > xRef = pResult; Reference< XResultSet > xRef = pResult;
pResult->setTablesMap(); pResult->setTablesMap();
#if 0
ORows aRows; ORows aRows;
Reference<XContent> xContent = m_pConnection->getContent(); Reference<XDynamicResultSet> xContent = m_pConnection->getDir();
Reference < XSortedDynamicResultSetFactory > xSRSFac(
m_pConnection->getDriver()->getFactory()->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.ucb.SortedDynamicResultSetFactory") ), UNO_QUERY );
Sequence<RuleTerm> aRules(1); Sequence< com::sun::star::ucb::NumberedSortingInfo > aSortInfo( 1 );
aRules[0].Property = OUString::createFromAscii( "Title" ); com::sun::star::ucb::NumberedSortingInfo* pInfo = aSortInfo.getArray();
aRules[0].Operand <<= tableNamePattern; pInfo[ 0 ].ColumnIndex = 1;
aRules[0].Operator = pInfo[ 0 ].Ascending = sal_True;
aRules[0].CaseSensitive
aRules[0].RegularExpression = sal_False;
SearchCriterium aCrit(aRules); Reference < com::sun::star::ucb::XAnyCompareFactory > xFactory;
Reference< com::sun::star::ucb::XDynamicResultSet > xDynamicResultSet;
xDynamicResultSet = xSRSFac->createSortedDynamicResultSet( xContent, aSortInfo, xFactory );
Reference<XResultSet> xResultSet = xDynamicResultSet->getStaticResultSet();
SearchInfo aInfo; Reference<XRow> xRow(xResultSet,UNO_QUERY);
aInfo.Recursion = 0;
aInfo.IncludeBase = sal_False;
aInfo.RespectFolderViewRestrictions = sal_False;
aInfo.RespectDocViewRestrictions = sal_False;
aInfo.FollowIndirections = sal_False;
Sequence<Property> aProps(1);
aProps[0].Name = OUString::createFromAscii( "Title" );
aProps[0].Type = ::getCppuType((OUString*)0);
SearchCommandArgument aArg(aInfo,aProps);
String aFilenameExtension = m_pConnection->getExtension(); String aFilenameExtension = m_pConnection->getExtension();
pDir->SetSort(FSYS_SORT_NAME | FSYS_SORT_ASCENDING | FSYS_SORT_END);
pDir->Update();
::rtl::OUString aTable(::rtl::OUString::createFromAscii("TABLE")); ::rtl::OUString aTable(::rtl::OUString::createFromAscii("TABLE"));
for (sal_uInt16 nDirPos = 0; nDirPos < pDir->Count(); nDirPos++) ::rtl::OUString aName;
xResultSet->beforeFirst();
while(xResultSet->next())
{ {
aName = xRow->getString(1);
ORow aRow(3); ORow aRow(3);
if (aFilenameExtension.Len()) if (aFilenameExtension.Len())
{ {
if(match(tableNamePattern,(*pDir)[nDirPos].GetBase().GetBuffer(),'\0')) aName = aName.replaceAt(aName.getLength()-(aFilenameExtension.Len()+1),aFilenameExtension.Len()+1,::rtl::OUString());
aRow.push_back(makeAny(::rtl::OUString((*pDir)[nDirPos].GetBase()))); if(match(tableNamePattern,aName.getStr(),'\0'))
aRow.push_back(makeAny(aName));
} }
else // keine extension, dann selbst filtern else // keine extension, dann selbst filtern
{ {
sal_Bool bErg = sal_False;
do do
{ {
DirEntry aEntry = (*pDir)[nDirPos]; INetURLObject aURL;
if (!(*pDir)[nDirPos].GetExtension().Len()) aURL.SetSmartProtocol(INET_PROT_FILE);
aURL.SetSmartURL(aName);
if (!aURL.getExtension().Len())
{ {
if(match(tableNamePattern,(*pDir)[nDirPos].GetBase().GetBuffer(),'\0')) if(match(tableNamePattern,aURL.getBase().GetBuffer(),'\0'))
aRow.push_back(makeAny(::rtl::OUString((*pDir)[nDirPos].GetBase()))); aRow.push_back(makeAny(::rtl::OUString(aURL.getBase())));
break; break;
} }
else else if(bErg = xResultSet->next())
nDirPos++; aName = xRow->getString(1);
} while ((unsigned int)nDirPos < pDir->Count()); } while (bErg);
} }
aRow.push_back(makeAny(aTable)); aRow.push_back(makeAny(aTable));
aRow.push_back(Any()); aRow.push_back(Any());
aRows.push_back(aRow); aRows.push_back(aRow);
} }
pResult->setRows(aRows); pResult->setRows(aRows);
#endif
return xRef; return xRef;
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
@ -1320,7 +1322,7 @@ Reference< XConnection > SAL_CALL ODatabaseMetaData::getConnection( ) throw(SQL
{ {
::osl::MutexGuard aGuard( m_aMutex ); ::osl::MutexGuard aGuard( m_aMutex );
return (Reference< XConnection >)m_pConnection;//new OConnection(m_aConnectionHandle); return (Reference< XConnection >)m_pConnection;//new OConnection(m_aConnectionHandle);
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------

View file

@ -2,9 +2,9 @@
* *
* $RCSfile: DTable.hxx,v $ * $RCSfile: DTable.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: 2000-09-20 06:51:20 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@ -71,8 +71,8 @@
#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ #ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
#include "connectivity/CommonTools.hxx" #include "connectivity/CommonTools.hxx"
#endif #endif
#ifndef _FSYS_HXX //autogen #ifndef _URLOBJ_HXX //autogen wg. INetURLObject
#include <tools/fsys.hxx> #include <tools/urlobj.hxx>
#endif #endif
@ -136,8 +136,8 @@ namespace connectivity
void readHeader(); void readHeader();
void fillColumns(); void fillColumns();
BOOL CreateFile(const DirEntry& aFile, BOOL& bCreateMemo); BOOL CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo);
BOOL CreateMemoFile(const DirEntry& aFile); BOOL CreateMemoFile(const INetURLObject& aFile);
BOOL HasMemoFields() const { return m_aHeader.db_typ > dBaseIV;} BOOL HasMemoFields() const { return m_aHeader.db_typ > dBaseIV;}
BOOL ReadMemoHeader(); BOOL ReadMemoHeader();
BOOL ReadMemo(ULONG nBlockNo, file::OFileValue& aVariable); BOOL ReadMemo(ULONG nBlockNo, file::OFileValue& aVariable);
@ -179,7 +179,7 @@ namespace connectivity
BOOL DropImpl(); BOOL DropImpl();
BOOL CreateImpl(); BOOL CreateImpl();
DirEntry getEntry(); String getEntry();
virtual BOOL InsertRow(file::ORefAssignValues& rRow, BOOL bFlush,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols); virtual BOOL InsertRow(file::ORefAssignValues& rRow, BOOL bFlush,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols);
virtual BOOL DeleteRow(const OSQLColumns& _rCols); virtual BOOL DeleteRow(const OSQLColumns& _rCols);

View file

@ -2,9 +2,9 @@
* *
* $RCSfile: FConnection.hxx,v $ * $RCSfile: FConnection.hxx,v $
* *
* $Revision: 1.1.1.1 $ * $Revision: 1.2 $
* *
* last change: $Author: hr $ $Date: 2000-09-18 16:14:26 $ * last change: $Author: oj $ $Date: 2000-09-20 06:51:34 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@ -58,7 +58,6 @@
* *
* *
************************************************************************/ ************************************************************************/
#ifndef _CONNECTIVITY_FILE_OCONNECTION_HXX_ #ifndef _CONNECTIVITY_FILE_OCONNECTION_HXX_
#define _CONNECTIVITY_FILE_OCONNECTION_HXX_ #define _CONNECTIVITY_FILE_OCONNECTION_HXX_
@ -101,6 +100,9 @@
#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ #ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_
#include <com/sun/star/sdbcx/XTablesSupplier.hpp> #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
#endif #endif
#ifndef _COM_SUN_STAR_UCB_XDYNAMICRESULTSET_HPP_
#include <com/sun/star/ucb/XDynamicResultSet.hpp>
#endif
#ifndef _CONNECTIVITY_SQLPARSE_HXX #ifndef _CONNECTIVITY_SQLPARSE_HXX
#include "connectivity/sqlparse.hxx" #include "connectivity/sqlparse.hxx"
#endif #endif
@ -150,7 +152,7 @@ namespace connectivity
String m_aFilenameExtension; String m_aFilenameExtension;
OFileDriver* m_pDriver; // Pointer to the owning OFileDriver* m_pDriver; // Pointer to the owning
// driver object // driver object
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > m_xDir; ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XDynamicResultSet > m_xDir;
::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent> m_xContent; ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent> m_xContent;
sal_Bool m_bClosed; sal_Bool m_bClosed;
@ -201,11 +203,14 @@ namespace connectivity
virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
// no interface methods // no interface methods
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > getDir() const { return m_xDir; } ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XDynamicResultSet > getDir() const { return m_xDir; }
::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent> getContent() const { return m_xContent; } ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent> getContent() const { return m_xContent; }
// create a catalog or return the catalog already created // create a catalog or return the catalog already created
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > createCatalog(); virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > createCatalog();
String getExtension() const { return m_aFilenameExtension;} String getExtension() const { return m_aFilenameExtension;}
OFileDriver* getDriver() const { return m_pDriver; }
}; };
} }
} }