diff options
23 files changed, 521 insertions, 134 deletions
diff --git a/connectivity/source/commontools/makefile.mk b/connectivity/source/commontools/makefile.mk index eaec158b66aa..33907471a67b 100644 --- a/connectivity/source/commontools/makefile.mk +++ b/connectivity/source/commontools/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.10 $ +# $Revision: 1.11 $ # -# last change: $Author: oj $ $Date: 2001-03-19 09:35:26 $ +# last change: $Author: oj $ $Date: 2001-03-28 11:31:43 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -75,13 +75,16 @@ ENVCFLAGS+=/FR$(SLO)$/ # --- Files -------------------------------------------------------- SLOFILES=\ - $(SLO)$/emptymetadata.obj \ - $(SLO)$/dbcharset.obj \ - $(SLO)$/dbtools.obj \ - $(SLO)$/dbexception.obj \ - $(SLO)$/dbconversion.obj \ - $(SLO)$/CommonTools.obj \ - $(SLO)$/DateConversion.obj \ + $(SLO)$/emptymetadata.obj \ + $(SLO)$/dbcharset.obj \ + $(SLO)$/dbtools.obj \ + $(SLO)$/dbexception.obj \ + $(SLO)$/dbconversion.obj \ + $(SLO)$/CommonTools.obj \ + $(SLO)$/FDatabaseMetaDataResultSetMetaData.obj \ + $(SLO)$/FDatabaseMetaDataResultSet.obj \ + $(SLO)$/FValue.obj \ + $(SLO)$/DateConversion.obj \ $(SLO)$/TDatabaseMetaDataBase.obj .IF "$(COM)"=="GCC" diff --git a/connectivity/source/drivers/calc/CDatabaseMetaData.cxx b/connectivity/source/drivers/calc/CDatabaseMetaData.cxx index a534e787f9f9..5dd895b6f5c7 100644 --- a/connectivity/source/drivers/calc/CDatabaseMetaData.cxx +++ b/connectivity/source/drivers/calc/CDatabaseMetaData.cxx @@ -2,9 +2,9 @@ * * $RCSfile: CDatabaseMetaData.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: nn $ $Date: 2001-03-16 14:39:51 $ + * last change: $Author: oj $ $Date: 2001-03-28 11:32:42 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -108,12 +108,15 @@ #ifndef _URLOBJ_HXX //autogen wg. INetURLObject #include <tools/urlobj.hxx> #endif -#ifndef _CONNECTIVITY_FILE_ADATABASEMETADATARESULTSET_HXX_ -#include "file/FDatabaseMetaDataResultSet.hxx" +#ifndef _CONNECTIVITY_FDATABASEMETADATARESULTSET_HXX_ +#include "FDatabaseMetaDataResultSet.hxx" #endif #ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ #include <com/sun/star/lang/XUnoTunnel.hpp> #endif +#ifndef _COMPHELPER_TYPES_HXX_ +#include <comphelper/types.hxx> +#endif #define CONNECTIVITY_PROPERTY_NAME_SPACE calc #ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ #include "propertyids.hxx" diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx index c8a3e990f279..94d407e15aa9 100644 --- a/connectivity/source/drivers/calc/CTable.cxx +++ b/connectivity/source/drivers/calc/CTable.cxx @@ -2,9 +2,9 @@ * * $RCSfile: CTable.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: nn $ $Date: 2001-03-16 14:39:51 $ + * last change: $Author: oj $ $Date: 2001-03-28 11:31:44 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -354,7 +354,7 @@ void lcl_GetColumnInfo( const Reference<XSpreadsheet>& xSheet, const Reference<X // ------------------------------------------------------------------------- -void lcl_SetValue( file::ORowSetValue& rValue, const Reference<XSpreadsheet>& xSheet, +void lcl_SetValue( ORowSetValue& rValue, const Reference<XSpreadsheet>& xSheet, sal_Int32 nStartCol, sal_Int32 nStartRow, sal_Bool bHasHeaders, const ::Date& rNullDate, sal_Int32 nDBRow, sal_Int32 nDBColumn, sal_Int32 nType ) @@ -860,7 +860,7 @@ End: return sal_True; } //------------------------------------------------------------------ -sal_Bool OCalcTable::fetchRow( file::OValueRow _rRow, const OSQLColumns & _rCols, +sal_Bool OCalcTable::fetchRow( OValueRow _rRow, const OSQLColumns & _rCols, sal_Bool _bUseTableDefs, sal_Bool bRetrieveData ) { // read the bookmark @@ -919,7 +919,7 @@ BOOL OCalcTable::InsertRow(OValueVector& rRow, BOOL bFlush,const Reference<XInde } //------------------------------------------------------------------ -BOOL OCalcTable::UpdateRow(file::OValueVector& rRow, OValueRow pOrgRow,const Reference<XIndexAccess>& _xCols) +BOOL OCalcTable::UpdateRow(OValueVector& rRow, OValueRow pOrgRow,const Reference<XIndexAccess>& _xCols) { return sal_False; // read-only for now } diff --git a/connectivity/source/drivers/dbase/DColumns.cxx b/connectivity/source/drivers/dbase/DColumns.cxx index 252ba2080f4c..248f7e8188e7 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.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2000-11-03 14:17:57 $ + * last change: $Author: oj $ $Date: 2001-03-28 11:31:44 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -68,16 +68,20 @@ #ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_ #include "connectivity/sdbcx/VColumn.hxx" #endif +#ifndef _COM_SUN_STAR_LANG_INDEXOUTOFBOUNDSEXCEPTION_HPP_ +#include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#endif using namespace connectivity::dbase; using namespace connectivity; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::lang; using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; - +typedef file::OColumns ODbaseColumns_BASE; Reference< XNamed > ODbaseColumns::createObject(const ::rtl::OUString& _rName) { @@ -102,4 +106,40 @@ Reference< XPropertySet > ODbaseColumns::createEmptyObject() Reference< XPropertySet > xRet = pRet; return xRet; } +// ----------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// XAppend +void SAL_CALL ODbaseColumns::appendByDescriptor( const Reference< XPropertySet >& descriptor ) throw(SQLException, ElementExistException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + if(!m_pTable->isNew()) + m_pTable->addColumn(descriptor); + ODbaseColumns_BASE::appendByDescriptor(descriptor); +} +// ----------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +// XDrop +void SAL_CALL ODbaseColumns::dropByName( const ::rtl::OUString& elementName ) throw(SQLException, NoSuchElementException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + if(!m_pTable->isNew()) + { + } + ODbaseColumns_BASE::dropByName(elementName); +} +// ----------------------------------------------------------------------------- +// ------------------------------------------------------------------------- +void SAL_CALL ODbaseColumns::dropByIndex( sal_Int32 index ) throw(SQLException, IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_rMutex); + if (index < 0 || index >= getCount()) + throw IndexOutOfBoundsException(); + + if(!m_pTable->isNew()) + { + + } + ODbaseColumns_BASE::dropByIndex(index); +} +// ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx index 5637db0bc38f..21bc450f341e 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.16 $ + * $Revision: 1.17 $ * - * last change: $Author: oj $ $Date: 2001-03-20 10:58:52 $ + * last change: $Author: oj $ $Date: 2001-03-28 11:31:44 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -87,8 +87,8 @@ #ifndef _URLOBJ_HXX //autogen wg. INetURLObject #include <tools/urlobj.hxx> #endif -#ifndef _CONNECTIVITY_FILE_ADATABASEMETADATARESULTSET_HXX_ -#include "file/FDatabaseMetaDataResultSet.hxx" +#ifndef _CONNECTIVITY_FDATABASEMETADATARESULTSET_HXX_ +#include "FDatabaseMetaDataResultSet.hxx" #endif #ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ #include <com/sun/star/lang/XUnoTunnel.hpp> @@ -101,7 +101,7 @@ #include "propertyids.hxx" #endif #ifndef _CONNECTIVITY_FILE_VALUE_HXX_ -#include "file/FValue.hxx" +#include "FValue.hxx" #endif #ifndef _COMPHELPER_EXTRACT_HXX_ #include <comphelper/extract.hxx> @@ -511,5 +511,20 @@ sal_Int32 SAL_CALL ODbaseDatabaseMetaData::getMaxColumnsInTable( ) throw(SQLExc return 128; } // ----------------------------------------------------------------------------- +sal_Bool SAL_CALL ODbaseDatabaseMetaData::supportsAlterTableWithAddColumn( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_True; +} +// ------------------------------------------------------------------------- +sal_Bool SAL_CALL ODbaseDatabaseMetaData::supportsAlterTableWithDropColumn( ) throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return sal_False; +} +// ----------------------------------------------------------------------------- + diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 4bbd455dd760..635676075ef8 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DTable.cxx,v $ * - * $Revision: 1.34 $ + * $Revision: 1.35 $ * - * last change: $Author: fs $ $Date: 2001-03-15 08:47:25 $ + * last change: $Author: oj $ $Date: 2001-03-28 11:31:44 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -130,11 +130,24 @@ #ifndef _DBHELPER_DBCONVERSION_HXX_ #include <connectivity/dbconversion.hxx> #endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _COMPHELPER_PROPERTY_HXX_ +#include <comphelper/property.hxx> +#endif +#ifndef _UNOTOOLS_TEMPFILE_HXX +#include <unotools/tempfile.hxx> +#endif +#ifndef _COMPHELPER_TYPES_HXX_ +#include <comphelper/types.hxx> +#endif using namespace connectivity; using namespace connectivity::dbase; using namespace connectivity::file; using namespace ::ucb; +using namespace ::utl; using namespace ::cppu; using namespace ::dbtools; using namespace ::com::sun::star::uno; @@ -204,6 +217,11 @@ void ODbaseTable::fillColumns() m_pFileStream->Seek(STREAM_SEEK_TO_BEGIN); m_pFileStream->Seek(32L); + m_aColumns->clear(); + m_aTypes.clear(); + m_aPrecisions.clear(); + m_aScales.clear(); + // Anzahl Felder: sal_Int32 nFieldCount = (m_aHeader.db_kopf - 1) / 32 - 1; @@ -380,9 +398,6 @@ void ODbaseTable::construct() } AllocBuffer(); - - refreshColumns(); - refreshIndexes(); } } //------------------------------------------------------------------ @@ -453,11 +468,7 @@ String ODbaseTable::getEntry() if ((sName == m_Name) && (sExt == sNeededExt)) { Reference< XContentAccess > xContentAccess( xDir, UNO_QUERY ); -#if SUPD>611 aURL = xContentAccess->queryContentIdentifierString(); -#else - aURL = xContentAccess->queryContentIdentfierString(); -#endif break; } } @@ -540,15 +551,14 @@ void SAL_CALL ODbaseTable::disposing(void) Sequence< Type > SAL_CALL ODbaseTable::getTypes( ) throw(RuntimeException) { Sequence< Type > aTypes = OTable_TYPEDEF::getTypes(); - Sequence< Type > aRet(aTypes.getLength()-3); + Sequence< Type > aRet(aTypes.getLength()-2); const Type* pBegin = aTypes.getConstArray(); const Type* pEnd = pBegin + aTypes.getLength(); sal_Int32 i=0; for(;pBegin != pEnd;++pBegin,++i) { - if(!(*pBegin == ::getCppuType((const Reference<XKeysSupplier>*)0) || - *pBegin == ::getCppuType((const Reference<XRename>*)0) || - *pBegin == ::getCppuType((const Reference<XAlterTable>*)0) || + if(!(*pBegin == ::getCppuType((const Reference<XKeysSupplier>*)0) || + *pBegin == ::getCppuType((const Reference<XAlterTable>*)0) || *pBegin == ::getCppuType((const Reference<XDataDescriptorFactory>*)0))) { aRet.getArray()[i] = *pBegin; @@ -562,9 +572,8 @@ Sequence< Type > SAL_CALL ODbaseTable::getTypes( ) throw(RuntimeException) // ------------------------------------------------------------------------- Any SAL_CALL ODbaseTable::queryInterface( const Type & rType ) throw(RuntimeException) { - if( rType == ::getCppuType((const Reference<XKeysSupplier>*)0) || - rType == ::getCppuType((const Reference<XRename>*)0) || - rType == ::getCppuType((const Reference<XAlterTable>*)0) || + if( rType == ::getCppuType((const Reference<XKeysSupplier>*)0) || + rType == ::getCppuType((const Reference<XAlterTable>*)0) || rType == ::getCppuType((const Reference<XDataDescriptorFactory>*)0)) return Any(); @@ -684,7 +693,7 @@ End: return sal_True; } //------------------------------------------------------------------ -sal_Bool ODbaseTable::fetchRow(file::OValueRow _rRow,const OSQLColumns & _rCols, sal_Bool _bUseTableDefs,sal_Bool bRetrieveData) +sal_Bool ODbaseTable::fetchRow(OValueRow _rRow,const OSQLColumns & _rCols, sal_Bool _bUseTableDefs,sal_Bool bRetrieveData) { // Einlesen der Daten BOOL bIsCurRecordDeleted = ((char)m_pBuffer[0] == '*') ? TRUE : sal_False; @@ -1303,11 +1312,15 @@ BOOL ODbaseTable::DropImpl() // jetzt noch die Indices loeschen String aIndexName; // aFile.SetExtension(String::CreateFromAscii("ndx")); - sal_Int32 nCount = m_pIndexes->getCount(), - i = 0; - while (i < nCount) + refreshIndexes(); // look for indexes which must be deleted as well + if(m_pIndexes) { - m_pIndexes->dropByIndex(i); + sal_Int32 nCount = m_pIndexes->getCount(), + i = 0; + while (i < nCount) + { + m_pIndexes->dropByIndex(i); + } } // aFile.SetBase(m_Name); aURL.setExtension(String::CreateFromAscii("inf")); @@ -1372,7 +1385,7 @@ BOOL ODbaseTable::InsertRow(OValueVector& rRow, BOOL bFlush,const Reference<XInd } //------------------------------------------------------------------ -BOOL ODbaseTable::UpdateRow(file::OValueVector& rRow, OValueRow pOrgRow,const Reference<XIndexAccess>& _xCols) +BOOL ODbaseTable::UpdateRow(OValueVector& rRow, OValueRow pOrgRow,const Reference<XIndexAccess>& _xCols) { // Buffer mit Leerzeichen fllen AllocBuffer(); @@ -1895,4 +1908,262 @@ BOOL ODbaseTable::WriteBuffer() return m_pFileStream->Write((char*) m_pBuffer, m_aHeader.db_slng) > 0; } // ----------------------------------------------------------------------------- +// XAlterTable +void SAL_CALL ODbaseTable::alterColumnByName( const ::rtl::OUString& colName, const Reference< XPropertySet >& descriptor ) throw(SQLException, NoSuchElementException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (ODbaseTable_BASE::rBHelper.bDisposed) + throw DisposedException(); + + Reference<XDataDescriptorFactory> xOldColumn; + m_pColumns->getByName(colName) >>= xOldColumn; + + alterColumn(m_pColumns->findColumn(colName),descriptor,xOldColumn); +} +// ------------------------------------------------------------------------- +void SAL_CALL ODbaseTable::alterColumnByIndex( sal_Int32 index, const Reference< XPropertySet >& descriptor ) throw(SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (ODbaseTable_BASE::rBHelper.bDisposed) + throw DisposedException(); + if(index < 0 || index >= m_pColumns->getCount()) + throw IndexOutOfBoundsException(); + + Reference<XDataDescriptorFactory> xOldColumn; + m_pColumns->getByIndex(index) >>= xOldColumn; + alterColumn(index,descriptor,xOldColumn); +} +// ----------------------------------------------------------------------------- +void ODbaseTable::alterColumn(sal_Int32 index, + const Reference< XPropertySet >& descriptor , + const Reference< XDataDescriptorFactory >& xOldColumn ) +{ + if(index < 0 || index >= m_pColumns->getCount()) + throw IndexOutOfBoundsException(); + + OSL_ENSURE(descriptor.is(),"descriptor can not be null!"); + OSL_ENSURE(xOldColumn.is(),"xOldColumn can not be null!"); + // creates a copy of the the original column and copy all properties from descriptor in xCopyColumn + Reference<XPropertySet> xCopyColumn = xOldColumn->createDataDescriptor(); + ::comphelper::copyProperties(descriptor,xCopyColumn); + + +// // get the name +// ::rtl::OUString sOldName,sNewName; +// xOldColumn->getPropertyByName(PROPERTY_NAME) >>= sOldName; +// descriptor->getPropertyByName(PROPERTY_NAME) >>= sNewName; +// +// // get the type +// sal_Int32 nOldType,nNewType; +// xOldColumn->getPropertyByName(PROPERTY_TYPE) >>= nOldType; +// descriptor->getPropertyByName(PROPERTY_TYPE) >>= nNewType; +// +// // get the precision +// sal_Int32 nOldPrec,nNewPrec; +// xOldColumn->getPropertyByName(PROPERTY_PRECISION) >>= nOldPrec; +// descriptor->getPropertyByName(PROPERTY_PRECISION) >>= nNewPrec; +// +// // get the scale +// sal_Int32 nOldScale,nNewScale; +// xOldColumn->getPropertyByName(PROPERTY_SCALE) >>= nOldScale; +// descriptor->getPropertyByName(PROPERTY_SCALE) >>= nNewScale; +// +// // check if currency changed +// sal_Bool bOldCur,bNewCur; +// bOldCur = ::cppu::any2bool(xOldColumn->getPropertyByName(PROPERTY_ISCURRENCY)); +// bNewCur = ::cppu::any2bool(descriptor->getPropertyByName(PROPERTY_ISCURRENCY)); + + // creates a temp file + + String sTempName = createTempFile(); + + ODbaseTable* pNewTable = new ODbaseTable(static_cast<ODbaseConnection*>(m_pConnection)); + Reference<XPropertySet> xHoldTable = pNewTable; + pNewTable->setPropertyValue(PROPERTY_NAME,makeAny(::rtl::OUString(sTempName))); + Reference<XAppend> xAppend(pNewTable->getColumns(),UNO_QUERY); + + // copy the structure + sal_Int32 i=0; + for(;i < index;++i) + { + Reference<XDataDescriptorFactory> xColumn; + m_pColumns->getByIndex(index) >>= xColumn; + Reference<XPropertySet> xCpy = xColumn->createDataDescriptor(); + xAppend->appendByDescriptor(xCpy); + } + ++i; // now insert our new column + xAppend->appendByDescriptor(xCopyColumn); + + for(;i < m_pColumns->getCount();++i) + { + Reference<XDataDescriptorFactory> xColumn; + m_pColumns->getByIndex(index) >>= xColumn; + Reference<XPropertySet> xCpy = xColumn->createDataDescriptor(); + xAppend->appendByDescriptor(xCpy); + } + + // construct the new table + if(!pNewTable->CreateImpl()) + { + delete pNewTable; + return; + } + + // copy the data + copyData(pNewTable); + + + DropImpl(); + pNewTable->rename(m_Name); + // release the temp file + pNewTable = NULL; + ::comphelper::disposeComponent(xHoldTable); + + FileClose(); + construct(); +} +// ------------------------------------------------------------------------- +void SAL_CALL ODbaseTable::rename( const ::rtl::OUString& newName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if (ODbaseTable_BASE::rBHelper.bDisposed) + throw DisposedException(); + + FileClose(); + String aName = getEntry(); + if(!aName.Len()) + { + ::rtl::OUString aIdent = m_pConnection->getContent()->getIdentifier()->getContentIdentifier(); + aIdent += ::rtl::OUString::createFromAscii("/"); + aIdent += m_Name; + aName = aIdent; + } + INetURLObject aURL; + aURL.SetURL(aName); + + if(aURL.getExtension() != m_pConnection->getExtension()) + aURL.setExtension(m_pConnection->getExtension()); + String sNewName(newName); + sNewName.AppendAscii("."); + sNewName += m_pConnection->getExtension(); + + try + { + Content aContent(aURL.GetURLNoPass(),Reference<XCommandEnvironment>()); + aContent.setPropertyValue( rtl::OUString::createFromAscii( "Title" ),makeAny( ::rtl::OUString(sNewName) ) ); + } + catch(Exception&) + { + throw ElementExistException(); + } + m_Name = newName; + construct(); +} +// ----------------------------------------------------------------------------- +void ODbaseTable::addColumn(const Reference< XPropertySet >& _xNewColumn) +{ + String sTempName = createTempFile(); + + ODbaseTable* pNewTable = new ODbaseTable(static_cast<ODbaseConnection*>(m_pConnection)); + Reference<XPropertySet> xHoldTable = pNewTable; + pNewTable->setPropertyValue(PROPERTY_NAME,makeAny(::rtl::OUString(sTempName))); + { + Reference<XAppend> xAppend(pNewTable->getColumns(),UNO_QUERY); + + // copy the structure + for(sal_Int32 i=0;i < m_pColumns->getCount();++i) + { + Reference<XDataDescriptorFactory> xColumn; + m_pColumns->getByIndex(i) >>= xColumn; + Reference<XPropertySet> xCpy = xColumn->createDataDescriptor(); + xAppend->appendByDescriptor(xCpy); + } + xAppend->appendByDescriptor(_xNewColumn); + } + + // construct the new table + if(!pNewTable->CreateImpl()) + { + return; + } + // copy the data + copyData(pNewTable); + // drop the old table + DropImpl(); + pNewTable->rename(m_Name); + // release the temp file + pNewTable = NULL; + ::comphelper::disposeComponent(xHoldTable); + FileClose(); + construct(); +} +// ----------------------------------------------------------------------------- +String ODbaseTable::createTempFile() +{ + ::rtl::OUString aIdent = m_pConnection->getContent()->getIdentifier()->getContentIdentifier(); + aIdent += ::rtl::OUString::createFromAscii("/"); + String sTempName(aIdent); + String sExt; + sExt.AssignAscii("."); + sExt += m_pConnection->getExtension(); + + TempFile aTempFile(String(m_Name),&sExt,&sTempName); + if(!aTempFile.IsValid()) + throw SQLException(::rtl::OUString::createFromAscii("Error while alter table!"),NULL,::rtl::OUString::createFromAscii("HY0000"),1000,Any()); + + INetURLObject aURL; + aURL.SetSmartProtocol(INET_PROT_FILE); + aURL.SetURL(aTempFile.GetURL()); + + Content aContent(aURL.GetURLNoPass(),Reference<XCommandEnvironment>()); + try + { + if (aContent.isDocument()) + { + // Hack fuer Bug #30609 , nur wenn das File existiert und die Laenge > 0 gibt es einen Fehler + SvStream* pFileStream = ::utl::UcbStreamHelper::CreateStream( aURL.GetURLNoPass(),STREAM_READ); + + if (pFileStream && pFileStream->Seek(STREAM_SEEK_TO_END)) + { + // aStatus.SetError(ERRCODE_IO_ALREADYEXISTS,TABLE,aFile.GetFull()); + return String(); + } + delete pFileStream; + } + } + catch(Exception&) // a exception is thrown when no file exists + { + } + String sNewName(aURL.getName()); + sNewName.Erase(sNewName.Len() - sExt.Len()); + return sNewName; +} +// ----------------------------------------------------------------------------- +void ODbaseTable::copyData(ODbaseTable* _pNewTable) +{ + OValueRow aRow = new OValueVector(m_pColumns->getCount()); + for(OValueVector::iterator aIter = aRow->begin(); aIter != aRow->end();++aIter) + aIter->setBound(sal_True); + + sal_Bool bOk = sal_True; + sal_Int32 nCurPos; + for(sal_uInt32 nRowPos = 0; nRowPos < m_aHeader.db_anz;++nRowPos) + { + if(bOk = seekRow(FILE_BOOKMARK,nRowPos,nCurPos)) + { + if(bOk = fetchRow(aRow,m_aColumns.getBody(),sal_True,sal_True)) + { + bOk = _pNewTable->InsertRow(*aRow,sal_True,_pNewTable->m_pColumns); + OSL_ENSURE(bOk,"Row could not be inserted!"); + } + else + OSL_ENSURE(bOk,"Row could not be fetched!"); + } + else + { + OSL_ASSERT(0); + } + } +} +// ----------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/dbase/DTables.cxx b/connectivity/source/drivers/dbase/DTables.cxx index 88e788fad3fe..ec79921decc5 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.9 $ + * $Revision: 1.10 $ * - * last change: $Author: oj $ $Date: 2001-03-01 10:56:00 $ + * last change: $Author: oj $ $Date: 2001-03-28 11:32:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -167,6 +167,9 @@ void SAL_CALL ODbaseTables::dropByName( const ::rtl::OUString& elementName ) thr if( aIter == m_aNameMap.end()) throw NoSuchElementException(elementName,*this); + if(!aIter->second.is()) // we want to drop a object which isn't loaded yet so we must load it + aIter->second = createObject(elementName); + Reference< XUnoTunnel> xTunnel(aIter->second.get(),UNO_QUERY); if(xTunnel.is()) { @@ -174,6 +177,8 @@ void SAL_CALL ODbaseTables::dropByName( const ::rtl::OUString& elementName ) thr if(pTable && pTable->DropImpl()) ODbaseTables_BASE_BASE::dropByName(elementName); } + else + throw SQLException(::rtl::OUString::createFromAscii("Can't drop table ") + elementName,*this,SQLSTATE_SEQUENCE,1000,Any()); } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/file/FDatabaseMetaData.cxx b/connectivity/source/drivers/file/FDatabaseMetaData.cxx index 56ad2763c383..41f4dc3236e5 100644 --- a/connectivity/source/drivers/file/FDatabaseMetaData.cxx +++ b/connectivity/source/drivers/file/FDatabaseMetaData.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FDatabaseMetaData.cxx,v $ * - * $Revision: 1.14 $ + * $Revision: 1.15 $ * - * last change: $Author: oj $ $Date: 2001-03-15 13:05:08 $ + * last change: $Author: oj $ $Date: 2001-03-28 11:31:44 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,8 +62,8 @@ #ifndef _CONNECTIVITY_FILE_ODATABASEMETADATA_HXX_ #include "file/FDatabaseMetaData.hxx" #endif -#ifndef _CONNECTIVITY_FILE_ORESULTSET_HXX_ -#include "file/FDatabaseMetaDataResultSet.hxx" +#ifndef _CONNECTIVITY_FDATABASEMETADATARESULTSET_HXX_ +#include "FDatabaseMetaDataResultSet.hxx" #endif #ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ #include <com/sun/star/sdbc/DataType.hpp> diff --git a/connectivity/source/drivers/file/makefile.mk b/connectivity/source/drivers/file/makefile.mk index a537cc7d06f5..b6afa45d0285 100644 --- a/connectivity/source/drivers/file/makefile.mk +++ b/connectivity/source/drivers/file/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.5 $ +# $Revision: 1.6 $ # -# last change: $Author: oj $ $Date: 2001-03-19 09:35:30 $ +# last change: $Author: oj $ $Date: 2001-03-28 11:31:44 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -79,9 +79,6 @@ ENVCFLAGS+=/FR$(SLO)$/ SLOFILES=\ $(SLO)$/FConnection.obj \ - $(SLO)$/FValue.obj \ - $(SLO)$/FDatabaseMetaDataResultSetMetaData.obj \ - $(SLO)$/FDatabaseMetaDataResultSet.obj \ $(SLO)$/FResultSetMetaData.obj \ $(SLO)$/FColumns.obj \ $(SLO)$/FTables.obj \ diff --git a/connectivity/source/drivers/flat/EDatabaseMetaData.cxx b/connectivity/source/drivers/flat/EDatabaseMetaData.cxx index 8bbd4f08181c..28ab98c7ebef 100644 --- a/connectivity/source/drivers/flat/EDatabaseMetaData.cxx +++ b/connectivity/source/drivers/flat/EDatabaseMetaData.cxx @@ -2,9 +2,9 @@ * * $RCSfile: EDatabaseMetaData.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: jl $ $Date: 2001-03-21 13:41:53 $ + * last change: $Author: oj $ $Date: 2001-03-28 11:31:45 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -87,8 +87,8 @@ #ifndef _URLOBJ_HXX //autogen wg. INetURLObject #include <tools/urlobj.hxx> #endif -#ifndef _CONNECTIVITY_FILE_ADATABASEMETADATARESULTSET_HXX_ -#include "file/FDatabaseMetaDataResultSet.hxx" +#ifndef _CONNECTIVITY_FDATABASEMETADATARESULTSET_HXX_ +#include "FDatabaseMetaDataResultSet.hxx" #endif #ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ #include <com/sun/star/lang/XUnoTunnel.hpp> diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx index 5f9825ae084a..6dae9b52e852 100644 --- a/connectivity/source/drivers/flat/ETable.cxx +++ b/connectivity/source/drivers/flat/ETable.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ETable.cxx,v $ * - * $Revision: 1.21 $ + * $Revision: 1.22 $ * - * last change: $Author: jl $ $Date: 2001-03-21 13:41:53 $ + * last change: $Author: oj $ $Date: 2001-03-28 11:31:45 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -838,7 +838,7 @@ sal_Bool OFlatTable::seekRow(FilePosition eCursorPosition, sal_Int32 nOffset, sa return sal_True; } //------------------------------------------------------------------ -sal_Bool OFlatTable::fetchRow(file::OValueRow _rRow,const OSQLColumns & _rCols,sal_Bool bIsTable,sal_Bool bRetrieveData) +sal_Bool OFlatTable::fetchRow(OValueRow _rRow,const OSQLColumns & _rCols,sal_Bool bIsTable,sal_Bool bRetrieveData) { OFlatConnection* pConnection = (OFlatConnection*)m_pConnection; (*_rRow)[0] = m_nFilePos; @@ -949,7 +949,7 @@ BOOL OFlatTable::InsertRow(OValueVector& rRow, BOOL bFlush,const Reference<XInde } //------------------------------------------------------------------ -BOOL OFlatTable::UpdateRow(file::OValueVector& rRow, OValueRow pOrgRow,const Reference<XIndexAccess>& _xCols) +BOOL OFlatTable::UpdateRow(OValueVector& rRow, OValueRow pOrgRow,const Reference<XIndexAccess>& _xCols) { return sal_True; } diff --git a/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx b/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx index 2f3d6065c5bc..eb34f04eb0fc 100644 --- a/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx +++ b/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ODatabaseMetaData.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: oj $ $Date: 2001-02-05 12:26:40 $ + * last change: $Author: oj $ $Date: 2001-03-28 11:31:45 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -68,6 +68,9 @@ #ifndef _CONNECTIVITY_ODBC_ORESULTSET_HXX_ #include "odbc/ODatabaseMetaDataResultSet.hxx" #endif +#ifndef _CONNECTIVITY_FDATABASEMETADATARESULTSET_HXX_ +#include "FDatabaseMetaDataResultSet.hxx" +#endif #ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ #include <com/sun/star/sdbc/DataType.hpp> #endif @@ -662,18 +665,45 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( ) throw(SQLException, { sal_Int32 nValue; OTools::GetInfo(m_aConnectionHandle,SQL_OJ_CAPABILITIES,nValue,*this); - return nValue; + return ((nValue & SQL_OJ_FULL|SQL_OJ_LEFT|SQL_OJ_RIGHT|SQL_OJ_NESTED|SQL_OJ_NOT_ORDERED|SQL_OJ_ALL_COMPARISON_OPS|SQL_OJ_INNER) != 0); } // ------------------------------------------------------------------------- Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException) { - SQLHANDLE hStmt; - SQLRETURN nRetcode = N3SQLAllocHandle(SQL_HANDLE_STMT,m_pConnection->getConnection(),&hStmt); - OTools::ThrowException(nRetcode,m_pConnection->getConnection(),SQL_HANDLE_DBC,*this); - - ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(hStmt,m_pConnection->getTextEncoding()); + // there exists no possibility to get table types so we have to check + static ::rtl::OUString sTableTypes[] = + { + ::rtl::OUString::createFromAscii("TABLE"), + ::rtl::OUString::createFromAscii("VIEW"), + ::rtl::OUString::createFromAscii("SYSTEM TABLE"), + ::rtl::OUString::createFromAscii("GLOBAL TEMPORARY"), + ::rtl::OUString::createFromAscii("LOCAL TEMPORARY"), + ::rtl::OUString::createFromAscii("ALIAS"), + ::rtl::OUString::createFromAscii("SYNONYM") + }; + sal_Int32 nSize = sizeof(sTableTypes) / sizeof(::rtl::OUString); + ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(); Reference< XResultSet > xRef = pResult; - pResult->openTablesTypes(); + pResult->setTableTypes(); + sal_Int32 nValue = 0; + OTools::GetInfo(m_aConnectionHandle,SQL_CREATE_VIEW,nValue,*this); + sal_Bool bViewsSupported = (nValue & SQL_CV_CREATE_VIEW) == SQL_CV_CREATE_VIEW; + + ORows aRows; + for(sal_Int32 i=0;i < nSize;++i) + { + if( !bViewsSupported && i == 1) + continue; // no views supported + ORow aRow; + aRow.push_back(ORowSetValue()); + aRow.push_back(ORowSetValue(sTableTypes[i])); + // bound row + ORow::iterator aIter = aRow.begin(); + for(;aIter != aRow.end();++aIter) + aIter->setBound(sal_True); + aRows.push_back(aRow); + } + pResult->setRows(aRows); return xRef; } // ------------------------------------------------------------------------- @@ -1056,28 +1086,28 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(S { sal_Int32 nValue; OTools::GetInfo(m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this); - return nValue & SQL_SU_PROCEDURE_INVOCATION; + return (nValue & SQL_SU_PROCEDURE_INVOCATION) == SQL_SU_PROCEDURE_INVOCATION; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) { sal_Int32 nValue; OTools::GetInfo(m_aConnectionHandle,SQL_SCHEMA_USAGE,nValue,*this); - return nValue & SQL_SU_PRIVILEGE_DEFINITION; + return (nValue & SQL_SU_PRIVILEGE_DEFINITION) == SQL_SU_PRIVILEGE_DEFINITION; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException) { sal_Int32 nValue; OTools::GetInfo(m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this); - return nValue & SQL_CU_PROCEDURE_INVOCATION; + return (nValue & SQL_CU_PROCEDURE_INVOCATION) == SQL_CU_PROCEDURE_INVOCATION; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) { sal_Int32 nValue; OTools::GetInfo(m_aConnectionHandle,SQL_CATALOG_USAGE,nValue,*this); - return nValue & SQL_CU_PRIVILEGE_DEFINITION; + return (nValue & SQL_CU_PRIVILEGE_DEFINITION) == SQL_CU_PRIVILEGE_DEFINITION; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/odbc/OResultSetMetaData.cxx b/connectivity/source/drivers/odbc/OResultSetMetaData.cxx index a0345f508e80..5c1db1172b8c 100644 --- a/connectivity/source/drivers/odbc/OResultSetMetaData.cxx +++ b/connectivity/source/drivers/odbc/OResultSetMetaData.cxx @@ -2,9 +2,9 @@ * * $RCSfile: OResultSetMetaData.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2000-12-12 15:50:18 $ + * last change: $Author: oj $ $Date: 2001-03-28 11:31:45 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -225,6 +225,7 @@ sal_Int32 SAL_CALL OResultSetMetaData::getPrecision( sal_Int32 column ) throw(SQ { return getNumColAttrib(column,SQL_DESC_PRECISION); } +// ----------------------------------------------------------------------------- sal_Int32 SAL_CALL OResultSetMetaData::getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { return getNumColAttrib(column,SQL_DESC_SCALE); diff --git a/connectivity/source/inc/calc/CTable.hxx b/connectivity/source/inc/calc/CTable.hxx index 57030e7f0c15..3163d2cbf64b 100644 --- a/connectivity/source/inc/calc/CTable.hxx +++ b/connectivity/source/inc/calc/CTable.hxx @@ -2,9 +2,9 @@ * * $RCSfile: CTable.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: nn $ $Date: 2001-02-21 11:34:47 $ + * last change: $Author: oj $ $Date: 2001-03-28 11:29:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -107,7 +107,7 @@ namespace connectivity void fillColumns(); BOOL WriteBuffer(); - BOOL UpdateBuffer(file::OValueVector& rRow, file::OValueRow pOrgRow,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols); + BOOL UpdateBuffer(OValueVector& rRow, OValueRow pOrgRow,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols); ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> isUniqueByColumnName(const ::rtl::OUString& _rColName); protected: @@ -129,7 +129,7 @@ namespace connectivity virtual sal_Int32 getCurrentLastPos() const; virtual sal_Bool seekRow(FilePosition eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos); - virtual sal_Bool fetchRow(file::OValueRow _rRow,const OSQLColumns& _rCols, sal_Bool _bUseTableDefs,sal_Bool bRetrieveData); + virtual sal_Bool fetchRow(OValueRow _rRow,const OSQLColumns& _rCols, sal_Bool _bUseTableDefs,sal_Bool bRetrieveData); virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); //XTypeProvider @@ -143,9 +143,9 @@ namespace connectivity BOOL DropImpl(); BOOL CreateImpl(); - virtual BOOL InsertRow(file::OValueVector& rRow, BOOL bFlush,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols); + virtual BOOL InsertRow(OValueVector& rRow, BOOL bFlush,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols); virtual BOOL DeleteRow(const OSQLColumns& _rCols); - virtual BOOL UpdateRow(file::OValueVector& rRow, file::OValueRow pOrgRow,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols); + virtual BOOL UpdateRow(OValueVector& rRow, OValueRow pOrgRow,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols); }; } } diff --git a/connectivity/source/inc/dbase/DColumns.hxx b/connectivity/source/inc/dbase/DColumns.hxx index 0f5005a8689d..189b35990098 100644 --- a/connectivity/source/inc/dbase/DColumns.hxx +++ b/connectivity/source/inc/dbase/DColumns.hxx @@ -2,9 +2,9 @@ * * $RCSfile: DColumns.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-03-28 11:28:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -83,6 +83,11 @@ namespace connectivity ) : file::OColumns(_pTable,_rMutex,_rVector) {} + // 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); + // 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); }; } } diff --git a/connectivity/source/inc/dbase/DDatabaseMetaData.hxx b/connectivity/source/inc/dbase/DDatabaseMetaData.hxx index f4b5aaa98ec3..7fd2d5e4e70b 100644 --- a/connectivity/source/inc/dbase/DDatabaseMetaData.hxx +++ b/connectivity/source/inc/dbase/DDatabaseMetaData.hxx @@ -2,9 +2,9 @@ * * $RCSfile: DDatabaseMetaData.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2000-12-06 11:55:20 $ + * last change: $Author: oj $ $Date: 2001-03-28 11:28:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -98,6 +98,9 @@ namespace connectivity virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL supportsAlterTableWithAddColumn( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsAlterTableWithDropColumn( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); }; } } diff --git a/connectivity/source/inc/dbase/DDatabaseMetaDataResultSetMetaData.hxx b/connectivity/source/inc/dbase/DDatabaseMetaDataResultSetMetaData.hxx index c63c46a3bc68..7e9dd0c7f784 100644 --- a/connectivity/source/inc/dbase/DDatabaseMetaDataResultSetMetaData.hxx +++ b/connectivity/source/inc/dbase/DDatabaseMetaDataResultSetMetaData.hxx @@ -2,9 +2,9 @@ * * $RCSfile: DDatabaseMetaDataResultSetMetaData.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-03-28 11:28:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -71,8 +71,8 @@ #ifndef _VECTOR_ #include <vector> #endif -#ifndef _CONNECTIVITY_FILE_ADATABASEMETADATARESULTSET_HXX_ -#include "file/FDatabaseMetaDataResultSet.hxx" +#ifndef _CONNECTIVITY_FDATABASEMETADATARESULTSET_HXX_ +#include "FDatabaseMetaDataResultSet.hxx" #endif #ifndef _CONNECTIVITY_COLUMN_HXX_ #include "OColumn.hxx" diff --git a/connectivity/source/inc/dbase/DIndex.hxx b/connectivity/source/inc/dbase/DIndex.hxx index 18443427354f..6ad794364284 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.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2000-11-03 13:53:38 $ + * last change: $Author: oj $ $Date: 2001-03-28 11:28:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -162,10 +162,10 @@ namespace connectivity BOOL IsText() const {return m_aHeader.db_keytype == 0;} USHORT GetMaxNodes() const {return m_aHeader.db_maxkeys;} - virtual BOOL Insert(sal_uInt32 nRec, const ORowSetValue_BASE& rValue); - virtual BOOL Update(sal_uInt32 nRec, const ORowSetValue_BASE&, const ORowSetValue_BASE&); - virtual BOOL Delete(sal_uInt32 nRec, const ORowSetValue_BASE& rValue); - virtual BOOL Find(sal_uInt32 nRec, const ORowSetValue_BASE& rValue); + virtual BOOL Insert(sal_uInt32 nRec, const ORowSetValue& rValue); + virtual BOOL Update(sal_uInt32 nRec, const ORowSetValue&, const ORowSetValue&); + virtual BOOL Delete(sal_uInt32 nRec, const ORowSetValue& rValue); + virtual BOOL Find(sal_uInt32 nRec, const ORowSetValue& rValue); void createINFEntry(); BOOL CreateImpl(); @@ -183,7 +183,7 @@ namespace connectivity // Tree operationen void Insert(ONDXPagePtr aCurPage, ONDXNode& rNode); void Release(BOOL bSave = TRUE); - BOOL ConvertToKey(ONDXKey* rKey, sal_uInt32 nRec, const ORowSetValue_BASE& rValue); + BOOL ConvertToKey(ONDXKey* rKey, sal_uInt32 nRec, const ORowSetValue& rValue); }; SvStream& operator << (SvStream &rStream, ODbaseIndex&); diff --git a/connectivity/source/inc/dbase/DTable.hxx b/connectivity/source/inc/dbase/DTable.hxx index 3fcd61d85466..cc055282f078 100644 --- a/connectivity/source/inc/dbase/DTable.hxx +++ b/connectivity/source/inc/dbase/DTable.hxx @@ -2,9 +2,9 @@ * * $RCSfile: DTable.hxx,v $ * - * $Revision: 1.18 $ + * $Revision: 1.19 $ * - * last change: $Author: oj $ $Date: 2001-03-01 10:54:35 $ + * last change: $Author: oj $ $Date: 2001-03-28 11:28:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -138,17 +138,22 @@ namespace connectivity SvStream* m_pMemoStream; sal_Bool m_bWriteableMemo; + void alterColumn(sal_Int32 index, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& descriptor , + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XDataDescriptorFactory>& xOldColumn ); void readHeader(); void fillColumns(); + String createTempFile(); + void copyData(ODbaseTable* _pNewTable); BOOL CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo); BOOL CreateMemoFile(const INetURLObject& aFile); BOOL HasMemoFields() const { return m_aHeader.db_typ > dBaseIV;} BOOL ReadMemoHeader(); - BOOL ReadMemo(ULONG nBlockNo, file::ORowSetValue& aVariable); + BOOL ReadMemo(ULONG nBlockNo, ORowSetValue& aVariable); - BOOL WriteMemo(file::ORowSetValue& aVariable, ULONG& rBlockNr); + BOOL WriteMemo(ORowSetValue& aVariable, ULONG& rBlockNr); BOOL WriteBuffer(); - BOOL UpdateBuffer(file::OValueVector& rRow, file::OValueRow pOrgRow,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols); + BOOL UpdateBuffer(OValueVector& rRow, OValueRow pOrgRow,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols); ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> isUniqueByColumnName(const ::rtl::OUString& _rColName); void AllocBuffer(); @@ -173,7 +178,7 @@ namespace connectivity virtual sal_Int32 getCurrentLastPos() const {return m_aHeader.db_anz;} virtual sal_Bool seekRow(FilePosition eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos); - virtual sal_Bool fetchRow(file::OValueRow _rRow,const OSQLColumns& _rCols, sal_Bool _bUseTableDefs,sal_Bool bRetrieveData); + virtual sal_Bool fetchRow(OValueRow _rRow,const OSQLColumns& _rCols, sal_Bool _bUseTableDefs,sal_Bool bRetrieveData); virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); //XTypeProvider @@ -183,14 +188,21 @@ namespace connectivity // 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(); + // XAlterTable + virtual void SAL_CALL alterColumnByName( const ::rtl::OUString& colName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL alterColumnByIndex( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + // XRename + virtual void SAL_CALL rename( const ::rtl::OUString& newName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); - BOOL DropImpl(); - BOOL CreateImpl(); - String getEntry(); + BOOL DropImpl(); + BOOL CreateImpl(); + String getEntry(); - virtual BOOL InsertRow(file::OValueVector& rRow, BOOL bFlush,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols); + virtual BOOL InsertRow(OValueVector& rRow, BOOL bFlush,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols); virtual BOOL DeleteRow(const OSQLColumns& _rCols); - virtual BOOL UpdateRow(file::OValueVector& rRow, file::OValueRow pOrgRow,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols); + virtual BOOL UpdateRow(OValueVector& rRow, OValueRow pOrgRow,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols); + + virtual void addColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& descriptor); }; } } diff --git a/connectivity/source/inc/dbase/dindexnode.hxx b/connectivity/source/inc/dbase/dindexnode.hxx index a96fd90661c2..b0b180facfab 100644 --- a/connectivity/source/inc/dbase/dindexnode.hxx +++ b/connectivity/source/inc/dbase/dindexnode.hxx @@ -2,9 +2,9 @@ * * $RCSfile: dindexnode.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2000-10-17 08:40:53 $ + * last change: $Author: oj $ $Date: 2001-03-28 11:28:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -71,7 +71,7 @@ #include "dbase/DIndexPage.hxx" #endif #ifndef _CONNECTIVITY_FILE_VALUE_HXX_ -#include "file/FValue.hxx" +#include "FValue.hxx" #endif namespace connectivity @@ -81,7 +81,6 @@ namespace connectivity class ONDXNode; class ODbaseIndex; - typedef file::ORowSetValue ORowSetValue_BASE; //================================================================== // Index Key //================================================================== @@ -90,11 +89,11 @@ namespace connectivity { friend class ONDXNode; UINT32 nRecord; /* Satzzeiger */ - ORowSetValue_BASE xValue; /* Schluesselwert */ + ORowSetValue xValue; /* Schluesselwert */ public: ONDXKey():nRecord(0){} - inline ONDXKey(const ORowSetValue_BASE& rVal, sal_Int32 eType, UINT32 nRec) + inline ONDXKey(const ORowSetValue& rVal, sal_Int32 eType, UINT32 nRec) : ONDXKey_BASE(eType) , nRecord(nRec) , xValue(rVal) @@ -325,7 +324,7 @@ namespace connectivity //================================================================== // inline implementation //================================================================== -// inline ONDXKey::ONDXKey(const ORowSetValue_BASE& rVal, sal_Int32 eType, UINT32 nRec) +// inline ONDXKey::ONDXKey(const ORowSetValue& rVal, sal_Int32 eType, UINT32 nRec) // : ONDXKey_BASE(eType) // , nRecord(nRec),xValue(rVal) // { diff --git a/connectivity/source/inc/file/FTable.hxx b/connectivity/source/inc/file/FTable.hxx index 8345ffb41778..7d4c2c330cfe 100644 --- a/connectivity/source/inc/file/FTable.hxx +++ b/connectivity/source/inc/file/FTable.hxx @@ -2,9 +2,9 @@ * * $RCSfile: FTable.hxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: oj $ $Date: 2000-12-13 14:33:06 $ + * last change: $Author: oj $ $Date: 2001-03-28 11:28:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -78,7 +78,7 @@ #include <tools/stream.hxx> #endif #ifndef _CONNECTIVITY_FILE_VALUE_HXX_ -#include "file/FValue.hxx" +#include "FValue.hxx" #endif namespace connectivity @@ -148,10 +148,13 @@ namespace connectivity { return sal_False; } - virtual BOOL UpdateRow(OValueVector& rRow, file::OValueRow pOrgRow,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols) + virtual BOOL UpdateRow(OValueVector& rRow, OValueRow pOrgRow,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols) { return sal_False; } + virtual void addColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& descriptor) + { + } ::rtl::OUString SAL_CALL getName() { return m_Name; } diff --git a/connectivity/source/inc/file/fcode.hxx b/connectivity/source/inc/file/fcode.hxx index 00f1a4fb8db0..428690386fe1 100644 --- a/connectivity/source/inc/file/fcode.hxx +++ b/connectivity/source/inc/file/fcode.hxx @@ -2,9 +2,9 @@ * * $RCSfile: fcode.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2000-11-03 13:49:39 $ + * last change: $Author: oj $ $Date: 2001-03-28 11:28:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -82,7 +82,7 @@ #include <com/sun/star/container/XNameAccess.hpp> #endif #ifndef _CONNECTIVITY_FILE_VALUE_HXX_ -#include "file/FValue.hxx" +#include "FValue.hxx" #endif diff --git a/connectivity/source/inc/flat/ETable.hxx b/connectivity/source/inc/flat/ETable.hxx index 13cc6cc31dbd..6d76caa25b69 100644 --- a/connectivity/source/inc/flat/ETable.hxx +++ b/connectivity/source/inc/flat/ETable.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ETable.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2000-11-27 07:59:34 $ + * last change: $Author: oj $ $Date: 2001-03-28 11:29:22 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -115,7 +115,7 @@ namespace connectivity BOOL CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo); BOOL WriteBuffer(); - BOOL UpdateBuffer(file::OValueVector& rRow, file::OValueRow pOrgRow,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols); + BOOL UpdateBuffer(OValueVector& rRow, OValueRow pOrgRow,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols); ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet> isUniqueByColumnName(const ::rtl::OUString& _rColName); void AllocBuffer(); @@ -136,7 +136,7 @@ namespace connectivity ); virtual sal_Bool seekRow(FilePosition eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos); - virtual sal_Bool fetchRow(file::OValueRow _rRow,const OSQLColumns& _rCols, sal_Bool bIsTable,sal_Bool bRetrieveData); + virtual sal_Bool fetchRow(OValueRow _rRow,const OSQLColumns& _rCols, sal_Bool bIsTable,sal_Bool bRetrieveData); virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); //XTypeProvider @@ -151,9 +151,9 @@ namespace connectivity BOOL CreateImpl(); String getEntry(); - virtual BOOL InsertRow(file::OValueVector& rRow, BOOL bFlush,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols); + virtual BOOL InsertRow(OValueVector& rRow, BOOL bFlush,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols); virtual BOOL DeleteRow(const OSQLColumns& _rCols); - virtual BOOL UpdateRow(file::OValueVector& rRow, file::OValueRow pOrgRow,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols); + virtual BOOL UpdateRow(OValueVector& rRow, OValueRow pOrgRow,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols); }; } } |