diff options
Diffstat (limited to 'connectivity/source/inc')
225 files changed, 23504 insertions, 0 deletions
diff --git a/connectivity/source/inc/AutoRetrievingBase.hxx b/connectivity/source/inc/AutoRetrievingBase.hxx new file mode 100644 index 000000000000..af5206830cf3 --- /dev/null +++ b/connectivity/source/inc/AutoRetrievingBase.hxx @@ -0,0 +1,59 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_AUTOKEYRETRIEVINGBASE_HXX_ +#define _CONNECTIVITY_AUTOKEYRETRIEVINGBASE_HXX_ + +#include <rtl/ustring.hxx> +#include "connectivity/dbtoolsdllapi.hxx" + +namespace connectivity +{ + class OOO_DLLPUBLIC_DBTOOLS OAutoRetrievingBase + { + ::rtl::OUString m_sGeneratedValueStatement; // contains the statement which should be used when query for automatically generated values + sal_Bool m_bAutoRetrievingEnabled; // set to when we should allow to query for generated values + protected: + OAutoRetrievingBase() : m_bAutoRetrievingEnabled(sal_False) {} + virtual ~OAutoRetrievingBase(){} + + inline void enableAutoRetrievingEnabled(sal_Bool _bAutoEnable) { m_bAutoRetrievingEnabled = _bAutoEnable; } + inline void setAutoRetrievingStatement(const ::rtl::OUString& _sStmt) { m_sGeneratedValueStatement = _sStmt; } + public: + inline sal_Bool isAutoRetrievingEnabled() const { return m_bAutoRetrievingEnabled; } + inline const ::rtl::OUString& getAutoRetrievingStatement() const { return m_sGeneratedValueStatement; } + + /** transform the statement to query for auto generated values + @param _sInsertStatement + The "INSERT" statement, is used to query for column and table names + @return + The transformed generated statement. + */ + ::rtl::OUString getTransformedGeneratedStatement(const ::rtl::OUString& _sInsertStatement) const; + }; +} +#endif // _CONNECTIVITY_AUTOKEYRETRIEVINGBASE_HXX_ + diff --git a/connectivity/source/inc/FDatabaseMetaDataResultSet.hxx b/connectivity/source/inc/FDatabaseMetaDataResultSet.hxx new file mode 100644 index 000000000000..134e7e5dfca1 --- /dev/null +++ b/connectivity/source/inc/FDatabaseMetaDataResultSet.hxx @@ -0,0 +1,279 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FDATABASEMETADATARESULTSET_HXX_ +#define _CONNECTIVITY_FDATABASEMETADATARESULTSET_HXX_ + +#include <com/sun/star/sdbc/XResultSet.hpp> +#include <com/sun/star/sdbc/XRow.hpp> +#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> +#include <com/sun/star/sdbc/XCloseable.hpp> +#include <com/sun/star/sdbc/XColumnLocate.hpp> +#include <com/sun/star/util/XCancellable.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#include <com/sun/star/sdbc/XResultSetUpdate.hpp> +#include <com/sun/star/sdbc/XRowUpdate.hpp> +#include <cppuhelper/compbase9.hxx> +#include <comphelper/proparrhlp.hxx> +#include "connectivity/CommonTools.hxx" +#include <comphelper/propertycontainer.hxx> +#include "connectivity/FValue.hxx" +#include "connectivity/dbtoolsdllapi.hxx" +#include <comphelper/broadcasthelper.hxx> +#include <vos/refernce.hxx> + +namespace connectivity +{ + class ODatabaseMetaDataResultSetMetaData; + typedef ::cppu::WeakComponentImplHelper9< ::com::sun::star::sdbc::XResultSet, + ::com::sun::star::sdbc::XRow, + ::com::sun::star::sdbc::XResultSetMetaDataSupplier, + ::com::sun::star::util::XCancellable, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::sdbc::XCloseable, + ::com::sun::star::lang::XInitialization, + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::sdbc::XColumnLocate> ODatabaseMetaDataResultSet_BASE; + + // typedef ORefVector<ORowSetValue> ORow; + // typedef ORefVector<ORow> ORows; + + class OOO_DLLPUBLIC_DBTOOLS ODatabaseMetaDataResultSet : + public comphelper::OBaseMutex, + public ODatabaseMetaDataResultSet_BASE, + public ::comphelper::OPropertyContainer, + public ::comphelper::OPropertyArrayUsageHelper<ODatabaseMetaDataResultSet> + { + + public: + DECLARE_STL_VECTOR(ORowSetValueDecoratorRef,ORow); + DECLARE_STL_VECTOR(ORow, ORows); + + enum MetaDataResultSetType + { + /// describes a result set as expected by XDatabaseMetaData::getCatalogs + eCatalogs = 0, + /// describes a result set as expected by XDatabaseMetaData::getSchemas + eSchemas = 1, + /// describes a result set as expected by XDatabaseMetaData::getColumnPrivileges + eColumnPrivileges = 2, + /// describes a result set as expected by XDatabaseMetaData::getColumns + eColumns = 3, + /// describes a result set as expected by XDatabaseMetaData::getTables + eTables = 4, + /// describes a result set as expected by XDatabaseMetaData::getTableTypes + eTableTypes = 5, + /// describes a result set as expected by XDatabaseMetaData::getProcedureColumns + eProcedureColumns = 6, + /// describes a result set as expected by XDatabaseMetaData::getProcedures + eProcedures = 7, + /// describes a result set as expected by XDatabaseMetaData::getExportedKeys + eExportedKeys = 8, + /// describes a result set as expected by XDatabaseMetaData::getImportedKeys + eImportedKeys = 9, + /// describes a result set as expected by XDatabaseMetaData::getPrimaryKeys + ePrimaryKeys = 10, + /// describes a result set as expected by XDatabaseMetaData::getIndexInfo + eIndexInfo = 11, + /// describes a result set as expected by XDatabaseMetaData::getTablePrivileges + eTablePrivileges = 12, + /// describes a result set as expected by XDatabaseMetaData::getCrossReference + eCrossReference = 13, + /// describes a result set as expected by XDatabaseMetaData::getTypeInfo + eTypeInfo = 14, + /// describes a result set as expected by XDatabaseMetaData::getBestRowIdentifier + eBestRowIdentifier = 15, + /// describes a result set as expected by XDatabaseMetaData::getVersionColumns + eVersionColumns = 16 + }; + + private: + ORowSetValue m_aEmptyValue; + ::com::sun::star::uno::WeakReferenceHelper m_aStatement; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData; + sal_Int32 m_nColPos; + + sal_Int32 m_nFetchSize; + sal_Int32 m_nResultSetType; + sal_Int32 m_nFetchDirection; + sal_Int32 m_nResultSetConcurrency; + + void construct(); + void checkIndex(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException); + void setType(MetaDataResultSetType _eType); + + protected: + ORows m_aRows; + ORows::iterator m_aRowsIter; + sal_Bool m_bBOF; + sal_Bool m_bEOF; + + virtual const ORowSetValue& getValue(sal_Int32 columnIndex); + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + + virtual ~ODatabaseMetaDataResultSet(); + public: + + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + /// default construction + ODatabaseMetaDataResultSet(); + /// construction of a pre-defined result set type + ODatabaseMetaDataResultSet( MetaDataResultSetType _eType ); + + void setRows(const ORows& _rRows); + + // XServiceInfo + + static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); + + protected: + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + // XResultSet + virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XRow + virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XResultSetMetaDataSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCancellable + virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) 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); + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + void setCatalogsMap(); + void setSchemasMap(); + void setColumnPrivilegesMap(); + void setColumnsMap(); + void setTablesMap(); + void setTableTypes(); + void setProcedureColumnsMap(); + void setProceduresMap(); + void setExportedKeysMap(); + void setImportedKeysMap(); + void setPrimaryKeysMap(); + void setIndexInfoMap(); + void setTablePrivilegesMap(); + void setCrossReferenceMap(); + void setTypeInfoMap(); + void setBestRowIdentifierMap(); + void setVersionColumnsMap(); + public: + // some methods to get already defined ORowSetValues + // this increase the reuse of ORowSetValues + /// return an empty ORowSetValueDecorator + static ORowSetValueDecoratorRef getEmptyValue(); + /// return an ORowSetValueDecorator with 0 as value + static ORowSetValueDecoratorRef get0Value(); + /// return an ORowSetValueDecorator with 1 as value + static ORowSetValueDecoratorRef get1Value(); + /// return an ORowSetValueDecorator with ColumnSearch::BASIC as value + static ORowSetValueDecoratorRef getBasicValue(); + /// return an ORowSetValueDecorator with string SELECT as value + static ORowSetValueDecoratorRef getSelectValue(); + /// return an ORowSetValueDecorator with string INSERT as value + static ORowSetValueDecoratorRef getInsertValue(); + /// return an ORowSetValueDecorator with string DELETE as value + static ORowSetValueDecoratorRef getDeleteValue(); + /// return an ORowSetValueDecorator with string UPDATE as value + static ORowSetValueDecoratorRef getUpdateValue(); + /// return an ORowSetValueDecorator with string CREATE as value + static ORowSetValueDecoratorRef getCreateValue(); + /// return an ORowSetValueDecorator with string READ as value + static ORowSetValueDecoratorRef getReadValue(); + /// return an ORowSetValueDecorator with string ALTER as value + static ORowSetValueDecoratorRef getAlterValue(); + /// return an ORowSetValueDecorator with string DROP as value + static ORowSetValueDecoratorRef getDropValue(); + /// return an ORowSetValueDecorator with string ' as value + static ORowSetValueDecoratorRef getQuoteValue(); + + }; +} +#endif // _CONNECTIVITY_FDATABASEMETADATARESULTSET_HXX_ + diff --git a/connectivity/source/inc/FDatabaseMetaDataResultSetMetaData.hxx b/connectivity/source/inc/FDatabaseMetaDataResultSetMetaData.hxx new file mode 100644 index 000000000000..de6979346f56 --- /dev/null +++ b/connectivity/source/inc/FDatabaseMetaDataResultSetMetaData.hxx @@ -0,0 +1,114 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DATABASEMETADATARESULTSETMETADATA_HXX_ +#define _CONNECTIVITY_DATABASEMETADATARESULTSETMETADATA_HXX_ + +#include <com/sun/star/sdbc/XResultSetMetaData.hpp> +#include <cppuhelper/implbase1.hxx> +#ifndef _VECTOR_ +#include <vector> +#endif +#include "FDatabaseMetaDataResultSet.hxx" +#include "OColumn.hxx" +#include "connectivity/StdTypeDefs.hxx" +#include "connectivity/dbtoolsdllapi.hxx" + +namespace connectivity +{ + //************************************************************** + //************ Class: ODatabaseMetaDataResultSetMetaData + //************************************************************** + typedef ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XResultSetMetaData> ODatabaseMetaResultSetMetaData_BASE; + + class OOO_DLLPUBLIC_DBTOOLS ODatabaseMetaDataResultSetMetaData : public ODatabaseMetaResultSetMetaData_BASE + { + TIntVector m_vMapping; // when not every column is needed + ::std::map<sal_Int32,connectivity::OColumn> m_mColumns; + ::std::map<sal_Int32,connectivity::OColumn>::const_iterator m_mColumnsIter; + + sal_Int32 m_nColCount; + protected: + virtual ~ODatabaseMetaDataResultSetMetaData(); + public: + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + ODatabaseMetaDataResultSetMetaData( ) + : m_nColCount(0) + { + } + /// Avoid ambigous cast error from the compiler. + inline operator ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > () throw() + { return this; } + + virtual sal_Int32 SAL_CALL getColumnCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnLabel( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSchemaName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTableName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalogName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnTypeName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnServiceName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + // methods to set the right column mapping + void setColumnPrivilegesMap(); + void setColumnMap(); + void setColumnsMap(); + void setTableNameMap(); + void setTablesMap(); + void setProcedureColumnsMap(); + void setPrimaryKeysMap(); + void setIndexInfoMap(); + void setTablePrivilegesMap(); + void setCrossReferenceMap(); + void setTypeInfoMap(); + void setProcedureNameMap(); + void setProceduresMap(); + void setTableTypes(); + void setBestRowIdentifierMap() { setVersionColumnsMap();} + void setVersionColumnsMap(); + void setExportedKeysMap() { setCrossReferenceMap(); } + void setImportedKeysMap() { setCrossReferenceMap(); } + void setCatalogsMap(); + void setSchemasMap(); + }; +} +#endif // _CONNECTIVITY_FILE_ADATABASEMETARESULTSETMETADATA_HXX_ + + diff --git a/connectivity/source/inc/OColumn.hxx b/connectivity/source/inc/OColumn.hxx new file mode 100644 index 000000000000..26f6d920b719 --- /dev/null +++ b/connectivity/source/inc/OColumn.hxx @@ -0,0 +1,146 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_COLUMN_HXX_ +#define _CONNECTIVITY_COLUMN_HXX_ + +#include <rtl/ustring.hxx> +#include <sal/types.h> +#include "connectivity/dbtoolsdllapi.hxx" + +namespace connectivity +{ + class OOO_DLLPUBLIC_DBTOOLS OColumn + { + ::rtl::OUString m_CatalogName; + ::rtl::OUString m_SchemaName; + ::rtl::OUString m_TableName; + ::rtl::OUString m_ColumnName; + ::rtl::OUString m_ColumnLabel; + ::rtl::OUString m_ColumnTypeName; + ::rtl::OUString m_ColumnServiceName; + + sal_Int32 m_Nullable; + sal_Int32 m_ColumnDisplaySize; + sal_Int32 m_Precision; + sal_Int32 m_Scale; + sal_Int32 m_ColumnType; + + sal_Bool m_AutoIncrement; + sal_Bool m_CaseSensitive; + sal_Bool m_Searchable; + sal_Bool m_Currency; + sal_Bool m_Signed; + sal_Bool m_ReadOnly; + sal_Bool m_Writable; + sal_Bool m_DefinitelyWritable; + + public: + OColumn() {} + OColumn(const ::rtl::OUString &_aTableName, + const ::rtl::OUString &_aColumnName, + + sal_Int32 _aNullable=0, + sal_Int32 _aColumnDisplaySize=0, + sal_Int32 _aPrecision=0, + sal_Int32 _aScale=0, + sal_Int32 _aColumnType=0, + + sal_Bool _aAutoIncrement=sal_False, + sal_Bool _aCaseSensitive=sal_False, + sal_Bool _aSearchable=sal_True, + sal_Bool _aCurrency=sal_False, + sal_Bool _aSigned=sal_False, + sal_Bool _aReadOnly=sal_True, + sal_Bool _aWritable=sal_False, + sal_Bool _aDefinitelyWritable=sal_False, + + const ::rtl::OUString &_aColumnLabel = ::rtl::OUString(), + const ::rtl::OUString &_aColumnTypeName = ::rtl::OUString(), + const ::rtl::OUString &_aColumnServiceName = ::rtl::OUString()) + : m_TableName(_aTableName), + m_ColumnName(_aColumnName), + m_ColumnLabel(_aColumnLabel), + m_ColumnTypeName(_aColumnTypeName), + m_ColumnServiceName(_aColumnServiceName), + + m_Nullable(_aNullable), + m_ColumnDisplaySize(_aColumnDisplaySize), + m_Precision(_aPrecision), + m_Scale(_aScale), + m_ColumnType(_aColumnType), + + m_AutoIncrement(_aAutoIncrement), + m_CaseSensitive(_aCaseSensitive), + m_Searchable(_aSearchable), + m_Currency(_aCurrency), + m_Signed(_aSigned), + m_ReadOnly(_aReadOnly), + m_Writable(_aWritable), + m_DefinitelyWritable(_aDefinitelyWritable) + { + if(!m_ColumnLabel.getLength()) + m_ColumnLabel = _aColumnName; + } + + inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW( () ) + { return ::rtl_allocateMemory( nSize ); } + inline static void * SAL_CALL operator new( size_t ,void* _pHint ) SAL_THROW( () ) + { return _pHint; } + inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW( () ) + { ::rtl_freeMemory( pMem ); } + inline static void SAL_CALL operator delete( void *,void* ) SAL_THROW( () ) + { } + + sal_Bool isAutoIncrement() const { return m_AutoIncrement; } + sal_Bool isCaseSensitive() const { return m_CaseSensitive; } + sal_Bool isSearchable() const { return m_Searchable; } + sal_Bool isCurrency() const { return m_Currency; } + sal_Bool isSigned() const { return m_Signed; } + sal_Bool isReadOnly() const { return m_ReadOnly; } + sal_Bool isWritable() const { return m_Writable; } + sal_Bool isDefinitelyWritable() const { return m_DefinitelyWritable; } + + sal_Int32 isNullable() const { return m_Nullable; } + sal_Int32 getColumnDisplaySize() const { return m_ColumnDisplaySize; } + sal_Int32 getPrecision() const { return m_Precision; } + sal_Int32 getScale() const { return m_Scale; } + sal_Int32 getColumnType() const { return m_ColumnType; } + + const ::rtl::OUString& getColumnLabel() const { return m_ColumnLabel; } + const ::rtl::OUString& getColumnName() const { return m_ColumnName; } + const ::rtl::OUString& getSchemaName() const { return m_SchemaName; } + const ::rtl::OUString& getTableName() const { return m_TableName; } + const ::rtl::OUString& getCatalogName() const { return m_CatalogName; } + const ::rtl::OUString& getColumnTypeName() const { return m_ColumnTypeName; } + const ::rtl::OUString& getColumnServiceName() const { return m_ColumnServiceName; } + + }; +} + +#endif //_CONNECTIVITY_COLUMN_HXX_ + diff --git a/connectivity/source/inc/OSubComponent.hxx b/connectivity/source/inc/OSubComponent.hxx new file mode 100644 index 000000000000..9927148f2512 --- /dev/null +++ b/connectivity/source/inc/OSubComponent.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_OSUBCOMPONENT_HXX_ +#define _CONNECTIVITY_OSUBCOMPONENT_HXX_ + +#include <cppuhelper/weak.hxx> +#include <cppuhelper/interfacecontainer.h> +#include "connectivity/dbtoolsdllapi.hxx" + +namespace com +{ + namespace sun + { + namespace star + { + namespace lang + { + class XComponent; + } + } + } +} +namespace connectivity +{ + OOO_DLLPUBLIC_DBTOOLS + void release(oslInterlockedCount& _refCount, + ::cppu::OBroadcastHelper& rBHelper, + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface, + ::com::sun::star::lang::XComponent* _pObject); + //************************************************************ + // OSubComponent + //************************************************************ + template <class SELF, class WEAK> class OSubComponent + { + protected: + // the parent must support the tunnel implementation + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xParent; + SELF* m_pDerivedImplementation; + + public: + OSubComponent( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xParent, + SELF* _pDerivedImplementation) + :m_xParent(_xParent) + ,m_pDerivedImplementation(_pDerivedImplementation) + { + } + + protected: + void dispose_ChildImpl() + { + // avoid ambiguity + ::osl::MutexGuard aGuard( m_pDerivedImplementation->WEAK::rBHelper.rMutex ); + m_xParent.clear(); + } + void relase_ChildImpl() + { + ::connectivity::release(m_pDerivedImplementation->m_refCount, + m_pDerivedImplementation->WEAK::rBHelper, + m_xParent, + m_pDerivedImplementation); + + m_pDerivedImplementation->WEAK::release(); + } + }; +} +#endif // _CONNECTIVITY_OSUBCOMPONENT_HXX_ + diff --git a/connectivity/source/inc/OTypeInfo.hxx b/connectivity/source/inc/OTypeInfo.hxx new file mode 100644 index 000000000000..d983b79da04e --- /dev/null +++ b/connectivity/source/inc/OTypeInfo.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_OTYPEINFO_HXX_ +#define _CONNECTIVITY_OTYPEINFO_HXX_ + +#include <com/sun/star/sdbc/ColumnSearch.hpp> +#include <com/sun/star/sdbc/DataType.hpp> +#include "connectivity/dbtoolsdllapi.hxx" + +namespace connectivity +{ + struct OTypeInfo + { + ::rtl::OUString aTypeName; // Name des Types in der Datenbank + ::rtl::OUString aLiteralPrefix; // Prefix zum Quoten + ::rtl::OUString aLiteralSuffix; // Suffix zum Quoten + ::rtl::OUString aCreateParams; // Parameter zum Erstellen + ::rtl::OUString aLocalTypeName; + + sal_Int32 nPrecision; // Laenge des Types + + sal_Int16 nMaximumScale; // Nachkommastellen + sal_Int16 nMinimumScale; // Min Nachkommastellen + + sal_Int16 nType; // Datenbanktyp + sal_Int16 nSearchType; // kann nach dem Typen gesucht werden + sal_Int16 nNumPrecRadix; // indicating the radix, which is usually 2 or 10 + + sal_Bool bCurrency : 1, // Waehrung + bAutoIncrement : 1, // Ist es ein automatisch incrementierendes Feld + bNullable : 1, // Kann das Feld NULL annehmen + bCaseSensitive : 1, // Ist der Type Casesensitive + bUnsigned : 1, // Ist der Type Unsigned + bEmpty_1 : 1, // for later use + bEmpty_2 : 1; + + OTypeInfo() + :nPrecision(0) + ,nMaximumScale(0) + ,nMinimumScale(0) + ,nType( ::com::sun::star::sdbc::DataType::OTHER) + ,nSearchType( ::com::sun::star::sdbc::ColumnSearch::FULL) + ,bCurrency(sal_False) + ,bAutoIncrement(sal_False) + ,bNullable(sal_True) + ,bCaseSensitive(sal_False) + ,bUnsigned(sal_False) + {} + + inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW( () ) + { return ::rtl_allocateMemory( nSize ); } + inline static void * SAL_CALL operator new( size_t /*nSize*/,void* _pHint ) SAL_THROW( () ) + { return _pHint; } + inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW( () ) + { ::rtl_freeMemory( pMem ); } + inline static void SAL_CALL operator delete( void * /*pMem*/,void* /*_pHint*/ ) SAL_THROW( () ) + { } + + sal_Bool operator == (const OTypeInfo& lh) const { return lh.nType == nType; } + sal_Bool operator != (const OTypeInfo& lh) const { return lh.nType != nType; } + + inline ::rtl::OUString getDBName() const { return aTypeName; } + }; +} +#endif // _CONNECTIVITY_OTYPEINFO_HXX_ + + diff --git a/connectivity/source/inc/ParameterSubstitution.hxx b/connectivity/source/inc/ParameterSubstitution.hxx new file mode 100644 index 000000000000..70a640e9d447 --- /dev/null +++ b/connectivity/source/inc/ParameterSubstitution.hxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "precompiled_connectivity.hxx" +#include <com/sun/star/util/XStringSubstitution.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/sdbc/XConnection.hpp> +#include <cppuhelper/implbase3.hxx> + +namespace connectivity +{ + typedef ::cppu::WeakImplHelper3< ::com::sun::star::util::XStringSubstitution + ,::com::sun::star::lang::XServiceInfo + ,::com::sun::star::lang::XInitialization > ParameterSubstitution_BASE; + class ParameterSubstitution : public ParameterSubstitution_BASE + { + ::osl::Mutex m_aMutex; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; + ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XConnection > m_xConnection; + + ParameterSubstitution( const ParameterSubstitution& ); + ParameterSubstitution& operator=( const ParameterSubstitution& ); + public: + + static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > create( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext); + protected: + ParameterSubstitution(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext ); + virtual ~ParameterSubstitution(){} + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XStringSubstitution + virtual ::rtl::OUString SAL_CALL substituteVariables( const ::rtl::OUString& aText, ::sal_Bool bSubstRequired ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL reSubstituteVariables( const ::rtl::OUString& aText ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSubstituteVariableValue( const ::rtl::OUString& variable ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + }; +// ================================== +} // connectivity +// ================================== diff --git a/connectivity/source/inc/RowFunctionParser.hxx b/connectivity/source/inc/RowFunctionParser.hxx new file mode 100644 index 000000000000..b514b82739d3 --- /dev/null +++ b/connectivity/source/inc/RowFunctionParser.hxx @@ -0,0 +1,152 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_ROWFUNCTIONPARSER_HXX_INCLUDED +#define CONNECTIVITY_ROWFUNCTIONPARSER_HXX_INCLUDED + +#include <sal/config.h> +#ifndef BOOST_SHARED_PTR_HPP_INCLUDED +#include <boost/shared_ptr.hpp> +#endif +#include "FDatabaseMetaDataResultSet.hxx" +#include <vector> +#include "connectivity/dbtoolsdllapi.hxx" + +// ------------------------------------------------------------------------- +namespace connectivity +{ +// ------------------------------------------------------------------------- +struct OOO_DLLPUBLIC_DBTOOLS RowEquation +{ + sal_Int32 nOperation; + ORowSetValueDecoratorRef nPara[ 3 ]; + + RowEquation() : + nOperation ( 0 ) + { + } +}; + +enum ExpressionFunct +{ + FUNC_CONST, + + ENUM_FUNC_EQUATION, + + UNARY_FUNC_COLUMN, + ENUM_FUNC_AND, + ENUM_FUNC_OR +}; + +#define EXPRESSION_FLAG_SUMANGLE_MODE 1 + +class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE ExpressionNode +{ +public: + virtual ~ExpressionNode(){} + + /** Operator to calculate function value. + + This method calculates the function value. + */ + virtual ORowSetValueDecoratorRef evaluate(const ODatabaseMetaDataResultSet::ORow& _aRow ) const = 0; + + virtual void fill(const ODatabaseMetaDataResultSet::ORow& _aRow ) const = 0; + + /** Operator to retrieve the type of expression node + */ + virtual ExpressionFunct getType() const = 0; + + /** Operator to retrieve the ms version of expression + */ + virtual ODatabaseMetaDataResultSet::ORow fillNode( + std::vector< RowEquation >& rEquations, ExpressionNode* pOptionalArg, sal_uInt32 nFlags ) = 0; +}; +typedef ::boost::shared_ptr< ExpressionNode > ExpressionNodeSharedPtr; + +/** This exception is thrown, when the arithmetic expression + parser failed to parse a string. + */ +struct OOO_DLLPUBLIC_DBTOOLS ParseError +{ + ParseError() {} + ParseError( const char* ) {} +}; + +class OOO_DLLPUBLIC_DBTOOLS FunctionParser +{ +public: + + /** Parse a string + + The following grammar is accepted by this method: + <code> + + number_digit = '0'|'1'|'2'|'3'|'4'|'5'|'6'|'7'|'8'|'9' + + number = number number_digit | number_digit + + equal_function = '=' + ternary_function = 'if' + + string_reference = 'a-z,A-Z,0-9' ' ' + modifier_reference = '$' '0-9' ' ' + + basic_expression = + number | + string_reference | + additive_expression equal_function additive_expression | + unary_function '(' number_digit ')' + ternary_function '(' additive_expression ',' additive_expression ', + ' additive_expression ')' | '(' additive_expression ')' + + </code> + + @param rFunction + The string to parse + + @throws ParseError if an invalid expression is given. + + @return the generated function object. + */ + + static ExpressionNodeSharedPtr parseFunction( const ::rtl::OUString& _sFunction); + +private: + // disabled constructor/destructor, since this is + // supposed to be a singleton + FunctionParser(); + + // default: disabled copy/assignment + FunctionParser(const FunctionParser&); + FunctionParser& operator=( const FunctionParser& ); +}; + +// ------------------------------------------------------------------------- +} // namespace connectivity +// ------------------------------------------------------------------------- +#endif /* CONNECTIVITY_ROWFUNCTIONPARSER_HXX_INCLUDED */ diff --git a/connectivity/source/inc/TConnection.hxx b/connectivity/source/inc/TConnection.hxx new file mode 100644 index 000000000000..f1acaa1c8aac --- /dev/null +++ b/connectivity/source/inc/TConnection.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CONNECTIVITY_CONNECTION_HXX +#define CONNECTIVITY_CONNECTION_HXX + +#include <rtl/textenc.h> +#include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#include <com/sun/star/sdbc/XConnection.hpp> +#include <cppuhelper/compbase4.hxx> +#include "propertyids.hxx" +#include "connectivity/CommonTools.hxx" +#include "connectivity/dbtoolsdllapi.hxx" +#include "resource/sharedresources.hxx" + +namespace connectivity +{ + typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::sdbc::XConnection, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::lang::XUnoTunnel + > OMetaConnection_BASE; + + typedef ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > TConditions; + + class OOO_DLLPUBLIC_DBTOOLS OMetaConnection : public OMetaConnection_BASE + { + protected: + ::osl::Mutex m_aMutex; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > + m_aConnectionInfo; + connectivity::OWeakRefArray m_aStatements; // vector containing a list + // of all the Statement objects + // for this Connection + ::rtl::OUString m_sURL; + rtl_TextEncoding m_nTextEncoding; // the encoding which is used for all text conversions + ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XDatabaseMetaData > + m_xMetaData; + SharedResources m_aResources; + public: + + static ::dbtools::OPropertyMap& getPropMap(); + + OMetaConnection(); + + inline rtl_TextEncoding getTextEncoding() const { return m_nTextEncoding; } + inline ::rtl::OUString getURL() const { return m_sURL; } + inline void setURL(const ::rtl::OUString& _rsUrl) { m_sURL = _rsUrl; } + void throwGenericSQLException( sal_uInt16 _nErrorResourceId,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _xContext ); + const SharedResources& getResources() const { return m_aResources;} + + inline void setConnectionInfo(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _aInfo) { m_aConnectionInfo = _aInfo; } + inline const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& + getConnectionInfo() const { return m_aConnectionInfo; } + + // OComponentHelper + virtual void SAL_CALL disposing(void); + + //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(); + }; +} +#endif // CONNECTIVITY_CONNECTION_HXX + + diff --git a/connectivity/source/inc/TDatabaseMetaDataBase.hxx b/connectivity/source/inc/TDatabaseMetaDataBase.hxx new file mode 100644 index 000000000000..3a7b47d2cbb2 --- /dev/null +++ b/connectivity/source/inc/TDatabaseMetaDataBase.hxx @@ -0,0 +1,142 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ODATABASEMETADATABASE_HXX_ +#define _CONNECTIVITY_ODATABASEMETADATABASE_HXX_ + +#include <com/sun/star/sdbc/XDatabaseMetaData2.hpp> +#include <cppuhelper/implbase2.hxx> +#include <comphelper/broadcasthelper.hxx> +#include <com/sun/star/lang/XEventListener.hpp> +#include "FDatabaseMetaDataResultSet.hxx" +#include <functional> +#include "connectivity/dbtoolsdllapi.hxx" + +namespace connectivity +{ + typedef ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > TConditions; + class OOO_DLLPUBLIC_DBTOOLS ODatabaseMetaDataBase : + public comphelper::OBaseMutex, + public ::cppu::WeakImplHelper2< ::com::sun::star::sdbc::XDatabaseMetaData2, + ::com::sun::star::lang::XEventListener> + { + private: + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_aConnectionInfo; + ::connectivity::ODatabaseMetaDataResultSet::ORows m_aTypeInfoRows; + + // cached database information + ::std::pair<bool,sal_Bool> m_isCatalogAtStart; + ::std::pair<bool,::rtl::OUString> m_sCatalogSeparator; + ::std::pair<bool,::rtl::OUString> m_sIdentifierQuoteString; + ::std::pair<bool,sal_Bool> m_supportsCatalogsInTableDefinitions; + ::std::pair<bool,sal_Bool> m_supportsSchemasInTableDefinitions; + ::std::pair<bool,sal_Bool> m_supportsCatalogsInDataManipulation; + ::std::pair<bool,sal_Bool> m_supportsSchemasInDataManipulation; + ::std::pair<bool,sal_Bool> m_supportsMixedCaseQuotedIdentifiers; + ::std::pair<bool,sal_Bool> m_supportsAlterTableWithAddColumn; + ::std::pair<bool,sal_Bool> m_supportsAlterTableWithDropColumn; + ::std::pair<bool,sal_Int32> m_MaxStatements; + ::std::pair<bool,sal_Int32> m_MaxTablesInSelect; + ::std::pair<bool,sal_Bool> m_storesMixedCaseQuotedIdentifiers; + + template <typename T> T callImplMethod(::std::pair<bool,T>& _rCache,const ::std::mem_fun_t<T,ODatabaseMetaDataBase>& _pImplMethod) + { + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !_rCache.first ) + { + _rCache.second = _pImplMethod(this); + _rCache.first = true; + } + return _rCache.second; + } + protected: + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener> m_xListenerHelper; // forward the calls from the connection to me + + virtual ~ODatabaseMetaDataBase(); + + protected: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > impl_getTypeInfo_throw() = 0; + // cached database information + virtual ::rtl::OUString impl_getIdentifierQuoteString_throw( ) = 0; + virtual sal_Bool impl_isCatalogAtStart_throw( ) = 0; + virtual ::rtl::OUString impl_getCatalogSeparator_throw( ) = 0; + virtual sal_Bool impl_supportsCatalogsInTableDefinitions_throw( ) = 0; + virtual sal_Bool impl_supportsSchemasInTableDefinitions_throw( ) = 0; + virtual sal_Bool impl_supportsCatalogsInDataManipulation_throw( ) = 0; + virtual sal_Bool impl_supportsSchemasInDataManipulation_throw( ) = 0; + virtual sal_Bool impl_supportsMixedCaseQuotedIdentifiers_throw( ) = 0; + virtual sal_Bool impl_supportsAlterTableWithAddColumn_throw( ) = 0; + virtual sal_Bool impl_supportsAlterTableWithDropColumn_throw( ) = 0; + virtual sal_Int32 impl_getMaxStatements_throw( ) = 0; + virtual sal_Int32 impl_getMaxTablesInSelect_throw( ) = 0; + virtual sal_Bool impl_storesMixedCaseQuotedIdentifiers_throw( ) = 0; + + + public: + + ODatabaseMetaDataBase(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rInfo); + + // XDatabaseMetaData2 + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getConnectionInfo( ) throw (::com::sun::star::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTypeInfo( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getProcedures( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getProcedureColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getSchemas( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCatalogs( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumnPrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTablePrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getBestRowIdentifier( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope, sal_Bool nullable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getVersionColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getPrimaryKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getImportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getExportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCrossReference( const ::com::sun::star::uno::Any& primaryCatalog, const ::rtl::OUString& primarySchema, const ::rtl::OUString& primaryTable, const ::com::sun::star::uno::Any& foreignCatalog, const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getIndexInfo( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Bool unique, sal_Bool approximate ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // cached database information + virtual ::rtl::OUString SAL_CALL getIdentifierQuoteString( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCatalogAtStart( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalogSeparator( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInTableDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInTableDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInDataManipulation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInDataManipulation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMixedCaseQuotedIdentifiers( ) 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); + virtual sal_Int32 SAL_CALL getMaxStatements( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxTablesInSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesMixedCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; +} +#endif // _CONNECTIVITY_ODATABASEMETADATABASE_HXX_ diff --git a/connectivity/source/inc/TKeyValue.hxx b/connectivity/source/inc/TKeyValue.hxx new file mode 100644 index 000000000000..1430bf798418 --- /dev/null +++ b/connectivity/source/inc/TKeyValue.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CONNECTIVITY_TKEYVALUE_HXX +#define CONNECTIVITY_TKEYVALUE_HXX + +#include "connectivity/FValue.hxx" +#include "connectivity/dbtoolsdllapi.hxx" + +namespace connectivity +{ + class OOO_DLLPUBLIC_DBTOOLS OKeyValue + { + private: + ::std::vector<ORowSetValueDecoratorRef> m_aKeys; + sal_Int32 m_nValue; + + protected: + OKeyValue(); + OKeyValue(sal_Int32 nVal); + public: + + ~OKeyValue(); + + inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW( () ) + { return ::rtl_allocateMemory( nSize ); } + inline static void * SAL_CALL operator new( size_t,void* _pHint ) SAL_THROW( () ) + { return _pHint; } + inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW( () ) + { ::rtl_freeMemory( pMem ); } + inline static void SAL_CALL operator delete( void *,void* ) SAL_THROW( () ) + { } + + static OKeyValue* createKeyValue(sal_Int32 nVal); + // static OKeyValue* createEmptyKeyValue(); + + inline void pushKey(const ORowSetValueDecoratorRef& _aValueRef) + { + m_aKeys.push_back(_aValueRef); + } + inline void setValue(sal_Int32 nVal) { m_nValue = nVal; } + + ::rtl::OUString getKeyString(::std::vector<ORowSetValueDecoratorRef>::size_type i) const + { + OSL_ENSURE(m_aKeys.size() > i,"Wrong index for KEyValue"); + return m_aKeys[i]->getValue(); + } + double getKeyDouble(::std::vector<ORowSetValueDecoratorRef>::size_type i) const + { + OSL_ENSURE(m_aKeys.size() > i,"Wrong index for KEyValue"); + return m_aKeys[i]->getValue(); + } + + inline sal_Int32 getValue() const { return m_nValue; } + }; +} + +#endif // CONNECTIVITY_TKEYVALUE_HXX + diff --git a/connectivity/source/inc/TPrivilegesResultSet.hxx b/connectivity/source/inc/TPrivilegesResultSet.hxx new file mode 100644 index 000000000000..3b5bc4963167 --- /dev/null +++ b/connectivity/source/inc/TPrivilegesResultSet.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CONNECTIVITY_PRIVILEGESRESULTSET_HXX +#define CONNECTIVITY_PRIVILEGESRESULTSET_HXX + +#include "FDatabaseMetaDataResultSet.hxx" +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#include "connectivity/dbtoolsdllapi.hxx" + +namespace connectivity +{ + class OOO_DLLPUBLIC_DBTOOLS OResultSetPrivileges : + public ODatabaseMetaDataResultSet + { + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> m_xTables; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow> m_xRow; + sal_Bool m_bResetValues; + protected: + virtual const ORowSetValue& getValue(sal_Int32 columnIndex); + public: + OResultSetPrivileges(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData>& _rxMeta + ,const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern); + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // XResultSet + virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; +} +#endif // CONNECTIVITY_PRIVILEGESRESULTSET_HXX diff --git a/connectivity/source/inc/TResultSetHelper.hxx b/connectivity/source/inc/TResultSetHelper.hxx new file mode 100644 index 000000000000..16f6ac049507 --- /dev/null +++ b/connectivity/source/inc/TResultSetHelper.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_TRESULTSETHELPER_HXX +#define CONNECTIVITY_TRESULTSETHELPER_HXX + +#include <sal/types.h> +#include "connectivity/dbtoolsdllapi.hxx" + +namespace connectivity +{ + class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IResultSetHelper + { + public: + enum Movement + { + NEXT = 0, + PRIOR, + FIRST, + LAST, + RELATIVE, + ABSOLUTE, + BOOKMARK + }; + public: + virtual sal_Bool move(Movement _eCursorPosition, sal_Int32 _nOffset, sal_Bool _bRetrieveData) = 0; + virtual sal_Int32 getDriverPos() const = 0; + virtual sal_Bool deletedVisible() const = 0; + virtual sal_Bool isRowDeleted() const = 0; + }; +} + +#endif // CONNECTIVITY_TRESULTSETHELPER_HXX + diff --git a/connectivity/source/inc/TSkipDeletedSet.hxx b/connectivity/source/inc/TSkipDeletedSet.hxx new file mode 100644 index 000000000000..bcd3fc23f1a6 --- /dev/null +++ b/connectivity/source/inc/TSkipDeletedSet.hxx @@ -0,0 +1,105 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CONNECTIVITY_SKIPDELETEDSSET_HXX +#define CONNECTIVITY_SKIPDELETEDSSET_HXX + +#include "TResultSetHelper.hxx" +#include <rtl/alloc.h> +#include <hash_map> +#include <vector> +#include "connectivity/dbtoolsdllapi.hxx" + +namespace connectivity +{ + /** + the class OSkipDeletedSet supports a general method to skip deleted rows + */ + class OOO_DLLPUBLIC_DBTOOLS OSkipDeletedSet + { + ::std::vector<sal_Int32> m_aBookmarksPositions;// vector of iterators to position map, the order is the logical position + IResultSetHelper* m_pHelper; // used for moving in the resultset + bool m_bDeletedVisible; + + sal_Bool moveAbsolute(sal_Int32 _nOffset,sal_Bool _bRetrieveData); + public: + OSkipDeletedSet(IResultSetHelper* _pHelper); + ~OSkipDeletedSet(); + + inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW( () ) + { return ::rtl_allocateMemory( nSize ); } + inline static void * SAL_CALL operator new( size_t,void* _pHint ) SAL_THROW( () ) + { return _pHint; } + inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW( () ) + { ::rtl_freeMemory( pMem ); } + inline static void SAL_CALL operator delete( void *,void* ) SAL_THROW( () ) + { } + + /** + skipDeleted moves the resultset to the position defined by the parameters + it garantees that the row isn't deleted + @param + IResultSetHelper::Movement _eCursorPosition in which direction the resultset should be moved + sal_Int32 _nOffset the position relativ to the movement + sal_Bool _bRetrieveData is true when the current row should be filled which data + @return + true when the movement was successful otherwise false + */ + sal_Bool skipDeleted(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, sal_Bool _bRetrieveData); + /** + clear the map and the vector used in this class + */ + void clear(); + /** + getMappedPosition returns the mapped position of a logical position + @param + sal_Int32 _nBookmark the logical position + + @return the mapped position + */ + sal_Int32 getMappedPosition(sal_Int32 _nBookmark) const; + /** + insertNewPosition adds a new position to the map + @param + sal_Int32 _nPos the logical position + */ + void insertNewPosition(sal_Int32 _nPos); + /** + deletePosition deletes this position from the map and decrement all following positions + @param + sal_Int32 _nPos the logical position + */ + void deletePosition(sal_Int32 _nPos); + /** + getLastPosition returns the last position + @return the last position + */ + inline sal_Int32 getLastPosition() const { return m_aBookmarksPositions.size(); } + inline void SetDeleted(bool _bDeletedVisible) { m_bDeletedVisible = _bDeletedVisible; } + }; +} +#endif // CONNECTIVITY_SKIPDELETEDSSET_HXX + diff --git a/connectivity/source/inc/TSortIndex.hxx b/connectivity/source/inc/TSortIndex.hxx new file mode 100644 index 000000000000..51a978121ca1 --- /dev/null +++ b/connectivity/source/inc/TSortIndex.hxx @@ -0,0 +1,139 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CONNECTIVITY_TSORTINDEX_HXX +#define CONNECTIVITY_TSORTINDEX_HXX + +#include "connectivity/dbtoolsdllapi.hxx" +#include "TKeyValue.hxx" + +namespace connectivity +{ + typedef enum + { + SQL_ORDERBYKEY_NONE, // do not sort + SQL_ORDERBYKEY_DOUBLE, // numeric key + SQL_ORDERBYKEY_STRING // String Key + } OKeyType; + + typedef enum + { + SQL_ASC = 1, // ascending + SQL_DESC = -1 // otherwise + } TAscendingOrder; + + class OKeySet; + class OKeyValue; // simple class which holds a sal_Int32 and a ::std::vector<ORowSetValueDecoratorRef> + + /** + The class OSortIndex can be used to implement a sorted index. + This can depend on the fields which should be sorted. + */ + class OOO_DLLPUBLIC_DBTOOLS OSortIndex + { + public: + typedef ::std::vector< ::std::pair<sal_Int32,OKeyValue*> > TIntValuePairVector; + typedef ::std::vector<OKeyType> TKeyTypeVector; + + private: + TIntValuePairVector m_aKeyValues; + TKeyTypeVector m_aKeyType; + ::std::vector<TAscendingOrder> m_aAscending; + sal_Bool m_bFrozen; + + public: + + OSortIndex( const ::std::vector<OKeyType>& _aKeyType, + const ::std::vector<TAscendingOrder>& _aAscending); + + ~OSortIndex(); + + inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW( () ) + { return ::rtl_allocateMemory( nSize ); } + inline static void * SAL_CALL operator new( size_t,void* _pHint ) SAL_THROW( () ) + { return _pHint; } + inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW( () ) + { ::rtl_freeMemory( pMem ); } + inline static void SAL_CALL operator delete( void *,void* ) SAL_THROW( () ) + { } + + + /** + AddKeyValue appends a new value. + @param + pKeyValue the keyvalue to be appended + ATTENTION: when the sortindex is already frozen the parameter will be deleted + */ + void AddKeyValue(OKeyValue * pKeyValue); + + /** + Freeze freezes the sortindex so that new values could only be appended by their value + */ + void Freeze(); + + /** + CreateKeySet creates the keyset which vaalues could be used to travel in your table/result + The returned keyset is frozen. + */ + ::vos::ORef<OKeySet> CreateKeySet(); + + + + // look at the name + sal_Bool IsFrozen() const { return m_bFrozen; } + // returns the current size of the keyvalues + sal_Int32 Count() const { return m_aKeyValues.size(); } + /** GetValue returns the value at position nPos (1..n) [sorted access]. + It only allowed to call this method after the sortindex has been frozen. + */ + + sal_Int32 GetValue(sal_Int32 nPos) const; + + inline const ::std::vector<OKeyType>& getKeyType() const { return m_aKeyType; } + inline TAscendingOrder getAscending(::std::vector<TAscendingOrder>::size_type _nPos) const { return m_aAscending[_nPos]; } + + }; + + /** + The class OKeySet is a refcountable vector which also has a state. + This state gives information about if the keyset is fixed. + */ + class OOO_DLLPUBLIC_DBTOOLS OKeySet : public ORefVector<sal_Int32> + { + sal_Bool m_bFrozen; + public: + OKeySet() + : ORefVector<sal_Int32>() + , m_bFrozen(sal_False){} + OKeySet(Vector::size_type _nSize) + : ORefVector<sal_Int32>(_nSize) + , m_bFrozen(sal_False){} + + sal_Bool isFrozen() const { return m_bFrozen; } + void setFrozen(sal_Bool _bFrozen=sal_True) { m_bFrozen = _bFrozen; } + }; +} +#endif // CONNECTIVITY_TSORTINDEX_HXX diff --git a/connectivity/source/inc/UStringDescription_Impl.hxx b/connectivity/source/inc/UStringDescription_Impl.hxx new file mode 100644 index 000000000000..708117cc77b3 --- /dev/null +++ b/connectivity/source/inc/UStringDescription_Impl.hxx @@ -0,0 +1,106 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_USTRINGDESCRIPTION_IMPL_HXX +#define CONNECTIVITY_USTRINGDESCRIPTION_IMPL_HXX + +#define IMPLEMENT_CONSTASCII_USTRING(name) \ +UStringDescription name(connectivity::dbtools::get##name) + +UStringDescription::UStringDescription(PVFN _fCharFkt) +{ + pZeroTerminatedName = (*_fCharFkt)(); + nLength = 0; + const sal_Char* pIter = pZeroTerminatedName; + while((*pIter++) != '\0') + ++nLength; +} +// ------------------------------------------------------------------------- +UStringDescription::~UStringDescription() +{ +} + +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_QUERYTIMEOUT ); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_MAXFIELDSIZE ); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_MAXROWS ); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CURSORNAME ); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_RESULTSETCONCURRENCY ); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_RESULTSETTYPE ); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FETCHDIRECTION ); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FETCHSIZE ); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ESCAPEPROCESSING ); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_USEBOOKMARKS ); + +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_NAME); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TYPE); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TYPENAME); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_PRECISION); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SCALE); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ISNULLABLE); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ISAUTOINCREMENT); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ISROWVERSION); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DESCRIPTION); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DEFAULTVALUE); + +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_REFERENCEDTABLE); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_UPDATERULE); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DELETERULE); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CATALOG); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ISUNIQUE); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ISPRIMARYKEYINDEX); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ISCLUSTERED); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ISASCENDING); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SCHEMANAME); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CATALOGNAME); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_COMMAND); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CHECKOPTION); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_PASSWORD); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_RELATEDCOLUMN); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ISSEARCHABLE); + +IMPLEMENT_CONSTASCII_USTRING(STAT_INVALID_INDEX); + +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FUNCTION); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TABLENAME); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_REALNAME); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DBASEPRECISIONCHANGED); +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ISCURRENCY); + +IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ISBOOKMARKABLE); +//============================================================ +//= error messages +//============================================================ +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/adabas/BCatalog.hxx b/connectivity/source/inc/adabas/BCatalog.hxx new file mode 100644 index 000000000000..1a74d368311a --- /dev/null +++ b/connectivity/source/inc/adabas/BCatalog.hxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADABAS_CATALOG_HXX_ +#define _CONNECTIVITY_ADABAS_CATALOG_HXX_ + +#include "connectivity/sdbcx/VCatalog.hxx" +#include "odbc/OFunctiondefs.hxx" +#include "connectivity/StdTypeDefs.hxx" + +namespace connectivity +{ + namespace adabas + { + // please don't name the class the same name as in an other namespaces + // some compilers have problems with this task as I noticed on windows + class OAdabasConnection; + class OAdabasCatalog : public connectivity::sdbcx::OCatalog + { + OAdabasConnection* m_pConnection; // used to get the metadata + SQLHANDLE m_aConnectionHdl; // used for odbc specific stuff + + void fillVector(const ::rtl::OUString& _sQuery,TStringVector& _rVector); + + protected: + /** builds the name which should be used to access the object later on in the collection. + Will only be called in fillNames. + @param _xRow + The cuurent row from a call of XDatabaseMetaData::getTables. + */ + virtual ::rtl::OUString buildName( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >& _xRow); + public: + // implementation of the pure virtual methods + virtual void refreshTables(); + virtual void refreshViews() ; + virtual void refreshGroups(); + virtual void refreshUsers() ; + + public: + OAdabasCatalog(SQLHANDLE _aConnectionHdl,OAdabasConnection* _pCon); + + OAdabasConnection* getConnection() const { return m_pConnection; } + sdbcx::OCollection* getPrivateTables() const { return m_pTables;} + sdbcx::OCollection* getPrivateViews() const { return m_pViews; } + + static const ::rtl::OUString& getDot(); + // correct the the column properties of float/real/double values + // all & parameters are IN and OUT + static void correctColumnProperties(sal_Int32 _nPrec, sal_Int32& _rnType,::rtl::OUString& _rsTypeName); + }; + } +} +#endif // _CONNECTIVITY_ADABAS_CATALOG_HXX_ + diff --git a/connectivity/source/inc/adabas/BColumn.hxx b/connectivity/source/inc/adabas/BColumn.hxx new file mode 100644 index 000000000000..bfe036b5c858 --- /dev/null +++ b/connectivity/source/inc/adabas/BColumn.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_COLUMN_HXX_ +#define _CONNECTIVITY_ADABAS_COLUMN_HXX_ + +#include "connectivity/sdbcx/VColumn.hxx" + +namespace connectivity +{ + namespace adabas + { + class OAdabasColumn : public sdbcx::OColumn + { + public: + OAdabasColumn(); + OAdabasColumn(const ::rtl::OUString& _Name, + const ::rtl::OUString& _TypeName, + const ::rtl::OUString& _DefaultValue, + sal_Int32 _IsNullable, + sal_Int32 _Precision, + sal_Int32 _Scale, + sal_Int32 _Type, + sal_Bool _IsAutoIncrement); + + }; + } +} +#endif // _CONNECTIVITY_ADABAS_COLUMN_HXX_ + diff --git a/connectivity/source/inc/adabas/BColumns.hxx b/connectivity/source/inc/adabas/BColumns.hxx new file mode 100644 index 000000000000..404f07d740e6 --- /dev/null +++ b/connectivity/source/inc/adabas/BColumns.hxx @@ -0,0 +1,61 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_COLUMNS_HXX_ +#define _CONNECTIVITY_ADABAS_COLUMNS_HXX_ + +#include "connectivity/sdbcx/VCollection.hxx" +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#include "connectivity/sdbcx/IRefreshable.hxx" +#include "adabas/BTable.hxx" + +namespace connectivity +{ + namespace adabas + { + class OColumns : public sdbcx::OCollection + { + protected: + OAdabasTable* m_pTable; + + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor(); + virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); + public: + OColumns( OAdabasTable* _pTable, + ::osl::Mutex& _rMutex, + const TStringVector &_rVector + ) : sdbcx::OCollection(*_pTable,sal_True,_rMutex,_rVector) + ,m_pTable(_pTable) + {} + }; + } +} +#endif // _CONNECTIVITY_ADABAS_COLUMNS_HXX_ + diff --git a/connectivity/source/inc/adabas/BConnection.hxx b/connectivity/source/inc/adabas/BConnection.hxx new file mode 100644 index 000000000000..678eb2e61049 --- /dev/null +++ b/connectivity/source/inc/adabas/BConnection.hxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADABAS_BCONNECTION_HXX_ +#define _CONNECTIVITY_ADABAS_BCONNECTION_HXX_ + +#include <cppuhelper/compbase2.hxx> +#include "odbc/OConnection.hxx" +#include <com/sun/star/sdbcx/XTablesSupplier.hpp> +#include <cppuhelper/weakref.hxx> +#include <vos/ref.hxx> + +namespace connectivity +{ + namespace odbc + { + class ODBCDriver; + } + namespace adabas + { + typedef connectivity::odbc::OConnection OConnection_BASE2; + + // we must use the name "OAdabasConnection" because of a compiler bug + + class OAdabasConnection : public OConnection_BASE2 + { + ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbcx::XTablesSupplier> m_xCatalog; + + protected: + virtual SQLRETURN openConnectionWithAuth(const ::rtl::OUString& aConnectStr,sal_Int32 nTimeOut, const ::rtl::OUString& _uid,const ::rtl::OUString& _pwd); + virtual connectivity::odbc::OConnection* cloneConnection(); // creates a new connection + public: + virtual SQLRETURN Construct( const ::rtl::OUString& url,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info) throw(::com::sun::star::sdbc::SQLException); + + OAdabasConnection(const SQLHANDLE _pDriverHandle,connectivity::odbc::ODBCDriver* _pDriver); + + // OComponentHelper; + virtual void SAL_CALL disposing(); + + ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > createCatalog(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > SAL_CALL createStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + //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(); + + ::vos::ORef<OSQLColumns> createSelectColumns(const ::rtl::OUString& _rSql); + }; + } +} +#endif // _CONNECTIVITY_ADABAS_BCONNECTION_HXX_ + diff --git a/connectivity/source/inc/adabas/BDatabaseMetaData.hxx b/connectivity/source/inc/adabas/BDatabaseMetaData.hxx new file mode 100644 index 000000000000..bae7de19f4a3 --- /dev/null +++ b/connectivity/source/inc/adabas/BDatabaseMetaData.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "odbc/ODatabaseMetaData.hxx" + +namespace connectivity +{ + namespace odbc + { + class OConnection; + } + namespace adabas + { + typedef odbc::ODatabaseMetaData OAdabasDatabaseMetaData_BASE; + + class OAdabasDatabaseMetaData : public OAdabasDatabaseMetaData_BASE + { + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > impl_getTypeInfo_throw(); + public: + OAdabasDatabaseMetaData(const SQLHANDLE _pHandle,odbc::OConnection* _pCon) + : ODatabaseMetaData(_pHandle,_pCon) + { + } + + // just to return our url + virtual ::rtl::OUString SAL_CALL getURL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} + diff --git a/connectivity/source/inc/adabas/BDriver.hxx b/connectivity/source/inc/adabas/BDriver.hxx new file mode 100644 index 000000000000..3b73da08cc6f --- /dev/null +++ b/connectivity/source/inc/adabas/BDriver.hxx @@ -0,0 +1,177 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_BDRIVER_HXX_ +#define _CONNECTIVITY_ADABAS_BDRIVER_HXX_ + +#include <com/sun/star/sdbc/XDriver.hpp> +#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp> +#include <com/sun/star/sdbcx/XTablesSupplier.hpp> +#include <com/sun/star/sdbcx/XCreateCatalog.hpp> +#include <com/sun/star/sdbcx/XDropCatalog.hpp> + +#include <com/sun/star/lang/XEventListener.hpp> + +//#include <unotools/tempfile.hxx> +#include <cppuhelper/implbase4.hxx> +#include "odbc/OFunctiondefs.hxx" +#include "odbc/ODriver.hxx" + +namespace connectivity +{ + namespace adabas + { + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ODriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ); + + typedef ::cppu::ImplHelper4< ::com::sun::star::sdbcx::XCreateCatalog, + ::com::sun::star::sdbcx::XDataDefinitionSupplier, + ::com::sun::star::lang::XEventListener, + ::com::sun::star::sdbcx::XDropCatalog> ODriver_BASE2; + + typedef odbc::ODBCDriver ODriver_BASE; + + class ODriver : public ODriver_BASE, + public ODriver_BASE2 + { + typedef struct DatabaseStruct + { + ::rtl::OUString sControlUser; + ::rtl::OUString sControlPassword; + ::rtl::OUString sSysUser; + ::rtl::OUString sSysPassword; + ::rtl::OUString sDomainPassword; + ::rtl::OUString sCacheSize; + ::rtl::OUString sBackupFile; + ::rtl::OUString sDataDevName; + ::rtl::OUString sSysDevSpace; + ::rtl::OUString sTransLogName; + ::rtl::OUString sDBName; + sal_Int32 nDataIncrement; // which size the database should grow + sal_Int32 nDataSize; + sal_Int32 nLogSize; + sal_Bool bShutDown; + sal_Bool bRestoreDatabase; + + DatabaseStruct() : nDataIncrement(0),nDataSize(0),nLogSize(0),bShutDown(sal_False),bRestoreDatabase(sal_False){ } + } TDatabaseStruct; + + DECLARE_STL_USTRINGACCESS_MAP(TDatabaseStruct,TDatabaseMap); + TDatabaseMap m_aDatabaseMap; // contains all adabas databases with their flag to shut down or not + + // environment vars + ::rtl::OUString m_sDbWork; + ::rtl::OUString m_sDbConfig; + ::rtl::OUString m_sDbRoot; + ::rtl::OUString m_sDbWorkURL; + ::rtl::OUString m_sDbConfigURL; + ::rtl::OUString m_sDbRootURL; + ::rtl::OUString m_sDbRunDir; + ::rtl::OUString m_sDelimit; + + void checkAndInsertNewDevSpace(const ::rtl::OUString& _rDBName,const TDatabaseStruct& _rDBInfo); + void checkAndRestart(const ::rtl::OUString& _rDBName,const TDatabaseStruct& _rDbInfo); + void X_CONS(const ::rtl::OUString& _DBNAME,const ::rtl::OString& _ACTION,const ::rtl::OUString& _FILENAME); + sal_Bool getDBName(const ::rtl::OUString& _rName,::rtl::OUString& _rDBName) const; + ::rtl::OUString getDatabaseInitFile( const TDatabaseStruct& _aInfo); + ::rtl::OUString generateInitFile() const; + void fillEnvironmentVariables(); + void fillInfo(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info, TDatabaseStruct& _rDBInfo /*out*/); + void LoadBatch(const ::rtl::OUString& _rDBNAME, + const ::rtl::OUString& _rUSR, + const ::rtl::OUString& _rPWD, + const ::rtl::OUString& _rBatch); + void XUTIL(const ::rtl::OUString& _rParam, + const ::rtl::OUString& _DBNAME, + const ::rtl::OUString& _USRNAME, + const ::rtl::OUString& _USRPWD); + int X_STOP(const ::rtl::OUString& _DBNAME); + int X_START(const ::rtl::OUString& _DBNAME); + void createDb(const TDatabaseStruct& _aInfo); + void clearDatabase(const ::rtl::OUString& _rDBName); + int X_PARAM(const ::rtl::OUString& _DBNAME, + const ::rtl::OUString& _USR, + const ::rtl::OUString& _PWD, + const ::rtl::OUString& _CMD); + sal_Int32 CreateFiles(const TDatabaseStruct& _aInfo); + sal_Bool CreateFile(const ::rtl::OUString &_FileName, + sal_Int32 _nSize); + void PutParam(const ::rtl::OUString& rDBNAME, + const ::rtl::OUString& rWhat, + const ::rtl::OUString& rHow); + void createNeededDirs( const ::rtl::OUString& _rDBName); + sal_Bool isKernelVersion(const char* _pVersion); + sal_Bool isVersion( const ::rtl::OUString& _rDBName, + const char* _pVersion); + + void convertOldVersion( const ::rtl::OUString& _rDBName, + const TDatabaseStruct& _rDbInfo); + + void installSystemTables( const TDatabaseStruct& _aInfo); + + protected: + virtual SQLHANDLE EnvironmentHandle(::rtl::OUString &_rPath); + virtual ~ODriver(); + public: + explicit ODriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory); + + // XInterface + static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); + private: + DECLARE_SERVICE_INFO(); + + virtual oslGenericFunction getOdbcFunction(sal_Int32 _nIndex) const; + // OComponentHelper + virtual void SAL_CALL disposing(void); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XDriver + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMajorVersion( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMinorVersion( ) throw(::com::sun::star::uno::RuntimeException); + + // XDataDefinitionSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& connection ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByURL( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + // XCreateCatalog + virtual void SAL_CALL createCatalog( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); + // XDropCatalog + virtual void SAL_CALL dropCatalog( const ::rtl::OUString& catalogName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + // XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); + }; + } + +} +#endif //_CONNECTIVITY_ADABAS_BDRIVER_HXX_ + + diff --git a/connectivity/source/inc/adabas/BGroup.hxx b/connectivity/source/inc/adabas/BGroup.hxx new file mode 100644 index 000000000000..58358b579dcf --- /dev/null +++ b/connectivity/source/inc/adabas/BGroup.hxx @@ -0,0 +1,50 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_GROUP_HXX_ +#define _CONNECTIVITY_ADABAS_GROUP_HXX_ + +#include "connectivity/sdbcx/VGroup.hxx" + +namespace connectivity +{ + namespace adabas + { + class OAdabasConnection; + class OAdabasGroup : public sdbcx::OGroup + { + OAdabasConnection* m_pConnection; + public: + virtual void refreshUsers(); + public: + OAdabasGroup( OAdabasConnection* _pConnection); + OAdabasGroup( OAdabasConnection* _pConnection,const ::rtl::OUString& _Name); + }; + } +} +#endif // _CONNECTIVITY_ADABAS_GROUP_HXX_ + diff --git a/connectivity/source/inc/adabas/BGroups.hxx b/connectivity/source/inc/adabas/BGroups.hxx new file mode 100644 index 000000000000..33888d4cbefb --- /dev/null +++ b/connectivity/source/inc/adabas/BGroups.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_GROUPS_HXX_ +#define _CONNECTIVITY_ADABAS_GROUPS_HXX_ + +#include "connectivity/sdbcx/VCollection.hxx" +namespace connectivity +{ + namespace sdbcx + { + class IRefreshableGroups; + } + namespace adabas + { + class OAdabasConnection; + class OGroups : public sdbcx::OCollection + { + protected: + OAdabasConnection* m_pConnection; + connectivity::sdbcx::IRefreshableGroups* m_pParent; + + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor(); + virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); + public: + OGroups(::cppu::OWeakObject& _rParent, + ::osl::Mutex& _rMutex, + const TStringVector &_rVector, + OAdabasConnection* _pConnection, + connectivity::sdbcx::IRefreshableGroups* _pParent) : sdbcx::OCollection(_rParent,sal_True,_rMutex,_rVector) + ,m_pConnection(_pConnection) + ,m_pParent(_pParent) + {} + }; + } +} + +#endif // _CONNECTIVITY_ADABAS_GROUPS_HXX_ + diff --git a/connectivity/source/inc/adabas/BIndex.hxx b/connectivity/source/inc/adabas/BIndex.hxx new file mode 100644 index 000000000000..0725d29d0cd6 --- /dev/null +++ b/connectivity/source/inc/adabas/BIndex.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_INDEX_HXX_ +#define _CONNECTIVITY_ADABAS_INDEX_HXX_ + +#include "connectivity/sdbcx/VIndex.hxx" +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> + +namespace connectivity +{ + namespace adabas + { + class OAdabasTable; + class OAdabasIndex : public sdbcx::OIndex + { + OAdabasTable* m_pTable; + public: + virtual void refreshColumns(); + public: + OAdabasIndex(OAdabasTable* _pTable); + OAdabasIndex( OAdabasTable* _pTable, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _Catalog, + sal_Bool _isUnique, + sal_Bool _isPrimaryKeyIndex, + sal_Bool _isClustered + ); + OAdabasTable* getTable() const { return m_pTable; } + }; + } +} +#endif // _CONNECTIVITY_ADABAS_INDEX_HXX_ + diff --git a/connectivity/source/inc/adabas/BIndexColumn.hxx b/connectivity/source/inc/adabas/BIndexColumn.hxx new file mode 100644 index 000000000000..b422ced8c337 --- /dev/null +++ b/connectivity/source/inc/adabas/BIndexColumn.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_INDEXCOLUMN_HXX_ +#define _CONNECTIVITY_ADABAS_INDEXCOLUMN_HXX_ + +#include "adabas/BColumn.hxx" + +namespace connectivity +{ + namespace adabas + { + class OIndexColumn : public OAdabasColumn + { + protected: + sal_Bool m_IsAscending; + public: + OIndexColumn(); + OIndexColumn( sal_Bool _IsAscending, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _TypeName, + const ::rtl::OUString& _DefaultValue, + sal_Int32 _IsNullable, + sal_Int32 _Precision, + sal_Int32 _Scale, + sal_Int32 _Type, + sal_Bool _IsAutoIncrement); + + virtual void construct(); + }; + } +} +#endif // _CONNECTIVITY_ADABAS_INDEXCOLUMN_HXX_ + diff --git a/connectivity/source/inc/adabas/BIndexColumns.hxx b/connectivity/source/inc/adabas/BIndexColumns.hxx new file mode 100644 index 000000000000..ca85d71155e8 --- /dev/null +++ b/connectivity/source/inc/adabas/BIndexColumns.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_INDEXCOLUMNS_HXX_ +#define _CONNECTIVITY_ADABAS_INDEXCOLUMNS_HXX_ + +#include "connectivity/sdbcx/VCollection.hxx" +#include "adabas/BIndex.hxx" + +namespace connectivity +{ + namespace adabas + { + class OIndexColumns : public sdbcx::OCollection + { + OAdabasIndex* m_pIndex; + protected: + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor(); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + public: + OIndexColumns( OAdabasIndex* _pIndex, + ::osl::Mutex& _rMutex, + const TStringVector &_rVector) + : sdbcx::OCollection(*_pIndex,sal_True,_rMutex,_rVector) + ,m_pIndex(_pIndex) + { + } + }; + } +} +#endif // _CONNECTIVITY_ADABAS_INDEXCOLUMNS_HXX_ + diff --git a/connectivity/source/inc/adabas/BIndexes.hxx b/connectivity/source/inc/adabas/BIndexes.hxx new file mode 100644 index 000000000000..3a00416a4605 --- /dev/null +++ b/connectivity/source/inc/adabas/BIndexes.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADABAS_INDEXES_HXX_ +#define _CONNECTIVITY_ADABAS_INDEXES_HXX_ + +#include "connectivity/sdbcx/VCollection.hxx" +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#include "adabas/BTable.hxx" +namespace connectivity +{ + namespace adabas + { + class OIndexes : public sdbcx::OCollection + { + OAdabasTable* m_pTable; + protected: + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor(); + virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); + public: + OIndexes(OAdabasTable* _pTable, + ::osl::Mutex& _rMutex, + const TStringVector &_rVector + ) : sdbcx::OCollection(*_pTable,sal_True,_rMutex,_rVector) + ,m_pTable(_pTable) + {} + }; + } +} + +#endif // _CONNECTIVITY_ADABAS_INDEXES_HXX_ + diff --git a/connectivity/source/inc/adabas/BKeys.hxx b/connectivity/source/inc/adabas/BKeys.hxx new file mode 100644 index 000000000000..6ed97dd2e58e --- /dev/null +++ b/connectivity/source/inc/adabas/BKeys.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_KEYS_HXX_ +#define _CONNECTIVITY_ADABAS_KEYS_HXX_ + +#include "connectivity/TKeys.hxx" +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#include "adabas/BTable.hxx" +namespace connectivity +{ + namespace adabas + { + class OKeys : public OKeysHelper + { + protected: + virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + + virtual ::rtl::OUString getDropForeignKey() const; + public: + OKeys(OAdabasTable* _pTable, + ::osl::Mutex& _rMutex, + const TStringVector &_rVector + ) : OKeysHelper(_pTable,_rMutex,_rVector) + {} + }; + } +} + +#endif // _CONNECTIVITY_ADABAS_KEYS_HXX_ + diff --git a/connectivity/source/inc/adabas/BPreparedStatement.hxx b/connectivity/source/inc/adabas/BPreparedStatement.hxx new file mode 100644 index 000000000000..a5cfac1666e4 --- /dev/null +++ b/connectivity/source/inc/adabas/BPreparedStatement.hxx @@ -0,0 +1,52 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CONNECTIVITY_ADABAS_PREPAREDSTATEMENT_HXX +#define CONNECTIVITY_ADABAS_PREPAREDSTATEMENT_HXX + +#include "odbc/OPreparedStatement.hxx" +#include "adabas/BConnection.hxx" + +namespace connectivity +{ + namespace adabas + { + class OAdabasPreparedStatement : public ::connectivity::odbc::OPreparedStatement + { + ::vos::ORef<OSQLColumns> m_aSelectColumns; + protected: + virtual odbc::OResultSet* createResulSet(); + virtual void setResultSetConcurrency(sal_Int32 _par0) ; + virtual void setResultSetType(sal_Int32 _par0) ; + virtual void setUsingBookmarks(sal_Bool _bUseBookmark) ; + public: + OAdabasPreparedStatement( OAdabasConnection* _pConnection,const ::rtl::OUString& sql); + }; + } +} + +#endif // CONNECTIVITY_ADABAS_PREPAREDSTATEMENT_HXX + diff --git a/connectivity/source/inc/adabas/BResultSet.hxx b/connectivity/source/inc/adabas/BResultSet.hxx new file mode 100644 index 000000000000..46dbf5684484 --- /dev/null +++ b/connectivity/source/inc/adabas/BResultSet.hxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CONNECTIVITY_ADABAS_RESULTSET_HXX +#define CONNECTIVITY_ADABAS_RESULTSET_HXX + +#include "odbc/OResultSet.hxx" + +namespace connectivity +{ + namespace adabas + { + class OAdabasResultSet : public ::connectivity::odbc::OResultSet + { + ::vos::ORef<OSQLColumns> m_aSelectColumns; + public: + OAdabasResultSet(SQLHANDLE _pStatementHandle,::connectivity::odbc::OStatement_Base* pStmt,const ::vos::ORef<OSQLColumns>& _rSelectColumns) + : ::connectivity::odbc::OResultSet( _pStatementHandle,pStmt) + ,m_aSelectColumns(_rSelectColumns) + {} + + // XResultSetMetaDataSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} + +#endif // CONNECTIVITY_ADABAS_RESULTSET_HXX + diff --git a/connectivity/source/inc/adabas/BResultSetMetaData.hxx b/connectivity/source/inc/adabas/BResultSetMetaData.hxx new file mode 100644 index 000000000000..1cbb328bcf1e --- /dev/null +++ b/connectivity/source/inc/adabas/BResultSetMetaData.hxx @@ -0,0 +1,56 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CONNECTIVITY_ADABAS_RESULTSETMETADATA_HXX +#define CONNECTIVITY_ADABAS_RESULTSETMETADATA_HXX + +#include "odbc/OResultSetMetaData.hxx" +#include <vos/ref.hxx> + +namespace connectivity +{ + namespace adabas + { + //************************************************************** + //************ Class: ResultSetMetaData + //************************************************************** + + typedef odbc::OResultSetMetaData OAdabasResultSetMetaData_BASE; + class OAdabasResultSetMetaData : public OAdabasResultSetMetaData_BASE + { + ::vos::ORef<OSQLColumns> m_aSelectColumns; + public: + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + OAdabasResultSetMetaData(odbc::OConnection* _pConnection, SQLHANDLE _pStmt ,const ::vos::ORef<OSQLColumns>& _rSelectColumns); + virtual ~OAdabasResultSetMetaData(); + + virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // CONNECTIVITY_ADABAS_RESULTSETMETADATA_HXX diff --git a/connectivity/source/inc/adabas/BStatement.hxx b/connectivity/source/inc/adabas/BStatement.hxx new file mode 100644 index 000000000000..abd8f93ef395 --- /dev/null +++ b/connectivity/source/inc/adabas/BStatement.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CONNECTIVITY_ADABAS_STATEMENT_HXX +#define CONNECTIVITY_ADABAS_STATEMENT_HXX + +#include "odbc/OStatement.hxx" +#include "adabas/BConnection.hxx" +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include "connectivity/commontools.hxx" +#endif +#include <vos/ref.hxx> + +namespace connectivity +{ + namespace adabas + { + class OAdabasStatement : public ::connectivity::odbc::OStatement + { + OAdabasConnection* m_pOwnConnection; + ::vos::ORef<OSQLColumns> m_aSelectColumns; + protected: + virtual odbc::OResultSet* createResulSet(); + virtual void setResultSetConcurrency(sal_Int32 _par0); + virtual void setResultSetType(sal_Int32 _par0) ; + virtual void setUsingBookmarks(sal_Bool _bUseBookmark); + public: + OAdabasStatement( OAdabasConnection* _pConnection) + : ::connectivity::odbc::OStatement( _pConnection ) + ,m_pOwnConnection(_pConnection) + {} + + virtual sal_Bool SAL_CALL execute( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} + +#endif // CONNECTIVITY_ADABAS_STATEMENT_HXX + diff --git a/connectivity/source/inc/adabas/BTable.hxx b/connectivity/source/inc/adabas/BTable.hxx new file mode 100644 index 000000000000..750f48093da1 --- /dev/null +++ b/connectivity/source/inc/adabas/BTable.hxx @@ -0,0 +1,110 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_TABLE_HXX_ +#define _CONNECTIVITY_ADABAS_TABLE_HXX_ + +#include "connectivity/sdbcx/VTable.hxx" +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#include "adabas/BConnection.hxx" +#include "connectivity/TTableHelper.hxx" + +namespace connectivity +{ + namespace adabas + { + typedef connectivity::OTableHelper OTable_TYPEDEF; + + ::rtl::OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xColProp); + + class OAdabasTable : public OTableHelper + { + OAdabasConnection* m_pConnection; + protected: + /** creates the column collection for the table + @param _rNames + The column names. + */ + virtual sdbcx::OCollection* createColumns(const TStringVector& _rNames); + + /** creates the key collection for the table + @param _rNames + The key names. + */ + virtual sdbcx::OCollection* createKeys(const TStringVector& _rNames); + + /** creates the index collection for the table + @param _rNames + The index names. + */ + virtual sdbcx::OCollection* createIndexes(const TStringVector& _rNames); + + public: + OAdabasTable( sdbcx::OCollection* _pTables, + OAdabasConnection* _pConnection); + OAdabasTable( sdbcx::OCollection* _pTables, + OAdabasConnection* _pConnection, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _Type, + const ::rtl::OUString& _Description = ::rtl::OUString(), + const ::rtl::OUString& _SchemaName = ::rtl::OUString(), + const ::rtl::OUString& _CatalogName = ::rtl::OUString() + ); + + ::rtl::OUString getTableName() const { return m_Name; } + ::rtl::OUString getSchema() const { return m_SchemaName; } + + // 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); + // XNamed + virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); + /** + returns the ALTER TABLE XXX COLUMN statement + */ + ::rtl::OUString getAlterTableColumnPart(const ::rtl::OUString& _rsColumnName ); + + // starts a sql transaaction + void beginTransAction(); + // rolls back a sql transaaction + void rollbackTransAction(); + // ends a sql transaaction + void endTransAction(); + // some methods to alter table structures + void alterColumnType(const ::rtl::OUString& _rColName,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor); + void alterNotNullValue(sal_Int32 _nNewNullable,const ::rtl::OUString& _rColName); + void alterDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName); + void dropDefaultValue(const ::rtl::OUString& _sNewDefault); + void addDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName); + }; + } +} +#endif // _CONNECTIVITY_ADABAS_TABLE_HXX_ + diff --git a/connectivity/source/inc/adabas/BTables.hxx b/connectivity/source/inc/adabas/BTables.hxx new file mode 100644 index 000000000000..089cbd082b42 --- /dev/null +++ b/connectivity/source/inc/adabas/BTables.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADABAS_TABLES_HXX_ +#define _CONNECTIVITY_ADABAS_TABLES_HXX_ + +#include "connectivity/sdbcx/VCollection.hxx" +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +namespace connectivity +{ + namespace adabas + { + class OTables : public sdbcx::OCollection + { + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; + // OCatalog* m_pParent; + protected: + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor(); + virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); + + void setComments(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void createTable( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + + virtual ::rtl::OUString getNameForObject(const sdbcx::ObjectType& _xObject); + public: + OTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, + const TStringVector &_rVector) : sdbcx::OCollection(_rParent,sal_True,_rMutex,_rVector) + ,m_xMetaData(_rMetaData) + {} + + // only the name is identical to ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + + // XDrop + void appendNew(const ::rtl::OUString& _rsNewTable); + // some helper functions + /** + returns a sql string which contains the column definition part for create or alter statements + */ + static ::rtl::OUString getColumnSqlType(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColProp); + /** + returns the "not null" part or the default part of the table statement + */ + static ::rtl::OUString getColumnSqlNotNullDefault(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColProp); + /** + returns the corresponding typename + can contain () which have to filled with values + */ + static ::rtl::OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColProp); + }; + } +} +#endif // _CONNECTIVITY_ADABAS_TABLES_HXX_ + diff --git a/connectivity/source/inc/adabas/BUser.hxx b/connectivity/source/inc/adabas/BUser.hxx new file mode 100644 index 000000000000..d694b950e120 --- /dev/null +++ b/connectivity/source/inc/adabas/BUser.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_USER_HXX_ +#define _CONNECTIVITY_ADABAS_USER_HXX_ + +#include "connectivity/sdbcx/VUser.hxx" + +namespace connectivity +{ + namespace adabas + { + class OAdabasConnection; + typedef connectivity::sdbcx::OUser OUser_TYPEDEF; + + class OAdabasUser : public OUser_TYPEDEF + { + OAdabasConnection* m_pConnection; + + ::rtl::OUString getPrivilegeString(sal_Int32 nRights) const; + // return the privileges and additional the grant rights + void getAnyTablePrivileges(const ::rtl::OUString& objName, sal_Int32& nRights,sal_Int32& nRightsWithGrant) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + public: + virtual void refreshGroups(); + public: + OAdabasUser( OAdabasConnection* _pConnection); + OAdabasUser( OAdabasConnection* _pConnection,const ::rtl::OUString& _Name); + + // XUser + virtual void SAL_CALL changePassword( const ::rtl::OUString& objPassword, const ::rtl::OUString& newPassword ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XAuthorizable + virtual sal_Int32 SAL_CALL getPrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getGrantablePrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + + class OUserExtend; + typedef ::comphelper::OPropertyArrayUsageHelper<OUserExtend> OUserExtend_PROP; + + class OUserExtend : public OAdabasUser, + public OUserExtend_PROP + { + protected: + ::rtl::OUString m_Password; + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + public: + OUserExtend(OAdabasConnection* _pConnection); + + virtual void construct(); + }; + } +} +#endif // _CONNECTIVITY_ADABAS_USER_HXX_ + diff --git a/connectivity/source/inc/adabas/BUsers.hxx b/connectivity/source/inc/adabas/BUsers.hxx new file mode 100644 index 000000000000..7f5d588e96ae --- /dev/null +++ b/connectivity/source/inc/adabas/BUsers.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_USERS_HXX_ +#define _CONNECTIVITY_ADABAS_USERS_HXX_ + +#include "connectivity/sdbcx/VCollection.hxx" +namespace connectivity +{ + namespace sdbcx + { + class IRefreshableUsers; + } + namespace adabas + { + class OAdabasConnection; + class OUsers : public sdbcx::OCollection + { + OAdabasConnection* m_pConnection; + connectivity::sdbcx::IRefreshableUsers* m_pParent; + public: + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor(); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); + public: + OUsers( ::cppu::OWeakObject& _rParent, + ::osl::Mutex& _rMutex, + const TStringVector &_rVector, + OAdabasConnection* _pConnection, + connectivity::sdbcx::IRefreshableUsers* _pParent) : sdbcx::OCollection(_rParent,sal_True,_rMutex,_rVector) + ,m_pConnection(_pConnection) + ,m_pParent(_pParent) + {} + + }; + } +} + +#endif // _CONNECTIVITY_ADABAS_USERS_HXX_ + diff --git a/connectivity/source/inc/adabas/BViews.hxx b/connectivity/source/inc/adabas/BViews.hxx new file mode 100644 index 000000000000..cfb0389b28e9 --- /dev/null +++ b/connectivity/source/inc/adabas/BViews.hxx @@ -0,0 +1,64 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADABAS_VIEWS_HXX_ +#define _CONNECTIVITY_ADABAS_VIEWS_HXX_ + +#include "connectivity/sdbcx/VCollection.hxx" +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +namespace connectivity +{ + namespace adabas + { + class OViews : public sdbcx::OCollection + { + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; + sal_Bool m_bInDrop; + // OCatalog* m_pParent; + protected: + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor(); + virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); + + void createView( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + public: + OViews(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, + const TStringVector &_rVector) : sdbcx::OCollection(_rParent,sal_True,_rMutex,_rVector) + ,m_xMetaData(_rMetaData) + ,m_bInDrop(sal_False) + {} + + // only the name is identical to ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + + void dropByNameImpl(const ::rtl::OUString& elementName); + }; + } +} +#endif // _CONNECTIVITY_ADABAS_VIEWS_HXX_ + diff --git a/connectivity/source/inc/ado/ACallableStatement.hxx b/connectivity/source/inc/ado/ACallableStatement.hxx new file mode 100644 index 000000000000..be36bb3edca2 --- /dev/null +++ b/connectivity/source/inc/ado/ACallableStatement.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_ACALLABLESTATEMENT_HXX_ +#define _CONNECTIVITY_ADO_ACALLABLESTATEMENT_HXX_ + +#include "ado/APreparedStatement.hxx" +#include <com/sun/star/sdbc/XRow.hpp> +#include <com/sun/star/sdbc/XOutParameters.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> + +namespace connectivity +{ + namespace ado + { + //************************************************************** + //************ Class: java.sql.CallableStatement + //************************************************************** + + class OCallableStatement : public OPreparedStatement, + public ::com::sun::star::sdbc::XRow, + public ::com::sun::star::sdbc::XOutParameters + { + OLEVariant m_aValue; + public: + DECLARE_SERVICE_INFO(); + virtual ~OCallableStatement() {} ; + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + OCallableStatement( OConnection* _pConnection,const OTypeInfoMap& _TypeInfo,const ::rtl::OUString& sql ); + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XRow + virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XOutParameters + virtual void SAL_CALL registerOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL registerNumericOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_OCallableStatement_HXX_ + + diff --git a/connectivity/source/inc/ado/ACatalog.hxx b/connectivity/source/inc/ado/ACatalog.hxx new file mode 100644 index 000000000000..e622367e0b53 --- /dev/null +++ b/connectivity/source/inc/ado/ACatalog.hxx @@ -0,0 +1,61 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADO_CATALOG_HXX_ +#define _CONNECTIVITY_ADO_CATALOG_HXX_ + +#include "connectivity/sdbcx/VCatalog.hxx" +#include "ado/Awrapadox.hxx" + +namespace connectivity +{ + namespace ado + { + class OConnection; + + class OCatalog : public connectivity::sdbcx::OCatalog + { + WpADOCatalog m_aCatalog; + OConnection* m_pConnection; + + public: + virtual void refreshTables(); + virtual void refreshViews() ; + virtual void refreshGroups(); + virtual void refreshUsers() ; + + public: + OCatalog(_ADOCatalog* _pCatalog,OConnection* _pCon); + ~OCatalog(); + + OConnection* getConnection() const { return m_pConnection; } + sdbcx::OCollection* getPrivateTables() const { return m_pTables; } + WpADOCatalog getCatalog() const { return m_aCatalog; } + }; + } +} +#endif // _CONNECTIVITY_ADO_CATALOG_HXX_ + diff --git a/connectivity/source/inc/ado/ACollection.hxx b/connectivity/source/inc/ado/ACollection.hxx new file mode 100644 index 000000000000..b1e291ce1d5c --- /dev/null +++ b/connectivity/source/inc/ado/ACollection.hxx @@ -0,0 +1,231 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_COLLECTION_HXX_ +#define _CONNECTIVITY_ADO_COLLECTION_HXX_ + +#include <cppuhelper/implbase3.hxx> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include "ado/Awrapadox.hxx" +#include "ado/Aolevariant.hxx" +#include <com/sun/star/lang/XServiceInfo.hpp> + +namespace connectivity +{ + namespace ado + { + namespace starcontainer = ::com::sun::star::container; + namespace starlang = ::com::sun::star::lang; + namespace staruno = ::com::sun::star::uno; + namespace starbeans = ::com::sun::star::beans; + + typedef ::cppu::WeakImplHelper3< starcontainer::XNameAccess, + starcontainer::XIndexAccess, + starlang::XServiceInfo> OCollectionBase; + + //************************************************************ + // OCollection + //************************************************************ + template <class T,class SimT,class OCl> class OCollection : public OCollectionBase + { + private: + OCollection( const OCollection& ); // never implemented + OCollection& operator=( const OCollection& ); // never implemented + + protected: + vector<OCl*> m_aElements; + ::cppu::OWeakObject& m_rParent; + ::osl::Mutex& m_rMutex; // mutex of the parent + T* m_pCollection; + + + public: + OCollection(::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex,T* _pCollection) + : m_rParent(_rParent) + ,m_rMutex(_rMutex) + ,m_pCollection(_pCollection) + { + m_pCollection->AddRef(); + } + + ~OCollection() + { + m_pCollection->Release(); + } + + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (staruno::RuntimeException) + { + return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.ACollection"); + } + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& _rServiceName ) throw(staruno::RuntimeException) + { + staruno::Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); + const ::rtl::OUString* pSupported = aSupported.getConstArray(); + for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) + if (pSupported->equals(_rServiceName)) + return sal_True; + + return sal_False; + } + virtual staruno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(staruno::RuntimeException) + { + staruno::Sequence< ::rtl::OUString > aSupported(1); + aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.Container"); + return aSupported; + } + + // dispatch the refcounting to the parent + virtual void SAL_CALL acquire() throw() + { + m_rParent.acquire(); + } + virtual void SAL_CALL release() throw() + { + m_rParent.release(); + } + + // ::com::sun::star::container::XElementAccess + virtual staruno::Type SAL_CALL getElementType( ) throw(staruno::RuntimeException) + { + return::getCppuType(static_cast< staruno::Reference< starbeans::XPropertySet>*>(NULL)); + } + + virtual sal_Bool SAL_CALL hasElements( ) throw(staruno::RuntimeException) + { + ::osl::MutexGuard aGuard(m_rMutex); + return getCount() > 0; + } + + // starcontainer::XIndexAccess + virtual sal_Int32 SAL_CALL getCount( ) throw(staruno::RuntimeException) + { + ::osl::MutexGuard aGuard(m_rMutex); + sal_Int32 nCnt = 0; + m_pCollection->get_Count(&nCnt); + return nCnt; + } + + virtual staruno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(starlang::IndexOutOfBoundsException, starlang::WrappedTargetException, staruno::RuntimeException) + { + ::osl::MutexGuard aGuard(m_rMutex); + if (Index < 0 || Index >= getCount()) + throw starlang::IndexOutOfBoundsException(); + SimT* pCol = NULL; + m_pCollection->get_Item(OLEVariant(Index),&pCol); + if(!pCol) + throw starlang::IndexOutOfBoundsException(); + + OCl* pIndex = new OCl(pCol); + + m_aElements.push_back(pIndex); + + return staruno::makeAny( staruno::Reference< starbeans::XPropertySet >(pIndex)); + } + + + // starcontainer::XNameAccess + virtual staruno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(starcontainer::NoSuchElementException, starlang::WrappedTargetException, staruno::RuntimeException) + { + ::osl::MutexGuard aGuard(m_rMutex); + + SimT* pCol = NULL; + m_pCollection->get_Item(OLEVariant(aName),&pCol); + if(!pCol) + throw starlang::IndexOutOfBoundsException(); + + OCl* pIndex = new OCl(pCol); + + m_aElements.push_back(pIndex); + + return staruno::makeAny( staruno::Reference< starbeans::XPropertySet >(pIndex)); + } + virtual staruno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw(staruno::RuntimeException) + { + ::osl::MutexGuard aGuard(m_rMutex); + sal_Int32 nLen = getCount(); + staruno::Sequence< ::rtl::OUString > aNameList(nLen); + + ::rtl::OUString* pStringArray = aNameList.getArray(); + OLEVariant aVar; + for (sal_Int32 i=0;i<nLen;++i) + { + aVar.setInt32(i); + SimT* pIdx = NULL; + m_pCollection->get_Item(aVar,&pIdx); + pIdx->AddRef(); + _bstr_t sBSTR; + pIdx->get_Name(&sBSTR); + (*pStringArray) = (sal_Unicode*)sBSTR; + pIdx->Release(); + ++pStringArray; + } + return aNameList; + } + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(staruno::RuntimeException) + { + ::osl::MutexGuard aGuard(m_rMutex); + SimT* pCol = NULL; + m_pCollection->get_Item(OLEVariant(aName),&pCol); + return pCol != NULL; + } + + void SAL_CALL disposing() + { + ::osl::MutexGuard aGuard(m_rMutex); + for (::std::vector<OCl*>::const_iterator i = m_aElements.begin(); i != m_aElements.end(); ++i) + { + (*i)->disposing(); + (*i)->release(); + } + m_aElements.clear(); + } + + }; + + class OIndex; + class OKey; + class OColumn; + class OTable; + class OView; + class OGroup; + class OUser; + + typedef OCollection< ADOIndexes,ADOIndex,OIndex> OIndexes; + typedef OCollection< ADOKeys,ADOKey,OKey> OKeys; + typedef OCollection< ADOColumns,ADOColumn,OColumn> OColumns; + typedef OCollection< ADOTables,ADOTable,OTable> OTables; + typedef OCollection< ADOViews,ADOView,OView> OViews; + typedef OCollection< ADOGroups,ADOGroup,OGroup> OGroups; + typedef OCollection< ADOUsers,ADOUser,OUser> OUsers; + + } +} +#endif // _CONNECTIVITY_ADO_COLLECTION_HXX_ + + + diff --git a/connectivity/source/inc/ado/AColumn.hxx b/connectivity/source/inc/ado/AColumn.hxx new file mode 100644 index 000000000000..f8eb107425dc --- /dev/null +++ b/connectivity/source/inc/ado/AColumn.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_COLUMN_HXX_ +#define _CONNECTIVITY_ADO_COLUMN_HXX_ + +#include "connectivity/sdbcx/VColumn.hxx" +#include "ado/Awrapadox.hxx" + +namespace connectivity +{ + namespace ado + { + class OConnection; + typedef sdbcx::OColumn OColumn_ADO; + class OAdoColumn : public OColumn_ADO + { + WpADOColumn m_aColumn; + OConnection* m_pConnection; + ::rtl::OUString m_ReferencedColumn; + sal_Bool m_IsAscending; + + void fillPropertyValues(); + protected: + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue + ) + throw (::com::sun::star::uno::Exception); + public: + OAdoColumn(sal_Bool _bCase,OConnection* _pConnection,_ADOColumn* _pColumn); + OAdoColumn(sal_Bool _bCase,OConnection* _pConnection); + // ODescriptor + virtual void construct(); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + // 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(); + + WpADOColumn getColumnImpl() const; + }; + } +} +#endif // _CONNECTIVITY_ADO_COLUMN_HXX_ + diff --git a/connectivity/source/inc/ado/AColumns.hxx b/connectivity/source/inc/ado/AColumns.hxx new file mode 100644 index 000000000000..5bbda06ab7a4 --- /dev/null +++ b/connectivity/source/inc/ado/AColumns.hxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_COLUMNS_HXX_ +#define _CONNECTIVITY_ADO_COLUMNS_HXX_ + +#include "connectivity/sdbcx/VCollection.hxx" +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#include "connectivity/sdbcx/IRefreshable.hxx" +#include "ado/Awrapadox.hxx" + +namespace connectivity +{ + namespace ado + { + class OConnection; + class OColumns : public sdbcx::OCollection + { + protected: + WpADOColumns m_aCollection; + OConnection* m_pConnection; + + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor(); + virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); + public: + OColumns( ::cppu::OWeakObject& _rParent, + ::osl::Mutex& _rMutex, + const TStringVector &_rVector, + const WpADOColumns& _rCollection, + sal_Bool _bCase, + OConnection* _pConnection) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector) + ,m_aCollection(_rCollection) + ,m_pConnection(_pConnection) + { + } + + }; + } +} +#endif // _CONNECTIVITY_ADO_COLUMNS_HXX_ + diff --git a/connectivity/source/inc/ado/AConnection.hxx b/connectivity/source/inc/ado/AConnection.hxx new file mode 100644 index 000000000000..67537155881c --- /dev/null +++ b/connectivity/source/inc/ado/AConnection.hxx @@ -0,0 +1,151 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADO_ACONNECTION_HXX_ +#define _CONNECTIVITY_ADO_ACONNECTION_HXX_ + +#include <com/sun/star/sdbc/SQLWarning.hpp> +#include <com/sun/star/sdbcx/XTablesSupplier.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include "OSubComponent.hxx" +#include <map> +#include "connectivity/CommonTools.hxx" +#include "OTypeInfo.hxx" +#include "TConnection.hxx" +#include "ado/Awrapado.hxx" + +namespace connectivity +{ + namespace ado + { + struct OExtendedTypeInfo + { + ::connectivity::OTypeInfo aSimpleType; // the general type info + DataTypeEnum eType; + + inline ::rtl::OUString getDBName() const { return aSimpleType.aTypeName; } + }; + + class WpADOConnection; + class ODriver; + class OCatalog; + typedef ::std::multimap<DataTypeEnum, OExtendedTypeInfo*> OTypeInfoMap; + typedef connectivity::OMetaConnection OConnection_BASE; + + + class OConnection : public OConnection_BASE, + public connectivity::OSubComponent<OConnection, OConnection_BASE> + { + friend class connectivity::OSubComponent<OConnection, OConnection_BASE>; + + protected: + //==================================================================== + // Data attributes + //==================================================================== + OTypeInfoMap m_aTypeInfo; // vector containing an entry + // for each row returned by + // DatabaseMetaData.getTypeInfo. + ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbcx::XTablesSupplier> m_xCatalog; + ODriver* m_pDriver; + private: + WpADOConnection* m_pAdoConnection; + OCatalog* m_pCatalog; + sal_Int32 m_nEngineType; + sal_Bool m_bClosed; + sal_Bool m_bAutocommit; + + protected: + void buildTypeInfo() throw( ::com::sun::star::sdbc::SQLException); + public: + + OConnection(ODriver* _pDriver) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // OConnection(const SQLHANDLE _pConnectionHandle); + ~OConnection(); + void construct(const ::rtl::OUString& url,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info); + + void closeAllStatements () throw( ::com::sun::star::sdbc::SQLException); + + //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(); + // XServiceInfo + DECLARE_SERVICE_INFO(); + // OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual void SAL_CALL release() throw(); + + // XConnection + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > SAL_CALL createStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareCall( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL nativeSQL( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getAutoCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL commit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL rollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isClosed( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setCatalog( const ::rtl::OUString& catalog ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalog( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTypeMap( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTypeMap( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) 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); + // + WpADOConnection* getConnection() { return m_pAdoConnection; } + void setCatalog(const ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbcx::XTablesSupplier>& _xCat) { m_xCatalog = _xCat; } + void setCatalog(OCatalog* _pCatalog) { m_pCatalog = _pCatalog; } + + const OTypeInfoMap* getTypeInfo() const { return &m_aTypeInfo;} + OCatalog* getAdoCatalog() const + { + if ( m_xCatalog.get().is() ) + return m_pCatalog; + return NULL; + } + + sal_Int32 getEngineType() const { return m_nEngineType; } + ODriver* getDriver() const { return m_pDriver; } + + static const OExtendedTypeInfo* getTypeInfoFromType(const OTypeInfoMap& _rTypeInfo, + DataTypeEnum _nType, + const ::rtl::OUString& _sTypeName, + sal_Int32 _nPrecision, + sal_Int32 _nScale, + sal_Bool& _brForceToType); + }; + } +} +#endif // _CONNECTIVITY_ADO_ACONNECTION_HXX_ + diff --git a/connectivity/source/inc/ado/ADatabaseMetaData.hxx b/connectivity/source/inc/ado/ADatabaseMetaData.hxx new file mode 100644 index 000000000000..2252363e606c --- /dev/null +++ b/connectivity/source/inc/ado/ADatabaseMetaData.hxx @@ -0,0 +1,230 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_ADATABASEMETADATA_HXX_ +#define _CONNECTIVITY_ADO_ADATABASEMETADATA_HXX_ + +#include "TDatabaseMetaDataBase.hxx" +#ifndef _MAP_ +#include <map> +#endif + + +namespace connectivity +{ + namespace ado + { + class WpADOConnection; + class OConnection; + //************************************************************** + //************ Class: ODatabaseMetaData + //************************************************************** + + class ODatabaseMetaData : public ODatabaseMetaDataBase + { + typedef struct _LiteralInfo + { + ::rtl::OUString pwszLiteralValue; + sal_uInt32 cchMaxLen; + sal_Bool fSupported; + } LiteralInfo; + + ::std::map<sal_uInt32,LiteralInfo> m_aLiteralInfo; + WpADOConnection* m_pADOConnection; + OConnection* m_pConnection; + + void fillLiterals(); + // get information out of rowset + sal_Int32 getMaxSize(sal_uInt32 _nId); + sal_Bool isCapable(sal_uInt32 _nId); + ::rtl::OUString getLiteral(sal_uInt32 _nProperty); + + // get info out of propertyst + ::rtl::OUString getStringProperty(const ::rtl::OUString& _aProperty) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getInt32Property(const ::rtl::OUString& _aProperty) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Bool getBoolProperty(const ::rtl::OUString& _aProperty) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > impl_getTypeInfo_throw(); + // cached database information + virtual ::rtl::OUString impl_getIdentifierQuoteString_throw( ); + virtual sal_Bool impl_isCatalogAtStart_throw( ); + virtual ::rtl::OUString impl_getCatalogSeparator_throw( ); + virtual sal_Bool impl_supportsCatalogsInTableDefinitions_throw( ); + virtual sal_Bool impl_supportsSchemasInTableDefinitions_throw( ) ; + virtual sal_Bool impl_supportsCatalogsInDataManipulation_throw( ); + virtual sal_Bool impl_supportsSchemasInDataManipulation_throw( ) ; + virtual sal_Bool impl_supportsMixedCaseQuotedIdentifiers_throw( ); + virtual sal_Bool impl_supportsAlterTableWithAddColumn_throw( ); + virtual sal_Bool impl_supportsAlterTableWithDropColumn_throw( ); + virtual sal_Int32 impl_getMaxStatements_throw( ); + virtual sal_Int32 impl_getMaxTablesInSelect_throw( ); + virtual sal_Bool impl_storesMixedCaseQuotedIdentifiers_throw( ); + public: + + ODatabaseMetaData(OConnection* _pCon); + + // XDatabaseMetaData + virtual sal_Bool SAL_CALL allProceduresAreCallable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL allTablesAreSelectable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getURL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getUserName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedLow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDatabaseProductName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDatabaseProductVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDriverName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDriverVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL usesLocalFiles( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + virtual ::rtl::OUString SAL_CALL getSQLKeywords( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getNumericFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getStringFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSystemFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTimeDateFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSearchStringEscape( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getExtraNameCharacters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsColumnAliasing( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTypeConversion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsGroupBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSchemaTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getProcedureTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalogTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsPositionedDelete( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsStoredProcedures( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsUnion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsUnionAll( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) 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 getMaxColumnsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) 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_Int32 SAL_CALL getMaxConnections( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxIndexLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxRowSize( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxStatementLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getProcedures( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getProcedureColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTables( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getSchemas( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCatalogs( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTableTypes( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumnPrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTablePrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getPrimaryKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getImportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getExportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCrossReference( const ::com::sun::star::uno::Any& primaryCatalog, const ::rtl::OUString& primarySchema, const ::rtl::OUString& primaryTable, const ::com::sun::star::uno::Any& foreignCatalog, const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getIndexInfo( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Bool unique, sal_Bool approximate ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsBatchUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getUDTs( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern, const ::com::sun::star::uno::Sequence< sal_Int32 >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_ADO_ADATABASEMETADATA_HXX_ + + diff --git a/connectivity/source/inc/ado/ADatabaseMetaDataResultSet.hxx b/connectivity/source/inc/ado/ADatabaseMetaDataResultSet.hxx new file mode 100644 index 000000000000..ce422f7ce528 --- /dev/null +++ b/connectivity/source/inc/ado/ADatabaseMetaDataResultSet.hxx @@ -0,0 +1,227 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_ADATABASEMETADATARESULTSET_HXX_ +#define _CONNECTIVITY_ADO_ADATABASEMETADATARESULTSET_HXX_ + +#include <com/sun/star/sdbc/XResultSet.hpp> +#include <com/sun/star/sdbc/XRow.hpp> +#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> +#include <com/sun/star/sdbc/XCloseable.hpp> +#include <com/sun/star/sdbc/XColumnLocate.hpp> +#include <com/sun/star/util/XCancellable.hpp> +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#include <com/sun/star/sdbc/XResultSetUpdate.hpp> +#include <com/sun/star/sdbc/XRowUpdate.hpp> +#include <cppuhelper/compbase7.hxx> +#include <comphelper/proparrhlp.hxx> +#include "ado/AStatement.hxx" +//#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +//#include "connectivity/CommonTools.hxx" +//#endif +#include <comphelper/broadcasthelper.hxx> +#include "connectivity/StdTypeDefs.hxx" + +namespace connectivity +{ + namespace ado + { + class ODatabaseMetaDataResultSetMetaData; + /* + ** java_sql_ResultSet + */ + typedef ::cppu::WeakComponentImplHelper7< ::com::sun::star::sdbc::XResultSet, + ::com::sun::star::sdbc::XRow, + ::com::sun::star::sdbc::XResultSetMetaDataSupplier, + ::com::sun::star::util::XCancellable, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::sdbc::XCloseable, + ::com::sun::star::sdbc::XColumnLocate> ODatabaseMetaDataResultSet_BASE; + + class ODatabaseMetaDataResultSet : public comphelper::OBaseMutex, + public ODatabaseMetaDataResultSet_BASE, + public ::cppu::OPropertySetHelper, + public ::comphelper::OPropertyArrayUsageHelper<ODatabaseMetaDataResultSet> + { + ::std::vector<sal_Int32> m_aColMapping; // pos 0 is unused so we don't have to decrement 1 everytime + + ::std::map<sal_Int32, TInt2IntMap > m_aValueRange; + ::std::map<sal_Int32, TInt2IntMap >::iterator m_aValueRangeIter; + + ::std::map<sal_Int32, ::std::map< ::rtl::OUString,sal_Int32> > m_aStrValueRange; + ::std::map<sal_Int32, ::std::map< ::rtl::OUString,sal_Int32> >::iterator m_aStrValueRangeIter; + + ::std::map<sal_Int32, ::std::map< sal_Int32,::rtl::OUString> > m_aIntValueRange; + ::std::map<sal_Int32, ::std::map< sal_Int32,::rtl::OUString> >::iterator m_aIntValueRangeIter; + + ADORecordset* m_pRecordSet; + ::com::sun::star::uno::WeakReferenceHelper m_aStatement; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData; + OLEVariant m_aValue; + sal_Int32 m_nRowPos; + sal_Bool m_bWasNull; + sal_Bool m_bEOF; + sal_Bool m_bOnFirstAfterOpen; + + sal_Int32 getResultSetConcurrency() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getResultSetType() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getFetchDirection() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getFetchSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + ::rtl::OUString getCursorName() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + void setFetchDirection(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setFetchSize(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + + inline sal_Int32 mapColumn (sal_Int32 column); + void checkRecordSet() throw(::com::sun::star::sdbc::SQLException); + OLEVariant getValue(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + protected: + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + + virtual sal_Bool SAL_CALL convertFastPropertyValue( + ::com::sun::star::uno::Any & rConvertedValue, + ::com::sun::star::uno::Any & rOldValue, + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue ) + throw (::com::sun::star::lang::IllegalArgumentException); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue + ) + throw (::com::sun::star::uno::Exception); + virtual void SAL_CALL getFastPropertyValue( + ::com::sun::star::uno::Any& rValue, + sal_Int32 nHandle + ) const; + public: + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + ODatabaseMetaDataResultSet( ADORecordset* _pRecordSet); + ~ODatabaseMetaDataResultSet(); + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + // XResultSet + virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XRow + virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XResultSetMetaDataSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCancellable + virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) 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); + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + const ::std::vector<sal_Int32>& getColumnMapping() { return m_aColMapping; } + + void setCatalogsMap(); + void setSchemasMap(); + void setColumnPrivilegesMap(); + void setColumnsMap(); + void setTablesMap(); + void setProcedureColumnsMap(); + void setProceduresMap(); + void setExportedKeysMap(); + void setImportedKeysMap(); + void setPrimaryKeysMap(); + void setIndexInfoMap(); + void setTablePrivilegesMap(); + void setCrossReferenceMap(); + void setTypeInfoMap(sal_Bool _bJetEngine); + }; + // ------------------------------------------------------------------------- + inline sal_Int32 ODatabaseMetaDataResultSet::mapColumn (sal_Int32 column) + { + sal_Int32 map = column; + + if (!m_aColMapping.empty()) + { + // Validate column number + map = m_aColMapping[column]; + } + + return map; + } + } + +} +#endif // _CONNECTIVITY_ADO_ADATABASEMETADATARESULTSET_HXX_ + diff --git a/connectivity/source/inc/ado/ADatabaseMetaDataResultSetMetaData.hxx b/connectivity/source/inc/ado/ADatabaseMetaDataResultSetMetaData.hxx new file mode 100644 index 000000000000..cf4e43335596 --- /dev/null +++ b/connectivity/source/inc/ado/ADatabaseMetaDataResultSetMetaData.hxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_ADATABASEMETADATARESULTSETMETADATA_HXX_ +#define _CONNECTIVITY_ADO_ADATABASEMETADATARESULTSETMETADATA_HXX_ + +#include <com/sun/star/sdbc/XResultSetMetaData.hpp> +#include <cppuhelper/implbase1.hxx> +#ifndef _VECTOR_ +#include <vector> +#endif +#include "ado/Awrapado.hxx" +#include "ado/ADatabaseMetaDataResultSet.hxx" +#include "OColumn.hxx" + +namespace connectivity +{ + namespace ado + { + //************************************************************** + //************ Class: ResultSetMetaData + //************************************************************** + typedef ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XResultSetMetaData> ODatabaseMetaResultSetMetaData_BASE; + + class ODatabaseMetaDataResultSetMetaData : public ODatabaseMetaResultSetMetaData_BASE + { + friend class ODatabaseMetaDataResultSet; + + const ::std::vector<sal_Int32> &m_vMapping; // when not every column is needed + ::std::map<sal_Int32,connectivity::OColumn> m_mColumns; + ::std::map<sal_Int32,connectivity::OColumn>::const_iterator m_mColumnsIter; + + ADORecordset* m_pRecordSet; + sal_Int32 m_nColCount; + + private: + ODatabaseMetaDataResultSetMetaData( const ODatabaseMetaDataResultSetMetaData& ); // never implemented + ODatabaseMetaDataResultSetMetaData& operator=( const ODatabaseMetaDataResultSetMetaData& ); // never implemented + + protected: + void setColumnPrivilegesMap(); + void setColumnsMap(); + void setTablesMap(); + void setProcedureColumnsMap(); + void setPrimaryKeysMap(); + void setIndexInfoMap(); + void setTablePrivilegesMap(); + void setCrossReferenceMap(); + void setTypeInfoMap(); + void setProceduresMap(); + public: + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + ODatabaseMetaDataResultSetMetaData( ADORecordset* _pRecordSet ,ODatabaseMetaDataResultSet* _pRes) + : m_pRecordSet(_pRecordSet),m_vMapping(_pRes->getColumnMapping()), + m_nColCount(m_vMapping.size()-1) + { + if(m_pRecordSet) + m_pRecordSet->AddRef(); + } + ~ODatabaseMetaDataResultSetMetaData(); + + /// Avoid ambigous cast error from the compiler. + inline operator ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > () throw() + { return this; } + + virtual sal_Int32 SAL_CALL getColumnCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnLabel( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSchemaName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTableName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalogName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnTypeName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnServiceName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_ADO_ADATABASEMETARESULTSETMETADATA_HXX_ + diff --git a/connectivity/source/inc/ado/ADriver.hxx b/connectivity/source/inc/ado/ADriver.hxx new file mode 100644 index 000000000000..30986533fa34 --- /dev/null +++ b/connectivity/source/inc/ado/ADriver.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_ADRIVER_HXX_ +#define _CONNECTIVITY_ADO_ADRIVER_HXX_ + +#include <com/sun/star/sdbc/XDriver.hpp> +#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/compbase3.hxx> +#include "connectivity/CommonTools.hxx" + +namespace connectivity +{ + namespace ado + { + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ODriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ); + + typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbc::XDriver, + ::com::sun::star::sdbcx::XDataDefinitionSupplier, + ::com::sun::star::lang::XServiceInfo + > ODriver_BASE; + class ODriver : public ODriver_BASE + { + ::osl::Mutex m_aMutex; + + connectivity::OWeakRefArray m_xConnections; // vector containing a list + // of all the Connection objects + // for this Driver + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB; + + + public: + ODriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB); + ~ODriver(); + + // OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() const { return m_xORB; } + + private: + void impl_checkURL_throw(const ::rtl::OUString& _sUrl); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + + // XDriver + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMajorVersion( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMinorVersion( ) throw(::com::sun::star::uno::RuntimeException); + + // XDataDefinitionSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& connection ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByURL( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } + +} +#endif //_CONNECTIVITY_ADO_ADRIVER_HXX_ + + diff --git a/connectivity/source/inc/ado/AGroup.hxx b/connectivity/source/inc/ado/AGroup.hxx new file mode 100644 index 000000000000..a42e41e9b216 --- /dev/null +++ b/connectivity/source/inc/ado/AGroup.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_GROUP_HXX_ +#define _CONNECTIVITY_ADABAS_GROUP_HXX_ + +#include "connectivity/sdbcx/VGroup.hxx" +#include "ado/Awrapadox.hxx" + +namespace connectivity +{ + namespace ado + { + typedef sdbcx::OGroup OGroup_ADO; + class OCatalog; + + class OAdoGroup : public OGroup_ADO + { + WpADOGroup m_aGroup; + OCatalog* m_pCatalog; + + sal_Int32 MapRight(RightsEnum _eNum); + RightsEnum Map2Right(sal_Int32 _eNum); + ObjectTypeEnum MapObjectType(sal_Int32 _ObjType); + protected: + virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue,sal_Int32 nHandle) const; + virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const ::com::sun::star::uno::Any& rValue)throw (::com::sun::star::uno::Exception); + + public: + virtual void refreshUsers(); + public: + OAdoGroup(OCatalog* _pParent,sal_Bool _bCase, ADOGroup* _pGroup=NULL); + OAdoGroup(OCatalog* _pParent,sal_Bool _bCase, const ::rtl::OUString& _Name); + + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + // 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(); + + // XAuthorizable + virtual sal_Int32 SAL_CALL getPrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getGrantablePrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + WpADOGroup getImpl() const { return m_aGroup; } + }; + } +} +#endif // _CONNECTIVITY_ADABAS_GROUP_HXX_ + diff --git a/connectivity/source/inc/ado/AGroups.hxx b/connectivity/source/inc/ado/AGroups.hxx new file mode 100644 index 000000000000..10c3af7d5aea --- /dev/null +++ b/connectivity/source/inc/ado/AGroups.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_GROUPS_HXX_ +#define _CONNECTIVITY_ADO_GROUPS_HXX_ + +#include "connectivity/sdbcx/VCollection.hxx" +#include "ado/Awrapadox.hxx" +#include "ado/ACatalog.hxx" + +namespace connectivity +{ + namespace sdbcx + { + class IRefreshableGroups; + } + namespace ado + { + class OAdabasConnection; + class OGroups : public sdbcx::OCollection + { + WpADOGroups m_aCollection; + OCatalog* m_pCatalog; + protected: + + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor(); + virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); + public: + OGroups(OCatalog* _pParent, + ::osl::Mutex& _rMutex, + const TStringVector &_rVector, + const WpADOGroups& _rCollection,sal_Bool _bCase) : sdbcx::OCollection(*_pParent,_bCase,_rMutex,_rVector) + ,m_aCollection(_rCollection) + ,m_pCatalog(_pParent) + { + } + }; + } +} + +#endif // _CONNECTIVITY_ADO_GROUPS_HXX_ + diff --git a/connectivity/source/inc/ado/AIndex.hxx b/connectivity/source/inc/ado/AIndex.hxx new file mode 100644 index 000000000000..5989dc59bd67 --- /dev/null +++ b/connectivity/source/inc/ado/AIndex.hxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_INDEX_HXX_ +#define _CONNECTIVITY_ADO_INDEX_HXX_ + +#include "connectivity/sdbcx/VIndex.hxx" +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#include "ado/Awrapadox.hxx" + +namespace connectivity +{ + namespace ado + { + typedef sdbcx::OIndex OIndex_ADO; + + class OConnection; + class OAdoIndex : public OIndex_ADO + { + WpADOIndex m_aIndex; + OConnection* m_pConnection; + protected: + void fillPropertyValues(); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const ::com::sun::star::uno::Any& rValue)throw (::com::sun::star::uno::Exception); + public: + virtual void refreshColumns(); + public: + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + OAdoIndex(sal_Bool _bCase, OConnection* _pConnection,ADOIndex* _pIndex); + OAdoIndex(sal_Bool _bCase, OConnection* _pConnection); + // com::sun::star::lang::XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + + WpADOIndex getImpl() const { return m_aIndex;} + }; + } +} +#endif // _CONNECTIVITY_ADO_INDEX_HXX_ + diff --git a/connectivity/source/inc/ado/AIndexColumn.hxx b/connectivity/source/inc/ado/AIndexColumn.hxx new file mode 100644 index 000000000000..42a92b028540 --- /dev/null +++ b/connectivity/source/inc/ado/AIndexColumn.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_INDEXCOLUMN_HXX_ +#define _CONNECTIVITY_ADABAS_INDEXCOLUMN_HXX_ + +#include "ado/AColumn.hxx" + +namespace connectivity +{ + namespace ado + { + class OIndexColumn : public OAdoColumn + { + protected: + sal_Bool m_IsAscending; + public: + OIndexColumn(); + OIndexColumn( sal_Bool _IsAscending, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _TypeName, + const ::rtl::OUString& _DefaultValue, + sal_Int32 _IsNullable, + sal_Int32 _Precision, + sal_Int32 _Scale, + sal_Int32 _Type, + sal_Bool _IsAutoIncrement); + + virtual void construct(); + }; + } +} +#endif // _CONNECTIVITY_ADABAS_INDEXCOLUMN_HXX_ + diff --git a/connectivity/source/inc/ado/AIndexColumns.hxx b/connectivity/source/inc/ado/AIndexColumns.hxx new file mode 100644 index 000000000000..251c31ab51b7 --- /dev/null +++ b/connectivity/source/inc/ado/AIndexColumns.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_INDEXCOLUMNS_HXX_ +#define _CONNECTIVITY_ADABAS_INDEXCOLUMNS_HXX_ + +#include "adabas/BColumns.hxx" + +namespace connectivity +{ + namespace adabas + { + class OIndexColumns : public OColumns + { + protected: + virtual ::com::sun::star::uno::Reference< starcontainer::XNamed > createObject(const ::rtl::OUString& _rName); + virtual ::com::sun::star::uno::Reference< starbeans::XPropertySet > createDescriptor(); + public: + OIndexColumns( ::cppu::OWeakObject& _rParent, + ::osl::Mutex& _rMutex, + const TStringVector &_rVector, + OTable* _pTable, + connectivity::sdbcx::IRefreshableColumns* _pParent) + : OColumns(_rParent,_rMutex,_rVector,_pTable,_pParent) + { + } + }; + } +} +#endif // _CONNECTIVITY_ADABAS_INDEXCOLUMNS_HXX_ + diff --git a/connectivity/source/inc/ado/AIndexes.hxx b/connectivity/source/inc/ado/AIndexes.hxx new file mode 100644 index 000000000000..d74c4c30ba93 --- /dev/null +++ b/connectivity/source/inc/ado/AIndexes.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADO_INDEXES_HXX_ +#define _CONNECTIVITY_ADO_INDEXES_HXX_ + +#include "connectivity/sdbcx/VCollection.hxx" +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#include "ado/Awrapadox.hxx" + +namespace connectivity +{ + namespace ado + { + class OConnection; + class OIndexes : public sdbcx::OCollection + { + WpADOIndexes m_aCollection; + OConnection* m_pConnection; + protected: + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor(); + virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); + public: + OIndexes(::cppu::OWeakObject& _rParent, + ::osl::Mutex& _rMutex, + const TStringVector &_rVector, + const WpADOIndexes& _rCollection, + sal_Bool _bCase, + OConnection* _pConnection) + : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector) + , m_aCollection(_rCollection) + , m_pConnection(_pConnection) + { + } + }; + } +} + +#endif // _CONNECTIVITY_ADO_INDEXES_HXX_ + diff --git a/connectivity/source/inc/ado/AKey.hxx b/connectivity/source/inc/ado/AKey.hxx new file mode 100644 index 000000000000..bcf859be1699 --- /dev/null +++ b/connectivity/source/inc/ado/AKey.hxx @@ -0,0 +1,73 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_KEY_HXX_ +#define _CONNECTIVITY_ADO_KEY_HXX_ + +#include "connectivity/sdbcx/VKey.hxx" +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#include "ado/Awrapadox.hxx" + +namespace connectivity +{ + namespace ado + { + typedef sdbcx::OKey OKey_ADO; + + class OConnection; + class OAdoKey : public OKey_ADO + { + WpADOKey m_aKey; + OConnection* m_pConnection; + protected: + void fillPropertyValues(); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const ::com::sun::star::uno::Any& rValue)throw (::com::sun::star::uno::Exception); + public: + virtual void refreshColumns(); + public: + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + OAdoKey(sal_Bool _bCase,OConnection* _pConnection,ADOKey* _pKey); + OAdoKey(sal_Bool _bCase,OConnection* _pConnection); + + // com::sun::star::lang::XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + + WpADOKey getImpl() const { return m_aKey;} + // map the update/delete rules + static RuleEnum Map2Rule(const sal_Int32& _eNum); + static sal_Int32 MapRule(const RuleEnum& _eNum); + + // map the keytypes + static sal_Int32 MapKeyRule(const KeyTypeEnum& _eNum); + static KeyTypeEnum Map2KeyRule(const sal_Int32& _eNum); + }; + } +} +#endif // _CONNECTIVITY_ADO_KEY_HXX_ + diff --git a/connectivity/source/inc/ado/AKeyColumn.hxx b/connectivity/source/inc/ado/AKeyColumn.hxx new file mode 100644 index 000000000000..9cd349659e93 --- /dev/null +++ b/connectivity/source/inc/ado/AKeyColumn.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADABAS_KEYCOLUMN_HXX_ +#define _CONNECTIVITY_ADABAS_KEYCOLUMN_HXX_ + +#include "ado/AColumn.hxx" + +namespace connectivity +{ + namespace ado + { + class OKeyColumn : public OAdoColumn + { + protected: + ::rtl::OUString m_ReferencedColumn; + public: + OKeyColumn(); + OKeyColumn( const ::rtl::OUString& _ReferencedColumn, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _TypeName, + const ::rtl::OUString& _DefaultValue, + sal_Int32 _IsNullable, + sal_Int32 _Precision, + sal_Int32 _Scale, + sal_Int32 _Type, + sal_Bool _IsAutoIncrement); + + virtual void construct(); + }; + } +} +#endif // _CONNECTIVITY_ADABAS_KEYCOLUMN_HXX_ + diff --git a/connectivity/source/inc/ado/AKeyColumns.hxx b/connectivity/source/inc/ado/AKeyColumns.hxx new file mode 100644 index 000000000000..2cd3d2fd9c38 --- /dev/null +++ b/connectivity/source/inc/ado/AKeyColumns.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_KEYCOLUMNS_HXX_ +#define _CONNECTIVITY_ADO_KEYCOLUMNS_HXX_ + +#include "connectivity/sdbcx/VCollection.hxx" + +namespace connectivity +{ + namespace ado + { + class OKeyColumns : public OColumns + { + protected: + virtual ::com::sun::star::uno::Reference< starcontainer::XNamed > createObject(const ::rtl::OUString& _rName); + virtual ::com::sun::star::uno::Reference< starbeans::XPropertySet > createDescriptor(); + public: + OKeyColumns( ::cppu::OWeakObject& _rParent, + ::osl::Mutex& _rMutex, + const TStringVector &_rVector, + OTable* _pTable, + connectivity::sdbcx::IRefreshableColumns* _pParent) + : OColumns(_rParent,_rMutex,_rVector,_pTable,_pParent) + { + } + }; + } +} +#endif // _CONNECTIVITY_ADO_KEYCOLUMNS_HXX_ + diff --git a/connectivity/source/inc/ado/AKeys.hxx b/connectivity/source/inc/ado/AKeys.hxx new file mode 100644 index 000000000000..27c9ce1f26dc --- /dev/null +++ b/connectivity/source/inc/ado/AKeys.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_KEYS_HXX_ +#define _CONNECTIVITY_ADO_KEYS_HXX_ + +#include "connectivity/sdbcx/VCollection.hxx" +#include "ado/Awrapadox.hxx" + +namespace connectivity +{ + namespace ado + { + class OConnection; + class OKeys : public sdbcx::OCollection + { + WpADOKeys m_aCollection; + OConnection* m_pConnection; + + protected: + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor(); + virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); + public: + OKeys(::cppu::OWeakObject& _rParent, + ::osl::Mutex& _rMutex, + const TStringVector &_rVector, + const WpADOKeys& _rCollection, + sal_Bool _bCase, + OConnection* _pConnection) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector) + ,m_aCollection(_rCollection) + ,m_pConnection(_pConnection) + { + } + }; + } +} + +#endif // _CONNECTIVITY_ADO_KEYS_HXX_ + diff --git a/connectivity/source/inc/ado/APreparedStatement.hxx b/connectivity/source/inc/ado/APreparedStatement.hxx new file mode 100644 index 000000000000..cceae70f87fb --- /dev/null +++ b/connectivity/source/inc/ado/APreparedStatement.hxx @@ -0,0 +1,124 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_APREPAREDSTATEMENT_HXX_ +#define _CONNECTIVITY_ADO_APREPAREDSTATEMENT_HXX_ + + +#include "ado/AStatement.hxx" +#include <com/sun/star/sdbc/XPreparedStatement.hpp> +#include <com/sun/star/sdbc/XParameters.hpp> +#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> +// #include <com/sun/star/sdbc/XClearParameters.hpp> +#include <com/sun/star/sdbc/XPreparedBatchExecution.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> + +namespace connectivity +{ + class OSQLParseNode; + namespace ado + { + + class OPreparedStatement : public OStatement_Base, + public ::com::sun::star::sdbc::XPreparedStatement, + public ::com::sun::star::sdbc::XParameters, + public ::com::sun::star::sdbc::XPreparedBatchExecution, + public ::com::sun::star::sdbc::XResultSetMetaDataSupplier, + public ::com::sun::star::lang::XServiceInfo + + { + void setParameter(sal_Int32 parameterIndex, const DataTypeEnum& _eType,const sal_Int32& _nSize,const OLEVariant& _Val) + throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void replaceParameterNodeName( OSQLParseNode* _pNode, + const ::rtl::OUString& _sDefaultName, + sal_Int32& _nParameterCount); + protected: + //==================================================================== + // Data attributes + //==================================================================== + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > m_xMetaData; + const OTypeInfoMap& m_aTypeInfo; + ADOParameters* m_pParameters; + + virtual ~OPreparedStatement(); + + public: + DECLARE_SERVICE_INFO(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + OPreparedStatement( OConnection* _pConnection,const OTypeInfoMap& _TypeInfo,const ::rtl::OUString& sql); + + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + // XPreparedStatement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL executeUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XParameters + virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearParameters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XPreparedBatchExecution + virtual void SAL_CALL addBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XResultSetMetaDataSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // OComponentHelper + virtual void SAL_CALL disposing(void); + }; + } +} +#endif // _CONNECTIVITY_ADO_APREPAREDSTATEMENT_HXX_ + diff --git a/connectivity/source/inc/ado/AResultSet.hxx b/connectivity/source/inc/ado/AResultSet.hxx new file mode 100644 index 000000000000..01d7796c03d4 --- /dev/null +++ b/connectivity/source/inc/ado/AResultSet.hxx @@ -0,0 +1,237 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_ARESULTSET_HXX_ +#define _CONNECTIVITY_ADO_ARESULTSET_HXX_ + +#include <com/sun/star/sdbc/XResultSet.hpp> +#include <com/sun/star/sdbc/XRow.hpp> +#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> +#include <com/sun/star/sdbc/XCloseable.hpp> +#include <com/sun/star/sdbc/XColumnLocate.hpp> +#include <com/sun/star/util/XCancellable.hpp> +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#include <com/sun/star/sdbc/XResultSetUpdate.hpp> +#include <com/sun/star/sdbcx/XRowLocate.hpp> +#include <com/sun/star/sdbcx/XDeleteRows.hpp> +#include <com/sun/star/sdbc/XRowUpdate.hpp> +#include <cppuhelper/compbase12.hxx> +#include <comphelper/proparrhlp.hxx> +#include "ado/AStatement.hxx" +//#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +//#include "connectivity/CommonTools.hxx" +//#endif +#include <comphelper/broadcasthelper.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> + +namespace connectivity +{ + namespace ado + { + class OResultSetMetaData; + /* + ** java_sql_ResultSet + */ + typedef ::cppu::WeakComponentImplHelper12< ::com::sun::star::sdbc::XResultSet, + ::com::sun::star::sdbc::XRow, + ::com::sun::star::sdbc::XResultSetMetaDataSupplier, + ::com::sun::star::util::XCancellable, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::sdbc::XResultSetUpdate, + ::com::sun::star::sdbc::XRowUpdate, + ::com::sun::star::sdbc::XCloseable, + ::com::sun::star::sdbc::XColumnLocate, + ::com::sun::star::sdbcx::XRowLocate, + ::com::sun::star::sdbcx::XDeleteRows, + ::com::sun::star::lang::XServiceInfo> OResultSet_BASE; + + class OResultSet : public comphelper::OBaseMutex, + public OResultSet_BASE, + public ::cppu::OPropertySetHelper, + public ::comphelper::OPropertyArrayUsageHelper<OResultSet> + { + + ADORecordset* m_pRecordSet; + OStatement_Base* m_pStmt; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xStatement; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData; + ::std::vector<OLEVariant> m_aBookmarks; + OLEVariant m_aValue; + sal_Int32 m_nRowPos; + sal_Bool m_bWasNull; + sal_Bool m_bEOF; + sal_Bool m_bOnFirstAfterOpen; + + sal_Int32 getResultSetConcurrency() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getResultSetType() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getFetchDirection() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getFetchSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + ::rtl::OUString getCursorName() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + void setFetchDirection(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setFetchSize(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void updateValue(sal_Int32 columnIndex,const OLEVariant& x); + OLEVariant getValue(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + protected: + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + virtual sal_Bool SAL_CALL convertFastPropertyValue( + ::com::sun::star::uno::Any & rConvertedValue, + ::com::sun::star::uno::Any & rOldValue, + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue ) + throw (::com::sun::star::lang::IllegalArgumentException); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue + ) + throw (::com::sun::star::uno::Exception); + virtual void SAL_CALL getFastPropertyValue( + ::com::sun::star::uno::Any& rValue, + sal_Int32 nHandle + ) const; + virtual ~OResultSet(); + public: + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + OResultSet( ADORecordset* _pRecordSet,OStatement_Base* pStmt); + OResultSet( ADORecordset* _pRecordSet); + + // late constructor + void construct(); + inline void setMetaData(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData>& _xMetaData) { m_xMetaData = _xMetaData;} + + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + // XResultSet + virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XRow + virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XResultSetMetaDataSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCancellable + virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) 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); + // XResultSetUpdate + virtual void SAL_CALL insertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL deleteRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XRowUpdate + virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XRowLocate + virtual ::com::sun::star::uno::Any SAL_CALL getBookmark( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL moveRelativeToBookmark( const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL compareBookmarks( const ::com::sun::star::uno::Any& first, const ::com::sun::star::uno::Any& second ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL hashBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XDeleteRows + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + }; + } + +} +#endif // _CONNECTIVITY_ADO_ARESULTSET_HXX_ + + diff --git a/connectivity/source/inc/ado/AResultSetMetaData.hxx b/connectivity/source/inc/ado/AResultSetMetaData.hxx new file mode 100644 index 000000000000..3702679f8d86 --- /dev/null +++ b/connectivity/source/inc/ado/AResultSetMetaData.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_ARESULTSETMETADATA_HXX_ +#define _CONNECTIVITY_ADO_ARESULTSETMETADATA_HXX_ + +#include <com/sun/star/sdbc/XResultSetMetaData.hpp> +#include <cppuhelper/implbase1.hxx> +#ifndef _VECTOR_ +#include <vector> +#endif +#include "ado/Awrapado.hxx" +#include "ado/AResultSet.hxx" +#include "OColumn.hxx" + +namespace connectivity +{ + namespace ado + { + + //************************************************************** + //************ Class: ResultSetMetaData + //************************************************************** + typedef ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XResultSetMetaData> OResultSetMetaData_BASE; + + class OResultSetMetaData : public OResultSetMetaData_BASE + { + friend class OResultSet; + + ADORecordset* m_pRecordSet; + sal_Int32 m_nColCount; + + sal_Int32 MapADOType2Jdbc(DataTypeEnum eType); + private: + OResultSetMetaData( const OResultSetMetaData& ); // never implemented + OResultSetMetaData& operator=( const OResultSetMetaData& ); // never implemented + + protected: + virtual ~OResultSetMetaData(); + public: + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + OResultSetMetaData( ADORecordset* _pRecordSet); + + virtual sal_Int32 SAL_CALL getColumnCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnLabel( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSchemaName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTableName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalogName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnTypeName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnServiceName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_ADO_ARESULTSETMETADATA_HXX_ + diff --git a/connectivity/source/inc/ado/AStatement.hxx b/connectivity/source/inc/ado/AStatement.hxx new file mode 100644 index 000000000000..86b6d92fc724 --- /dev/null +++ b/connectivity/source/inc/ado/AStatement.hxx @@ -0,0 +1,201 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_ASTATEMENT_HXX_ +#define _CONNECTIVITY_ADO_ASTATEMENT_HXX_ + +#include <com/sun/star/sdbc/XStatement.hpp> +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#include <com/sun/star/sdbc/XMultipleResults.hpp> +#include <com/sun/star/sdbc/XBatchExecution.hpp> +#include <com/sun/star/sdbc/XCloseable.hpp> +#include <com/sun/star/sdbc/SQLWarning.hpp> +#include <com/sun/star/util/XCancellable.hpp> +#include <cppuhelper/compbase5.hxx> +#include <comphelper/proparrhlp.hxx> +#include <comphelper/uno3.hxx> +#include <comphelper/broadcasthelper.hxx> +#include "ado/AConnection.hxx" +#ifndef _LIST_ +#include <list> +#endif +#include "ado/Awrapado.hxx" +#include <com/sun/star/lang/XServiceInfo.hpp> + +namespace connectivity +{ + namespace ado + { + typedef ::cppu::WeakComponentImplHelper5< ::com::sun::star::sdbc::XStatement, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::util::XCancellable, + ::com::sun::star::sdbc::XCloseable, + ::com::sun::star::sdbc::XMultipleResults> OStatement_BASE; + + //************************************************************** + //************ Class: java.sql.Statement + //************************************************************** + class OStatement_Base : public comphelper::OBaseMutex, + public OStatement_BASE, + public ::cppu::OPropertySetHelper, + public ::comphelper::OPropertyArrayUsageHelper<OStatement_Base>, + public connectivity::OSubComponent<OStatement_Base, OStatement_BASE> + + { + friend class connectivity::OSubComponent<OStatement_Base, OStatement_BASE>; + friend class OResultSet; + + ::com::sun::star::sdbc::SQLWarning m_aLastWarning; + + protected: + ::std::list< ::rtl::OUString> m_aBatchList; + + ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet> m_xResultSet; // The last ResultSet created + // for this Statement + + OConnection* m_pConnection;// The owning Connection object + WpADOCommand m_Command; + WpADORecordset m_RecordSet; + OLEVariant m_RecordsAffected; + OLEVariant m_Parameters; + ::std::vector<connectivity::OTypeInfo> m_aTypeInfo; // Hashtable containing an entry + // for each row returned by + // DatabaseMetaData.getTypeInfo. + sal_Int32 m_nMaxRows; + sal_Int32 m_nFetchSize; + LockTypeEnum m_eLockType; + CursorTypeEnum m_eCursorType; + + using OStatement_BASE::rBHelper; + private: + + sal_Int32 getQueryTimeOut() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getMaxFieldSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getMaxRows() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getResultSetConcurrency() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getResultSetType() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getFetchDirection() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getFetchSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + ::rtl::OUString getCursorName() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + void setQueryTimeOut(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setMaxFieldSize(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setMaxRows(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setResultSetConcurrency(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setResultSetType(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setFetchDirection(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setFetchSize(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setCursorName(const ::rtl::OUString &_par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + protected: + + void assignRecordSet( ADORecordset* _pRS ); + + void reset () throw( ::com::sun::star::sdbc::SQLException); + void clearMyResultSet () throw( ::com::sun::star::sdbc::SQLException); + void setWarning (const ::com::sun::star::sdbc::SQLWarning &ex) throw( ::com::sun::star::sdbc::SQLException); + sal_Int32 getColumnCount () throw( ::com::sun::star::sdbc::SQLException); + sal_Int32 getRowCount () throw( ::com::sun::star::sdbc::SQLException); + sal_Int32 getPrecision ( sal_Int32 sqlType); + + void disposeResultSet(); + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + virtual sal_Bool SAL_CALL convertFastPropertyValue( + ::com::sun::star::uno::Any & rConvertedValue, + ::com::sun::star::uno::Any & rOldValue, + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue ) + throw (::com::sun::star::lang::IllegalArgumentException); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue + ) + throw (::com::sun::star::uno::Exception); + virtual void SAL_CALL getFastPropertyValue( + ::com::sun::star::uno::Any& rValue, + sal_Int32 nHandle + ) const; + public: + OStatement_Base(OConnection* _pConnection ); + + using OStatement_BASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >; + // OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + // XStatement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + virtual sal_Int32 SAL_CALL executeUpdate( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + virtual sal_Bool SAL_CALL execute( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) 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); + // XCancellable + virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XMultipleResults + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getResultSet( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getMoreResults( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + + class OStatement : public OStatement_Base, + public ::com::sun::star::sdbc::XBatchExecution, + public ::com::sun::star::lang::XServiceInfo + { + public: + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + OStatement( OConnection* _pConnection) : OStatement_Base( _pConnection){}; + ~OStatement(); + + DECLARE_SERVICE_INFO(); + + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + // XBatchExecution + virtual void SAL_CALL addBatch( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_ADO_ASTATEMENT_HXX_ + diff --git a/connectivity/source/inc/ado/ATable.hxx b/connectivity/source/inc/ado/ATable.hxx new file mode 100644 index 000000000000..1048f1e2823b --- /dev/null +++ b/connectivity/source/inc/ado/ATable.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_TABLE_HXX_ +#define _CONNECTIVITY_ADO_TABLE_HXX_ + +#include "connectivity/sdbcx/VTable.hxx" +#include "ado/Awrapadox.hxx" +#include "ado/ACatalog.hxx" + +namespace connectivity +{ + namespace ado + { + typedef connectivity::sdbcx::OTable OTable_TYPEDEF; + typedef connectivity::sdbcx::OTableDescriptor_BASE OTableDescriptor_BASE_TYPEDEF; + + class OAdoTable : public OTable_TYPEDEF + { + WpADOTable m_aTable; + OCatalog* m_pCatalog; + + protected: + void fillPropertyValues(); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const ::com::sun::star::uno::Any& rValue)throw (::com::sun::star::uno::Exception); + + public: + virtual void refreshColumns(); + virtual void refreshKeys(); + virtual void refreshIndexes(); + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + + public: + OAdoTable(sdbcx::OCollection* _pTables,sal_Bool _bCase,OCatalog* _pCatalog,_ADOTable* _pTable); + OAdoTable(sdbcx::OCollection* _pTables,sal_Bool _bCase,OCatalog* _pCatalog); + + + virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); + ::rtl::OUString getSchema() const { return m_SchemaName; } + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> getMetaData() const; + // 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(); + + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + // 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); + + // 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); + // + sal_Bool create() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + WpADOTable getImpl() const { return m_aTable;} + OCatalog* getCatalog() const { return m_pCatalog; } + }; + } +} +#endif // _CONNECTIVITY_ADO_TABLE_HXX_ + diff --git a/connectivity/source/inc/ado/ATables.hxx b/connectivity/source/inc/ado/ATables.hxx new file mode 100644 index 000000000000..0bba73babbc6 --- /dev/null +++ b/connectivity/source/inc/ado/ATables.hxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADO_TABLES_HXX_ +#define _CONNECTIVITY_ADO_TABLES_HXX_ + +#include "connectivity/sdbcx/VCollection.hxx" +#include "ado/Awrapadox.hxx" +#include "ado/ACatalog.hxx" + +namespace connectivity +{ + namespace ado + { + class OCatalog; + class OTables : public sdbcx::OCollection + { + WpADOTables m_aCollection; + OCatalog* m_pCatalog; + protected: + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor(); + void setComments(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); + public: + OTables(OCatalog* _pParent, ::osl::Mutex& _rMutex, + const TStringVector &_rVector, + const WpADOTables& _rCollection, + sal_Bool _bCase) : sdbcx::OCollection(*_pParent,_bCase,_rMutex,_rVector) + ,m_pCatalog(_pParent) + ,m_aCollection(_rCollection) + { + OSL_ENSURE(m_aCollection.IsValid(),"Collection isn't valid"); + } + void appendNew(const ::rtl::OUString& _rsNewTable); + }; + } +} +#endif // _CONNECTIVITY_ADO_TABLES_HXX_ + diff --git a/connectivity/source/inc/ado/AUser.hxx b/connectivity/source/inc/ado/AUser.hxx new file mode 100644 index 000000000000..ec0b7cbba399 --- /dev/null +++ b/connectivity/source/inc/ado/AUser.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_USER_HXX_ +#define _CONNECTIVITY_ADO_USER_HXX_ + +#include "connectivity/sdbcx/VUser.hxx" +#include "ado/Awrapadox.hxx" + +namespace connectivity +{ + namespace ado + { + class OCatalog; + typedef connectivity::sdbcx::OUser OUser_TYPEDEF; + typedef connectivity::sdbcx::OUser_BASE OUser_BASE_TYPEDEF; + + class OAdoUser : public OUser_TYPEDEF + { + protected: + WpADOUser m_aUser; + OCatalog* m_pCatalog; + + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue + ) + throw (::com::sun::star::uno::Exception); + virtual void SAL_CALL getFastPropertyValue( + ::com::sun::star::uno::Any& rValue, + sal_Int32 nHandle + ) const; + public: + virtual void refreshGroups(); + public: + OAdoUser(OCatalog* _pParent,sal_Bool _bCase, ADOUser* _pUser=NULL); + OAdoUser(OCatalog* _pParent,sal_Bool _bCase, const ::rtl::OUString& _Name); + + // 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(); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XUser + virtual void SAL_CALL changePassword( const ::rtl::OUString& objPassword, const ::rtl::OUString& newPassword ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XAuthorizable + virtual sal_Int32 SAL_CALL getPrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getGrantablePrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + WpADOUser getImpl() const { return m_aUser;} + }; + + class OUserExtend; + typedef ::comphelper::OPropertyArrayUsageHelper<OUserExtend> OUserExtend_PROP; + + class OUserExtend : public OAdoUser, + public OUserExtend_PROP + { + protected: + ::rtl::OUString m_Password; + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + public: + OUserExtend(OCatalog* _pParent,sal_Bool _bCase,ADOUser* _pUser=NULL); + OUserExtend(OCatalog* _pParent,sal_Bool _bCase,const ::rtl::OUString& _Name); + + virtual void construct(); + ::rtl::OUString getPassword() const { return m_Password;} + }; + } +} +#endif // _CONNECTIVITY_ADO_USER_HXX_ + diff --git a/connectivity/source/inc/ado/AUsers.hxx b/connectivity/source/inc/ado/AUsers.hxx new file mode 100644 index 000000000000..aae377cca111 --- /dev/null +++ b/connectivity/source/inc/ado/AUsers.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_USERS_HXX_ +#define _CONNECTIVITY_ADO_USERS_HXX_ + +#include "connectivity/sdbcx/VCollection.hxx" +#include "ado/Awrapadox.hxx" +#include "ado/ACatalog.hxx" + +namespace connectivity +{ + namespace sdbcx + { + class IRefreshableUsers; + } + namespace ado + { + + class OUsers : public sdbcx::OCollection + { + WpADOUsers m_aCollection; + OCatalog* m_pCatalog; + public: + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor(); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); + public: + OUsers( OCatalog* _pParent, + ::osl::Mutex& _rMutex, + const TStringVector &_rVector, + const WpADOUsers& _rCollection, + sal_Bool _bCase) + :sdbcx::OCollection(*_pParent,_bCase,_rMutex,_rVector) + ,m_aCollection(_rCollection) + ,m_pCatalog(_pParent) + { + } + }; + } +} + +#endif // _CONNECTIVITY_ADO_USERS_HXX_ + diff --git a/connectivity/source/inc/ado/AView.hxx b/connectivity/source/inc/ado/AView.hxx new file mode 100644 index 000000000000..90589c54a5c8 --- /dev/null +++ b/connectivity/source/inc/ado/AView.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_VIEW_HXX_ +#define _CONNECTIVITY_ADO_VIEW_HXX_ + +#include "connectivity/sdbcx/VView.hxx" +#include "ado/Awrapadox.hxx" + +namespace connectivity +{ + namespace ado + { + + typedef sdbcx::OView OView_ADO; + + class OAdoView : public OView_ADO + { + WpADOView m_aView; + + protected: + // OPropertySetHelper + virtual void SAL_CALL getFastPropertyValue( + ::com::sun::star::uno::Any& rValue, + sal_Int32 nHandle + ) const; + public: + OAdoView(sal_Bool _bCase, ADOView* _pView=NULL); + + // 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(); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + WpADOView getImpl() const { return m_aView;} + }; + } +} + +#endif // _CONNECTIVITY_ADO_VIEW_HXX_ + diff --git a/connectivity/source/inc/ado/AViews.hxx b/connectivity/source/inc/ado/AViews.hxx new file mode 100644 index 000000000000..8411dfa2b82c --- /dev/null +++ b/connectivity/source/inc/ado/AViews.hxx @@ -0,0 +1,64 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_VIEWS_HXX_ +#define _CONNECTIVITY_ADO_VIEWS_HXX_ + +#include "connectivity/sdbcx/VCollection.hxx" +#include "ado/Awrapadox.hxx" +#include "ado/ACatalog.hxx" + + +namespace connectivity +{ + namespace ado + { + + class OViews : public sdbcx::OCollection + { + WpADOViews m_aCollection; + OCatalog* m_pCatalog; + protected: + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor(); + virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + void setComments(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); + public: + OViews(OCatalog* _pParent, ::osl::Mutex& _rMutex, + const TStringVector &_rVector, + WpADOViews& _rCollection,sal_Bool _bCase) : sdbcx::OCollection(*_pParent,_bCase,_rMutex,_rVector) + ,m_aCollection(_rCollection) + ,m_pCatalog(_pParent) + { + } + }; + } +} +#endif // _CONNECTIVITY_ADO_VIEWS_HXX_ + diff --git a/connectivity/source/inc/ado/Aolevariant.hxx b/connectivity/source/inc/ado/Aolevariant.hxx new file mode 100644 index 000000000000..ab2641396f9b --- /dev/null +++ b/connectivity/source/inc/ado/Aolevariant.hxx @@ -0,0 +1,175 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADO_AOLEVARIANT_HXX_ +#define _CONNECTIVITY_ADO_AOLEVARIANT_HXX_ + +#include <sal/types.h> +#ifdef __MINGW32__ +#include <windows.h> +#endif +#include <rtl/ustring.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include "ado_pre_sys_include.h" +#include <oaidl.h> +#include "ado_post_sys_include.h" + +namespace com +{ + namespace sun + { + namespace star + { + namespace util + { + struct Date; + struct Time; + struct DateTime; + } + } + } +} +namespace connectivity +{ + namespace ado + { + class OLEString + { + BSTR m_sStr; + public: + OLEString(); + OLEString(const BSTR& _sBStr); + OLEString(const ::rtl::OUString& _sBStr); + OLEString(const OLEString& _rRh) + { + OLEString::operator=(_rRh); + } + ~OLEString(); + OLEString& operator=(const ::rtl::OUString& _rSrc); + OLEString& operator=(const BSTR& _rSrc); + OLEString& operator=(const OLEString& _rSrc); + operator ::rtl::OUString() const; + operator BSTR() const; + BSTR* operator &(); + sal_Int32 length() const; + }; + + class OLEVariant : public ::tagVARIANT + { + public: + OLEVariant(); + OLEVariant(const VARIANT& varSrc); + OLEVariant(const OLEVariant& varSrc) ; + OLEVariant(sal_Bool x) ; + OLEVariant(sal_Int8 n) ; + OLEVariant(sal_Int16 n) ; + OLEVariant(sal_Int32 n) ; + OLEVariant(sal_Int64 x) ; + + OLEVariant(const rtl::OUString& us) ; + ~OLEVariant() ; + OLEVariant(const ::com::sun::star::util::Date& x ); + OLEVariant(const ::com::sun::star::util::Time& x ); + OLEVariant(const ::com::sun::star::util::DateTime& x ); + OLEVariant(const float &x); + OLEVariant(const double &x); + OLEVariant(IDispatch* pDispInterface); + OLEVariant(const ::com::sun::star::uno::Sequence< sal_Int8 >& x); + OLEVariant& operator=(const OLEVariant& varSrc); + // Assign a const VARIANT& (::VariantCopy handles everything) + // + OLEVariant& operator=(const tagVARIANT& varSrc); + // Assign a const VARIANT* (::VariantCopy handles everything) + // + OLEVariant& operator=(const VARIANT* pSrc); + void setByte(sal_uInt8 n) ; + void setInt16(sal_Int16 n) ; + void setInt32(sal_Int32 n) ; + void setFloat(float f) ; + void setDouble(double d) ; + void setDate(DATE d) ; + void setChar(unsigned char a) ; + void setCurrency(double aCur) ; + void setBool(sal_Bool b) ; + void setString(const rtl::OUString& us) ; + void setNoArg() ; + + void setIDispatch(IDispatch* pDispInterface); + void setNull() ; + void setEmpty() ; + + void setUI1SAFEARRAYPtr(SAFEARRAY* pSafeAr); + void setArray(SAFEARRAY* pSafeArray, VARTYPE vtType); + sal_Bool isNull() const ; + sal_Bool isEmpty() const ; + + VARTYPE getType() const ; + void ChangeType(VARTYPE vartype, const OLEVariant* pSrc); + + + operator ::rtl::OUString() const; + + operator sal_Bool() const { return getBool(); } + operator sal_Int8() const { return getInt8(); } + operator sal_Int16() const { return getInt16(); } + operator sal_Int32() const { return getInt32(); } + operator float() const { return getFloat(); } + operator double() const { return getDouble(); } + + operator ::com::sun::star::uno::Sequence< sal_Int8 >() const; + operator ::com::sun::star::util::Date() const ; + operator ::com::sun::star::util::Time() const ; + operator ::com::sun::star::util::DateTime()const ; + ::rtl::OUString getString() const; + sal_Bool getBool() const; + IUnknown* getIUnknown() const; + IDispatch* getIDispatch() const; + sal_uInt8 getByte() const; + sal_Int16 getInt16() const; + sal_Int8 getInt8() const; + sal_Int32 getInt32() const; + sal_uInt32 getUInt32() const; + float getFloat() const; + double getDouble() const; + double getDate() const; + CY getCurrency() const; + SAFEARRAY* getUI1SAFEARRAYPtr() const; + ::com::sun::star::uno::Any makeAny() const; + + static VARIANT_BOOL VariantBool(sal_Bool bEinBoolean); + + private: + void CHS(); + + void set(double n); + + }; + } +} + +#endif // _CONNECTIVITY_ADO_AOLEVARIANT_HXX_ + diff --git a/connectivity/source/inc/ado/Aolewrap.hxx b/connectivity/source/inc/ado/Aolewrap.hxx new file mode 100644 index 000000000000..8bc9c4b4fa70 --- /dev/null +++ b/connectivity/source/inc/ado/Aolewrap.hxx @@ -0,0 +1,245 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADO_AOLEWRAP_HXX_ +#define _CONNECTIVITY_ADO_AOLEWRAP_HXX_ + +#include <osl/diagnose.h> +#include <osl/thread.h> +#include <map> +#include <vector> +#include "connectivity/StdTypeDefs.hxx" + +namespace rtl +{ + class OUString; +} +namespace connectivity +{ + namespace ado + { + class OLEVariant; + class WpBase + { + protected: + IDispatch* pIUnknown; + + void setIDispatch(IDispatch* _pIUnknown); + public: + WpBase(); + WpBase(IDispatch* pInt); + //inline + WpBase& operator=(const WpBase& rhs); + WpBase& operator=(IDispatch* rhs); + WpBase(const WpBase& aWrapper); + virtual ~WpBase(); + void clear(); + + + sal_Bool IsValid() const; + operator IDispatch*(); + + }; + ////////////////////////////////////////////////////////////////////////// + // + // Template-Klasse WpOLEBase<class T> + // ================================== + // + // Objekte dieser Klasse haelt einen Zeiger auf ein Interface vom Typ T. + // Es gibt Konstruktoren und Zuweisungsoperator die sicherstellen, dass + // AddRef() und Release() entsprechend den COM-Konventionen gerufen werden. + // Ein Objekt kann auch keinen Zeiger halten (Nullzeiger), dann ergibt + // der Aufruf von IsValid() FALSE. + // + // Um effizientes pass-by-value machen zu koennen, ist diese (ebenso wie die + // abgeleiteten Klassen) eine ganz schmale Wrapper-Klasse unter Vermeidung + // virtueller Methoden und mit Inlining. + + //------------------------------------------------------------------------ + template<class T> class WpOLEBase : public WpBase + { + protected: + T* pInterface; + + public: + WpOLEBase(T* pInt = NULL) : WpBase(pInt),pInterface(pInt){} + + + //inline + WpOLEBase<T>& operator=(const WpOLEBase<T>& rhs) + { + WpBase::operator=(rhs); + pInterface = rhs.pInterface; + return *this; + }; + + WpOLEBase<T>& operator=(T* rhs) + { + WpBase::operator=(rhs); + pInterface = rhs.pInterface; + return *this; + } + + WpOLEBase(const WpOLEBase<T>& aWrapper) + { + operator=(aWrapper); + } + + virtual ~WpOLEBase() + { + } + + operator T*() const { return static_cast<T*>(pInterface); } + void setWithOutAddRef(T* _pInterface) + { + pInterface = _pInterface; + WpBase::setIDispatch(_pInterface); + } + }; + + + ////////////////////////////////////////////////////////////////////////// + // + // Template-Klasse WpOLECollection<class Ts, class T, class WrapT> + // =============================================================== + // + // Diese Klasse, welche sich von WpOLEBase<Ts> ableitet, abstrahiert die + // den DAO-Collections gemeinsamen Eigenschaften: + // + // Sie werden ueber ein Interface Ts (etwa: DAOFields) angesprochen + // und koennen ueber get_Item (hier:GetItem) Items des Typs T (genauer: + // mit Interface T, etwa DAOField) herausgeben. + // + // Diese Wrapperklasse gibt aber nicht ein Interface T heraus, + // sondern ein Objekt der Klasse WrapT. Dieses muss eine Konstruktion + // durch T zulassen, vorzugsweise ist es von WpOLEBase<T> abgeleitet. + // + + //------------------------------------------------------------------------ + template<class Ts, class T, class WrapT> class WpOLECollection : public WpOLEBase<Ts> + { + public: + using WpOLEBase<Ts>::pInterface; + using WpOLEBase<Ts>::IsValid; + // Konstruktoren, operator= + // diese rufen nur die Oberklasse + WpOLECollection(Ts* pInt=NULL):WpOLEBase<Ts>(pInt){} + WpOLECollection(const WpOLECollection& rhs){operator=(rhs);} + inline WpOLECollection& operator=(const WpOLECollection& rhs) + {WpOLEBase<Ts>::operator=(rhs); return *this;}; + + ////////////////////////////////////////////////////////////////////// + + inline void Refresh(){pInterface->Refresh();} + + inline sal_Int32 GetItemCount() const + { + sal_Int32 nCount = 0; + return pInterface ? (SUCCEEDED(pInterface->get_Count(&nCount)) ? nCount : sal_Int32(0)) : sal_Int32(0); + } + + inline WrapT GetItem(sal_Int32 index) const + { + OSL_ENSURE(index >= 0 && index<GetItemCount(),"Wrong index for field!"); + T* pT = NULL; + WrapT aRet(NULL); + if(SUCCEEDED(pInterface->get_Item(OLEVariant(index), &pT))) + aRet.setWithOutAddRef(pT); + return aRet; + } + + inline WrapT GetItem(const OLEVariant& index) const + { + T* pT = NULL; + WrapT aRet(NULL); + if(SUCCEEDED(pInterface->get_Item(index, &pT))) + aRet.setWithOutAddRef(pT); + return aRet; + } + + inline WrapT GetItem(const ::rtl::OUString& sStr) const + { + WrapT aRet(NULL); + T* pT = NULL; + if (FAILED(pInterface->get_Item(OLEVariant(sStr), &pT))) + { +#if OSL_DEBUG_LEVEL > 0 + ::rtl::OString sTemp("Unknown Item: "); + sTemp += ::rtl::OString(sStr.getStr(),sStr.getLength(),osl_getThreadTextEncoding()); + OSL_ENSURE(0,sTemp); +#endif + } + else + aRet.setWithOutAddRef(pT); + return aRet; + } + inline void fillElementNames(TStringVector& _rVector) + { + if(IsValid()) + { + Refresh(); + sal_Int32 nCount = GetItemCount(); + _rVector.reserve(nCount); + for(sal_Int32 i=0;i< nCount;++i) + { + WrapT aElement = GetItem(i); + if(aElement.IsValid()) + _rVector.push_back(aElement.get_Name()); + } + } + } + }; + + template<class Ts, class T, class WrapT> class WpOLEAppendCollection: + public WpOLECollection<Ts,T,WrapT> + { + + public: + // Konstruktoren, operator= + // diese rufen nur die Oberklasse + using WpOLEBase<Ts>::pInterface; + WpOLEAppendCollection(Ts* pInt=NULL):WpOLECollection<Ts,T,WrapT>(pInt){} + WpOLEAppendCollection(const WpOLEAppendCollection& rhs){ operator=(rhs); } + inline WpOLEAppendCollection& operator=(const WpOLEAppendCollection& rhs) + {WpOLEBase<Ts>::operator=(rhs); return *this;}; + ////////////////////////////////////////////////////////////////////// + + inline sal_Bool Append(const WrapT& aWrapT) + { + return SUCCEEDED(pInterface->Append(OLEVariant((T*)aWrapT))); + }; + + inline sal_Bool Delete(const ::rtl::OUString& sName) + { + return SUCCEEDED(pInterface->Delete(OLEVariant(sName))); + }; + + + }; + } +} +#endif // _CONNECTIVITY_ADO_AOLEWRAP_HXX_ + diff --git a/connectivity/source/inc/ado/Awrapado.hxx b/connectivity/source/inc/ado/Awrapado.hxx new file mode 100644 index 000000000000..0e4cd9395255 --- /dev/null +++ b/connectivity/source/inc/ado/Awrapado.hxx @@ -0,0 +1,419 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADO_AWRAPADO_HXX_ +#define _CONNECTIVITY_ADO_AWRAPADO_HXX_ + +#include <com/sun/star/beans/PropertyAttribute.hpp> + +// Includes fuer ADO +#include "ado_pre_sys_include.h" +#include <oledb.h> +#include <ocidl.h> +#include <adoint.h> +#include "ado_post_sys_include.h" + + +#include "ado/adoimp.hxx" +#include "ado/Aolewrap.hxx" +#include "ado/Aolevariant.hxx" + +namespace connectivity +{ + namespace ado + { + class WpADOConnection; + class WpADOCommand; + class WpADORecordset; + class WpADOField; + class WpADOParameter; + class WpADOError; + class WpADOProperty; + + typedef WpOLEAppendCollection< ADOFields, ADOField, WpADOField> WpADOFields; + typedef WpOLECollection< ADOProperties, ADOProperty, WpADOProperty> WpADOProperties; + + //------------------------------------------------------------------------ + class WpADOConnection : public WpOLEBase<ADOConnection> + { + friend class WpADOCommand; + public: + + WpADOConnection(ADOConnection* pInt) : WpOLEBase<ADOConnection>(pInt){} + + WpADOConnection(const WpADOConnection& rhs){operator=(rhs);} + + WpADOConnection& operator=(const WpADOConnection& rhs) + {WpOLEBase<ADOConnection>::operator=(rhs); return *this;} + + ////////////////////////////////////////////////////////////////////// + + WpADOProperties get_Properties() const; + + rtl::OUString GetConnectionString() const; + + sal_Bool PutConnectionString(const ::rtl::OUString &aCon) const; + + sal_Int32 GetCommandTimeout() const; + + void PutCommandTimeout(sal_Int32 nRet); + + sal_Int32 GetConnectionTimeout() const ; + + void PutConnectionTimeout(sal_Int32 nRet); + + sal_Bool Close( ) ; + + sal_Bool Execute(const ::rtl::OUString& _CommandText,OLEVariant& RecordsAffected,long Options, WpADORecordset** ppiRset); + + sal_Bool BeginTrans(); + + sal_Bool CommitTrans( ) ; + + sal_Bool RollbackTrans( ); + + sal_Bool Open(const ::rtl::OUString& ConnectionString, const ::rtl::OUString& UserID,const ::rtl::OUString& Password,long Options); + + sal_Bool GetErrors(ADOErrors** pErrors); + + ::rtl::OUString GetDefaultDatabase() const; + + sal_Bool PutDefaultDatabase(const ::rtl::OUString& _bstr); + + IsolationLevelEnum get_IsolationLevel() const ; + + sal_Bool put_IsolationLevel(const IsolationLevelEnum& eNum) ; + + sal_Int32 get_Attributes() const; + + sal_Bool put_Attributes(sal_Int32 nRet); + + CursorLocationEnum get_CursorLocation() const; + + sal_Bool put_CursorLocation(const CursorLocationEnum &eNum) ; + + ConnectModeEnum get_Mode() const; + + sal_Bool put_Mode(const ConnectModeEnum &eNum) ; + + ::rtl::OUString get_Provider() const; + + sal_Bool put_Provider(const ::rtl::OUString& _bstr); + + sal_Int32 get_State() const; + + sal_Bool OpenSchema(SchemaEnum eNum,OLEVariant& Restrictions,OLEVariant& SchemaID,ADORecordset**pprset); + + ::rtl::OUString get_Version() const; + + // special methods + ADORecordset* getExportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ); + ADORecordset* getImportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ); + ADORecordset* getPrimaryKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ); + ADORecordset* getIndexInfo( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Bool unique, sal_Bool approximate ); + ADORecordset* getTablePrivileges( const ::com::sun::star::uno::Any& catalog, + const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& tableNamePattern ); + ADORecordset* getCrossReference( const ::com::sun::star::uno::Any& primaryCatalog, + const ::rtl::OUString& primarySchema, + const ::rtl::OUString& primaryTable, + const ::com::sun::star::uno::Any& foreignCatalog, + const ::rtl::OUString& foreignSchema, + const ::rtl::OUString& foreignTable); + ADORecordset* getProcedures( const ::com::sun::star::uno::Any& catalog, + const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& procedureNamePattern ); + ADORecordset* getProcedureColumns( const ::com::sun::star::uno::Any& catalog, + const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& procedureNamePattern, + const ::rtl::OUString& columnNamePattern ); + ADORecordset* getTables( const ::com::sun::star::uno::Any& catalog, + const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& tableNamePattern, + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types ); + ADORecordset* getColumns( const ::com::sun::star::uno::Any& catalog, + const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& tableNamePattern, + const ::rtl::OUString& columnNamePattern ); + ADORecordset* getColumnPrivileges( const ::com::sun::star::uno::Any& catalog, + const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& table, + const ::rtl::OUString& columnNamePattern ); + ADORecordset* getTypeInfo(DataTypeEnum _eType = adEmpty ); + }; + + //------------------------------------------------------------------------ + class WpADOCommand : public WpOLEBase<ADOCommand> + { + public: + WpADOCommand(){} + // Konstruktoren, operator= + // diese rufen nur die Oberklasse + WpADOCommand(ADOCommand* pInt) : WpOLEBase<ADOCommand>(pInt){} + + WpADOCommand(const WpADOCommand& rhs){operator=(rhs);} + + WpADOCommand& operator=(const WpADOCommand& rhs) + { + WpOLEBase<ADOCommand>::operator=(rhs); return *this;} + + ////////////////////////////////////////////////////////////////////// + + sal_Bool putref_ActiveConnection( WpADOConnection *pCon); + + void put_ActiveConnection(/* [in] */ const OLEVariant& vConn); + void Create(); + sal_Int32 get_State() const; + ::rtl::OUString get_CommandText() const; + sal_Bool put_CommandText(const ::rtl::OUString &aCon) ; + sal_Int32 get_CommandTimeout() const; + void put_CommandTimeout(sal_Int32 nRet); + sal_Bool get_Prepared() const; + sal_Bool put_Prepared(VARIANT_BOOL bPrepared) const; + sal_Bool Execute(OLEVariant& RecordsAffected,OLEVariant& Parameters,long Options, ADORecordset** ppiRset); + ADOParameter* CreateParameter(const ::rtl::OUString &_bstr,DataTypeEnum Type,ParameterDirectionEnum Direction,long nSize,const OLEVariant &Value); + + ADOParameters* get_Parameters() const; + sal_Bool put_CommandType( /* [in] */ CommandTypeEnum lCmdType); + CommandTypeEnum get_CommandType( ) const ; + // gibt den Namen des Feldes zur"ueck + ::rtl::OUString GetName() const ; + sal_Bool put_Name(const ::rtl::OUString& _Name); + sal_Bool Cancel(); + }; + //------------------------------------------------------------------------ + class WpADOError : public WpOLEBase<ADOError> + { + public: + + // Konstruktoren, operator= + // diese rufen nur die Oberklasse + + WpADOError(ADOError* pInt):WpOLEBase<ADOError>(pInt){} + + WpADOError(const WpADOError& rhs){operator=(rhs);} + + WpADOError& operator=(const WpADOError& rhs) + {WpOLEBase<ADOError>::operator=(rhs); return *this;} + + ////////////////////////////////////////////////////////////////////// + + ::rtl::OUString GetDescription() const; + + ::rtl::OUString GetSource() const ; + + sal_Int32 GetNumber() const ; + ::rtl::OUString GetSQLState() const ; + sal_Int32 GetNativeError() const ; + }; + + + + //------------------------------------------------------------------------ + class WpADOField : public WpOLEBase<ADOField> + { + // friend class WpADOFields; + public: + + // Konstruktoren, operator= + // diese rufen nur die Oberklasse + WpADOField(ADOField* pInt=NULL):WpOLEBase<ADOField>(pInt){} + WpADOField(const WpADOField& rhs){operator=(rhs);} + + WpADOField& operator=(const WpADOField& rhs) + {WpOLEBase<ADOField>::operator=(rhs); return *this;} + ////////////////////////////////////////////////////////////////////// + + WpADOProperties get_Properties(); + sal_Int32 GetActualSize() const ; + sal_Int32 GetAttributes() const ; + sal_Int32 GetStatus() const ; + sal_Int32 GetDefinedSize() const ; + // gibt den Namen des Feldes zur"ueck + ::rtl::OUString GetName() const ; + DataTypeEnum GetADOType() const ; + void get_Value(OLEVariant& aValVar) const ; + OLEVariant get_Value() const; + sal_Bool PutValue(const OLEVariant& aVariant); + sal_Int32 GetPrecision() const ; + sal_Int32 GetNumericScale() const ; + sal_Bool AppendChunk(const OLEVariant& _Variant); + OLEVariant GetChunk(long Length) const; + void GetChunk(long Length,OLEVariant &aValVar) const; + OLEVariant GetOriginalValue() const; + void GetOriginalValue(OLEVariant &aValVar) const; + OLEVariant GetUnderlyingValue() const; + + void GetUnderlyingValue(OLEVariant &aValVar) const; + + sal_Bool PutPrecision(sal_Int8 _prec); + + sal_Bool PutNumericScale(sal_Int8 _prec); + + void PutADOType(DataTypeEnum eType) ; + + sal_Bool PutDefinedSize(sal_Int32 _nDefSize); + + sal_Bool PutAttributes(sal_Int32 _nDefSize); + }; + + + + //------------------------------------------------------------------------ + class WpADOProperty: public WpOLEBase<ADOProperty> + { + public: + // Konstruktoren, operator= + // diese rufen nur die Oberklasse + WpADOProperty(ADOProperty* pInt=NULL):WpOLEBase<ADOProperty>(pInt){} + WpADOProperty(const WpADOProperty& rhs){operator=(rhs);} + WpADOProperty& operator=(const WpADOProperty& rhs) + {WpOLEBase<ADOProperty>::operator=(rhs); return *this;} + ////////////////////////////////////////////////////////////////////// + + OLEVariant GetValue() const; + void GetValue(OLEVariant &aValVar) const; + sal_Bool PutValue(const OLEVariant &aValVar) ; + ::rtl::OUString GetName() const ; + DataTypeEnum GetADOType() const ; + sal_Int32 GetAttributes() const ; + sal_Bool PutAttributes(sal_Int32 _nDefSize); + }; + + + class WpADORecordset : public WpOLEBase<ADORecordset> + { + + public: + // Konstruktoren, operator= + // diese rufen nur die Oberklasse + WpADORecordset(ADORecordset* pInt=NULL):WpOLEBase<ADORecordset>(pInt){} + WpADORecordset(const WpADORecordset& rhs){operator=(rhs);} + WpADORecordset& operator=(const WpADORecordset& rhs) + { + WpOLEBase<ADORecordset>::operator=(rhs); + return *this; + } + ~WpADORecordset() + { + // if(pInterface && get_State() == adStateOpen) + // Close(); + } + ////////////////////////////////////////////////////////////////////// + void Create(); + sal_Bool Open( + /* [optional][in] */ VARIANT Source, + /* [optional][in] */ VARIANT ActiveConnection, + /* [defaultvalue][in] */ CursorTypeEnum CursorType, + /* [defaultvalue][in] */ LockTypeEnum LockType, + /* [defaultvalue][in] */ sal_Int32 Options); + LockTypeEnum GetLockType(); + void Close(); + sal_Bool Cancel() const; + sal_Int32 get_State( ); + sal_Bool Supports( /* [in] */ CursorOptionEnum CursorOptions); + PositionEnum get_AbsolutePosition(); + void GetDataSource(IUnknown** pIUnknown) const ; + void PutRefDataSource(IUnknown* pIUnknown); + void GetBookmark(VARIANT& var); + OLEVariant GetBookmark(); + CompareEnum CompareBookmarks(const OLEVariant& left,const OLEVariant& right); + sal_Bool SetBookmark(const OLEVariant &pSafeAr); + WpADOFields GetFields() const; + sal_Bool Move(sal_Int32 nRows, VARIANT aBmk); + sal_Bool MoveNext(); + sal_Bool MovePrevious(); + sal_Bool MoveFirst(); + sal_Bool MoveLast(); + + sal_Bool IsAtBOF() const; + sal_Bool IsAtEOF() const; + sal_Bool Delete(AffectEnum eNum); + sal_Bool AddNew(const OLEVariant &FieldList,const OLEVariant &Values); + sal_Bool Update(const OLEVariant &FieldList,const OLEVariant &Values); + sal_Bool CancelUpdate(); + WpADOProperties get_Properties() const; + sal_Bool NextRecordset(OLEVariant& RecordsAffected,ADORecordset** ppiRset); + sal_Bool get_RecordCount(sal_Int32 &_nRet) const; + sal_Bool get_MaxRecords(sal_Int32 &_nRet) const; + sal_Bool put_MaxRecords(sal_Int32 _nRet); + sal_Bool get_CursorType(CursorTypeEnum &_nRet) const; + sal_Bool put_CursorType(CursorTypeEnum _nRet); + sal_Bool get_LockType(LockTypeEnum &_nRet) const; + sal_Bool put_LockType(LockTypeEnum _nRet); + sal_Bool get_CacheSize(sal_Int32 &_nRet) const; + sal_Bool put_CacheSize(sal_Int32 _nRet); + sal_Bool UpdateBatch(AffectEnum AffectRecords); + }; + + //------------------------------------------------------------------------ + class WpADOParameter:public WpOLEBase<ADOParameter> + { + public: + // Konstruktoren, operator= + // diese rufen nur die Oberklasse + WpADOParameter(ADOParameter* pInt):WpOLEBase<ADOParameter>(pInt){} + WpADOParameter(const WpADOParameter& rhs):WpOLEBase<ADOParameter>(rhs){} + WpADOParameter& operator=(const WpADOParameter& rhs) + {WpOLEBase<ADOParameter>::operator=(rhs); return *this;} + ////////////////////////////////////////////////////////////////////// + + ::rtl::OUString GetName() const ; + DataTypeEnum GetADOType() const ; + void put_Type(const DataTypeEnum& _eType); + sal_Bool put_Size(const sal_Int32& _nSize); + sal_Int32 GetAttributes() const ; + sal_Int32 GetPrecision() const ; + sal_Int32 GetNumericScale() const ; + ParameterDirectionEnum get_Direction() const; + void GetValue(OLEVariant& aValVar) const ; + OLEVariant GetValue() const; + sal_Bool PutValue(const OLEVariant& aVariant); + sal_Bool AppendChunk(const OLEVariant& aVariant); + }; + + class OTools + { + public: + /** putValue set the property value at the ado column + @param _rProps the properties where to set + @param _aPosition which property to set + @param _aValVar the value to set + */ + static void putValue(const WpADOProperties& _rProps,const OLEVariant &_aPosition,const OLEVariant &_aValVar); + + /** getValue returns a specific property value + @param _rProps the properties where to set + @param _aPosition the property + + @return the property value + */ + static OLEVariant getValue(const WpADOProperties& _rProps,const OLEVariant &_aPosition); + }; + } +} +#endif //_CONNECTIVITY_ADO_AWRAPADO_HXX_ + diff --git a/connectivity/source/inc/ado/Awrapadox.hxx b/connectivity/source/inc/ado/Awrapadox.hxx new file mode 100644 index 000000000000..452e17c7450f --- /dev/null +++ b/connectivity/source/inc/ado/Awrapadox.hxx @@ -0,0 +1,149 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ADO_AWRAPADOX_HXX_ +#define _CONNECTIVITY_ADO_AWRAPADOX_HXX_ + +#include <com/sun/star/beans/PropertyAttribute.hpp> + +#ifndef __User_FWD_DEFINED__ +#define __User_FWD_DEFINED__ +typedef struct _ADOUser User; +#endif /* __User_FWD_DEFINED__ */ + +#ifndef __Group_FWD_DEFINED__ +#define __Group_FWD_DEFINED__ +typedef struct _ADOGroup Group; +#endif /* __Group_FWD_DEFINED__ */ + +#ifndef __Column_FWD_DEFINED__ +#define __Column_FWD_DEFINED__ +typedef struct _ADOColumn Column; +#endif /* __Column_FWD_DEFINED__ */ + +#ifndef __Index_FWD_DEFINED__ +#define __Index_FWD_DEFINED__ +typedef struct _ADOIndex Index; +#endif /* __cplusplus */ + +#ifndef __Key_FWD_DEFINED__ +#define __Key_FWD_DEFINED__ +typedef struct _ADOKey Key; +#endif /* __Key_FWD_DEFINED__ */ + +#ifndef __Table_FWD_DEFINED__ +#define __Table_FWD_DEFINED__ +typedef struct _ADOTable Table; +#endif /* __Table_FWD_DEFINED__ */ + + +#include "ado_pre_sys_include.h" +#include <adoint.h> +#include <adoctint.h> +#include "ado_post_sys_include.h" + + +#include "ado/Aolewrap.hxx" +#include "ado/Aolevariant.hxx" +#include "ado/adoimp.hxx" +#include "ado/Awrapado.hxx" +#include "ado/WrapColumn.hxx" +#include "ado/WrapIndex.hxx" +#include "ado/WrapKey.hxx" +#include "ado/WrapTable.hxx" +#include "ado/WrapCatalog.hxx" + +namespace connectivity +{ + namespace ado + { + class WpADOView : public WpOLEBase<ADOView> + { + public: + WpADOView(ADOView* pInt=NULL) : WpOLEBase<ADOView>(pInt){} + WpADOView(const WpADOView& rhs){operator=(rhs);} + + inline WpADOView& operator=(const WpADOView& rhs) + {WpOLEBase<ADOView>::operator=(rhs); return *this;} + + ::rtl::OUString get_Name() const; + void get_Command(OLEVariant& _rVar) const; + void put_Command(OLEVariant& _rVar); + }; + + class WpADOGroup : public WpOLEBase<ADOGroup> + { + public: + WpADOGroup(ADOGroup* pInt=NULL) : WpOLEBase<ADOGroup>(pInt){} + WpADOGroup(const WpADOGroup& rhs){operator=(rhs);} + + inline WpADOGroup& operator=(const WpADOGroup& rhs) + {WpOLEBase<ADOGroup>::operator=(rhs); return *this;} + + void Create(); + + ::rtl::OUString get_Name() const; + void put_Name(const ::rtl::OUString& _rName); + RightsEnum GetPermissions( + /* [in] */ const OLEVariant& Name, + /* [in] */ ObjectTypeEnum ObjectType); + sal_Bool SetPermissions( + /* [in] */ const OLEVariant& Name, + /* [in] */ ObjectTypeEnum ObjectType, + /* [in] */ ActionEnum Action, + /* [in] */ RightsEnum Rights); + WpADOUsers get_Users( ); + }; + + class WpADOUser : public WpOLEBase<_ADOUser> + { + public: + WpADOUser(_ADOUser* pInt=NULL) : WpOLEBase<_ADOUser>(pInt){} + WpADOUser(const WpADOUser& rhs){operator=(rhs);} + + inline WpADOUser& operator=(const WpADOUser& rhs) + {WpOLEBase<_ADOUser>::operator=(rhs); return *this;} + + void Create(); + + ::rtl::OUString get_Name() const; + void put_Name(const ::rtl::OUString& _rName); + sal_Bool ChangePassword(const ::rtl::OUString& _rPwd,const ::rtl::OUString& _rNewPwd); + WpADOGroups get_Groups(); + RightsEnum GetPermissions( + /* [in] */ const OLEVariant& Name, + /* [in] */ ObjectTypeEnum ObjectType); + sal_Bool SetPermissions( + /* [in] */ const OLEVariant& Name, + /* [in] */ ObjectTypeEnum ObjectType, + /* [in] */ ActionEnum Action, + /* [in] */ RightsEnum Rights); + }; + } +} +#endif // _CONNECTIVITY_ADO_AWRAPADOX_HXX_ + diff --git a/connectivity/source/inc/ado/WrapCatalog.hxx b/connectivity/source/inc/ado/WrapCatalog.hxx new file mode 100644 index 000000000000..5c3321777ba0 --- /dev/null +++ b/connectivity/source/inc/ado/WrapCatalog.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CONNECTIVITY_ADO_WRAP_CATALOG_HXX +#define CONNECTIVITY_ADO_WRAP_CATALOG_HXX + +#include "ado/WrapTypeDefs.hxx" + +namespace connectivity +{ + namespace ado + { + class WpADOCatalog : public WpOLEBase<_ADOCatalog> + { + public: + WpADOCatalog(_ADOCatalog* pInt = NULL) : WpOLEBase<_ADOCatalog>(pInt){} + WpADOCatalog(const WpADOCatalog& rhs){operator=(rhs);} + + inline WpADOCatalog& operator=(const WpADOCatalog& rhs) + {WpOLEBase<_ADOCatalog>::operator=(rhs); return *this;} + + ::rtl::OUString GetObjectOwner(const ::rtl::OUString& _rName, ObjectTypeEnum _eNum); + + void putref_ActiveConnection(IDispatch* pCon); + WpADOTables get_Tables(); + WpADOViews get_Views(); + WpADOGroups get_Groups(); + WpADOUsers get_Users(); + ADOProcedures* get_Procedures(); + void Create(); + }; + } +} + +#endif //CONNECTIVITY_ADO_WRAP_CATALOG_HXX diff --git a/connectivity/source/inc/ado/WrapColumn.hxx b/connectivity/source/inc/ado/WrapColumn.hxx new file mode 100644 index 000000000000..35b84be6ee8a --- /dev/null +++ b/connectivity/source/inc/ado/WrapColumn.hxx @@ -0,0 +1,72 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CONNECTIVITY_ADO_WRAP_COLUMN_HXX +#define CONNECTIVITY_ADO_WRAP_COLUMN_HXX + +#include "ado/Aolewrap.hxx" + +#include "ado_pre_sys_include.h" +#include <adoint.h> +#include "ado_post_sys_include.h" + +namespace connectivity +{ + namespace ado + { + class WpADOColumn : public WpOLEBase<_ADOColumn> + { + public: + WpADOColumn(_ADOColumn* pInt=NULL) : WpOLEBase<_ADOColumn>(pInt){} + WpADOColumn(const WpADOColumn& rhs){operator=(rhs);} + + void Create(); + + inline WpADOColumn& operator=(const WpADOColumn& rhs) + {WpOLEBase<_ADOColumn>::operator=(rhs); return *this;} + + ::rtl::OUString get_Name() const; + ::rtl::OUString get_RelatedColumn() const; + void put_Name(const ::rtl::OUString& _rName); + void put_RelatedColumn(const ::rtl::OUString& _rName); + DataTypeEnum get_Type() const; + void put_Type(const DataTypeEnum& _eNum) ; + sal_Int32 get_Precision() const; + void put_Precision(sal_Int32 _nPre) ; + sal_uInt8 get_NumericScale() const; + void put_NumericScale(sal_Int8 _nScale); + SortOrderEnum get_SortOrder() const; + void put_SortOrder(SortOrderEnum _nScale); + sal_Int32 get_DefinedSize() const; + ColumnAttributesEnum get_Attributes() const; + sal_Bool put_Attributes(const ColumnAttributesEnum& _eNum); + WpADOProperties get_Properties() const; + void put_ParentCatalog(/* [in] */ _ADOCatalog __RPC_FAR *ppvObject); + }; + } +} + +#endif //CONNECTIVITY_ADO_WRAP_COLUMN_HXX diff --git a/connectivity/source/inc/ado/WrapIndex.hxx b/connectivity/source/inc/ado/WrapIndex.hxx new file mode 100644 index 000000000000..4968d756d05c --- /dev/null +++ b/connectivity/source/inc/ado/WrapIndex.hxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CONNECTIVITY_ADO_WRAP_INDEX_HXX +#define CONNECTIVITY_ADO_WRAP_INDEX_HXX + +#include "ado/WrapTypeDefs.hxx" + +namespace connectivity +{ + namespace ado + { + class WpADOIndex : public WpOLEBase<_ADOIndex> + { + public: + WpADOIndex(_ADOIndex* pInt=NULL) : WpOLEBase<_ADOIndex>(pInt){} + WpADOIndex(const WpADOIndex& rhs){operator=(rhs);} + + inline WpADOIndex& operator=(const WpADOIndex& rhs) + {WpOLEBase<_ADOIndex>::operator=(rhs); return *this;} + + void Create(); + + ::rtl::OUString get_Name() const; + void put_Name(const ::rtl::OUString& _rName); + sal_Bool get_Clustered() const; + void put_Clustered(sal_Bool _b); + sal_Bool get_Unique() const; + void put_Unique(sal_Bool _b); + sal_Bool get_PrimaryKey() const; + void put_PrimaryKey(sal_Bool _b); + WpADOColumns get_Columns() const; + }; + } +} + +#endif //CONNECTIVITY_ADO_WRAP_INDEX_HXX diff --git a/connectivity/source/inc/ado/WrapKey.hxx b/connectivity/source/inc/ado/WrapKey.hxx new file mode 100644 index 000000000000..fb7dcd3181b1 --- /dev/null +++ b/connectivity/source/inc/ado/WrapKey.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CONNECTIVITY_ADO_WRAP_KEY_HXX +#define CONNECTIVITY_ADO_WRAP_KEY_HXX + +#include "ado/WrapTypeDefs.hxx" + +namespace connectivity +{ + namespace ado + { + class WpADOKey : public WpOLEBase<ADOKey> + { + public: + WpADOKey(ADOKey* pInt=NULL) : WpOLEBase<ADOKey>(pInt){} + WpADOKey(const WpADOKey& rhs){operator=(rhs);} + + inline WpADOKey& operator=(const WpADOKey& rhs) + {WpOLEBase<ADOKey>::operator=(rhs); return *this;} + + void Create(); + + ::rtl::OUString get_Name() const; + void put_Name(const ::rtl::OUString& _rName); + KeyTypeEnum get_Type() const; + void put_Type(const KeyTypeEnum& _eNum) ; + ::rtl::OUString get_RelatedTable() const; + void put_RelatedTable(const ::rtl::OUString& _rName); + RuleEnum get_DeleteRule() const; + void put_DeleteRule(const RuleEnum& _eNum) ; + RuleEnum get_UpdateRule() const; + void put_UpdateRule(const RuleEnum& _eNum) ; + WpADOColumns get_Columns() const; + }; + } +} + +#endif //CONNECTIVITY_ADO_WRAP_KEY_HXX diff --git a/connectivity/source/inc/ado/WrapTable.hxx b/connectivity/source/inc/ado/WrapTable.hxx new file mode 100644 index 000000000000..b66f41017399 --- /dev/null +++ b/connectivity/source/inc/ado/WrapTable.hxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CONNECTIVITY_ADO_WRAP_TABLE_HXX +#define CONNECTIVITY_ADO_WRAP_TABLE_HXX + +#include "ado/WrapTypeDefs.hxx" + +namespace connectivity +{ + namespace ado + { + class WpADOCatalog; + + class WpADOTable : public WpOLEBase<_ADOTable> + { + public: + WpADOTable(_ADOTable* pInt=NULL) : WpOLEBase<_ADOTable>(pInt){} + WpADOTable(const WpADOTable& rhs){operator=(rhs);} + + inline WpADOTable& operator=(const WpADOTable& rhs) + {WpOLEBase<_ADOTable>::operator=(rhs); return *this;} + + void Create(); + + ::rtl::OUString get_Name() const; + void put_Name(const ::rtl::OUString& _rName); + ::rtl::OUString get_Type() const; + WpADOColumns get_Columns() const; + WpADOIndexes get_Indexes() const; + WpADOKeys get_Keys() const; + WpADOCatalog get_ParentCatalog() const; + WpADOProperties get_Properties() const; + void putref_ParentCatalog(/* [in] */ _ADOCatalog __RPC_FAR *ppvObject); + }; + + + typedef WpOLEAppendCollection<ADOTables, _ADOTable, WpADOTable> WpADOTables; + } +} + +#endif //CONNECTIVITY_ADO_WRAP_TABLE_HXX diff --git a/connectivity/source/inc/ado/WrapTypeDefs.hxx b/connectivity/source/inc/ado/WrapTypeDefs.hxx new file mode 100644 index 000000000000..bcf4156759d8 --- /dev/null +++ b/connectivity/source/inc/ado/WrapTypeDefs.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CONNECTIVITY_ADO_WRAP_TYPEDEFS_HXX +#define CONNECTIVITY_ADO_WRAP_TYPEDEFS_HXX + + +namespace connectivity +{ + namespace ado + { + class WpADOTable; + class WpADOKey; + class WpADOIndex; + class WpADOColumn; + class WpADOGroup; + class WpADOView; + class WpADOUser; + + typedef WpOLEAppendCollection<ADOTables, _ADOTable, WpADOTable> WpADOTables; + typedef WpOLEAppendCollection<ADOKeys, ADOKey, WpADOKey> WpADOKeys; + typedef WpOLEAppendCollection<ADOIndexes, _ADOIndex, WpADOIndex> WpADOIndexes; + typedef WpOLEAppendCollection<ADOColumns, _ADOColumn, WpADOColumn> WpADOColumns; + typedef WpOLEAppendCollection<ADOGroups, ADOGroup, WpADOGroup> WpADOGroups; + typedef WpOLEAppendCollection<ADOViews, ADOView, WpADOView> WpADOViews; + typedef WpOLEAppendCollection<ADOUsers, _ADOUser, WpADOUser> WpADOUsers; + } +} + +#endif //CONNECTIVITY_ADO_WRAP_TYPEDEFS_HXX diff --git a/connectivity/source/inc/ado/adoimp.hxx b/connectivity/source/inc/ado/adoimp.hxx new file mode 100644 index 000000000000..a7254ff0d020 --- /dev/null +++ b/connectivity/source/inc/ado/adoimp.hxx @@ -0,0 +1,112 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ADO_ADOIMP_HXX_ +#define _CONNECTIVITY_ADO_ADOIMP_HXX_ + +#include <com/sun/star/sdbc/SQLException.hpp> + +#include "ado_pre_sys_include.h" +#include <adoctint.h> +#include "ado_post_sys_include.h" + +struct ADOConnection; +enum DataTypeEnum; +namespace connectivity +{ + namespace ado + { + + class WpADOField; + class OLEString; + class ADOS + { + public: + // Auch hier: BSTR mit SysFreeString() freigeben! + static OLEString& GetKeyStr(); + + static const CLSID CLSID_ADOCATALOG_25; + static const IID IID_ADOCATALOG_25; + + static const CLSID CLSID_ADOCONNECTION_21; + static const IID IID_ADOCONNECTION_21; + + static const CLSID CLSID_ADOCOMMAND_21; + static const IID IID_ADOCOMMAND_21; + + static const CLSID CLSID_ADORECORDSET_21; + static const IID IID_ADORECORDSET_21; + + static const CLSID CLSID_ADOINDEX_25; + static const IID IID_ADOINDEX_25; + + static const CLSID CLSID_ADOCOLUMN_25; + static const IID IID_ADOCOLUMN_25; + + static const CLSID CLSID_ADOKEY_25; + static const IID IID_ADOKEY_25; + + static const CLSID CLSID_ADOTABLE_25; + static const IID IID_ADOTABLE_25; + + static const CLSID CLSID_ADOGROUP_25; + static const IID IID_ADOGROUP_25; + + static const CLSID CLSID_ADOUSER_25; + static const IID IID_ADOUSER_25; + + static const CLSID CLSID_ADOVIEW_25; + static const IID IID_ADOVIEW_25; + + static void ThrowException(ADOConnection* _pAdoCon,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + static sal_Int32 MapADOType2Jdbc(DataTypeEnum eType); + static DataTypeEnum MapJdbc2ADOType(sal_Int32 _nType,sal_Int32 _nJetEngine); + static sal_Bool isJetEngine(sal_Int32 _nEngineType); + + static ObjectTypeEnum mapObjectType2Ado(sal_Int32 objType); + static sal_Int32 mapAdoType2Object(ObjectTypeEnum objType); + static sal_Int32 mapAdoRights2Sdbc(RightsEnum eRights); + static sal_Int32 mapRights2Ado(sal_Int32 nRights); + + static WpADOField getField(ADORecordset* _pRecordSet,sal_Int32 _nColumnIndex) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + + + } +} + +#define ADO_PROP(ItemName) \ + WpADOProperty aProp(aProps.GetItem(ItemName)); \ + OLEVariant aVar; \ + if(aProp.IsValid()) \ + aVar = aProp.GetValue(); \ + else \ + ADOS::ThrowException(*m_pADOConnection,*this); + + +#endif //_CONNECTIVITY_ADO_ADOIMP_HXX_ + + diff --git a/connectivity/source/inc/calc/CCatalog.hxx b/connectivity/source/inc/calc/CCatalog.hxx new file mode 100644 index 000000000000..8144e3012453 --- /dev/null +++ b/connectivity/source/inc/calc/CCatalog.hxx @@ -0,0 +1,50 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_CALC_CATALOG_HXX_ +#define _CONNECTIVITY_CALC_CATALOG_HXX_ + +#include "file/FCatalog.hxx" + +namespace connectivity +{ + namespace calc + { + class OCalcConnection; + class OCalcCatalog : public file::OFileCatalog + { + public: + virtual void refreshTables(); + + public: + OCalcCatalog(OCalcConnection* _pCon); + }; + } +} + +#endif // _CONNECTIVITY_CALC_CATALOG_HXX_ + diff --git a/connectivity/source/inc/calc/CColumns.hxx b/connectivity/source/inc/calc/CColumns.hxx new file mode 100644 index 000000000000..f87355867a78 --- /dev/null +++ b/connectivity/source/inc/calc/CColumns.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_CALC_COLUMNS_HXX_ +#define _CONNECTIVITY_CALC_COLUMNS_HXX_ + +#include "file/FColumns.hxx" + +namespace connectivity +{ + namespace calc + { + class OCalcColumns : public file::OColumns + { + protected: + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + public: + OCalcColumns(file::OFileTable* _pTable, + ::osl::Mutex& _rMutex, + const TStringVector &_rVector + ) : file::OColumns(_pTable,_rMutex,_rVector) + {} + + }; + } +} + +#endif // _CONNECTIVITY_CALC_COLUMNS_HXX_ + diff --git a/connectivity/source/inc/calc/CConnection.hxx b/connectivity/source/inc/calc/CConnection.hxx new file mode 100644 index 000000000000..ee6cd7180378 --- /dev/null +++ b/connectivity/source/inc/calc/CConnection.hxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_CALC_CONNECTION_HXX_ +#define _CONNECTIVITY_CALC_CONNECTION_HXX_ + +#include "file/FConnection.hxx" + +namespace com { namespace sun { namespace star { namespace sheet { + class XSpreadsheetDocument; +} } } } + + +namespace connectivity +{ + namespace calc + { + class ODriver; + class OCalcConnection : public file::OConnection + { + // the spreadsheet document: + ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument > m_xDoc; + ::rtl::OUString m_sPassword; + String m_aFileName; + oslInterlockedCount m_nDocCount; + + public: + OCalcConnection(ODriver* _pDriver); + virtual ~OCalcConnection(); + + virtual void construct(const ::rtl::OUString& _rUrl, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rInfo ) + throw( ::com::sun::star::sdbc::SQLException); + + // XServiceInfo + DECLARE_SERVICE_INFO(); + + // OComponentHelper + virtual void SAL_CALL disposing(void); + + // XConnection + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > createCatalog(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > SAL_CALL createStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareCall( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + // no interface methods + ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument> acquireDoc(); + void releaseDoc(); + + class ODocHolder + { + OCalcConnection* m_pConnection; + ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument> m_xDoc; + public: + ODocHolder(OCalcConnection* _pConnection) : m_pConnection(_pConnection) + { + m_xDoc = m_pConnection->acquireDoc(); + } + ~ODocHolder() + { + m_xDoc.clear(); + m_pConnection->releaseDoc(); + } + ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument> getDoc() const { return m_xDoc; } + }; + }; + } +} + +#endif // _CONNECTIVITY_CALC_CONNECTION_HXX_ + diff --git a/connectivity/source/inc/calc/CDatabaseMetaData.hxx b/connectivity/source/inc/calc/CDatabaseMetaData.hxx new file mode 100644 index 000000000000..c2eff7deddf8 --- /dev/null +++ b/connectivity/source/inc/calc/CDatabaseMetaData.hxx @@ -0,0 +1,61 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_CALC_DATABASEMETADATA_HXX_ +#define _CONNECTIVITY_CALC_DATABASEMETADATA_HXX_ + +#include "file/FDatabaseMetaData.hxx" + +namespace connectivity +{ + namespace calc + { + //************************************************************** + //************ Class: java.sql.DatabaseMetaDataDate + //************************************************************** + + class OCalcDatabaseMetaData : public file::ODatabaseMetaData + { + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > impl_getTypeInfo_throw(); + virtual ::rtl::OUString SAL_CALL getURL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + 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 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTables( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + protected: + virtual ~OCalcDatabaseMetaData(); + public: + OCalcDatabaseMetaData(file::OConnection* _pCon); + }; + } +} + +#endif // _CONNECTIVITY_CALC_DATABASEMETADATA_HXX_ + diff --git a/connectivity/source/inc/calc/CDriver.hxx b/connectivity/source/inc/calc/CDriver.hxx new file mode 100644 index 000000000000..6e98d9b3f00a --- /dev/null +++ b/connectivity/source/inc/calc/CDriver.hxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_CALC_DRIVER_HXX_ +#define _CONNECTIVITY_CALC_DRIVER_HXX_ + +#include "file/FDriver.hxx" + +namespace connectivity +{ + namespace calc + { + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL + ODriver_CreateInstance(const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) + throw( ::com::sun::star::uno::Exception ); + + class ODriver : public file::OFileDriver + { + public: + ODriver(const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) : + file::OFileDriver(_rxFactory){} + + static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); + ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + + // XDriver + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL + connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue >& info ) + throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) + throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} + +#endif //_CONNECTIVITY_CALC_DRIVER_HXX_ + diff --git a/connectivity/source/inc/calc/CPreparedStatement.hxx b/connectivity/source/inc/calc/CPreparedStatement.hxx new file mode 100644 index 000000000000..ddbf9816c3a9 --- /dev/null +++ b/connectivity/source/inc/calc/CPreparedStatement.hxx @@ -0,0 +1,50 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_CALC_PREPAREDSTATEMENT_HXX_ +#define _CONNECTIVITY_CALC_PREPAREDSTATEMENT_HXX_ + +#include "file/FPreparedStatement.hxx" + +namespace connectivity +{ + namespace calc + { + class OConnection; + class OCalcPreparedStatement : public file::OPreparedStatement + { + protected: + virtual file::OResultSet* createResultSet(); + public: + OCalcPreparedStatement( file::OConnection* _pConnection) : file::OPreparedStatement( _pConnection){} + DECLARE_SERVICE_INFO(); + }; + } +} + +#endif //_CONNECTIVITY_CALC_PREPAREDSTATEMENT_HXX_ + diff --git a/connectivity/source/inc/calc/CResultSet.hxx b/connectivity/source/inc/calc/CResultSet.hxx new file mode 100644 index 000000000000..f2f9045ad935 --- /dev/null +++ b/connectivity/source/inc/calc/CResultSet.hxx @@ -0,0 +1,90 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_CALC_RESULTSET_HXX_ +#define _CONNECTIVITY_CALC_RESULTSET_HXX_ + +#include "file/FResultSet.hxx" +#include <com/sun/star/sdbcx/XRowLocate.hpp> +#include <com/sun/star/sdbcx/XDeleteRows.hpp> +#include <cppuhelper/implbase2.hxx> + +namespace connectivity +{ + namespace calc + { + class OCalcResultSet; + // these typedef's are only necessary for the compiler + typedef ::cppu::ImplHelper2< ::com::sun::star::sdbcx::XRowLocate, + ::com::sun::star::sdbcx::XDeleteRows> OCalcResultSet_BASE; + typedef file::OResultSet OCalcResultSet_BASE2; + typedef ::comphelper::OPropertyArrayUsageHelper<OCalcResultSet> OCalcResultSet_BASE3; + + + class OCalcResultSet : public OCalcResultSet_BASE2, + public OCalcResultSet_BASE, + public OCalcResultSet_BASE3 + { + sal_Bool m_bBookmarkable; + protected: + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + virtual sal_Bool fillIndexValues(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier> &_xIndex); + public: + DECLARE_SERVICE_INFO(); + + OCalcResultSet( file::OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator); + + private: + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + + // XRowLocate + virtual ::com::sun::star::uno::Any SAL_CALL getBookmark( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL moveRelativeToBookmark( const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL compareBookmarks( const ::com::sun::star::uno::Any& first, const ::com::sun::star::uno::Any& second ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL hashBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XDeleteRows + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + virtual sal_Bool isRowDeleted() const { return sal_False; } + + }; + } +} + +#endif //_CONNECTIVITY_CALC_RESULTSET_HXX_ + diff --git a/connectivity/source/inc/calc/CStatement.hxx b/connectivity/source/inc/calc/CStatement.hxx new file mode 100644 index 000000000000..1a44a2029e09 --- /dev/null +++ b/connectivity/source/inc/calc/CStatement.hxx @@ -0,0 +1,50 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_CALC_STATEMENT_HXX_ +#define _CONNECTIVITY_CALC_STATEMENT_HXX_ + +#include "file/FStatement.hxx" + +namespace connectivity +{ + namespace calc + { + class OConnection; + class OCalcStatement : public file::OStatement + { + protected: + virtual file::OResultSet* createResultSet(); + public: + OCalcStatement( file::OConnection* _pConnection) : file::OStatement( _pConnection){} + DECLARE_SERVICE_INFO(); + }; + } +} + +#endif //_CONNECTIVITY_CALC_STATEMENT_HXX_ + diff --git a/connectivity/source/inc/calc/CTable.hxx b/connectivity/source/inc/calc/CTable.hxx new file mode 100644 index 000000000000..fddd29d72506 --- /dev/null +++ b/connectivity/source/inc/calc/CTable.hxx @@ -0,0 +1,107 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_CALC_TABLE_HXX_ +#define _CONNECTIVITY_CALC_TABLE_HXX_ + +#include "file/FTable.hxx" +#include <tools/date.hxx> + +namespace com { namespace sun { namespace star { namespace sheet { + class XSpreadsheet; + class XSpreadsheetDocument; +} } } } + +namespace com { namespace sun { namespace star { namespace util { + class XNumberFormats; +} } } } + + +namespace connectivity +{ + namespace calc + { + typedef file::OFileTable OCalcTable_BASE; + class OCalcConnection; + + typedef ::std::map< ::rtl::OUString, + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed>, + comphelper::UStringMixLess > OContainer; + + class OCalcTable : public OCalcTable_BASE + { + private: + ::std::vector<sal_Int32> m_aTypes; // holds all type for columns just to avoid to ask the propertyset + ::std::vector<sal_Int32> m_aPrecisions; // same as aboth + ::std::vector<sal_Int32> m_aScales; + ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet > m_xSheet; + OCalcConnection* m_pConnection; + sal_Int32 m_nStartCol; + sal_Int32 m_nStartRow; + sal_Int32 m_nDataCols; + sal_Int32 m_nDataRows; + sal_Bool m_bHasHeaders; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats > m_xFormats; + ::Date m_aNullDate; + + void fillColumns(); + + protected: + virtual void FileClose(); + public: + virtual void refreshColumns(); + virtual void refreshIndexes(); + + public: + OCalcTable( sdbcx::OCollection* _pTables,OCalcConnection* _pConnection, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _Type, + const ::rtl::OUString& _Description = ::rtl::OUString(), + const ::rtl::OUString& _SchemaName = ::rtl::OUString(), + const ::rtl::OUString& _CatalogName = ::rtl::OUString() + ); + + virtual sal_Int32 getCurrentLastPos() const; + virtual sal_Bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos); + virtual sal_Bool fetchRow(OValueRefRow& _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 + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL disposing(void); + + // 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(); + + void construct(); + }; + } +} + +#endif // _CONNECTIVITY_CALC_TABLE_HXX_ + diff --git a/connectivity/source/inc/calc/CTables.hxx b/connectivity/source/inc/calc/CTables.hxx new file mode 100644 index 000000000000..08bcb98df463 --- /dev/null +++ b/connectivity/source/inc/calc/CTables.hxx @@ -0,0 +1,52 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_CALC_TABLES_HXX_ +#define _CONNECTIVITY_CALC_TABLES_HXX_ + +#include "file/FTables.hxx" + +namespace connectivity +{ + namespace calc + { + typedef file::OTables OCalcTables_BASE; + + class OCalcTables : public OCalcTables_BASE + { + protected: + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + public: + OCalcTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, + const TStringVector &_rVector) : OCalcTables_BASE(_rMetaData,_rParent,_rMutex,_rVector) + {} + }; + } +} + +#endif // _CONNECTIVITY_CALC_TABLES_HXX_ + diff --git a/connectivity/source/inc/dbase/DCatalog.hxx b/connectivity/source/inc/dbase/DCatalog.hxx new file mode 100644 index 000000000000..50a0ae607b6f --- /dev/null +++ b/connectivity/source/inc/dbase/DCatalog.hxx @@ -0,0 +1,49 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_CATALOG_HXX_ +#define _CONNECTIVITY_DBASE_CATALOG_HXX_ + +#include "file/FCatalog.hxx" + +namespace connectivity +{ + namespace dbase + { + class ODbaseConnection; + class ODbaseCatalog : public file::OFileCatalog + { + public: + virtual void refreshTables(); + + public: + ODbaseCatalog(ODbaseConnection* _pCon); + }; + } +} +#endif // _CONNECTIVITY_DBASE_CATALOG_HXX_ + diff --git a/connectivity/source/inc/dbase/DCode.hxx b/connectivity/source/inc/dbase/DCode.hxx new file mode 100644 index 000000000000..e00ed85b7863 --- /dev/null +++ b/connectivity/source/inc/dbase/DCode.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CONNECTIVITY_DBASE_DCODE_HXX +#define CONNECTIVITY_DBASE_DCODE_HXX + +#include "file/fanalyzer.hxx" +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include "file/fcode.hxx" + +namespace connectivity +{ + namespace file + { + class OConnection; + } + namespace dbase + { + class OFILEAnalyzer : public file::OSQLAnalyzer + { + public: + OFILEAnalyzer(file::OConnection* _pConnection) : file::OSQLAnalyzer(_pConnection){} + virtual file::OOperandAttr* createOperandAttr(sal_Int32 _nPos, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xCol, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _xIndexes=NULL); + }; + + // Attribute aus einer Ergebniszeile + class OFILEOperandAttr : public file::OOperandAttr + { + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xIndex; + public: + OFILEOperandAttr(sal_uInt16 _nPos, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xColumn, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _xIndexes=NULL); + + virtual sal_Bool isIndexed() const; + virtual file::OEvaluateSet* preProcess(file::OBoolOperator* pOp, file::OOperand* pRight = 0); + TYPEINFO(); + }; + } +} + +#endif // CONNECTIVITY_DBASE_DCODE_HXX + diff --git a/connectivity/source/inc/dbase/DColumns.hxx b/connectivity/source/inc/dbase/DColumns.hxx new file mode 100644 index 000000000000..b11e24d33661 --- /dev/null +++ b/connectivity/source/inc/dbase/DColumns.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_COLUMNS_HXX_ +#define _CONNECTIVITY_DBASE_COLUMNS_HXX_ + +#include "file/FColumns.hxx" + +namespace connectivity +{ + namespace dbase + { + class ODbaseColumns : public file::OColumns + { + protected: + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor(); + virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); + public: + ODbaseColumns(file::OFileTable* _pTable, + ::osl::Mutex& _rMutex, + const TStringVector &_rVector + ) : file::OColumns(_pTable,_rMutex,_rVector) + {} + }; + } +} +#endif // _CONNECTIVITY_DBASE_COLUMNS_HXX_ + diff --git a/connectivity/source/inc/dbase/DConnection.hxx b/connectivity/source/inc/dbase/DConnection.hxx new file mode 100644 index 000000000000..50192586d8a7 --- /dev/null +++ b/connectivity/source/inc/dbase/DConnection.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_DCONNECTION_HXX_ +#define _CONNECTIVITY_DBASE_DCONNECTION_HXX_ + +#include "file/FConnection.hxx" + +namespace connectivity +{ + namespace dbase + { + class ODriver; + typedef file::OConnection ODbaseConnection_Base; + class ODbaseConnection : public ODbaseConnection_Base + { + protected: + virtual ~ODbaseConnection(); + public: + ODbaseConnection(ODriver* _pDriver); + // XServiceInfo + DECLARE_SERVICE_INFO(); + + // XConnection + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > createCatalog(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > SAL_CALL createStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareCall( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_DBASE_DCONNECTION_HXX_ + diff --git a/connectivity/source/inc/dbase/DDatabaseMetaData.hxx b/connectivity/source/inc/dbase/DDatabaseMetaData.hxx new file mode 100644 index 000000000000..68159f0dce34 --- /dev/null +++ b/connectivity/source/inc/dbase/DDatabaseMetaData.hxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_ODATABASEMETADATA_HXX_ +#define _CONNECTIVITY_DBASE_ODATABASEMETADATA_HXX_ + +#include "file/FDatabaseMetaData.hxx" + +namespace connectivity +{ + namespace dbase + { + //************************************************************** + //************ Class: java.sql.DatabaseMetaDataDate + //************************************************************** + + class ODbaseDatabaseMetaData : public file::ODatabaseMetaData + { + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > impl_getTypeInfo_throw(); + virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getURL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getIndexInfo( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Bool unique, sal_Bool approximate ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + 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); + + virtual sal_Bool impl_storesMixedCaseQuotedIdentifiers_throw( ); + virtual sal_Bool impl_supportsMixedCaseQuotedIdentifiers_throw( ); + protected: + virtual ~ODbaseDatabaseMetaData(); + public: + ODbaseDatabaseMetaData(file::OConnection* _pCon); + }; + } +} +#endif // _CONNECTIVITY_DBASE_ODATABASEMETADATA_HXX_ + diff --git a/connectivity/source/inc/dbase/DDatabaseMetaDataResultSet.hxx b/connectivity/source/inc/dbase/DDatabaseMetaDataResultSet.hxx new file mode 100644 index 000000000000..b6fbdb231d4d --- /dev/null +++ b/connectivity/source/inc/dbase/DDatabaseMetaDataResultSet.hxx @@ -0,0 +1,196 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_ADATABASEMETADATARESULTSET_HXX_ +#define _CONNECTIVITY_FILE_ADATABASEMETADATARESULTSET_HXX_ + +#include <com/sun/star/sdbc/XResultSet.hpp> +#include <com/sun/star/sdbc/XRow.hpp> +#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> +#include <com/sun/star/sdbc/XCloseable.hpp> +#include <com/sun/star/sdbc/XColumnLocate.hpp> +#include <com/sun/star/util/XCancellable.hpp> +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#include <com/sun/star/sdbc/XResultSetUpdate.hpp> +#include <com/sun/star/sdbc/XRowUpdate.hpp> +#include <cppuhelper/compbase7.hxx> +#include <comphelper/proparrhlp.hxx> +#ifndef _CONNECTIVITY_FILE_ASTATEMENT_HXX_ +#include "file/FStatement.hxx" +#endif +#include "connectivity/CommonTools.hxx" +#include <comphelper/propertycontainer.hxx> + +namespace connectivity +{ + namespace file + { + namespace ::com::sun::star::sdbc = ::com::sun::star::sdbc; + namespace ::com::sun::star::beans = ::com::sun::star::beans; + namespace ::com::sun::star::util = ::com::sun::star::util; + + class ODatabaseMetaDataResultSetMetaData; + typedef ::cppu::WeakComponentImplHelper7< ::com::sun::star::sdbc::XResultSet, + ::com::sun::star::sdbc::XRow, + ::com::sun::star::sdbc::XResultSetMetaDataSupplier, + ::com::sun::star::util::XCancellable, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::sdbc::XCloseable, + ::com::sun::star::sdbc::XColumnLocate> ODatabaseMetaDataResultSet_BASE; + + DECLARE_STL_VECTOR(::com::sun::star::uno::Any,ORow); + DECLARE_STL_VECTOR(ORow, ORows); + + class ODatabaseMetaDataResultSet : public comphelper::OBaseMutex, + public ODatabaseMetaDataResultSet_BASE, + public ::comphelper::OPropertyContainer, + public ::comphelper::OPropertyArrayUsageHelper<ODatabaseMetaDataResultSet> + { + + + ORows m_aRows; + ORowsIterator m_aRowsIter; + ::com::sun::star::uno::WeakReferenceHelper + m_aStatement; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> + m_xMetaData; + sal_Int32 m_nRowPos; + sal_Int32 m_nColPos; + + sal_Int32 m_nFetchSize; + sal_Int32 m_nResultSetType; + sal_Int32 m_nFetchDirection; + sal_Int32 m_nResultSetConcurrency; + + sal_Bool m_bWasNull; + sal_Bool m_bBOF; + + void construct(); + + protected: + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + + virtual ~ODatabaseMetaDataResultSet(); + public: + DECLARE_CTY_DEFAULTS(ODatabaseMetaDataResultSet_BASE); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + ODatabaseMetaDataResultSet( ); + + + void setRows(const ORows& _rRows) { m_aRows = _rRows; } + + void setCatalogsMap(); + void setSchemasMap(); + void setColumnPrivilegesMap(); + void setColumnsMap(); + void setTablesMap(); + void setTableTypes(); + void setProcedureColumnsMap(); + void setProceduresMap(); + void setExportedKeysMap(); + void setImportedKeysMap(); + void setPrimaryKeysMap(); + void setIndexInfoMap(); + void setTablePrivilegesMap(); + void setCrossReferenceMap(); + void setTypeInfoMap(); + + private: + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) + { + return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); + } + // XResultSet + virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XRow + virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XResultSetMetaDataSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCancellable + virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) 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); + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } + +} +#endif // _CONNECTIVITY_FILE_ADATABASEMETADATARESULTSET_HXX_ + diff --git a/connectivity/source/inc/dbase/DDatabaseMetaDataResultSetMetaData.hxx b/connectivity/source/inc/dbase/DDatabaseMetaDataResultSetMetaData.hxx new file mode 100644 index 000000000000..11cdb41c6545 --- /dev/null +++ b/connectivity/source/inc/dbase/DDatabaseMetaDataResultSetMetaData.hxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_ADATABASEMETADATARESULTSETMETADATA_HXX_ +#define _CONNECTIVITY_FILE_ADATABASEMETADATARESULTSETMETADATA_HXX_ + +#include <com/sun/star/sdbc/XResultSetMetaData.hpp> +#include <cppuhelper/implbase1.hxx> +#ifndef _VECTOR_ +#include <vector> +#endif +#include "FDatabaseMetaDataResultSet.hxx" +#include "OColumn.hxx" + +namespace connectivity +{ + namespace file + { + //************************************************************** + //************ Class: ResultSetMetaData + //************************************************************** + typedef ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XResultSetMetaData> ODatabaseMetaResultSetMetaData_BASE; + + class ODatabaseMetaDataResultSetMetaData : public ODatabaseMetaResultSetMetaData_BASE + { + friend class ODatabaseMetaDataResultSet; + + ::std::vector<sal_Int32> m_vMapping; // when not every column is needed + ::std::map<sal_Int32,connectivity::OColumn> m_mColumns; + ::std::map<sal_Int32,connectivity::OColumn>::const_iterator m_mColumnsIter; + + sal_Int32 m_nColCount; + + protected: + void setColumnPrivilegesMap(); + void setColumnsMap(); + void setTablesMap(); + void setProcedureColumnsMap(); + void setPrimaryKeysMap(); + void setIndexInfoMap(); + void setTablePrivilegesMap(); + void setCrossReferenceMap(); + void setTypeInfoMap(); + void setProceduresMap(); + void setTableTypes(); + public: + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + ODatabaseMetaDataResultSetMetaData( ODatabaseMetaDataResultSet* _pRes) + : m_nColCount(0) + { + } + ~ODatabaseMetaDataResultSetMetaData(); + + /// Avoid ambigous cast error from the compiler. + inline operator ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > () throw() + { return this; } + + virtual sal_Int32 SAL_CALL getColumnCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnLabel( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSchemaName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTableName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalogName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnTypeName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnServiceName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_FILE_ADATABASEMETARESULTSETMETADATA_HXX_ + + diff --git a/connectivity/source/inc/dbase/DDriver.hxx b/connectivity/source/inc/dbase/DDriver.hxx new file mode 100644 index 000000000000..cbdfbe03c920 --- /dev/null +++ b/connectivity/source/inc/dbase/DDriver.hxx @@ -0,0 +1,61 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_DDRIVER_HXX_ +#define _CONNECTIVITY_DBASE_DDRIVER_HXX_ + +#include <cppuhelper/compbase2.hxx> +#include "connectivity/CommonTools.hxx" +#include "file/FDriver.hxx" + +namespace connectivity +{ + namespace dbase + { + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ODriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ); + + class ODriver : public file::OFileDriver + { + public: + ODriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) : file::OFileDriver(_rxFactory){} + + // XInterface + static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); + // static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); + + ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + // XDriver + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } + +} +#endif //_CONNECTIVITY_DBASE_DDRIVER_HXX_ + diff --git a/connectivity/source/inc/dbase/DIndex.hxx b/connectivity/source/inc/dbase/DIndex.hxx new file mode 100644 index 000000000000..9155ba72bb87 --- /dev/null +++ b/connectivity/source/inc/dbase/DIndex.hxx @@ -0,0 +1,160 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_INDEX_HXX_ +#define _CONNECTIVITY_DBASE_INDEX_HXX_ + +#include "connectivity/sdbcx/VIndex.hxx" +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include "dbase/DTable.hxx" +#include "dbase/dindexnode.hxx" + +#define dBASE_III_GROUP "dBase III" + +namespace connectivity +{ + namespace dbase + { + class OIndexIterator; + class ONDXKey; + + typedef sdbcx::OIndex ODbaseIndex_BASE; + typedef file::OBoolOperator OBoolOperator_BASE; + typedef file::OOperand OOperand_BASE; + + class ODbaseIndex : public ODbaseIndex_BASE + { + friend SvStream& operator << (SvStream &rStream, ODbaseIndex&); + friend SvStream& operator >> (SvStream &rStream, ODbaseIndex&); + + friend class ONDXNode; + friend class ONDXPage; + friend class ONDXPagePtr; + friend class OIndexIterator; + + public: + //================================================================== + // Kopfsatz-Struktur, verbleibt im Speicher + //================================================================== + struct NDXHeader + { + sal_uInt32 db_rootpage; /* Position der Rootpage */ + sal_uInt32 db_pagecount; /* Anzahl Pages */ + sal_uInt8 db_frei[4]; /* reserviert */ + sal_uInt16 db_keylen; /* Laenge des Schluessels */ + sal_uInt16 db_maxkeys; /* Max. # keys pro Seite */ + sal_uInt16 db_keytype; /* Art des Schluessels + (0-Text) + (1-Numerisch) */ + sal_uInt16 db_keyrec; /* Laenge eines IndexSatzes + SatzNr + keylen */ + sal_uInt8 db_frei1[3]; /* reserviert */ + sal_uInt8 db_unique; /* eindeutig */ + char db_name[488]; /* index_name (Feldname) */ + }; + + private: + SvStream* m_pFileStream; // Stream zum Lesen/Schreiben des Index + NDXHeader m_aHeader; + ONDXPageList m_aCollector; // Pool von nicht mehr benoetigten Seiten + ONDXPagePtr m_aRoot, // Wurzel des b+ Baums + m_aCurLeaf; // aktuelles Blatt + USHORT m_nCurNode; // Position des aktuellen Knoten + + sal_uInt32 m_nPageCount, + m_nRootPage; + + ODbaseTable* m_pTable; + BOOL m_bUseCollector : 1; // Verwenden des GarbageCollectors + + ::rtl::OUString getCompletePath(); + void closeImpl(); + /* closes and kill the index file and throws an error. + */ + void impl_killFileAndthrowError_throw(sal_uInt16 _nErrorId,const ::rtl::OUString& _sFile); + protected: + virtual ~ODbaseIndex(); + public: + ODbaseIndex(ODbaseTable* _pTable); + ODbaseIndex(ODbaseTable* _pTable,const NDXHeader& _aHeader,const ::rtl::OUString& _Name); + + sal_Bool openIndexFile(); + virtual void refreshColumns(); + + // 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(); + + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + const ODbaseTable* getTable() const { return m_pTable; } + const NDXHeader& getHeader() const { return m_aHeader; } + virtual OIndexIterator* createIterator(OBoolOperator_BASE* pOp, + const OOperand_BASE* pOperand = NULL); + + void SetRootPos(sal_uInt32 nPos) {m_nRootPage = nPos;} + void SetPageCount(sal_uInt32 nCount) {m_nPageCount = nCount;} + + sal_uInt32 GetRootPos() {return m_nRootPage;} + sal_uInt32 GetPageCount() {return m_nPageCount;} + + 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& 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(); + BOOL DropImpl(); + + DECLARE_SERVICE_INFO(); + protected: + + ONDXPage* CreatePage(sal_uInt32 nPagePos, ONDXPage* pParent = NULL, BOOL bLoad = FALSE); + void Collect(ONDXPage*); + ONDXPagePtr getRoot(); + + sal_Bool isUnique() const { return m_IsUnique; } + BOOL UseCollector() const {return m_bUseCollector;} + // Tree operationen + void Insert(ONDXPagePtr aCurPage, ONDXNode& rNode); + void Release(BOOL bSave = TRUE); + BOOL ConvertToKey(ONDXKey* rKey, sal_uInt32 nRec, const ORowSetValue& rValue); + }; + + SvStream& operator << (SvStream &rStream, ODbaseIndex&); + SvStream& operator >> (SvStream &rStream, ODbaseIndex&); + } +} + +#endif // _CONNECTIVITY_DBASE_INDEX_HXX_ + + diff --git a/connectivity/source/inc/dbase/DIndexColumns.hxx b/connectivity/source/inc/dbase/DIndexColumns.hxx new file mode 100644 index 000000000000..be4f2577237e --- /dev/null +++ b/connectivity/source/inc/dbase/DIndexColumns.hxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_INDEXCOLUMNS_HXX_ +#define _CONNECTIVITY_DBASE_INDEXCOLUMNS_HXX_ + +#include "connectivity/sdbcx/VCollection.hxx" +#include "dbase/DIndex.hxx" +#include "dbase/DTable.hxx" + +namespace connectivity +{ + namespace dbase + { + class ODbaseIndexColumns : public sdbcx::OCollection + { + ODbaseIndex* m_pIndex; + protected: + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor(); + virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + public: + ODbaseIndexColumns( ODbaseIndex* _pIndex, + ::osl::Mutex& _rMutex, + const TStringVector &_rVector) + : sdbcx::OCollection(*_pIndex,_pIndex->getTable()->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers(),_rMutex,_rVector) + , m_pIndex(_pIndex) + {} + + }; + } +} +#endif // _CONNECTIVITY_DBASE_INDEXCOLUMNS_HXX_ + + diff --git a/connectivity/source/inc/dbase/DIndexIter.hxx b/connectivity/source/inc/dbase/DIndexIter.hxx new file mode 100644 index 000000000000..99ed3f37af91 --- /dev/null +++ b/connectivity/source/inc/dbase/DIndexIter.hxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_INDEXITER_HXX_ +#define _CONNECTIVITY_DBASE_INDEXITER_HXX_ + +#include "file/fcode.hxx" +#include "dbase/DIndex.hxx" +#include "dbase/dindexnode.hxx" + +namespace connectivity +{ + namespace dbase + { + //================================================================== + // IndexIterator + //================================================================== + class OIndexIterator + { + protected: + file::OBoolOperator* m_pOperator; + const file::OOperand* m_pOperand; + ODbaseIndex* m_pIndex; + ONDXPagePtr m_aRoot, + m_aCurLeaf; + USHORT m_nCurNode; + + protected: + ULONG Find(BOOL bFirst); + ULONG GetCompare(BOOL bFirst); + ULONG GetLike(BOOL bFirst); + ULONG GetNull(BOOL bFirst); + ULONG GetNotNull(BOOL bFirst); + + ONDXKey* GetFirstKey(ONDXPage* pPage, + const file::OOperand& rKey); + ONDXKey* GetNextKey(); + ODbaseIndex* GetIndex() const {return m_pIndex;} + + + public: + OIndexIterator(ODbaseIndex* pInd, + file::OBoolOperator* pOp, + const file::OOperand* pOper) + :m_pOperator(pOp) + ,m_pOperand(pOper) + ,m_pIndex(pInd) + ,m_nCurNode(NODE_NOTFOUND) + { + pInd->acquire(); + } + + virtual ~OIndexIterator(); + ULONG First(); + ULONG Next(); + + }; + } +} +#endif // _CONNECTIVITY_DBASE_INDEXITER_HXX_ + diff --git a/connectivity/source/inc/dbase/DIndexPage.hxx b/connectivity/source/inc/dbase/DIndexPage.hxx new file mode 100644 index 000000000000..ad67a7f7ee20 --- /dev/null +++ b/connectivity/source/inc/dbase/DIndexPage.hxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_INDEXPAGE_HXX_ +#define _CONNECTIVITY_DBASE_INDEXPAGE_HXX_ + +//#ifndef _REF_HXX +//#include <tools/ref.hxx> +//#endif +#include <vos/ref.hxx> +#include <tools/stream.hxx> +#ifndef _VECTOR_ +#include <vector> +#endif +//#ifndef _CONNECTIVITY_FILE_FCODE_HXX_ +//#include "file/fcode.hxx" +//#endif +//#ifndef _CONNECTIVITY_DBASE_INDEXNODE_HXX_ +//#include "dbase/dindexnode.hxx" +//#endif + +#if 0 +namespace connectivity +{ + namespace dbase + { + //================================================================== + // Index Seitenverweis + //================================================================== + // SV_DECL_REF(ONDXPage); // Basisklasse da weitere Informationen gehalten werden muessen + + class ONDXPage; + typedef vos::ORef<ONDXPage> ONDXPagePtr_BASE; + + class ONDXPagePtr : public ONDXPagePtr_BASE //ONDXPageRef + { + friend SvStream& operator << (SvStream &rStream, const ONDXPagePtr&); + friend SvStream& operator >> (SvStream &rStream, ONDXPagePtr&); + + UINT32 nPagePos; // Position in der Indexdatei + + public: + ONDXPagePtr(UINT32 nPos = 0):nPagePos(nPos){} + ONDXPagePtr(const ONDXPagePtr& rRef); + ONDXPagePtr(ONDXPage* pRefPage); + + ONDXPagePtr& operator=(const ONDXPagePtr& rRef); + ONDXPagePtr& operator=(ONDXPage* pPageRef); + + UINT32 GetPagePos() const {return nPagePos;} + BOOL HasPage() const {return nPagePos != 0;} + sal_Bool Is() const { return isValid(); } + void Clear() + { + unbind(); + } + }; + + SvStream& operator << (SvStream &rStream, const ONDXPagePtr&); + SvStream& operator >> (SvStream &rStream, ONDXPagePtr&); + } +} +#endif +#endif // _CONNECTIVITY_DBASE_INDEXPAGE_HXX_ + diff --git a/connectivity/source/inc/dbase/DIndexes.hxx b/connectivity/source/inc/dbase/DIndexes.hxx new file mode 100644 index 000000000000..e07e0cb90cb3 --- /dev/null +++ b/connectivity/source/inc/dbase/DIndexes.hxx @@ -0,0 +1,61 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_INDEXES_HXX_ +#define _CONNECTIVITY_DBASE_INDEXES_HXX_ + +#include "connectivity/sdbcx/VCollection.hxx" +#include "dbase/DTable.hxx" + +namespace connectivity +{ + namespace dbase + { + class ODbaseTable; + + typedef sdbcx::OCollection ODbaseIndexes_BASE; + + class ODbaseIndexes : public ODbaseIndexes_BASE + { + ODbaseTable* m_pTable; + protected: + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor(); + virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); + public: + ODbaseIndexes(ODbaseTable* _pTable, ::osl::Mutex& _rMutex, + const TStringVector &_rVector) : ODbaseIndexes_BASE(*_pTable,_pTable->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers(),_rMutex,_rVector) + , m_pTable(_pTable) + {} + + }; + } +} +#endif // _CONNECTIVITY_DBASE_INDEXES_HXX_ + diff --git a/connectivity/source/inc/dbase/DPreparedStatement.hxx b/connectivity/source/inc/dbase/DPreparedStatement.hxx new file mode 100644 index 000000000000..ca682e3383c8 --- /dev/null +++ b/connectivity/source/inc/dbase/DPreparedStatement.hxx @@ -0,0 +1,50 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_DPREPAREDSTATEMENT_HXX_ +#define _CONNECTIVITY_DBASE_DPREPAREDSTATEMENT_HXX_ + +#include "file/FPreparedStatement.hxx" + +namespace connectivity +{ + namespace dbase + { + class OConnection; + class ODbasePreparedStatement : public file::OPreparedStatement + { + protected: + virtual file::OResultSet* createResultSet(); + public: + ODbasePreparedStatement( file::OConnection* _pConnection) : file::OPreparedStatement( _pConnection){} + DECLARE_SERVICE_INFO(); + }; + } +} + +#endif //_CONNECTIVITY_DBASE_DPREPAREDSTATEMENT_HXX_ + diff --git a/connectivity/source/inc/dbase/DResultSet.hxx b/connectivity/source/inc/dbase/DResultSet.hxx new file mode 100644 index 000000000000..f84d749aabe8 --- /dev/null +++ b/connectivity/source/inc/dbase/DResultSet.hxx @@ -0,0 +1,90 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_DBASE_DRESULTSET_HXX_ +#define _CONNECTIVITY_DBASE_DRESULTSET_HXX_ + +#include "file/FResultSet.hxx" +#include <com/sun/star/sdbcx/XRowLocate.hpp> +#include <com/sun/star/sdbcx/XDeleteRows.hpp> +#include <cppuhelper/implbase2.hxx> + +namespace connectivity +{ + namespace dbase + { + class ODbaseResultSet; + // these typedef's are only necessary for the compiler + typedef ::cppu::ImplHelper2< ::com::sun::star::sdbcx::XRowLocate, + ::com::sun::star::sdbcx::XDeleteRows> ODbaseResultSet_BASE; + typedef file::OResultSet ODbaseResultSet_BASE2; + typedef ::comphelper::OPropertyArrayUsageHelper<ODbaseResultSet> ODbaseResultSet_BASE3; + + + class ODbaseResultSet : public ODbaseResultSet_BASE2, + public ODbaseResultSet_BASE, + public ODbaseResultSet_BASE3 + { + sal_Bool m_bBookmarkable; + protected: + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + virtual sal_Bool fillIndexValues(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier> &_xIndex); + virtual file::OSQLAnalyzer* createAnalyzer(); + public: + DECLARE_SERVICE_INFO(); + + ODbaseResultSet( file::OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + + // XRowLocate + virtual ::com::sun::star::uno::Any SAL_CALL getBookmark( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL moveRelativeToBookmark( const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL compareBookmarks( const ::com::sun::star::uno::Any& first, const ::com::sun::star::uno::Any& second ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL hashBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XDeleteRows + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + // own methods + sal_Int32 getCurrentFilePos() const; + + }; + } +} +#endif //_CONNECTIVITY_DBASE_DRESULTSET_HXX_ + diff --git a/connectivity/source/inc/dbase/DStatement.hxx b/connectivity/source/inc/dbase/DStatement.hxx new file mode 100644 index 000000000000..fae73931be30 --- /dev/null +++ b/connectivity/source/inc/dbase/DStatement.hxx @@ -0,0 +1,49 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_DSTATEMENT_HXX_ +#define _CONNECTIVITY_DBASE_DSTATEMENT_HXX_ + +#include "file/FStatement.hxx" + +namespace connectivity +{ + namespace dbase + { + class OConnection; + class ODbaseStatement : public file::OStatement + { + protected: + virtual file::OResultSet* createResultSet(); + public: + ODbaseStatement( file::OConnection* _pConnection) : file::OStatement( _pConnection){} + DECLARE_SERVICE_INFO(); + }; + } +} + +#endif //_CONNECTIVITY_DBASE_DSTATEMENT_HXX_ diff --git a/connectivity/source/inc/dbase/DTable.hxx b/connectivity/source/inc/dbase/DTable.hxx new file mode 100644 index 000000000000..cca6d97c41c6 --- /dev/null +++ b/connectivity/source/inc/dbase/DTable.hxx @@ -0,0 +1,185 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_TABLE_HXX_ +#define _CONNECTIVITY_DBASE_TABLE_HXX_ + +#include "file/FTable.hxx" +#include "connectivity/sdbcx/VColumn.hxx" +#include "connectivity/CommonTools.hxx" +#include <tools/urlobj.hxx> + + +namespace connectivity +{ + namespace dbase + { + typedef file::OFileTable ODbaseTable_BASE; + class ODbaseConnection; + + typedef ::std::map< ::rtl::OUString, + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed>, comphelper::UStringMixLess > OContainer; + + class ODbaseTable : public ODbaseTable_BASE + { + // der Typ einer dBase datei wird mit dem ersten Byte bestimmt + public: + enum DBFType { dBaseIII = 0x03, + dBaseIV = 0x04, + dBaseV = 0x05, + VisualFoxPro = 0x30, + VisualFoxProAuto = 0x31, // Visual FoxPro w. AutoIncrement field + dBaseFS = 0x43, + dBaseFSMemo = 0xB3, + dBaseIIIMemo = 0x83, + dBaseIVMemo = 0x8B, + dBaseIVMemoSQL = 0x8E, + FoxProMemo = 0xF5 + }; + enum DBFMemoType { MemodBaseIII = 0, + MemodBaseIV, + MemoFoxPro + }; + + private: + struct DBFHeader { /* Kopfsatz-Struktur */ + DBFType db_typ; /* Dateityp */ + BYTE db_aedat[3]; /* Datum der letzen Aenderung */ + /* JJ MM TT */ + sal_uInt32 db_anz; /* Anzahl der Saetze */ + USHORT db_kopf; /* laenge Kopfsatz-Struktur */ + USHORT db_slng; /* laenge der Daten-Saetze */ + BYTE db_frei[20]; /* reserviert */ + }; + struct DBFColumn { /* Feldbezeichner */ + BYTE db_fnm[11]; /* Feldname */ + BYTE db_typ; /* Feldtyp */ + UINT32 db_adr; /* Feldadresse */ + BYTE db_flng; /* Feldlaenge */ + BYTE db_dez; /* Dezimalstellen fuer N */ + BYTE db_frei2[14]; /* reserviert */ + }; + struct DBFMemoHeader + { + DBFMemoType db_typ; /* Dateityp */ + UINT32 db_next; /* naechster freier Block */ + USHORT db_size; /* Blockgroesse: dBase 3 fest */ + }; + + ::std::vector<sal_Int32> m_aTypes; // holds all type for columns just to avoid to ask the propertyset + ::std::vector<sal_Int32> m_aPrecisions; // same as aboth + ::std::vector<sal_Int32> m_aScales; + ::std::vector<sal_Int32> m_aRealFieldLengths; + DBFHeader m_aHeader; + DBFMemoHeader m_aMemoHeader; + SvStream* m_pMemoStream; + rtl_TextEncoding m_eEncoding; + 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,sal_Int32 _nPos); + 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, ORowSetValue& aVariable); + + BOOL WriteMemo(ORowSetValue& aVariable, ULONG& rBlockNr); + BOOL WriteBuffer(); + BOOL UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols); + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> isUniqueByColumnName(sal_Int32 _nColumnPos); + void AllocBuffer(); + + void throwInvalidDbaseFormat(); + void SAL_CALL renameImpl( const ::rtl::OUString& newName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); + void throwInvalidColumnType(const sal_uInt16 _nErrorId,const ::rtl::OUString& _sColumnName); + + protected: + virtual void FileClose(); +// using ::connectivity::sdbcx::OTableDescriptor_BASE::rBHelper; + + public: + virtual void refreshColumns(); + virtual void refreshIndexes(); + + public: + ODbaseTable( sdbcx::OCollection* _pTables,ODbaseConnection* _pConnection); + ODbaseTable( sdbcx::OCollection* _pTables,ODbaseConnection* _pConnection, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _Type, + const ::rtl::OUString& _Description = ::rtl::OUString(), + const ::rtl::OUString& _SchemaName = ::rtl::OUString(), + const ::rtl::OUString& _CatalogName = ::rtl::OUString() + ); + + void construct(); // can throw any exception + + virtual sal_Int32 getCurrentLastPos() const; + virtual sal_Bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos); + virtual sal_Bool fetchRow(OValueRefRow& _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 + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL disposing(void); + + // 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(); + + + virtual BOOL InsertRow(OValueRefVector& rRow, BOOL bFlush,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols); + virtual BOOL DeleteRow(const OSQLColumns& _rCols); + virtual BOOL UpdateRow(OValueRefVector& rRow, OValueRefRow& 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); + virtual void dropColumn(sal_Int32 _nPos); + + static String getEntry(file::OConnection* _pConnection,const ::rtl::OUString& _sURL ); + static BOOL Drop_Static(const ::rtl::OUString& _sUrl,sal_Bool _bHasMemoFields,sdbcx::OCollection* _pIndexes ); + + virtual void refreshHeader(); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> getMetaData() const; + }; + } +} +#endif // _CONNECTIVITY_DBASE_TABLE_HXX_ + diff --git a/connectivity/source/inc/dbase/DTables.hxx b/connectivity/source/inc/dbase/DTables.hxx new file mode 100644 index 000000000000..1ada68b8cf20 --- /dev/null +++ b/connectivity/source/inc/dbase/DTables.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_DBASE_TABLES_HXX_ +#define _CONNECTIVITY_DBASE_TABLES_HXX_ + +#include "file/FTables.hxx" + +namespace connectivity +{ + namespace dbase + { + // namespace ::com::sun::star::sdbcx = ::com::sun::star::sdbcx; + typedef file::OTables ODbaseTables_BASE; + + class ODbaseTables : public ODbaseTables_BASE + { + protected: + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor(); + virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); + public: + ODbaseTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, + const TStringVector &_rVector) : ODbaseTables_BASE(_rMetaData,_rParent,_rMutex,_rVector) + {} + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_DBASE_TABLES_HXX_ + diff --git a/connectivity/source/inc/dbase/dindexnode.hxx b/connectivity/source/inc/dbase/dindexnode.hxx new file mode 100644 index 000000000000..97661e3ff5d9 --- /dev/null +++ b/connectivity/source/inc/dbase/dindexnode.hxx @@ -0,0 +1,347 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_DBASE_INDEXNODE_HXX_ +#define _CONNECTIVITY_DBASE_INDEXNODE_HXX_ + +#include "file/fcode.hxx" +#include "file/FTable.hxx" +#include "dbase/DIndexPage.hxx" +#include "connectivity/FValue.hxx" +#include <tools/ref.hxx> + +#define NODE_NOTFOUND 0xFFFF +#define PAGE_SIZE 512 + +namespace connectivity +{ + namespace dbase + { + + class ONDXNode; + class ODbaseIndex; + //================================================================== + // Index Key + //================================================================== + typedef file::OOperand ONDXKey_BASE; + class ONDXKey : public ONDXKey_BASE + { + friend class ONDXNode; + UINT32 nRecord; /* Satzzeiger */ + ORowSetValue xValue; /* Schluesselwert */ + + public: + ONDXKey(UINT32 nRec=0); + ONDXKey(const ORowSetValue& rVal, sal_Int32 eType, UINT32 nRec); + ONDXKey(const rtl::OUString& aStr, UINT32 nRec = 0); + ONDXKey(double aVal, UINT32 nRec = 0); + + inline ONDXKey(const ONDXKey& rKey); + + inline ONDXKey& operator= (const ONDXKey& rKey); + virtual void setValue(const ORowSetValue& _rVal); + + virtual const ORowSetValue& getValue() const; + + UINT32 GetRecord() const { return nRecord; } + void setRecord(UINT32 _nRec) { nRecord = _nRec; } + void ResetRecord() { nRecord = 0; } + + BOOL operator == (const ONDXKey& rKey) const; + BOOL operator != (const ONDXKey& rKey) const; + BOOL operator < (const ONDXKey& rKey) const; + BOOL operator <= (const ONDXKey& rKey) const; + BOOL operator > (const ONDXKey& rKey) const; + BOOL operator >= (const ONDXKey& rKey) const; + + BOOL Load (SvFileStream& rStream, BOOL bText); + BOOL Write(SvFileStream& rStream, BOOL bText); + + static BOOL IsText(sal_Int32 eType); + + private: + StringCompare Compare(const ONDXKey& rKey) const; + }; + + + + + //================================================================== + // Index Seitenverweis + //================================================================== + SV_DECL_REF(ONDXPage) // Basisklasse da weitere Informationen gehalten werden muessen + + + class ONDXPagePtr : public ONDXPageRef + { + friend SvStream& operator << (SvStream &rStream, const ONDXPagePtr&); + friend SvStream& operator >> (SvStream &rStream, ONDXPagePtr&); + + UINT32 nPagePos; // Position in der Indexdatei + + public: + ONDXPagePtr(UINT32 nPos = 0):nPagePos(nPos){} + ONDXPagePtr(const ONDXPagePtr& rRef); + ONDXPagePtr(ONDXPage* pRefPage); + + ONDXPagePtr& operator=(const ONDXPagePtr& rRef); + ONDXPagePtr& operator=(ONDXPage* pPageRef); + + UINT32 GetPagePos() const {return nPagePos;} + BOOL HasPage() const {return nPagePos != 0;} + // sal_Bool Is() const { return isValid(); } + }; + //================================================================== + // Index Seite + //================================================================== + class ONDXPage : public SvRefBase + { + friend class ODbaseIndex; + + friend SvStream& operator << (SvStream &rStream, const ONDXPage&); + friend SvStream& operator >> (SvStream &rStream, ONDXPage&); + + UINT32 nPagePos; // Position in der Indexdatei + BOOL bModified : 1; + USHORT nCount; + + ONDXPagePtr aParent, // VaterSeite + aChild; // Zeiger auf rechte ChildPage + ODbaseIndex& rIndex; + ONDXNode* ppNodes; // array von Knoten + + public: + // Knoten Operationen + USHORT Count() const {return nCount;} + + BOOL Insert(ONDXNode& rNode, sal_uInt32 nRowsLeft = 0); + BOOL Insert(USHORT nIndex, ONDXNode& rNode); + BOOL Append(ONDXNode& rNode); + BOOL Delete(USHORT); + void Remove(USHORT); + void Release(BOOL bSave = TRUE); + void ReleaseFull(BOOL bSave = TRUE); + + // Aufteilen und Zerlegen + ONDXNode Split(ONDXPage& rPage); + void Merge(USHORT nParentNodePos, ONDXPagePtr xPage); + + // Zugriffsoperationen + ONDXNode& operator[] (USHORT nPos); + const ONDXNode& operator[] (USHORT nPos) const; + + BOOL IsRoot() const; + BOOL IsLeaf() const; + BOOL IsModified() const; + BOOL HasParent(); + BOOL HasChild() const; + + BOOL IsFull() const; + + UINT32 GetPagePos() const {return nPagePos;} + ONDXPagePtr& GetChild(ODbaseIndex* pIndex = 0); + + // Parent braucht nicht nachgeladen zu werden + ONDXPagePtr GetParent(); + ODbaseIndex& GetIndex() {return rIndex;} + const ODbaseIndex& GetIndex() const {return rIndex;} + + // Setzen des Childs, ueber Referenz, um die PagePos zu erhalten + void SetChild(ONDXPagePtr aCh); + void SetParent(ONDXPagePtr aPa); + + USHORT Search(const ONDXKey& rSearch); + USHORT Search(const ONDXPage* pPage); + void SearchAndReplace(const ONDXKey& rSearch, ONDXKey& rReplace); + + protected: + ONDXPage(ODbaseIndex& rIndex, sal_uInt32 nPos, ONDXPage* = NULL); + ~ONDXPage(); + + virtual void QueryDelete(); + + void SetModified(BOOL bMod) {bModified = bMod;} + void SetPagePos(UINT32 nPage) {nPagePos = nPage;} + + BOOL Find(const ONDXKey&); // rek. Abstieg + USHORT FindPos(const ONDXKey& rKey) const; + +#if OSL_DEBUG_LEVEL > 1 + void PrintPage(); +#endif + }; + + SV_IMPL_REF(ONDXPage); + + SvStream& operator << (SvStream &rStream, const ONDXPagePtr&); + SvStream& operator >> (SvStream &rStream, ONDXPagePtr&); + + inline BOOL ONDXPage::IsRoot() const {return !aParent.Is();} + inline BOOL ONDXPage::IsLeaf() const {return !aChild.HasPage();} + inline BOOL ONDXPage::IsModified() const {return bModified;} + inline BOOL ONDXPage::HasParent() {return aParent.Is();} + inline BOOL ONDXPage::HasChild() const {return aChild.HasPage();} + inline ONDXPagePtr ONDXPage::GetParent() {return aParent;} + + inline void ONDXPage::SetParent(ONDXPagePtr aPa = ONDXPagePtr()) + { + aParent = aPa; + } + + inline void ONDXPage::SetChild(ONDXPagePtr aCh = ONDXPagePtr()) + { + aChild = aCh; + if (aChild.Is()) + aChild->SetParent(this); + } + SvStream& operator >> (SvStream &rStream, ONDXPage& rPage); + SvStream& operator << (SvStream &rStream, const ONDXPage& rPage); + + + typedef ::std::vector<ONDXPage*> ONDXPageList; + + //================================================================== + // Index Knoten + //================================================================== + class ONDXNode + { + friend class ONDXPage; + ONDXPagePtr aChild; /* naechster Seitenverweis */ + ONDXKey aKey; + + public: + ONDXNode(){} + ONDXNode(const ONDXKey& rKey, + ONDXPagePtr aPagePtr = ONDXPagePtr()) + :aChild(aPagePtr),aKey(rKey) {} + + // verweist der Knoten auf eine Seite + BOOL HasChild() const {return aChild.HasPage();} + // Ist ein Index angegeben, kann gegebenfalls die Seite nachgeladen werden + ONDXPagePtr& GetChild(ODbaseIndex* pIndex = NULL, ONDXPage* = NULL); + + const ONDXKey& GetKey() const { return aKey;} + ONDXKey& GetKey() { return aKey;} + + // Setzen des Childs, ueber Referenz, um die PagePos zu erhalten + void SetChild(ONDXPagePtr aCh = ONDXPagePtr(), ONDXPage* = NULL); + void SetKey(ONDXKey& rKey) {aKey = rKey;} + + void Write(SvStream &rStream, const ONDXPage& rPage) const; + void Read(SvStream &rStream, ODbaseIndex&); + }; + //================================================================== + // inline implementation + //================================================================== +// inline ONDXKey::ONDXKey(const ORowSetValue& rVal, sal_Int32 eType, UINT32 nRec) +// : ONDXKey_BASE(eType) +// , nRecord(nRec),xValue(rVal) +// { +// } + + +// inline ONDXKey::ONDXKey(const rtl::OUString& aStr, UINT32 nRec) +// : ONDXKey_BASE(::com::sun::star::sdbc::DataType::VARCHAR) +// ,nRecord(nRec) +// { +// if (aStr.len()) +// xValue = aStr; +// } + +// inline ONDXKey::ONDXKey(double aVal, UINT32 nRec) +// : ONDXKey_BASE(::com::sun::star::sdbc::DataType::DOUBLE) +// ,nRecord(nRec) +// ,xValue(aVal) +// { +// } + +// inline ONDXKey::ONDXKey(UINT32 nRec) +// :nRecord(nRec) +// { +// } + + inline ONDXKey::ONDXKey(const ONDXKey& rKey) + : ONDXKey_BASE(rKey.getDBType()) + ,nRecord(rKey.nRecord) + ,xValue(rKey.xValue) + { + } + + inline ONDXKey& ONDXKey::operator=(const ONDXKey& rKey) + { + if(&rKey == this) + return *this; + + xValue = rKey.xValue; + nRecord = rKey.nRecord; + m_eDBType = rKey.getDBType(); + return *this; + } + + inline BOOL ONDXKey::operator == (const ONDXKey& rKey) const + { + if(&rKey == this) + return sal_True; + return Compare(rKey) == COMPARE_EQUAL; + } + inline BOOL ONDXKey::operator != (const ONDXKey& rKey) const + { + return !operator== (rKey); + } + inline BOOL ONDXKey::operator < (const ONDXKey& rKey) const + { + return Compare(rKey) == COMPARE_LESS; + } + inline BOOL ONDXKey::operator > (const ONDXKey& rKey) const + { + return Compare(rKey) == COMPARE_GREATER; + } + inline BOOL ONDXKey::operator <= (const ONDXKey& rKey) const + { + return !operator > (rKey); + } + inline BOOL ONDXKey::operator >= (const ONDXKey& rKey) const + { + return !operator< (rKey); + } + + inline void ONDXNode::SetChild(ONDXPagePtr aCh, ONDXPage* pParent) + { + aChild = aCh; + if (aChild.Is()) + aChild->SetParent(pParent); + } + + } + +} + + + + +#endif // _CONNECTIVITY_DBASE_INDEXNODE_HXX_ + + diff --git a/connectivity/source/inc/diagnose_ex.h b/connectivity/source/inc/diagnose_ex.h new file mode 100644 index 000000000000..1bdb4f451281 --- /dev/null +++ b/connectivity/source/inc/diagnose_ex.h @@ -0,0 +1,46 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_DIAGNOSE_EX_H +#define CONNECTIVITY_DIAGNOSE_EX_H + +#if OSL_DEBUG_LEVEL > 0 + #define OSL_VERIFY_RES( expression, fail_message ) \ + OSL_ENSURE( expression, fail_message ) + #define OSL_VERIFY_EQUALS( expression, compare, fail_message ) \ + OSL_ENSURE( expression == compare, fail_message ) +#else + #define OSL_VERIFY_RES( expression, fail_message ) \ + (void)(expression) + #define OSL_VERIFY_EQUALS( expression, compare, fail_message ) \ + (void)(expression) +#endif + +#define OSL_UNUSED( expression ) \ + (void)(expression) + +#endif // CONNECTIVITY_DIAGNOSE_EX_H diff --git a/connectivity/source/inc/file/FCatalog.hxx b/connectivity/source/inc/file/FCatalog.hxx new file mode 100644 index 000000000000..2b16a43f42fc --- /dev/null +++ b/connectivity/source/inc/file/FCatalog.hxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_CATALOG_HXX_ +#define _CONNECTIVITY_FILE_CATALOG_HXX_ + +#include "connectivity/sdbcx/VCatalog.hxx" + +#include "file/filedllapi.hxx" + +namespace connectivity +{ + namespace file + { + class OConnection; + class OOO_DLLPUBLIC_FILE SAL_NO_VTABLE OFileCatalog : + public connectivity::sdbcx::OCatalog + { + protected: + OConnection* m_pConnection; + + /** builds the name which should be used to access the object later on in the collection. + Will only be called in fillNames. + @param _xRow + The current row from the resultset given to fillNames. + */ + virtual ::rtl::OUString buildName( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >& _xRow); + + public: + virtual void refreshTables(); + virtual void refreshViews(); + virtual void refreshGroups(); + virtual void refreshUsers(); + + public: + OFileCatalog(OConnection* _pCon); + OConnection* getConnection() { return m_pConnection; } + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + // ::cppu::OComponentHelper + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL disposing(void); + }; + } +} +#endif // _CONNECTIVITY_FILE_CATALOG_HXX_ + diff --git a/connectivity/source/inc/file/FColumns.hxx b/connectivity/source/inc/file/FColumns.hxx new file mode 100644 index 000000000000..119ad228ad55 --- /dev/null +++ b/connectivity/source/inc/file/FColumns.hxx @@ -0,0 +1,59 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_COLUMNS_HXX_ +#define _CONNECTIVITY_FILE_COLUMNS_HXX_ + +#include "connectivity/sdbcx/VCollection.hxx" +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#include "connectivity/sdbcx/IRefreshable.hxx" +#include "file/FTable.hxx" +#include "file/filedllapi.hxx" + +namespace connectivity +{ + namespace file + { + class OOO_DLLPUBLIC_FILE OColumns : public sdbcx::OCollection + { + protected: + OFileTable* m_pTable; + + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + public: + OColumns( OFileTable* _pTable, + ::osl::Mutex& _rMutex, + const TStringVector &_rVector + ) : sdbcx::OCollection(*_pTable,_pTable->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers(),_rMutex,_rVector) + ,m_pTable(_pTable) + {} + }; + } +} +#endif // _CONNECTIVITY_FILE_COLUMNS_HXX_ + diff --git a/connectivity/source/inc/file/FConnection.hxx b/connectivity/source/inc/file/FConnection.hxx new file mode 100644 index 000000000000..d908ec836264 --- /dev/null +++ b/connectivity/source/inc/file/FConnection.hxx @@ -0,0 +1,160 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_FILE_OCONNECTION_HXX_ +#define _CONNECTIVITY_FILE_OCONNECTION_HXX_ + +#include <com/sun/star/ucb/XContent.hpp> +#include <com/sun/star/sdbc/SQLWarning.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include "OSubComponent.hxx" +#ifndef _MAP_ +#include <map> +#endif +#include "connectivity/CommonTools.hxx" +#include "OTypeInfo.hxx" +#include <tools/string.hxx> +#include <com/sun/star/sdbcx/XTablesSupplier.hpp> +#include <com/sun/star/ucb/XDynamicResultSet.hpp> +#include "connectivity/sqlparse.hxx" +#include "connectivity/sqliterator.hxx" +#include "TConnection.hxx" +#include "file/filedllapi.hxx" + +namespace connectivity +{ + namespace file + { + + class OStatement_Base; + class ODatabaseMetaData; + class OFileDriver; + + class OOO_DLLPUBLIC_FILE OConnection : + public connectivity::OMetaConnection, + public connectivity::OSubComponent<OConnection, connectivity::OMetaConnection> + { + friend class connectivity::OSubComponent<OConnection, connectivity::OMetaConnection>; + + protected: + //==================================================================== + // Data attributes + //==================================================================== + ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbcx::XTablesSupplier> m_xCatalog; + + ::com::sun::star::sdbc::SQLWarning m_aLastWarning; // Last SQLWarning generated by + + String m_aFilenameExtension; + OFileDriver* m_pDriver; // Pointer to the owning + // driver object + ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XDynamicResultSet > m_xDir; // directory + ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent> m_xContent; + + sal_Bool m_bClosed; + sal_Bool m_bAutoCommit; + sal_Bool m_bReadOnly; + sal_Bool m_bShowDeleted; + sal_Bool m_bCaseSensitiveExtension; + sal_Bool m_bCheckSQL92; + bool m_bDefaultTextEncoding; + + + void throwUrlNotValid(const ::rtl::OUString & _rsUrl,const ::rtl::OUString & _rsMessage); + + virtual ~OConnection(); + public: + + OConnection(OFileDriver* _pDriver); + + virtual void construct(const ::rtl::OUString& _rUrl,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rInfo ) throw( ::com::sun::star::sdbc::SQLException); + + void closeAllStatements () throw( ::com::sun::star::sdbc::SQLException); + + // OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual void SAL_CALL release() throw(); + + // XServiceInfo + DECLARE_SERVICE_INFO(); + + // XConnection + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > SAL_CALL createStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareCall( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL nativeSQL( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getAutoCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL commit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL rollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isClosed( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setCatalog( const ::rtl::OUString& catalog ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalog( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTypeMap( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTypeMap( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) 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); + //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(); + + // no interface methods + ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XDynamicResultSet > getDir() const; + ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent> getContent() const { return m_xContent; } + // create a catalog or return the catalog already created + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > createCatalog(); + + sal_Bool matchesExtension( const String& _rExt ) const; + + inline const String& getExtension() const { return m_aFilenameExtension; } + inline sal_Bool isCaseSensitveExtension() const { return m_bCaseSensitiveExtension; } + inline OFileDriver* getDriver() const { return m_pDriver; } + inline sal_Bool showDeleted() const { return m_bShowDeleted; } + inline sal_Bool isCheckEnabled() const { return m_bCheckSQL92; } + inline bool isTextEncodingDefaulted() const { return m_bDefaultTextEncoding; } + + public: + struct GrantAccess + { + friend class ODatabaseMetaData; + private: + GrantAccess() { } + }; + + void setCaseSensitiveExtension( sal_Bool _bIsCS, GrantAccess ) { m_bCaseSensitiveExtension = _bIsCS; } + }; + } +} +#endif // _CONNECTIVITY_FILE_OCONNECTION_HXX_ + diff --git a/connectivity/source/inc/file/FDatabaseMetaData.hxx b/connectivity/source/inc/file/FDatabaseMetaData.hxx new file mode 100644 index 000000000000..4104b72a8045 --- /dev/null +++ b/connectivity/source/inc/file/FDatabaseMetaData.hxx @@ -0,0 +1,197 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_ODATABASEMETADATA_HXX_ +#define _CONNECTIVITY_FILE_ODATABASEMETADATA_HXX_ + +#include "TDatabaseMetaDataBase.hxx" +#include "file/FConnection.hxx" +#include "file/filedllapi.hxx" + +namespace connectivity +{ + namespace file + { + //************************************************************** + //************ Class: ODatabaseMetaData + //************************************************************** + + class OOO_DLLPUBLIC_FILE SAL_NO_VTABLE ODatabaseMetaData : + public ODatabaseMetaDataBase + { + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > impl_getTypeInfo_throw(); + // cached database information + virtual ::rtl::OUString impl_getIdentifierQuoteString_throw( ); + virtual sal_Bool impl_isCatalogAtStart_throw( ); + virtual ::rtl::OUString impl_getCatalogSeparator_throw( ); + virtual sal_Bool impl_supportsCatalogsInTableDefinitions_throw( ); + virtual sal_Bool impl_supportsSchemasInTableDefinitions_throw( ) ; + virtual sal_Bool impl_supportsCatalogsInDataManipulation_throw( ); + virtual sal_Bool impl_supportsSchemasInDataManipulation_throw( ) ; + virtual sal_Bool impl_supportsMixedCaseQuotedIdentifiers_throw( ); + virtual sal_Bool impl_supportsAlterTableWithAddColumn_throw( ); + virtual sal_Bool impl_supportsAlterTableWithDropColumn_throw( ); + virtual sal_Int32 impl_getMaxStatements_throw( ); + virtual sal_Int32 impl_getMaxTablesInSelect_throw( ); + virtual sal_Bool impl_storesMixedCaseQuotedIdentifiers_throw( ); + protected: + OConnection* m_pConnection; // I need the native class not only the interface + virtual ~ODatabaseMetaData(); + public: + + ODatabaseMetaData(OConnection* _pCon); + // XDatabaseMetaData + virtual sal_Bool SAL_CALL allProceduresAreCallable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL allTablesAreSelectable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getURL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getUserName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedLow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDatabaseProductName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDatabaseProductVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDriverName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDriverVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL usesLocalFiles( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSQLKeywords( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getNumericFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getStringFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSystemFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTimeDateFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSearchStringEscape( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getExtraNameCharacters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsColumnAliasing( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTypeConversion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsGroupBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSchemaTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getProcedureTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalogTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsPositionedDelete( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsStoredProcedures( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsUnion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsUnionAll( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) 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 getMaxColumnsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) 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_Int32 SAL_CALL getMaxConnections( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxIndexLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxRowSize( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxStatementLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTables( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTableTypes( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTablePrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsBatchUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getUDTs( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern, const ::com::sun::star::uno::Sequence< sal_Int32 >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_FILE_ODATABASEMETADATA_HXX_ + diff --git a/connectivity/source/inc/file/FDateFunctions.hxx b/connectivity/source/inc/file/FDateFunctions.hxx new file mode 100644 index 000000000000..30c553dc17ab --- /dev/null +++ b/connectivity/source/inc/file/FDateFunctions.hxx @@ -0,0 +1,242 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_FDATEFUNCTIONS_HXX_ +#define _CONNECTIVITY_FILE_FDATEFUNCTIONS_HXX_ + +#include "file/fcode.hxx" +#include "file/filedllapi.hxx" + +namespace connectivity +{ + class OSQLParseNode; + namespace file + { + /** DAYOFWEEK(date) + Returns the weekday index for date (1 = Sunday, 2 = Monday, ... 7 = Saturday). These index values correspond to the ODBC standard. + + > SELECT DAYOFWEEK('1998-02-03'); + -> 3 + */ + class OOp_DayOfWeek : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const; + }; + + /** DAYOFMONTH(date) + Returns the day of the month for date, in the range 1 to 31: + + > SELECT DAYOFMONTH('1998-02-03'); + -> 3 + */ + class OOp_DayOfMonth : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const; + }; + + /** DAYOFYEAR(date) + Returns the day of the year for date, in the range 1 to 366: + + > SELECT DAYOFYEAR('1998-02-03'); + -> 34 + + */ + class OOp_DayOfYear : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const; + }; + + /** MONTH(date) + Returns the month for date, in the range 1 to 12: + + > SELECT MONTH('1998-02-03'); + -> 2 + */ + class OOp_Month : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const; + }; + + /** DAYNAME(date) + Returns the name of the weekday for date: + + > SELECT DAYNAME('1998-02-05'); + -> 'Thursday' + + */ + class OOp_DayName : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const; + }; + + /** MONTHNAME(date) + Returns the name of the month for date: + + > SELECT MONTHNAME('1998-02-05'); + -> 'February' + + */ + class OOp_MonthName : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const; + }; + + /** QUARTER(date) + Returns the quarter of the year for date, in the range 1 to 4: + + > SELECT QUARTER('98-04-01'); + -> 2 + + */ + class OOp_Quarter : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const; + }; + + /** WEEK(date) + WEEK(date,first) + With a single argument, returns the week for date, in the range 0 to 53 (yes, there may be the beginnings of a week 53), for locations where Sunday is the first day of the week. The two-argument form of WEEK() allows you to specify whether the week starts on Sunday or Monday and whether the return value should be in the range 0-53 or 1-52. Here is a table for how the second argument works: + Value Meaning + 0 Week starts on Sunday and return value is in range 0-53 + 1 Week starts on Monday and return value is in range 0-53 + 2 Week starts on Sunday and return value is in range 1-53 + 3 Week starts on Monday and return value is in range 1-53 (ISO 8601) + + > SELECT WEEK('1998-02-20'); + -> 7 + > SELECT WEEK('1998-02-20',0); + -> 7 + > SELECT WEEK('1998-02-20',1); + -> 8 + > SELECT WEEK('1998-12-31',1); + -> 53 + + */ + class OOp_Week : public ONthOperator + { + protected: + virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const; + }; + + /** YEAR(date) + Returns the year for date, in the range 1000 to 9999: + + > SELECT YEAR('98-02-03'); + -> 1998 + */ + class OOp_Year : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const; + }; + + /** HOUR(time) + Returns the hour for time, in the range 0 to 23: + + > SELECT HOUR('10:05:03'); + -> 10 + */ + class OOp_Hour : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const; + }; + + /** MINUTE(time) + Returns the minute for time, in the range 0 to 59: + + > SELECT MINUTE('98-02-03 10:05:03'); + -> 5 + + */ + class OOp_Minute : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const; + }; + + /** SECOND(time) + Returns the second for time, in the range 0 to 59: + + > SELECT SECOND('10:05:03'); + -> 3 + */ + class OOp_Second : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const; + }; + + /** CURDATE() + CURRENT_DATE + Returns today's date as a value in 'YYYY-MM-DD' or YYYYMMDD format, depending on whether the function is used in a string or numeric context: + + > SELECT CURDATE(); + -> '1997-12-15' + */ + class OOp_CurDate : public ONthOperator + { + protected: + virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const; + }; + + /** CURTIME() + CURRENT_TIME + Returns the current time as a value in 'HH:MM:SS' or HHMMSS format, depending on whether the function is used in a string or numeric context: + + > SELECT CURTIME(); + -> '23:50:26' + */ + class OOp_CurTime : public ONthOperator + { + protected: + virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const; + }; + + /** NOW() + Returns the current date and time as a value in 'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHHMMSS format, depending on whether the function is used in a string or numeric context: + + > SELECT NOW(); + -> '1997-12-15 23:50:26' + */ + class OOp_Now : public ONthOperator + { + protected: + virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const; + }; + } +} + +#endif // _CONNECTIVITY_FILE_FCODE_HXX_ + diff --git a/connectivity/source/inc/file/FDriver.hxx b/connectivity/source/inc/file/FDriver.hxx new file mode 100644 index 000000000000..416f6e48eb9d --- /dev/null +++ b/connectivity/source/inc/file/FDriver.hxx @@ -0,0 +1,87 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_ODRIVER_HXX_ +#define _CONNECTIVITY_FILE_ODRIVER_HXX_ + +#include <com/sun/star/sdbc/XDriver.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp> +#include <cppuhelper/compbase3.hxx> +#include "connectivity/CommonTools.hxx" +#include "file/filedllapi.hxx" + +namespace connectivity +{ + namespace file + { + typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbc::XDriver, + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::sdbcx::XDataDefinitionSupplier> ODriver_BASE; + + class OOO_DLLPUBLIC_FILE SAL_NO_VTABLE OFileDriver : public ODriver_BASE + { + protected: + ::osl::Mutex m_aMutex; + + connectivity::OWeakRefArray m_xConnections; // vector containing a list + // of all the Connection objects + // for this Driver + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; + public: + OFileDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory); + + // OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + + // XDriver + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMajorVersion( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMinorVersion( ) throw(::com::sun::star::uno::RuntimeException); + + // XDataDefinitionSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& connection ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByURL( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getFactory() const { return m_xFactory; } + }; + } + +} +#endif //_CONNECTIVITY_FILE_ODRIVER_HXX_ + + diff --git a/connectivity/source/inc/file/FNumericFunctions.hxx b/connectivity/source/inc/file/FNumericFunctions.hxx new file mode 100644 index 000000000000..cd52f1a1158a --- /dev/null +++ b/connectivity/source/inc/file/FNumericFunctions.hxx @@ -0,0 +1,376 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_FNUMERICFUNCTIONS_HXX_ +#define _CONNECTIVITY_FILE_FNUMERICFUNCTIONS_HXX_ + +#include "file/fcode.hxx" +#include "file/filedllapi.hxx" + +namespace connectivity +{ + class OSQLParseNode; + namespace file + { + /** ABS(X) + Returns the absolute value of X: + + > SELECT ABS(2); + -> 2 + > SELECT ABS(-32); + -> 32 + + */ + class OOp_Abs : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const; + }; + + /** SIGN(X) + Returns the sign of the argument as -1, 0, or 1, depending on whether X is negative, zero, or positive: + + > SELECT SIGN(-32); + -> -1 + > SELECT SIGN(0); + -> 0 + > SELECT SIGN(234); + -> 1 + + */ + class OOp_Sign : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const; + }; + + /** MOD(N,M) + % + Modulo (like the % operator in C). Returns the remainder of N divided by M: + + > SELECT MOD(234, 10); + -> 4 + > SELECT 253 % 7; + -> 1 + > SELECT MOD(29,9); + -> 2 + > SELECT 29 MOD 9; + -> 2 + */ + class OOp_Mod : public OBinaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const; + }; + + /** FLOOR(X) + Returns the largest integer value not greater than X: + + > SELECT FLOOR(1.23); + -> 1 + > SELECT FLOOR(-1.23); + -> -2 + + */ + class OOp_Floor : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const; + }; + + /** CEILING(X) + Returns the smallest integer value not less than X: + + > SELECT CEILING(1.23); + -> 2 + > SELECT CEILING(-1.23); + -> -1 + + */ + class OOp_Ceiling : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const; + }; + + /** ROUND(X) + ROUND(X,D) + Returns the argument X, rounded to the nearest integer. With two arguments rounded to a number to D decimals. + + > SELECT ROUND(-1.23); + -> -1 + > SELECT ROUND(-1.58); + -> -2 + > SELECT ROUND(1.58); + -> 2 + > SELECT ROUND(1.298, 1); + -> 1.3 + > SELECT ROUND(1.298, 0); + -> 1 + > SELECT ROUND(23.298, -1); + -> 20 + */ + class OOp_Round : public ONthOperator + { + protected: + virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const; + }; + + /** EXP(X) + Returns the value of e (the base of natural logarithms) raised to the power of X: + + > SELECT EXP(2); + -> 7.389056 + > SELECT EXP(-2); + -> 0.135335 + */ + class OOp_Exp : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const; + }; + + /** LN(X) + Returns the natural logarithm of X: + + > SELECT LN(2); + -> 0.693147 + > SELECT LN(-2); + -> NULL + + */ + class OOp_Ln : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const; + }; + + /** LOG(X) + LOG(B,X) + If called with one parameter, this function returns the natural logarithm of X: + + > SELECT LOG(2); + -> 0.693147 + > SELECT LOG(-2); + -> NULL + + If called with two parameters, this function returns the logarithm of X for an arbitary base B: + + > SELECT LOG(2,65536); + -> 16.000000 + > SELECT LOG(1,100); + -> NULL + */ + class OOp_Log : public ONthOperator + { + protected: + virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const; + }; + + /** LOG10(X) + Returns the base-10 logarithm of X: + + > SELECT LOG10(2); + -> 0.301030 + > SELECT LOG10(100); + -> 2.000000 + > SELECT LOG10(-100); + -> NULL + */ + class OOp_Log10 : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const; + }; + + /** POWER(X,Y) + Returns the value of X raised to the power of Y: + + > SELECT POW(2,2); + -> 4.000000 + > SELECT POW(2,-2); + -> 0.250000 + */ + class OOp_Pow : public OBinaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const; + }; + + /** SQRT(X) + Returns the non-negative square root of X: + + > SELECT SQRT(4); + -> 2.000000 + > SELECT SQRT(20); + -> 4.472136 + */ + class OOp_Sqrt : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const; + }; + + /** PI() + Returns the value of PI. The default shown number of decimals is 5, but internally uses the full double precession for PI. + + > SELECT PI(); + -> 3.141593 + > SELECT PI()+0.000000000000000000; + -> 3.141592653589793116 + + */ + class OOp_Pi : public ONthOperator + { + protected: + virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const; + }; + + /** COS(X) + Returns the cosine of X, where X is given in radians: + + > SELECT COS(PI()); + -> -1.000000 + */ + class OOp_Cos : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs = ORowSetValue()) const; + }; + + /** SIN(X) + Returns the sine of X, where X is given in radians: + + > SELECT SIN(PI()); + -> 0.000000 + + */ + class OOp_Sin : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs = ORowSetValue()) const; + }; + /** TAN(X) + Returns the tangent of X, where X is given in radians: + + > SELECT TAN(PI()+1); + -> 1.557408 + */ + class OOp_Tan : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs = ORowSetValue()) const; + }; + + /** ACOS(X) + Returns the arc cosine of X, that is, the value whose cosine is X. Returns NULL if X is not in the range -1 to 1: + + > SELECT ACOS(1); + -> 0.000000 + > SELECT ACOS(1.0001); + -> NULL + > SELECT ACOS(0); + -> 1.570796 + */ + class OOp_ACos : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs = ORowSetValue()) const; + }; + + /** ASIN(X) + Returns the arc sine of X, that is, the value whose sine is X. Returns NULL if X is not in the range -1 to 1: + + > SELECT ASIN(0.2); + -> 0.201358 + > SELECT ASIN('foo'); + -> 0.000000 + */ + class OOp_ASin : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs = ORowSetValue()) const; + }; + + /** ATAN(X) + Returns the arc tangent of X, that is, the value whose tangent is X: + + > SELECT ATAN(2); + -> 1.107149 + > SELECT ATAN(-2); + -> -1.107149 + */ + class OOp_ATan : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs = ORowSetValue()) const; + }; + + /** ATAN2(Y,X) + Returns the arc tangent of the two variables X and Y. It is similar to calculating the arc tangent of Y / X, except that the signs of both arguments are used to determine the quadrant of the result: + + > SELECT ATAN2(-2,2); + -> -0.785398 + > SELECT ATAN2(PI(),0); + -> 1.570796 + + */ + class OOp_ATan2 : public OBinaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const; + }; + + /** DEGREES(X) + Returns the argument X, converted from radians to degrees: + + > SELECT DEGREES(PI()); + -> 180.000000 + */ + class OOp_Degrees : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs = ORowSetValue()) const; + }; + + /** RADIANS(X) + Returns the argument X, converted from degrees to radians: + + > SELECT RADIANS(90); + -> 1.570796 + + */ + class OOp_Radians : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs = ORowSetValue()) const; + }; + } +} + +#endif // _CONNECTIVITY_FILE_FNUMERICFUNCTIONS_HXX_ + diff --git a/connectivity/source/inc/file/FPreparedStatement.hxx b/connectivity/source/inc/file/FPreparedStatement.hxx new file mode 100644 index 000000000000..9528ca16a508 --- /dev/null +++ b/connectivity/source/inc/file/FPreparedStatement.hxx @@ -0,0 +1,135 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_OPREPAREDSTATEMENT_HXX_ +#define _CONNECTIVITY_FILE_OPREPAREDSTATEMENT_HXX_ + +#include "file/filedllapi.hxx" +#include "file/FStatement.hxx" +#include <com/sun/star/sdbc/XPreparedStatement.hpp> +#include <com/sun/star/sdbc/XParameters.hpp> +#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> +// #include <com/sun/star/sdbc/XClearParameters.hpp> +#include <com/sun/star/sdbc/XPreparedBatchExecution.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include "file/FResultSet.hxx" + +namespace connectivity +{ + namespace file + { + + class OOO_DLLPUBLIC_FILE SAL_NO_VTABLE OPreparedStatement : public OStatement_BASE2, + public ::com::sun::star::sdbc::XPreparedStatement, + public ::com::sun::star::sdbc::XParameters, + public ::com::sun::star::sdbc::XResultSetMetaDataSupplier, + public ::com::sun::star::lang::XServiceInfo + + { + protected: + //==================================================================== + // Data attributes + //==================================================================== + ::rtl::OUString m_aSql; + OValueRefRow m_aParameterRow; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData; + + OResultSet* m_pResultSet; + ::vos::ORef<connectivity::OSQLColumns> m_xParamColumns; // the parameter columns + + // factory method for resultset's + virtual OResultSet* createResultSet(); + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> initResultSet(); + + void checkAndResizeParameters(sal_Int32 parameterIndex); + void setParameter(sal_Int32 parameterIndex, const ORowSetValue& x); + + UINT32 AddParameter(connectivity::OSQLParseNode * pParameter, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xCol); + void scanParameter(OSQLParseNode* pParseNode,::std::vector< OSQLParseNode*>& _rParaNodes); + void describeColumn(OSQLParseNode* _pParameter,OSQLParseNode* _pNode,const OSQLTable& _xTable); + void describeParameter(); + + virtual void parseParamterElem(const String& _sColumnName,OSQLParseNode* pRow_Value_Constructor_Elem); + virtual void initializeResultSet(OResultSet* _pResult); + + virtual ~OPreparedStatement(); + public: + DECLARE_SERVICE_INFO(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + OPreparedStatement( OConnection* _pConnection); + + virtual void construct(const ::rtl::OUString& sql) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + // OComponentHelper + virtual void SAL_CALL disposing(void); + //XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + // XPreparedStatement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL executeUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XParameters + virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearParameters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XResultSetMetaDataSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_FILE_OPREPAREDSTATEMENT_HXX_ + + diff --git a/connectivity/source/inc/file/FResultSet.hxx b/connectivity/source/inc/file/FResultSet.hxx new file mode 100644 index 000000000000..530387ceef4a --- /dev/null +++ b/connectivity/source/inc/file/FResultSet.hxx @@ -0,0 +1,357 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_FRESULTSET_HXX_ +#define _CONNECTIVITY_FILE_FRESULTSET_HXX_ + +#ifndef _COM_SUN_STAR_SQLC_XRESULTSET_HPP_ +#include <com/sun/star/sdbc/XResultSet.hpp> +#endif +#ifndef _COM_SUN_STAR_SQLC_XROW_HPP_ +#include <com/sun/star/sdbc/XRow.hpp> +#endif +#ifndef _COM_SUN_STAR_SQLC_XRESULTSETMETADATASUPPLIER_HPP_ +#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SQLC_XCLOSEABLE_HPP_ +#include <com/sun/star/sdbc/XCloseable.hpp> +#endif +#ifndef _COM_SUN_STAR_SQLC_XCOLUMNLOCATE_HPP_ +#include <com/sun/star/sdbc/XColumnLocate.hpp> +#endif +#include <com/sun/star/util/XCancellable.hpp> +#ifndef _COM_SUN_STAR_SQLC_XWARNINGSSUPPLIER_HPP_ +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SQLC_XRESULTSETUPDATE_HPP_ +#include <com/sun/star/sdbc/XResultSetUpdate.hpp> +#endif +#ifndef _COM_SUN_STAR_SQLC_XROWUPDATE_HPP_ +#include <com/sun/star/sdbc/XRowUpdate.hpp> +#endif +#include <cppuhelper/compbase12.hxx> +#include <comphelper/proparrhlp.hxx> +#include "file/FStatement.hxx" +#include "connectivity/CommonTools.hxx" +#include <comphelper/propertycontainer.hxx> +#include "file/fanalyzer.hxx" +#include "file/FTable.hxx" +#include "file/filedllapi.hxx" +#include <comphelper/broadcasthelper.hxx> +#include "connectivity/StdTypeDefs.hxx" +#include "TSortIndex.hxx" +#include "TSkipDeletedSet.hxx" +#include <com/sun/star/lang/XEventListener.hpp> + +namespace connectivity +{ + namespace file + { + /* + ** java_sql_ResultSet + */ + typedef ::cppu::WeakComponentImplHelper12< ::com::sun::star::sdbc::XResultSet, + ::com::sun::star::sdbc::XRow, + ::com::sun::star::sdbc::XResultSetMetaDataSupplier, + ::com::sun::star::util::XCancellable, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::sdbc::XResultSetUpdate, + ::com::sun::star::sdbc::XRowUpdate, + ::com::sun::star::sdbc::XCloseable, + ::com::sun::star::sdbc::XColumnLocate, + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::lang::XEventListener, + ::com::sun::star::lang::XUnoTunnel> OResultSet_BASE; + + class OOO_DLLPUBLIC_FILE OResultSet : + public comphelper::OBaseMutex, + public ::connectivity::IResultSetHelper, + public OResultSet_BASE, + public ::comphelper::OPropertyContainer, + public ::comphelper::OPropertyArrayUsageHelper<OResultSet> + { + + protected: + ::std::vector<void*> m_aBindVector; + ::std::vector<sal_Int32> m_aColMapping; // pos 0 is unused so we don't have to decrement 1 everytime + + ::std::vector<sal_Int32> m_aOrderbyColumnNumber; + ::std::vector<TAscendingOrder> m_aOrderbyAscending; + + OValueRefRow m_aSelectRow; + OValueRefRow m_aRow; + OValueRefRow m_aEvaluateRow; // contains all values of a row + OValueRefRow m_aParameterRow; + OValueRefRow m_aInsertRow; // needed for insert by cursor + ORefAssignValues m_aAssignValues; // needed for insert,update and parameters + // to compare with the restrictions + TIntVector* m_pEvaluationKeySet; + TIntVector::iterator m_aEvaluateIter; + + +// TInt2IntMap m_aBookmarks; // map from bookmarks to logical position +// ::std::vector<TInt2IntMap::iterator> m_aBookmarksPositions;// vector of iterators to bookmark map, the order is the logical position + OSkipDeletedSet m_aSkipDeletedSet; + + ::vos::ORef<OKeySet> m_pFileSet; + OKeySet::Vector::iterator m_aFileSetIter; + + + + OSortIndex* m_pSortIndex; + ::vos::ORef<connectivity::OSQLColumns> m_xColumns; // this are the select columns + ::vos::ORef<connectivity::OSQLColumns> m_xParamColumns; + OFileTable* m_pTable; + connectivity::OSQLParseNode* m_pParseTree; + + OSQLAnalyzer* m_pSQLAnalyzer; + connectivity::OSQLParseTreeIterator& m_aSQLIterator; + + sal_Int32 m_nFetchSize; + sal_Int32 m_nResultSetType; + sal_Int32 m_nFetchDirection; + sal_Int32 m_nResultSetConcurrency; + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xStatement; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> m_xDBMetaData; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xColNames; // table columns + ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> m_xColsIdx; // table columns + + + ::rtl::OUString m_aTableRange; + rtl_TextEncoding m_nTextEncoding; + sal_Int32 m_nRowPos; + sal_Int32 m_nFilePos; + sal_Int32 m_nLastVisitedPos; + sal_Int32 m_nRowCountResult; + sal_Int32 m_nCurrentPosition; // current position of the resultset is returned when ask for getRow() + sal_Int32 m_nColumnCount; + sal_Bool m_bWasNull; + sal_Bool m_bEOF; // after last record + sal_Bool m_bLastRecord; + sal_Bool m_bInserted; // true when moveToInsertRow was called + // set to false when cursor moved or cancel + sal_Bool m_bRowUpdated; + sal_Bool m_bRowInserted; + sal_Bool m_bRowDeleted; + sal_Bool m_bShowDeleted; + sal_Bool m_bIsCount; + + void initializeRow(OValueRefRow& _rRow,sal_Int32 _nColumnCount); + void construct(); + sal_Bool evaluate(); + + BOOL ExecuteRow(IResultSetHelper::Movement eFirstCursorPosition, + INT32 nOffset = 1, + BOOL bEvaluate = TRUE, + BOOL bRetrieveData = TRUE); + + OKeyValue* GetOrderbyKeyValue(OValueRefRow& _rRow); + BOOL IsSorted() const { return !m_aOrderbyColumnNumber.empty() && m_aOrderbyColumnNumber[0] != SQL_COLUMN_NOTFOUND;} + + // return true when the select statement is "select count(*) from table" + inline sal_Bool isCount() const { return m_bIsCount; } + void checkIndex(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException); + + const ORowSetValue& getValue(sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException); + void updateValue(sal_Int32 columnIndex,const ORowSetValue& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // clear insert row + void clearInsertRow(); + void sortRows(); + protected: + + using OResultSet_BASE::rBHelper; + + BOOL Move(IResultSetHelper::Movement eCursorPosition, INT32 nOffset, BOOL bRetrieveData); + virtual sal_Bool fillIndexValues(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier> &_xIndex); + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + + virtual ~OResultSet(); + public: + DECLARE_SERVICE_INFO(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + OResultSet( OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator); + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > operator *() + { + return ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >(*(OResultSet_BASE*)this); + } + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + // XResultSet + virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XRow + virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XResultSetMetaDataSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCancellable + virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) 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); + // XResultSetUpdate + virtual void SAL_CALL insertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL deleteRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XRowUpdate + virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // 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(); + //XEventlistener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); + + // special methods + inline sal_Int32 mapColumn(sal_Int32 column); + virtual BOOL OpenImpl(); + virtual void doTableSpecials(const OSQLTable& _xTable); + + inline sal_Int32 getRowCountResult() const { return m_nRowCountResult; } + inline void setParameterRow(const OValueRefRow& _rParaRow) { m_aParameterRow = _rParaRow; } + inline void setEvaluationRow(const OValueRefRow& _aRow) { m_aEvaluateRow = _aRow; } + inline void setParameterColumns(const ::vos::ORef<connectivity::OSQLColumns>& _xParamColumns) { m_xParamColumns = _xParamColumns; } + inline void setAssignValues(const ORefAssignValues& _aAssignValues) { m_aAssignValues = _aAssignValues; } + inline void setBindingRow(const OValueRefRow& _aRow) { m_aRow = _aRow; } + inline void setSelectRow(const OValueRefRow& _rRow) + { + m_aSelectRow = _rRow; + m_nColumnCount = m_aSelectRow->get().size(); + } + inline void setColumnMapping(const ::std::vector<sal_Int32>& _aColumnMapping) { m_aColMapping = _aColumnMapping; } + inline void setSqlAnalyzer(OSQLAnalyzer* _pSQLAnalyzer) { m_pSQLAnalyzer = _pSQLAnalyzer; } + + inline void setOrderByColumns(const ::std::vector<sal_Int32>& _aColumnOrderBy) { m_aOrderbyColumnNumber = _aColumnOrderBy; } + inline void setOrderByAscending(const ::std::vector<TAscendingOrder>& _aOrderbyAsc) { m_aOrderbyAscending = _aOrderbyAsc; } + inline void setEvaluationKeySet(TIntVector* _pEvaluationKeySet) { m_pEvaluationKeySet = _pEvaluationKeySet; } + inline void setMetaData(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData>& _xMetaData) { m_xMetaData = _xMetaData;} + + // clears the resultset so it can be reused by a preparedstatement + void clear(); + static void setBoundedColumns(const OValueRefRow& _rRow, + const OValueRefRow& _rSelectRow, + const ::vos::ORef<connectivity::OSQLColumns>& _rxColumns, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xNames, + sal_Bool _bSetColumnMapping, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData>& _xMetaData, + ::std::vector<sal_Int32>& _rColMapping); + + // IResultSetHelper + virtual sal_Bool move(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, sal_Bool _bRetrieveData); + virtual sal_Int32 getDriverPos() const; + virtual sal_Bool deletedVisible() const; + virtual sal_Bool isRowDeleted() const; + }; + // ------------------------------------------------------------------------- + inline sal_Int32 OResultSet::mapColumn(sal_Int32 column) + { + sal_Int32 map = column; + + OSL_ENSURE(column > 0, "file::OResultSet::mapColumn: invalid column index!"); + // the first column (index 0) is for convenience only. The first real select column is no 1. + if ((column > 0) && (column < (sal_Int32)m_aColMapping.size())) + map = m_aColMapping[column]; + + return map; + } + } +} +#endif // _CONNECTIVITY_FILE_ORESULTSET_HXX_ + + diff --git a/connectivity/source/inc/file/FResultSetMetaData.hxx b/connectivity/source/inc/file/FResultSetMetaData.hxx new file mode 100644 index 000000000000..60bd3b179709 --- /dev/null +++ b/connectivity/source/inc/file/FResultSetMetaData.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_ORESULTSETMETADATA_HXX_ +#define _CONNECTIVITY_FILE_ORESULTSETMETADATA_HXX_ + +#include <com/sun/star/sdbc/XResultSetMetaData.hpp> +#include <cppuhelper/implbase1.hxx> +#include "connectivity/CommonTools.hxx" +#include <vos/ref.hxx> +#include "file/filedllapi.hxx" + +namespace connectivity +{ + namespace file + { + class OFileTable; + //************************************************************** + //************ Class: ResultSetMetaData + //************************************************************** + typedef ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XResultSetMetaData> OResultSetMetaData_BASE; + + class OOO_DLLPUBLIC_FILE OResultSetMetaData : + public OResultSetMetaData_BASE + { + ::rtl::OUString m_aTableName; + ::vos::ORef<connectivity::OSQLColumns> m_xColumns; + OFileTable* m_pTable; + + void checkColumnIndex(sal_Int32 column) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + protected: + virtual ~OResultSetMetaData(); + public: + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + OResultSetMetaData(const ::vos::ORef<connectivity::OSQLColumns>& _rxColumns,const ::rtl::OUString& _aTableName,OFileTable* _pTable); + + /// Avoid ambigous cast error from the compiler. + inline operator ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > () throw() + { return this; } + + virtual sal_Int32 SAL_CALL getColumnCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnLabel( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSchemaName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTableName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalogName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnTypeName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnServiceName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_FILE_ORESULTSETMETADATA_HXX_ + + diff --git a/connectivity/source/inc/file/FStatement.hxx b/connectivity/source/inc/file/FStatement.hxx new file mode 100644 index 000000000000..0983811b9bd2 --- /dev/null +++ b/connectivity/source/inc/file/FStatement.hxx @@ -0,0 +1,223 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_OSTATEMENT_HXX_ +#define _CONNECTIVITY_FILE_OSTATEMENT_HXX_ + +#include <com/sun/star/sdbc/XStatement.hpp> +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#include <com/sun/star/sdbc/XMultipleResults.hpp> +#include <com/sun/star/sdbc/XBatchExecution.hpp> +#include <com/sun/star/sdbc/XCloseable.hpp> +#include <com/sun/star/sdbc/SQLWarning.hpp> +#include <com/sun/star/util/XCancellable.hpp> +#include <comphelper/proparrhlp.hxx> +#include <cppuhelper/compbase3.hxx> +#include <cppuhelper/implbase2.hxx> +#include <comphelper/uno3.hxx> +#include "connectivity/CommonTools.hxx" +#include "file/FConnection.hxx" +#include "file/filedllapi.hxx" +#ifndef _LIST_ +#include <list> +#endif +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <comphelper/propertycontainer.hxx> +#include "file/fanalyzer.hxx" +#include <comphelper/broadcasthelper.hxx> +#include "TSortIndex.hxx" + +#define SQL_COLUMN_NOTFOUND STRING_NOTFOUND + +namespace connectivity +{ + namespace file + { + class OResultSet; + class OFileTable; + typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::util::XCancellable, + ::com::sun::star::sdbc::XCloseable> OStatement_BASE; + + //************************************************************** + //************ Class: java.sql.Statement + //************************************************************** + class OOO_DLLPUBLIC_FILE OStatement_Base : + public comphelper::OBaseMutex, + public OStatement_BASE, + public ::comphelper::OPropertyContainer, + public ::comphelper::OPropertyArrayUsageHelper<OStatement_Base> + + { + protected: + ::std::vector<sal_Int32> m_aColMapping; // pos 0 is unused so we don't have to decrement 1 everytime + ::std::vector<sal_Int32> m_aParameterIndexes; // maps the parameter index to column index + ::std::vector<sal_Int32> m_aOrderbyColumnNumber; + ::std::vector<TAscendingOrder> m_aOrderbyAscending; + + ::com::sun::star::sdbc::SQLWarning m_aLastWarning; + ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet> m_xResultSet; // The last ResultSet created + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> m_xDBMetaData; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xColNames; // table columns // for this Statement + + + connectivity::OSQLParser m_aParser; + connectivity::OSQLParseTreeIterator m_aSQLIterator; + + OConnection* m_pConnection;// The owning Connection object + connectivity::OSQLParseNode* m_pParseTree; + OSQLAnalyzer* m_pSQLAnalyzer; //the sql analyzer used by the resultset + + ::std::vector<sal_Int32>* m_pEvaluationKeySet; + + OFileTable* m_pTable; // the current table + OValueRefRow m_aSelectRow; + OValueRefRow m_aRow; + OValueRefRow m_aEvaluateRow; // contains all values of a row + ORefAssignValues m_aAssignValues; // needed for insert,update and parameters + // to compare with the restrictions + + ::rtl::OUString m_aCursorName; + sal_Int32 m_nMaxFieldSize; + sal_Int32 m_nMaxRows; + sal_Int32 m_nQueryTimeOut; + sal_Int32 m_nFetchSize; + sal_Int32 m_nResultSetType; + sal_Int32 m_nFetchDirection; + sal_Int32 m_nResultSetConcurrency; + sal_Bool m_bEscapeProcessing; + + ::cppu::OBroadcastHelper& rBHelper; + + protected: + // initialize the column index map (mapping select columns to table columns) + void createColumnMapping(); + // searches the statement for sort criteria + void anylizeSQL(); + void setOrderbyColumn( connectivity::OSQLParseNode* pColumnRef, + connectivity::OSQLParseNode* pAscendingDescending); + + virtual void initializeResultSet(OResultSet* _pResult); + // create the analyzer + virtual OSQLAnalyzer* createAnalyzer(); + + void reset () throw( ::com::sun::star::sdbc::SQLException); + void clearMyResultSet () throw( ::com::sun::star::sdbc::SQLException); + void setWarning (const ::com::sun::star::sdbc::SQLWarning &ex) throw( ::com::sun::star::sdbc::SQLException); + sal_Int32 getPrecision ( sal_Int32 sqlType); + + void disposeResultSet(); + void GetAssignValues(); + void SetAssignValue(const String& aColumnName, + const String& aValue, + BOOL bSetNull = FALSE, + UINT32 nParameter=SQL_NO_PARAMETER); + void ParseAssignValues( const ::std::vector< String>& aColumnNameList, + connectivity::OSQLParseNode* pRow_Value_Constructor_Elem,xub_StrLen nIndex); + + virtual void parseParamterElem(const String& _sColumnName,OSQLParseNode* pRow_Value_Constructor_Elem); + // factory method for resultset's + virtual OResultSet* createResultSet() = 0; + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + virtual ~OStatement_Base(); + public: + connectivity::OSQLParseNode* getParseTree() const { return m_pParseTree;} + + OStatement_Base(OConnection* _pConnection ); + + OConnection* getOwnConnection() const { return m_pConnection;} + + using OStatement_BASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >; + + virtual void construct(const ::rtl::OUString& sql) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + // OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + // virtual void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) = 0; + virtual void SAL_CALL acquire() throw(); + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) 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); + // XCancellable + virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + + class OOO_DLLPUBLIC_FILE OStatement_BASE2 : + public OStatement_Base, + public connectivity::OSubComponent<OStatement_BASE2, OStatement_BASE> + + { + friend class connectivity::OSubComponent<OStatement_BASE2, OStatement_BASE>; + public: + OStatement_BASE2(OConnection* _pConnection ) : OStatement_Base(_pConnection ), + connectivity::OSubComponent<OStatement_BASE2, OStatement_BASE>((::cppu::OWeakObject*)_pConnection, this){} + // OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual void SAL_CALL release() throw(); + }; + + typedef ::cppu::ImplHelper2< ::com::sun::star::sdbc::XStatement,::com::sun::star::lang::XServiceInfo > OStatement_XStatement; + class OOO_DLLPUBLIC_FILE OStatement : + public OStatement_BASE2, + public OStatement_XStatement + { + protected: + // factory method for resultset's + virtual OResultSet* createResultSet(); + public: + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + OStatement( OConnection* _pConnection) : OStatement_BASE2( _pConnection){} + DECLARE_SERVICE_INFO(); + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XStatement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + virtual sal_Int32 SAL_CALL executeUpdate( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + virtual sal_Bool SAL_CALL execute( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + }; + } +} +#endif // _CONNECTIVITY_FILE_OSTATEMENT_HXX_ + diff --git a/connectivity/source/inc/file/FStringFunctions.hxx b/connectivity/source/inc/file/FStringFunctions.hxx new file mode 100644 index 000000000000..d90f53b38cf3 --- /dev/null +++ b/connectivity/source/inc/file/FStringFunctions.hxx @@ -0,0 +1,283 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_FSTRINGFUNCTIONS_HXX_ +#define _CONNECTIVITY_FILE_FSTRINGFUNCTIONS_HXX_ + +#include "file/fcode.hxx" +#include "file/filedllapi.hxx" + +namespace connectivity +{ + class OSQLParseNode; + namespace file + { + /** UCASE(str) + UPPER(str) + Returns the string str with all characters changed to uppercase according to the current character set mapping (the default is ISO-8859-1 Latin1): + + > SELECT UCASE('Hej'); + -> 'HEJ' + + */ + class OOp_Upper : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const; + }; + + /** LCASE(str) + LOWER(str) + Returns the string str with all characters changed to lowercase according to the current character set mapping (the default is ISO-8859-1 Latin1): + + > SELECT LCASE('QUADRATICALLY'); + -> 'quadratically' + + */ + class OOp_Lower : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const; + }; + + /** ASCII(str) + Returns the ASCII code value of the leftmost character of the string str. Returns 0 if str is the empty string. Returns NULL if str is NULL: + + > SELECT ASCII('2'); + -> 50 + > SELECT ASCII(2); + -> 50 + > SELECT ASCII('dx'); + -> 100 + + */ + class OOp_Ascii : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const; + }; + + /** LENGTH(str) + OCTET_LENGTH(str) + CHAR_LENGTH(str) + CHARACTER_LENGTH(str) + Returns the length of the string str: + + > SELECT LENGTH('text'); + -> 4 + > SELECT OCTET_LENGTH('text'); + -> 4 + + */ + class OOp_CharLength : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const; + }; + + /** CHAR(N,...) + CHAR() interprets the arguments as integers and returns a string consisting of the characters given by the ASCII code values of those integers. NULL values are skipped: + + > SELECT CHAR(ascii('t'),ascii('e'),ascii('s'),ascii('t')); + -> 'test' + > SELECT CHAR(77,77.3,'77.3'); + -> 'MMM' + + */ + class OOp_Char : public ONthOperator + { + protected: + virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const; + }; + + /** CONCAT(str1,str2,...) + Returns the string that results from concatenating the arguments. Returns NULL if any argument is NULL. May have more than 2 arguments. A numeric argument is converted to the equivalent string form: + + > SELECT CONCAT('OO', 'o', 'OO'); + -> 'OOoOO' + > SELECT CONCAT('OO', NULL, 'OO'); + -> NULL + > SELECT CONCAT(14.3); + -> '14.3' + + */ + class OOp_Concat : public ONthOperator + { + protected: + virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const; + }; + + /** LOCATE(substr,str) + POSITION(substr IN str) + Returns the position of the first occurrence of substring substr in string str. Returns 0 if substr is not in str: + + > SELECT LOCATE('bar', 'foobarbar'); + -> 4 + > SELECT LOCATE('xbar', 'foobar'); + -> 0 + LOCATE(substr,str,pos) + Returns the position of the first occurrence of substring substr in string str, starting at position pos. Returns 0 if substr is not in str: + + > SELECT LOCATE('bar', 'foobarbar',5); + -> 7 + + */ + class OOp_Locate : public ONthOperator + { + protected: + virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const; + }; + + /** SUBSTRING(str,pos) + SUBSTRING(str FROM pos) + Returns a substring from string str starting at position pos: + + > SELECT SUBSTRING('Quadratically',5); + -> 'ratically' + > SELECT SUBSTRING('foobarbar' FROM 4); + -> 'barbar' + SUBSTRING(str,pos,len) + SUBSTRING(str FROM pos FOR len) + Returns a substring len characters long from string str, starting at position pos. The variant form that uses FROM is SQL-92 syntax: + + > SELECT SUBSTRING('Quadratically',5,6); + -> 'ratica' + + */ + class OOp_SubString : public ONthOperator + { + protected: + virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const; + }; + + /** LTRIM(str) + Returns the string str with leading space characters removed: + + > SELECT LTRIM(' barbar'); + -> 'barbar' + + */ + class OOp_LTrim : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const; + }; + + /** RTRIM(str) + Returns the string str with trailing space characters removed: + + > SELECT RTRIM('barbar '); + -> 'barbar' + + */ + class OOp_RTrim : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const; + }; + + /** SPACE(N) + Returns a string consisting of N space characters: + + > SELECT SPACE(6); + -> ' ' + + */ + class OOp_Space : public OUnaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs) const; + }; + + /** REPLACE(str,from_str,to_str) + Returns the string str with all occurrences of the string from_str replaced by the string to_str: + + > SELECT REPLACE('www.OOo.com', 'w', 'Ww'); + -> 'WwWwWw.OOo.com' + + */ + class OOp_Replace : public ONthOperator + { + protected: + virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const; + }; + + /** REPEAT(str,count) + Returns a string consisting of the string str repeated count times. If count <= 0, returns an empty string. Returns NULL if str or count are NULL: + + > SELECT REPEAT('OOo', 3); + -> 'OOoOOoOOo' + + */ + class OOp_Repeat : public OBinaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const; + }; + + /** INSERT(str,pos,len,newstr) + Returns the string str, with the substring beginning at position pos and len characters long replaced by the string newstr: + + > SELECT INSERT('Quadratic', 3, 4, 'What'); + -> 'QuWhattic' + + */ + class OOp_Insert : public ONthOperator + { + protected: + virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const; + }; + + /** LEFT(str,len) + Returns the leftmost len characters from the string str: + + > SELECT LEFT('foobarbar', 5); + -> 'fooba' + + */ + class OOp_Left : public OBinaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const; + }; + + /** RIGHT(str,len) + Returns the rightmost len characters from the string str: + + > SELECT RIGHT('foobarbar', 4); + -> 'rbar' + */ + class OOp_Right : public OBinaryOperator + { + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const; + }; + } +} + +#endif // _CONNECTIVITY_FILE_FCODE_HXX_ + diff --git a/connectivity/source/inc/file/FTable.hxx b/connectivity/source/inc/file/FTable.hxx new file mode 100644 index 000000000000..bc4cd450f931 --- /dev/null +++ b/connectivity/source/inc/file/FTable.hxx @@ -0,0 +1,120 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_TABLE_HXX_ +#define _CONNECTIVITY_FILE_TABLE_HXX_ + +#include "connectivity/sdbcx/VTable.hxx" +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#ifndef _CONNECTIVITY_FILE_BCONNECTION_HXX_ +#include "file/FConnection.hxx" +#endif +#include "file/filedllapi.hxx" +#include <tools/stream.hxx> +#include "connectivity/FValue.hxx" +#include "TResultSetHelper.hxx" + +namespace connectivity +{ + namespace file + { + typedef connectivity::sdbcx::OTable OTable_TYPEDEF; + + class OOO_DLLPUBLIC_FILE OFileTable : public OTable_TYPEDEF + { + protected: + OConnection* m_pConnection; + SvStream* m_pFileStream; + ::vos::ORef<OSQLColumns> m_aColumns; + sal_Int32 m_nFilePos; // aktuelle IResultSetHelper::Movement + sal_uInt8* m_pBuffer; + sal_uInt16 m_nBufferSize; // Groesse des ReadBuffer, wenn pBuffer != NULL + sal_Bool m_bWriteable; // svstream cann't say if we are writeable + // so we have to + + virtual void FileClose(); + virtual ~OFileTable( ); + public: + virtual void refreshColumns(); + virtual void refreshKeys(); + virtual void refreshIndexes(); + public: + OFileTable( sdbcx::OCollection* _pTables,OConnection* _pConnection); + OFileTable( sdbcx::OCollection* _pTables,OConnection* _pConnection, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _Type, + const ::rtl::OUString& _Description = ::rtl::OUString(), + const ::rtl::OUString& _SchemaName = ::rtl::OUString(), + const ::rtl::OUString& _CatalogName = ::rtl::OUString() + ); + + //XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + + OConnection* getConnection() const { return m_pConnection;} + virtual sal_Int32 getCurrentLastPos() const {return -1;} + + virtual sal_Bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos) = 0; + virtual sal_Bool fetchRow(OValueRefRow& _rRow,const OSQLColumns& _rCols, sal_Bool _bUseTableDefs,sal_Bool bRetrieveData) = 0; + + ::vos::ORef<OSQLColumns> getTableColumns() const {return m_aColumns;} + virtual BOOL InsertRow(OValueRefVector& rRow, BOOL bFlush,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& _xCols); + virtual BOOL DeleteRow(const OSQLColumns& _rCols); + virtual BOOL UpdateRow(OValueRefVector& rRow, OValueRefRow& 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); + virtual void dropColumn(sal_Int32 _nPos); + // refresh the header of file based tables to see changes done by someone + virtual void refreshHeader(); + + ::rtl::OUString SAL_CALL getName() throw() { return m_Name; } + + ::rtl::OUString getSchema() { return m_SchemaName; } + sal_Bool isReadOnly() const { return !m_bWriteable; } + // m_pFileStream && !m_pFileStream->IsWritable(); } + // 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(); + + + sal_Int32 getFilePos() const { return m_nFilePos; } + + public: + // helper + + // creates a stream using ::utl::UcbStreamHelper::CreateStream, but the error is simplified + // (NULL or non-NULL is returned) + static SvStream* createStream_simpleError( const String& _rFileName, StreamMode _eOpenMode); + }; + } +} +#endif // _CONNECTIVITY_FILE_TABLE_HXX_ + diff --git a/connectivity/source/inc/file/FTables.hxx b/connectivity/source/inc/file/FTables.hxx new file mode 100644 index 000000000000..4a15985c248b --- /dev/null +++ b/connectivity/source/inc/file/FTables.hxx @@ -0,0 +1,61 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_TABLES_HXX_ +#define _CONNECTIVITY_FILE_TABLES_HXX_ + +#include "file/filedllapi.hxx" +#include "connectivity/sdbcx/VCollection.hxx" +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> + +namespace connectivity +{ + namespace file + { + class OOO_DLLPUBLIC_FILE SAL_NO_VTABLE OTables : + public sdbcx::OCollection + { + protected: + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; + + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + public: + OTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, + const TStringVector &_rVector) : sdbcx::OCollection(_rParent,_rMetaData->storesMixedCaseQuotedIdentifiers(),_rMutex,_rVector) + ,m_xMetaData(_rMetaData) + {} + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + + // only the name is identical to ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + }; + } +} +#endif // _CONNECTIVITY_FILE_TABLES_HXX_ + diff --git a/connectivity/source/inc/file/fanalyzer.hxx b/connectivity/source/inc/file/fanalyzer.hxx new file mode 100644 index 000000000000..c882b760765a --- /dev/null +++ b/connectivity/source/inc/file/fanalyzer.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_FANALYZER_HXX_ +#define _CONNECTIVITY_FILE_FANALYZER_HXX_ + +#include "file/fcomp.hxx" +#include "file/filedllapi.hxx" + +namespace connectivity +{ + namespace file + { + class OConnection; + class OOO_DLLPUBLIC_FILE OSQLAnalyzer + { + typedef ::std::list<OEvaluateSet*> OEvaluateSetList; + typedef ::std::pair< ::vos::ORef<OPredicateCompiler>,::vos::ORef<OPredicateInterpreter> > TPredicates; + + ::std::vector< TPredicates > m_aSelectionEvaluations; + ::vos::ORef<OPredicateCompiler> m_aCompiler; + ::vos::ORef<OPredicateInterpreter> m_aInterpreter; + OConnection* m_pConnection; + + mutable sal_Bool m_bHasSelectionCode; + mutable sal_Bool m_bSelectionFirstTime; + + void bindRow(OCodeList& rCodeList,const OValueRefRow& _pRow,OEvaluateSetList& _rEvaluateSetList); + + public: + OSQLAnalyzer(OConnection* _pConnection); + virtual ~OSQLAnalyzer(); + inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW( () ) + { return ::rtl_allocateMemory( nSize ); } + inline static void * SAL_CALL operator new( size_t /*nSize*/,void* _pHint ) SAL_THROW( () ) + { return _pHint; } + inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW( () ) + { ::rtl_freeMemory( pMem ); } + inline static void SAL_CALL operator delete( void * /*pMem*/,void* /*_pHint*/ ) SAL_THROW( () ) + { } + + OConnection* getConnection() const { return m_pConnection; } + void describeParam(::vos::ORef<OSQLColumns> rParameterColumns); // genauere Beschreibung der Parameter + ::std::vector<sal_Int32>* bindEvaluationRow(OValueRefRow& _pRow); // Anbinden einer Ergebniszeile an die Restrictions + /** bind the select columns if they contain a function which needs a row value + @param _pRow the result row + */ + void bindSelectRow(const OValueRefRow& _pRow); + + /** binds the row to parameter for the restrictions + @param _pRow the parameter row + */ + void bindParameterRow(OValueRefRow& _pRow); + + void setIndexes(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _xIndexes); + + void dispose(); + void start(OSQLParseNode* pSQLParseNode); + void clean(); + virtual BOOL hasRestriction() const; + virtual BOOL hasFunctions() const; + inline BOOL evaluateRestriction() { return m_aInterpreter->start(); } + void setSelectionEvaluationResult(OValueRefRow& _pRow,const ::std::vector<sal_Int32>& _rColumnMapping); + void setOrigColumns(const OFileColumns& rCols); + virtual OOperandAttr* createOperandAttr(sal_Int32 _nPos, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xCol, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _xIndexes=NULL); + }; + } +} +#endif // _CONNECTIVITY_FILE_FANALYZER_HXX_ + diff --git a/connectivity/source/inc/file/fcode.hxx b/connectivity/source/inc/file/fcode.hxx new file mode 100644 index 000000000000..7a2125206549 --- /dev/null +++ b/connectivity/source/inc/file/fcode.hxx @@ -0,0 +1,396 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FILE_FCODE_HXX_ +#define _CONNECTIVITY_FILE_FCODE_HXX_ + +#include "connectivity/sqliterator.hxx" +#include <com/sun/star/sdbc/DataType.hpp> +#include "connectivity/CommonTools.hxx" +#include <tools/rtti.hxx> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include "connectivity/FValue.hxx" +#include "file/filedllapi.hxx" + +namespace connectivity +{ + class OSQLParseNode; + namespace dbase + { + class ODbaseIndex; + } + namespace file + { + + class OOperand; + typedef ::std::stack<OOperand*> OCodeStack; + class OBoolOperator; + typedef ::std::map<sal_Int32,sal_Int32> OEvaluateSet; + + typedef ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> OFileColumns; + + + class OOO_DLLPUBLIC_FILE OCode + { + public: + OCode(); + virtual ~OCode(); + + inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW( () ) + { return ::rtl_allocateMemory( nSize ); } + inline static void * SAL_CALL operator new( size_t /*nSize*/,void* _pHint ) SAL_THROW( () ) + { return _pHint; } + inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW( () ) + { ::rtl_freeMemory( pMem ); } + inline static void SAL_CALL operator delete( void * /*pMem*/,void* /*_pHint*/ ) SAL_THROW( () ) + { } + + TYPEINFO(); + }; + + + // operands that the parsetree generate + class OOO_DLLPUBLIC_FILE OOperand : public OCode + { + protected: + sal_Int32 m_eDBType; + + OOperand(const sal_Int32& _rType) : m_eDBType(_rType){} + OOperand() : m_eDBType(::com::sun::star::sdbc::DataType::OTHER){} + + public: + virtual const ORowSetValue& getValue() const = 0; + virtual void setValue(const ORowSetValue& _rVal) = 0; + + virtual sal_Int32 getDBType() const {return m_eDBType;} + virtual OEvaluateSet* preProcess(OBoolOperator* pOp, OOperand* pRight = 0); + inline sal_Bool isValid() const; + + TYPEINFO(); + }; + + class OOO_DLLPUBLIC_FILE OOperandRow : public OOperand + { + sal_uInt16 m_nRowPos; + protected: + OValueRefRow m_pRow; + + OOperandRow(sal_uInt16 _nPos, sal_Int32 _rType); + public: + sal_uInt16 getRowPos() const {return m_nRowPos;} + virtual const ORowSetValue& getValue() const; + virtual void setValue(const ORowSetValue& _rVal); + void bindValue(const OValueRefRow& _pRow); // Bindung an den Wert, den der Operand repraesentiert + + TYPEINFO(); + }; + + // Attribute aus einer Ergebniszeile + class OOO_DLLPUBLIC_FILE OOperandAttr : public OOperandRow + { + protected: + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xColumn; + + public: + OOperandAttr(sal_uInt16 _nPos, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xColumn); + + virtual sal_Bool isIndexed() const; + virtual OEvaluateSet* preProcess(OBoolOperator* pOp, OOperand* pRight = 0); + TYPEINFO(); + }; + + // Parameter fuer ein Praedikat + class OOperandParam : public OOperandRow + { + public: + OOperandParam(connectivity::OSQLParseNode* pNode, sal_Int32 _nPos); + void describe(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xColumn, ::vos::ORef<connectivity::OSQLColumns> _xParamColumns); + + TYPEINFO(); + }; + + // WerteOperanden + class OOperandValue : public OOperand + { + protected: + ORowSetValue m_aValue; + + protected: + OOperandValue(){} + OOperandValue(const ORowSetValue& _rVar, sal_Int32 eDbType) + : OOperand(eDbType) + , m_aValue(_rVar) + {} + + OOperandValue(sal_Int32 eDbType) :OOperand(eDbType){} + public: + virtual const ORowSetValue& getValue() const; + virtual void setValue(const ORowSetValue& _rVal); + + TYPEINFO(); + }; + + + // Konstanten + class OOperandConst : public OOperandValue + { + public: + OOperandConst(const connectivity::OSQLParseNode& rColumnRef, const rtl::OUString& aStrValue); + + TYPEINFO(); + }; + + + // Ergebnis Operanden + class OOperandResult : public OOperandValue + { + protected: + OOperandResult(const ORowSetValue& _rVar, sal_Int32 eDbType) + :OOperandValue(_rVar, eDbType) {} + OOperandResult(sal_Int32 eDbType) + :OOperandValue(eDbType) {} + public: + OOperandResult(const ORowSetValue& _rVar) + :OOperandValue(_rVar, _rVar.getTypeKind()) {} + TYPEINFO(); + }; + + + class OOperandResultBOOL : public OOperandResult + { + public: + OOperandResultBOOL(sal_Bool bResult) : OOperandResult(::com::sun::star::sdbc::DataType::BIT) + { + m_aValue = bResult ? 1.0 : 0.0; + m_aValue.setBound(sal_True); + } + }; + + class OOperandResultNUM : public OOperandResult + { + public: + OOperandResultNUM(double fNum) : OOperandResult(::com::sun::star::sdbc::DataType::DOUBLE) + { + m_aValue = fNum; + m_aValue.setBound(sal_True); + } + }; + + /** special stop operand + is appended when a list of arguments ends + */ + class OStopOperand : public OOperandValue + { + public: + OStopOperand(){} + TYPEINFO(); + }; + + // Operatoren + class OOO_DLLPUBLIC_FILE OOperator : public OCode + { + public: + virtual void Exec(OCodeStack&) = 0; + virtual sal_uInt16 getRequestedOperands() const; // Anzahl benoetigter Operanden + // Standard ist 2 + TYPEINFO(); + }; + + + // boolsche Operatoren + + class OOO_DLLPUBLIC_FILE OBoolOperator : public OOperator + { + public: + TYPEINFO(); + virtual void Exec(OCodeStack&); + virtual sal_Bool operate(const OOperand*, const OOperand*) const; + }; + + class OOp_NOT : public OBoolOperator + { + public: + TYPEINFO(); + + protected: + virtual void Exec(OCodeStack&); + virtual sal_Bool operate(const OOperand*, const OOperand* = NULL) const; + virtual sal_uInt16 getRequestedOperands() const; + }; + + class OOp_AND : public OBoolOperator + { + public: + TYPEINFO(); + + protected: + virtual sal_Bool operate(const OOperand*, const OOperand*) const; + }; + + class OOp_OR : public OBoolOperator + { + public: + TYPEINFO(); + protected: + virtual sal_Bool operate(const OOperand*, const OOperand*) const; + }; + + class OOO_DLLPUBLIC_FILE OOp_ISNULL : public OBoolOperator + { + public: + TYPEINFO(); + public: + virtual void Exec(OCodeStack&); + virtual sal_uInt16 getRequestedOperands() const; + virtual sal_Bool operate(const OOperand*, const OOperand* = NULL) const; + }; + + class OOO_DLLPUBLIC_FILE OOp_ISNOTNULL : public OOp_ISNULL + { + public: + TYPEINFO(); + virtual sal_Bool operate(const OOperand*, const OOperand* = NULL) const; + }; + + class OOO_DLLPUBLIC_FILE OOp_LIKE : public OBoolOperator + { + public: + TYPEINFO(); + protected: + const sal_Unicode cEscape; + + public: + OOp_LIKE(const sal_Unicode cEsc = L'\0'):cEscape(cEsc){}; + + virtual sal_Bool operate(const OOperand*, const OOperand*) const; + }; + + class OOp_NOTLIKE : public OOp_LIKE + { + public: + TYPEINFO(); + public: + OOp_NOTLIKE(const sal_Unicode cEsc = L'\0'):OOp_LIKE(cEsc){}; + + virtual sal_Bool operate(const OOperand*, const OOperand*) const; + }; + + class OOO_DLLPUBLIC_FILE OOp_COMPARE : public OBoolOperator + { + sal_Int32 aPredicateType; + + public: + TYPEINFO(); + OOp_COMPARE(sal_Int32 aPType) + :aPredicateType(aPType) {} + + inline sal_Int32 getPredicateType() const { return aPredicateType; } + virtual sal_Bool operate(const OOperand*, const OOperand*) const; + }; + + // numerische Operatoren + + class ONumOperator : public OOperator + { + public: + virtual void Exec(OCodeStack&); + + TYPEINFO(); + + protected: + virtual double operate(const double& fLeft,const double& fRight) const = 0; + }; + + class OOp_ADD : public ONumOperator + { + protected: + virtual double operate(const double& fLeft,const double& fRight) const; + }; + + class OOp_SUB : public ONumOperator + { + protected: + virtual double operate(const double& fLeft,const double& fRight) const; + }; + + class OOp_MUL : public ONumOperator + { + protected: + virtual double operate(const double& fLeft,const double& fRight) const; + }; + + class OOp_DIV : public ONumOperator + { + protected: + virtual double operate(const double& fLeft,const double& fRight) const; + }; + + inline sal_Bool OOperand::isValid() const + { + return getValue().getDouble() != double(0.0); + } + + // operator + class ONthOperator : public OOperator + { + public: + virtual void Exec(OCodeStack&); + + TYPEINFO(); + + protected: + virtual ORowSetValue operate(const ::std::vector<ORowSetValue>& lhs) const = 0; + }; + + class OBinaryOperator : public OOperator + { + public: + virtual void Exec(OCodeStack&); + + TYPEINFO(); + + protected: + virtual ORowSetValue operate(const ORowSetValue& lhs,const ORowSetValue& rhs) const = 0; + }; + + class OUnaryOperator : public OOperator + { + public: + virtual void Exec(OCodeStack&); + virtual sal_uInt16 getRequestedOperands() const; + virtual ORowSetValue operate(const ORowSetValue& lhs) const = 0; + + TYPEINFO(); + + }; + } +} + +#endif // _CONNECTIVITY_FILE_FCODE_HXX_ + diff --git a/connectivity/source/inc/file/fcomp.hxx b/connectivity/source/inc/file/fcomp.hxx new file mode 100644 index 000000000000..b46d24ddd089 --- /dev/null +++ b/connectivity/source/inc/file/fcomp.hxx @@ -0,0 +1,120 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_FILE_FCOMP_HXX_ +#define _CONNECTIVITY_FILE_FCOMP_HXX_ + +#include "file/fcode.hxx" +#include "file/filedllapi.hxx" +#ifndef _LIST_ +#include <list> +#endif + +namespace connectivity +{ + class OSQLParseNode; + namespace file + { + class OCode; + class OOperand; + class OSQLAnalyzer; + typedef::std::vector<OCode*> OCodeList; + + class OPredicateCompiler : public ::vos::OReference + { + friend class OPredicateInterpreter; + friend class OSQLAnalyzer; + + OCodeList m_aCodeList; + OFileColumns m_orgColumns; // in filecurs this are the filecolumns + OSQLAnalyzer* m_pAnalyzer; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xIndexes; + sal_Int32 m_nParamCounter; + sal_Bool m_bORCondition; + public: + OPredicateCompiler(OSQLAnalyzer* pAnalyzer); + + virtual ~OPredicateCompiler(); + + inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW( () ) + { return ::rtl_allocateMemory( nSize ); } + inline static void * SAL_CALL operator new( size_t /*nSize*/,void* _pHint ) SAL_THROW( () ) + { return _pHint; } + inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW( () ) + { ::rtl_freeMemory( pMem ); } + inline static void SAL_CALL operator delete( void * /*pMem*/,void* /*_pHint*/ ) SAL_THROW( () ) + { } + void dispose(); + + void start(connectivity::OSQLParseNode* pSQLParseNode); + OOperand* execute(connectivity::OSQLParseNode* pPredicateNode); + + void Clean(); + sal_Bool isClean() const {return m_aCodeList.empty();} + sal_Bool hasCode() const {return !isClean();} + sal_Bool hasORCondition() const {return m_bORCondition;} + void setOrigColumns(const OFileColumns& rCols) { m_orgColumns = rCols; } + const OFileColumns getOrigColumns() const { return m_orgColumns; } + protected: + OOperand* execute_COMPARE(connectivity::OSQLParseNode* pPredicateNode) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + OOperand* execute_LIKE(connectivity::OSQLParseNode* pPredicateNode) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + OOperand* execute_BETWEEN(connectivity::OSQLParseNode* pPredicateNode) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + OOperand* execute_ISNULL(connectivity::OSQLParseNode* pPredicateNode) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + OOperand* execute_Operand(connectivity::OSQLParseNode* pPredicateNode) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + OOperand* execute_Fold(OSQLParseNode* pPredicateNode) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + OOperand* executeFunction(OSQLParseNode* pPredicateNode) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + + + class OPredicateInterpreter : + public ::vos::OReference + { + OCodeStack m_aStack; + ::vos::ORef<OPredicateCompiler> m_rCompiler; + + public: + OPredicateInterpreter(const ::vos::ORef<OPredicateCompiler>& rComp) : m_rCompiler(rComp){} + virtual ~OPredicateInterpreter(); + + sal_Bool evaluate(OCodeList& rCodeList); + void evaluateSelection(OCodeList& rCodeList,ORowSetValueDecoratorRef& _rVal); + + inline sal_Bool start() + { + return evaluate(m_rCompiler->m_aCodeList); + } + + inline void startSelection(ORowSetValueDecoratorRef& _rVal) + { + return evaluateSelection(m_rCompiler->m_aCodeList,_rVal); + } + + + }; + } +} +#endif // _CONNECTIVITY_FILE_FCOMP_HXX_ + diff --git a/connectivity/source/inc/file/filedllapi.hxx b/connectivity/source/inc/file/filedllapi.hxx new file mode 100644 index 000000000000..11f98fa80690 --- /dev/null +++ b/connectivity/source/inc/file/filedllapi.hxx @@ -0,0 +1,40 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FILEDLLAPI_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FILEDLLAPI_HXX + +#include "sal/config.h" + +#include "sal/types.h" + +#if defined OOO_DLLIMPLEMENTATION_FILE +#define OOO_DLLPUBLIC_FILE SAL_DLLPUBLIC_EXPORT +#else +#define OOO_DLLPUBLIC_FILE SAL_DLLPUBLIC_IMPORT +#endif + +#endif diff --git a/connectivity/source/inc/file/quotedstring.hxx b/connectivity/source/inc/file/quotedstring.hxx new file mode 100644 index 000000000000..cb9215a014b2 --- /dev/null +++ b/connectivity/source/inc/file/quotedstring.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_QUOTED_STRING_HXX +#define CONNECTIVITY_QUOTED_STRING_HXX + +#include <tools/string.hxx> +#include "file/filedllapi.hxx" + +namespace connectivity +{ + //================================================================== + // Ableitung von String mit ueberladenen GetToken/GetTokenCount-Methoden + // Speziell fuer FLAT FILE-Format: Strings koennen gequotet sein + //================================================================== + class OOO_DLLPUBLIC_FILE QuotedTokenizedString + { + String m_sString; + public: + QuotedTokenizedString() {} + QuotedTokenizedString(const String& _sString) : m_sString(_sString){} + + xub_StrLen GetTokenCount( sal_Unicode cTok , sal_Unicode cStrDel ) const; + void GetTokenSpecial( String& _rStr,xub_StrLen& nStartPos, sal_Unicode cTok = ';', sal_Unicode cStrDel = '\0' ) const; + inline String& GetString() { return m_sString; } + inline xub_StrLen Len() const { return m_sString.Len(); } + inline operator String&() { return m_sString; } + }; +} + +#endif // CONNECTIVITY_QUOTED_STRING_HXX diff --git a/connectivity/source/inc/flat/ECatalog.hxx b/connectivity/source/inc/flat/ECatalog.hxx new file mode 100644 index 000000000000..4692f58171d8 --- /dev/null +++ b/connectivity/source/inc/flat/ECatalog.hxx @@ -0,0 +1,49 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FLAT_CATALOG_HXX_ +#define _CONNECTIVITY_FLAT_CATALOG_HXX_ + +#include "file/FCatalog.hxx" + +namespace connectivity +{ + namespace flat + { + class OFlatConnection; + class OFlatCatalog : public file::OFileCatalog + { + public: + virtual void refreshTables(); + + public: + OFlatCatalog(OFlatConnection* _pCon); + }; + } +} +#endif // _CONNECTIVITY_FLAT_CATALOG_HXX_ + diff --git a/connectivity/source/inc/flat/EColumns.hxx b/connectivity/source/inc/flat/EColumns.hxx new file mode 100644 index 000000000000..7c6e7dfd0f2e --- /dev/null +++ b/connectivity/source/inc/flat/EColumns.hxx @@ -0,0 +1,52 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FLAT_COLUMNS_HXX_ +#define _CONNECTIVITY_FLAT_COLUMNS_HXX_ + +#include "file/FColumns.hxx" + +namespace connectivity +{ + namespace flat + { + class OFlatColumns : public file::OColumns + { + protected: + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + public: + OFlatColumns(file::OFileTable* _pTable, + ::osl::Mutex& _rMutex, + const TStringVector &_rVector + ) : file::OColumns(_pTable,_rMutex,_rVector) + {} + + }; + } +} +#endif // _CONNECTIVITY_FLAT_COLUMNS_HXX_ + diff --git a/connectivity/source/inc/flat/EConnection.hxx b/connectivity/source/inc/flat/EConnection.hxx new file mode 100644 index 000000000000..3b4fb7e558d6 --- /dev/null +++ b/connectivity/source/inc/flat/EConnection.hxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FLAT_ECONNECTION_HXX_ +#define _CONNECTIVITY_FLAT_ECONNECTION_HXX_ + +#include "file/FConnection.hxx" + +namespace connectivity +{ + namespace flat + { + class ODriver; + class OFlatConnection : public file::OConnection + { + private: + sal_Bool m_bHeaderLine; // column names in first row + sal_Unicode m_cFieldDelimiter; // look at the name + sal_Unicode m_cStringDelimiter; // delimiter for strings m_cStringDelimiter blabla m_cStringDelimiter + sal_Unicode m_cDecimalDelimiter; // Dezimal-delimiter (Dezimalpoint) + sal_Unicode m_cThousandDelimiter; // + public: + OFlatConnection(ODriver* _pDriver); + virtual ~OFlatConnection(); + + virtual void construct(const ::rtl::OUString& _rUrl,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rInfo ) throw( ::com::sun::star::sdbc::SQLException); + + // own methods + inline sal_Bool isHeaderLine() const { return m_bHeaderLine; } + inline sal_Unicode getFieldDelimiter() const { return m_cFieldDelimiter; } + inline sal_Unicode getStringDelimiter() const { return m_cStringDelimiter; } + inline sal_Unicode getDecimalDelimiter() const { return m_cDecimalDelimiter; } + inline sal_Unicode getThousandDelimiter() const { return m_cThousandDelimiter;} + // XServiceInfo + DECLARE_SERVICE_INFO(); + + // XConnection + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > createCatalog(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > SAL_CALL createStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareCall( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_FLAT_DCONNECTION_HXX_ + diff --git a/connectivity/source/inc/flat/EDatabaseMetaData.hxx b/connectivity/source/inc/flat/EDatabaseMetaData.hxx new file mode 100644 index 000000000000..79cb18bcbf40 --- /dev/null +++ b/connectivity/source/inc/flat/EDatabaseMetaData.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FLAT_EDATABASEMETADATA_HXX_ +#define _CONNECTIVITY_FLAT_EDATABASEMETADATA_HXX_ + +#include "file/FDatabaseMetaData.hxx" + +namespace connectivity +{ + namespace flat + { + //************************************************************** + //************ Class: java.sql.DatabaseMetaDataDate + //************************************************************** + + class OFlatDatabaseMetaData : public file::ODatabaseMetaData + { + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > impl_getTypeInfo_throw(); + protected: + virtual ~OFlatDatabaseMetaData(); + public: + OFlatDatabaseMetaData(file::OConnection* _pCon); + + virtual ::rtl::OUString SAL_CALL getURL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_FLAT_ODATABASEMETADATA_HXX_ + diff --git a/connectivity/source/inc/flat/EDriver.hxx b/connectivity/source/inc/flat/EDriver.hxx new file mode 100644 index 000000000000..124dbf1f6156 --- /dev/null +++ b/connectivity/source/inc/flat/EDriver.hxx @@ -0,0 +1,61 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FLAT_EDRIVER_HXX_ +#define _CONNECTIVITY_FLAT_EDRIVER_HXX_ + +#include <cppuhelper/compbase2.hxx> +#include "connectivity/CommonTools.hxx" +#include "file/FDriver.hxx" + +namespace connectivity +{ + namespace flat + { + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ODriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ); + + class ODriver : public file::OFileDriver + { + public: + ODriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) : file::OFileDriver(_rxFactory){} + + // XInterface + static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); + // static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); + + ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + // XDriver + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } + +} +#endif //_CONNECTIVITY_FLAT_DDRIVER_HXX_ + diff --git a/connectivity/source/inc/flat/EPreparedStatement.hxx b/connectivity/source/inc/flat/EPreparedStatement.hxx new file mode 100644 index 000000000000..50ffb9173b79 --- /dev/null +++ b/connectivity/source/inc/flat/EPreparedStatement.hxx @@ -0,0 +1,50 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FLAT_DPREPAREDSTATEMENT_HXX_ +#define _CONNECTIVITY_FLAT_DPREPAREDSTATEMENT_HXX_ + +#include "file/FPreparedStatement.hxx" + +namespace connectivity +{ + namespace flat + { + class OConnection; + class OFlatPreparedStatement : public file::OPreparedStatement + { + protected: + virtual file::OResultSet* createResultSet(); + public: + OFlatPreparedStatement( file::OConnection* _pConnection) : file::OPreparedStatement( _pConnection){} + DECLARE_SERVICE_INFO(); + }; + } +} + +#endif //_CONNECTIVITY_FLAT_DPREPAREDSTATEMENT_HXX_ + diff --git a/connectivity/source/inc/flat/EResultSet.hxx b/connectivity/source/inc/flat/EResultSet.hxx new file mode 100644 index 000000000000..6a9958dd7bea --- /dev/null +++ b/connectivity/source/inc/flat/EResultSet.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FLAT_ERESULTSET_HXX_ +#define _CONNECTIVITY_FLAT_ERESULTSET_HXX_ + +#include "file/FResultSet.hxx" +#include <com/sun/star/sdbcx/XRowLocate.hpp> +#include <cppuhelper/implbase1.hxx> + +namespace connectivity +{ + namespace flat + { + class OFlatResultSet; + // these typedef's are only necessary for the compiler + typedef ::cppu::ImplHelper1< ::com::sun::star::sdbcx::XRowLocate> OFlatResultSet_BASE; + typedef file::OResultSet OFlatResultSet_BASE2; + typedef ::comphelper::OPropertyArrayUsageHelper<OFlatResultSet> OFlatResultSet_BASE3; + + + class OFlatResultSet : public OFlatResultSet_BASE2, + public OFlatResultSet_BASE, + public OFlatResultSet_BASE3 + { + sal_Bool m_bBookmarkable; + protected: + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + public: + DECLARE_SERVICE_INFO(); + + OFlatResultSet( file::OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + + // XRowLocate + virtual ::com::sun::star::uno::Any SAL_CALL getBookmark( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL moveRelativeToBookmark( const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL compareBookmarks( const ::com::sun::star::uno::Any& first, const ::com::sun::star::uno::Any& second ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL hashBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif //_CONNECTIVITY_FLAT_DRESULTSET_HXX_ + diff --git a/connectivity/source/inc/flat/EStatement.hxx b/connectivity/source/inc/flat/EStatement.hxx new file mode 100644 index 000000000000..c80dfe0405a2 --- /dev/null +++ b/connectivity/source/inc/flat/EStatement.hxx @@ -0,0 +1,49 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FLAT_ESTATEMENT_HXX_ +#define _CONNECTIVITY_FLAT_ESTATEMENT_HXX_ + +#include "file/FStatement.hxx" + +namespace connectivity +{ + namespace flat + { + class OConnection; + class OFlatStatement : public file::OStatement + { + protected: + virtual file::OResultSet* createResultSet(); + public: + OFlatStatement( file::OConnection* _pConnection) : file::OStatement( _pConnection){} + DECLARE_SERVICE_INFO(); + }; + } +} + +#endif //_CONNECTIVITY_FLAT_DSTATEMENT_HXX_ diff --git a/connectivity/source/inc/flat/ETable.hxx b/connectivity/source/inc/flat/ETable.hxx new file mode 100644 index 000000000000..51d57376c5d2 --- /dev/null +++ b/connectivity/source/inc/flat/ETable.hxx @@ -0,0 +1,103 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FLAT_TABLE_HXX_ +#define _CONNECTIVITY_FLAT_TABLE_HXX_ + +#include "file/FTable.hxx" +#include "connectivity/sdbcx/VColumn.hxx" +#include "connectivity/CommonTools.hxx" +#include <tools/urlobj.hxx> +#include "file/quotedstring.hxx" + +namespace connectivity +{ + namespace flat + { + typedef file::OFileTable OFlatTable_BASE; + class OFlatConnection; + + typedef ::std::map< ::rtl::OUString, + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed>, comphelper::UStringMixLess > OContainer; + typedef ::std::map<sal_Int32, sal_Int32> TRowPositionsInFile; + + class OFlatTable : public OFlatTable_BASE + { + // maps a row postion to a file position + TRowPositionsInFile m_aFilePosToEndLinePos; + ::std::map<sal_Int32, TRowPositionsInFile::iterator> + m_aRowPosToFilePos; + ::std::vector<sal_Int32> m_aTypes; // holds all type for columns just to avoid to ask the propertyset + ::std::vector<sal_Int32> m_aPrecisions; // same as aboth + ::std::vector<sal_Int32> m_aScales; + QuotedTokenizedString m_aCurrentLine; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xNumberFormatter; + ::com::sun::star::util::Date m_aNullDate; + sal_Int32 m_nStartRowFilePos; + sal_Int32 m_nRowPos; + sal_Int32 m_nMaxRowCount; // will be set if stream is once eof + sal_Unicode m_cStringDelimiter; // delimiter for strings m_cStringDelimiter blabla m_cStringDelimiter + sal_Unicode m_cFieldDelimiter; // look at the name + bool m_bNeedToReadLine; + private: + void fillColumns(const ::com::sun::star::lang::Locale& _aLocale); + BOOL CreateFile(const INetURLObject& aFile, BOOL& bCreateMemo); + sal_Bool readLine(sal_Int32& _rnCurrentPos); + public: + virtual void refreshColumns(); + + public: + // DECLARE_CTY_DEFAULTS( OFlatTable_BASE); + OFlatTable( sdbcx::OCollection* _pTables,OFlatConnection* _pConnection, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _Type, + const ::rtl::OUString& _Description = ::rtl::OUString(), + const ::rtl::OUString& _SchemaName = ::rtl::OUString(), + const ::rtl::OUString& _CatalogName = ::rtl::OUString() + ); + + void construct(); // can throw any exception + + virtual sal_Bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos); + virtual sal_Bool fetchRow(OValueRefRow& _rRow,const OSQLColumns& _rCols, sal_Bool bIsTable,sal_Bool bRetrieveData); + virtual void refreshHeader(); + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL disposing(void); + + // 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(); + + String getEntry(); + }; + } +} +#endif // _CONNECTIVITY_FLAT_TABLE_HXX_ + diff --git a/connectivity/source/inc/flat/ETables.hxx b/connectivity/source/inc/flat/ETables.hxx new file mode 100644 index 000000000000..b14379d4c6ae --- /dev/null +++ b/connectivity/source/inc/flat/ETables.hxx @@ -0,0 +1,52 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_FLAT_TABLES_HXX_ +#define _CONNECTIVITY_FLAT_TABLES_HXX_ + +#include "file/FTables.hxx" + +namespace connectivity +{ + namespace flat + { + // namespace ::com::sun::star::sdbcx = ::com::sun::star::sdbcx; + typedef file::OTables OFlatTables_BASE; + + class OFlatTables : public OFlatTables_BASE + { + protected: + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + public: + OFlatTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, + const TStringVector &_rVector) : OFlatTables_BASE(_rMetaData,_rParent,_rMutex,_rVector) + {} + }; + } +} +#endif // _CONNECTIVITY_FLAT_TABLES_HXX_ + diff --git a/connectivity/source/inc/hsqldb/HCatalog.hxx b/connectivity/source/inc/hsqldb/HCatalog.hxx new file mode 100644 index 000000000000..a58ddbcecf9d --- /dev/null +++ b/connectivity/source/inc/hsqldb/HCatalog.hxx @@ -0,0 +1,72 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CONNECTIVITY_HSQLDB_CATALOG_HXX +#define CONNECTIVITY_HSQLDB_CATALOG_HXX + +#include "connectivity/sdbcx/VCatalog.hxx" +#include "connectivity/StdTypeDefs.hxx" + +namespace connectivity +{ + namespace hsqldb + { + // please don't name the class the same name as in an other namespaces + // some compilers have problems with this task as I noticed on windows + class OHCatalog : public connectivity::sdbcx::OCatalog + { + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection; + + /** calls XDatabaseMetaData::getTables. + @param _sKindOfObject + The type of tables to be fetched. + @param _rNames + The container for the names to be filled. + */ + void refreshObjects(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _sKindOfObject,TStringVector& _rNames); + + public: + // implementation of the pure virtual methods + virtual void refreshTables(); + virtual void refreshViews() ; + virtual void refreshGroups(); + virtual void refreshUsers() ; + + public: + OHCatalog(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection); + + inline sdbcx::OCollection* getPrivateTables() const { return m_pTables;} + inline sdbcx::OCollection* getPrivateViews() const { return m_pViews; } + inline ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > getConnection() const { return m_xConnection; } + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + // ::cppu::OComponentHelper + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // CONNECTIVITY_HSQLDB_CATALOG_HXX + diff --git a/connectivity/source/inc/hsqldb/HColumns.hxx b/connectivity/source/inc/hsqldb/HColumns.hxx new file mode 100644 index 000000000000..dc3e0e9655c2 --- /dev/null +++ b/connectivity/source/inc/hsqldb/HColumns.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CONNECTIVITY_HSQLDB_COLUMN_HXX +#define CONNECTIVITY_HSQLDB_COLUMN_HXX +#include "connectivity/TColumnsHelper.hxx" +#include "connectivity/sdbcx/VColumn.hxx" + +namespace connectivity +{ + namespace hsqldb + { + class OHSQLColumns : public OColumnsHelper + { + protected: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor(); + public: + OHSQLColumns( ::cppu::OWeakObject& _rParent + ,sal_Bool _bCase + ,::osl::Mutex& _rMutex + ,const TStringVector &_rVector + ,sal_Bool _bUseHardRef = sal_True + ); + }; + + class OHSQLColumn; + typedef sdbcx::OColumn OHSQLColumn_BASE; + typedef ::comphelper::OIdPropertyArrayUsageHelper<OHSQLColumn> OHSQLColumn_PROP; + + class OHSQLColumn : public OHSQLColumn_BASE, + public OHSQLColumn_PROP + { + ::rtl::OUString m_sAutoIncrement; + protected: + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const; + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + + public: + OHSQLColumn(sal_Bool _bCase); + virtual void construct(); + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // CONNECTIVITY_HSQLDB_COLUMN_HXX + diff --git a/connectivity/source/inc/hsqldb/HConnection.hxx b/connectivity/source/inc/hsqldb/HConnection.hxx new file mode 100644 index 000000000000..021f09c485bd --- /dev/null +++ b/connectivity/source/inc/hsqldb/HConnection.hxx @@ -0,0 +1,186 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_HSQLDB_CONNECTION_HXX +#define CONNECTIVITY_HSQLDB_CONNECTION_HXX + +#include "connectivity/ConnectionWrapper.hxx" +/** === begin UNO includes === **/ +#include <com/sun/star/util/XFlushable.hpp> +#include <com/sun/star/sdbc/XDriver.hpp> +#ifndef __com_sun_star_sdb_application_XTableUIProvider_hpp__ +#include <com/sun/star/sdb/application/XTableUIProvider.hpp> +#endif +#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> +/** === end UNO includes === **/ +#include <cppuhelper/compbase2.hxx> +#include <comphelper/uno3.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <memory> + +namespace connectivity +{ + namespace hsqldb + { + class SAL_NO_VTABLE IMethodGuardAccess + { + public: + virtual ::osl::Mutex& getMutex() const = 0; + virtual void checkDisposed() const = 0; + }; + + //========================================================================== + //= OHsqlConnection - wraps all methods to the real connection from the driver + //= but when disposed it doesn't dispose the real connection + //========================================================================== + typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::util::XFlushable + , ::com::sun::star::sdb::application::XTableUIProvider + > OHsqlConnection_BASE; + + class OHsqlConnection :public ::comphelper::OBaseMutex + ,public OHsqlConnection_BASE + ,public OConnectionWrapper + ,public IMethodGuardAccess + { + private: + ::cppu::OInterfaceContainerHelper m_aFlushListeners; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > m_xDriver; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB; + bool m_bIni; + bool m_bReadOnly; + + protected: + virtual void SAL_CALL disposing(void); + virtual ~OHsqlConnection(); + + public: + OHsqlConnection( + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > _rxDriver, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection, + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _xORB + ); + + // XServiceInfo + DECLARE_SERVICE_INFO(); + DECLARE_XTYPEPROVIDER() + DECLARE_XINTERFACE( ) + + // IMethodGuardAccess + virtual ::osl::Mutex& getMutex() const; + virtual void checkDisposed() const; + + // XFlushable + virtual void SAL_CALL flush( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addFlushListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XFlushListener >& l ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeFlushListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XFlushListener >& l ) throw (::com::sun::star::uno::RuntimeException); + + // XTableUIProvider + virtual ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > SAL_CALL getTableIcon( const ::rtl::OUString& TableName, ::sal_Int32 ColorMode ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getTableEditor( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >& DocumentUI, const ::rtl::OUString& TableName ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + private: +#if 0 + // TODO: resource + /** creates the dialog used for editing a linked table + + @param _rTableName + the name of the table to create the editor for. + + @param _rxDocumentUI + the UI of the database document, for which the editor is to be created. + Must not be <NULL/>. + + @return + the table editor dialog instance. + + @throws ::com::sun::star::lang::WrappedTargetException + if creating the dialog instance fails + + @throws ::com::sun::star::uno::RuntimeException + if a serious error occures + + @precond + Our mutex is locked. + */ + ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XExecutableDialog > + impl_createLinkedTableEditor_throw( + const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >& _rxDocumentUI, + const ::rtl::OUString& _rTableName + ); +#endif + + /** retrieves our table container + @return + our table container. Guaranteed to not be <NULL/>. + @throws ::com::sun::star::lang::WrappedTargetException + if a non-RuntimeException is caught during obtaining the container. + @throws ::com::sun::star::uno::RuntimeException + if a serious error occurs + @precond + We're not disposed. + */ + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > + impl_getTableContainer_throw(); + + /** checks whether the given table name denotes an existing table + @param _rTableName + the fully name of the table to check for existence + @throws ::com::sun::star::lang::IllegalArgumentException + if the name does not denote an existing table + @precond + We're not disposed. + */ + void impl_checkExistingTable_throw( const ::rtl::OUString& _rTableName ); + + /** checks whether the given table name refers to a HSQL TEXT TABLE + */ + bool impl_isTextTable_nothrow( const ::rtl::OUString& _rTableName ); + + /** retrieves the icon for HSQL TEXT TABLEs + */ + ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > + impl_getTextTableIcon_nothrow( ::sal_Int32 _ColorMode ); + }; + + //========================================================================== + //= OHsqlConnection + //========================================================================== + class MethodGuard : public ::osl::MutexGuard + { + private: + typedef ::osl::MutexGuard BaseGuard; + + public: + MethodGuard( const IMethodGuardAccess& _rComponent ) + :BaseGuard( _rComponent.getMutex() ) + { + _rComponent.checkDisposed(); + } + }; + } +} +#endif // CONNECTIVITY_HSQLDB_CONNECTION_HXX diff --git a/connectivity/source/inc/hsqldb/HDriver.hxx b/connectivity/source/inc/hsqldb/HDriver.hxx new file mode 100644 index 000000000000..72d21d5774e1 --- /dev/null +++ b/connectivity/source/inc/hsqldb/HDriver.hxx @@ -0,0 +1,144 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CONNECTIVITY_HSQLDB_DRIVER_HXX +#define CONNECTIVITY_HSQLDB_DRIVER_HXX + +#include <com/sun/star/sdbc/XDriver.hpp> +#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp> +#include <com/sun/star/sdbcx/XCreateCatalog.hpp> +#include <com/sun/star/embed/XTransactionListener.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/compbase5.hxx> +#include <comphelper/uno3.hxx> +#include <comphelper/stl_types.hxx> +#include <comphelper/broadcasthelper.hxx> +#include "connectivity/CommonTools.hxx" + +//........................................................................ +namespace connectivity +{ +//........................................................................ + + class OMetaConnection; + + namespace hsqldb + { + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ODriverDelegator_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ); + + typedef ::cppu::WeakComponentImplHelper5< ::com::sun::star::sdbc::XDriver + ,::com::sun::star::sdbcx::XDataDefinitionSupplier + , ::com::sun::star::lang::XServiceInfo + , ::com::sun::star::sdbcx::XCreateCatalog + , ::com::sun::star::embed::XTransactionListener + > ODriverDelegator_BASE; + + typedef ::std::pair< ::com::sun::star::uno::WeakReferenceHelper,::com::sun::star::uno::WeakReferenceHelper> TWeakRefPair; + typedef ::std::pair< ::rtl::OUString ,TWeakRefPair > TWeakConnectionPair; + + typedef ::std::pair< ::com::sun::star::uno::WeakReferenceHelper,TWeakConnectionPair> TWeakPair; + typedef ::std::vector< TWeakPair > TWeakPairVector; + + + /** delegates all calls to the orignal driver and extend the existing one with the SDBCX layer. + + */ + class ODriverDelegator : public ::comphelper::OBaseMutex + ,public ODriverDelegator_BASE + { + TWeakPairVector m_aConnections; // vector containing a list + // of all the Connection objects + // for this Driver + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > m_xDriver; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; + sal_Bool m_bInShutDownConnections; + + /** load the driver we want to delegate. + The <member>m_xDriver</member> may be <NULL/> if the driver could not be loaded. + @return + The driver which was currently selected. + */ + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > loadDriver( ); + + /** shut down the connection and revoke the storage from the map + @param _aIter + The connection to shut down and storage to revoke. + */ + void shutdownConnection(const TWeakPairVector::iterator& _aIter); + + public: + /** creates a new delegator for a HSQLDB driver + */ + ODriverDelegator(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory); + + // XServiceInfo + DECLARE_SERVICE_INFO(); + static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); + + // XDriver + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMajorVersion( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMinorVersion( ) throw (::com::sun::star::uno::RuntimeException); + + // XDataDefinitionSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& connection ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByURL( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + // XCreateCatalog + virtual void SAL_CALL createCatalog( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); + + // XTransactionListener + virtual void SAL_CALL preCommit( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL commited( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL preRevert( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL reverted( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); + + void shutdownConnections(); + protected: + /// dtor + virtual ~ODriverDelegator(); + // OComponentHelper + virtual void SAL_CALL disposing(void); + + /** called when we connected to a newly created embedded database + */ + void onConnectedNewDatabase( + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection + ); + }; + } + +//........................................................................ +} // namespace connectivity +//........................................................................ +#endif // CONNECTIVITY_HSQLDB_DRIVER_HXX + diff --git a/connectivity/source/inc/hsqldb/HStorageAccess.h b/connectivity/source/inc/hsqldb/HStorageAccess.h new file mode 100644 index 000000000000..279b82225e73 --- /dev/null +++ b/connectivity/source/inc/hsqldb/HStorageAccess.h @@ -0,0 +1,95 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include <jni.h> +/* Header for class com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess */ + +#ifndef _Included_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess +#define _Included_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess +#ifdef __cplusplus +extern "C" { +#endif +/* Inaccessible static: class_00024com_00024sun_00024star_00024sdbcx_00024comp_00024hsqldb_00024StorageNativeOutputStream */ +/* + * Class: com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess + * Method: openStream + * Signature: (Ljava/lang/String;Ljava/lang/String;I)V + */ +JNIEXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_openStream + (JNIEnv *, jobject, jstring, jstring, jint); + +/* + * Class: com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess + * Method: close + * Signature: (Ljava/lang/String;Ljava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_close + (JNIEnv *, jobject, jstring, jstring); + +/* + * Class: com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess + * Method: getFilePointer + * Signature: (Ljava/lang/String;Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_getFilePointer + (JNIEnv *, jobject, jstring, jstring); + +/* + * Class: com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess + * Method: length + * Signature: (Ljava/lang/String;Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_length + (JNIEnv *, jobject, jstring, jstring); + +/* + * Class: com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess + * Method: read + * Signature: (Ljava/lang/String;Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_read__Ljava_lang_String_2Ljava_lang_String_2 + (JNIEnv *, jobject, jstring, jstring); + +/* + * Class: com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess + * Method: read + * Signature: (Ljava/lang/String;Ljava/lang/String;[BII)I + */ +JNIEXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_read__Ljava_lang_String_2Ljava_lang_String_2_3BII + (JNIEnv *, jobject, jstring, jstring, jbyteArray, jint, jint); + +/* + * Class: com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess + * Method: readInt + * Signature: (Ljava/lang/String;Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_readInt + (JNIEnv *, jobject, jstring, jstring); + +/* + * Class: com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess + * Method: seek + * Signature: (Ljava/lang/String;Ljava/lang/String;J)V + */ +JNIEXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_seek + (JNIEnv *, jobject, jstring, jstring, jlong); + +/* + * Class: com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess + * Method: write + * Signature: (Ljava/lang/String;Ljava/lang/String;[BII)V + */ +JNIEXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_write + (JNIEnv *, jobject, jstring, jstring, jbyteArray, jint, jint); + +/* + * Class: com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess + * Method: writeInt + * Signature: (Ljava/lang/String;Ljava/lang/String;I)V + */ +JNIEXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_NativeStorageAccess_writeInt + (JNIEnv *, jobject, jstring, jstring, jint); + + +#ifdef __cplusplus +} +#endif +#endif diff --git a/connectivity/source/inc/hsqldb/HStorageAccess.hxx b/connectivity/source/inc/hsqldb/HStorageAccess.hxx new file mode 100644 index 000000000000..13721e020101 --- /dev/null +++ b/connectivity/source/inc/hsqldb/HStorageAccess.hxx @@ -0,0 +1,43 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_HSQLDB_STORAGEACCESS_HXX +#define CONNECTIVITY_HSQLDB_STORAGEACCESS_HXX + +#include "hsqldb/HStorageAccess.h" + +namespace connectivity { namespace hsqldb +{ + class DataLogFile; +} } + +jint read_from_storage_stream( JNIEnv * env, jobject obj_this, jstring name, jstring key, ::connectivity::hsqldb::DataLogFile* logger = NULL ); +jint read_from_storage_stream_into_buffer( JNIEnv * env, jobject obj_this,jstring name, jstring key, jbyteArray buffer, jint off, jint len, ::connectivity::hsqldb::DataLogFile* logger = NULL ); +void write_to_storage_stream_from_buffer( JNIEnv* env, jobject obj_this, jstring name, jstring key, jbyteArray buffer, jint off, jint len, ::connectivity::hsqldb::DataLogFile* logger = NULL ); +void write_to_storage_stream( JNIEnv* env, jobject obj_this, jstring name, jstring key, jint v, ::connectivity::hsqldb::DataLogFile* logger = NULL ); + +#endif // CONNECTIVITY_HSQLDB_STORAGEACCESS_HXX diff --git a/connectivity/source/inc/hsqldb/HStorageMap.hxx b/connectivity/source/inc/hsqldb/HStorageMap.hxx new file mode 100644 index 000000000000..47cb4781c72a --- /dev/null +++ b/connectivity/source/inc/hsqldb/HStorageMap.hxx @@ -0,0 +1,94 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CONNECTIVI_HSQLDB_HSTORAGEMAP_HXX +#define CONNECTIVI_HSQLDB_HSTORAGEMAP_HXX + +#include <com/sun/star/embed/XStorage.hpp> +#include <com/sun/star/embed/XTransactionListener.hpp> +#include <com/sun/star/io/XStream.hpp> +#include <com/sun/star/io/XOutputStream.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/io/XSeekable.hpp> +#ifndef BOOST_SHARED_PTR_HPP_INCLUDED +#include <boost/shared_ptr.hpp> +#endif +#include <comphelper/stl_types.hxx> +#include <jni.h> +//........................................................................ +namespace connectivity +{ +//........................................................................ + namespace hsqldb + { + class StreamHelper + { + ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream> m_xStream; + ::com::sun::star::uno::Reference< ::com::sun::star::io::XSeekable> m_xSeek; + ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream> m_xOutputStream; + ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream> m_xInputStream; + public: + StreamHelper(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream>& _xStream); + ~StreamHelper(); + + ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream> getInputStream(); + ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream> getOutputStream(); + ::com::sun::star::uno::Reference< ::com::sun::star::io::XSeekable> getSeek(); + }; + + + DECLARE_STL_USTRINGACCESS_MAP(::boost::shared_ptr<StreamHelper>,TStreamMap); + typedef ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >, ::rtl::OUString > TStorageURLPair; + typedef ::std::pair< TStorageURLPair, TStreamMap> TStoragePair; + DECLARE_STL_USTRINGACCESS_MAP(TStoragePair,TStorages); + /** contains all storages so far accessed. + */ + class StorageContainer + { + public: + static ::rtl::OUString registerStorage(const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage>& _xStorage,const ::rtl::OUString& _sURL); + static TStorages::mapped_type getRegisteredStorage(const ::rtl::OUString& _sKey); + static ::rtl::OUString getRegisteredKey(const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage>& _xStorage); + static void revokeStorage(const ::rtl::OUString& _sKey,const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XTransactionListener>& _xListener); + + static TStreamMap::mapped_type registerStream(JNIEnv * env,jstring name, jstring key,sal_Int32 _nMode); + static void revokeStream(JNIEnv * env,jstring name, jstring key); + static TStreamMap::mapped_type getRegisteredStream( JNIEnv * env, jstring name, jstring key); + + static ::rtl::OUString jstring2ustring(JNIEnv * env, jstring jstr); + static ::rtl::OUString removeURLPrefix(const ::rtl::OUString& _sURL,const ::rtl::OUString& _sFileURL); + static ::rtl::OUString removeOldURLPrefix(const ::rtl::OUString& _sURL); + static void throwJavaException(const ::com::sun::star::uno::Exception& _aException,JNIEnv * env); + }; + //........................................................................ + } // namespace hsqldb + //........................................................................ +//........................................................................ +} // namespace connectivity + +//........................................................................ +#endif // CONNECTIVI_HSQLDB_HSTORAGEMAP_HXX + diff --git a/connectivity/source/inc/hsqldb/HTable.hxx b/connectivity/source/inc/hsqldb/HTable.hxx new file mode 100644 index 000000000000..ade78e9e5dfc --- /dev/null +++ b/connectivity/source/inc/hsqldb/HTable.hxx @@ -0,0 +1,128 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_HSQLDB_TABLE_HXX +#define CONNECTIVITY_HSQLDB_TABLE_HXX + +#include "connectivity/TTableHelper.hxx" +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#include <comphelper/IdPropArrayHelper.hxx> + +namespace connectivity +{ + namespace hsqldb + { + + ::rtl::OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xColProp); + + class OHSQLTable; + typedef ::comphelper::OIdPropertyArrayUsageHelper< OHSQLTable > OHSQLTable_PROP; + class OHSQLTable : public OTableHelper + ,public OHSQLTable_PROP + { + sal_Int32 m_nPrivileges; // we have to set our privileges by our own + + /** executes the statmenmt. + @param _rStatement + The statement to execute. + */ + void executeStatement(const ::rtl::OUString& _rStatement ); + protected: + + /** creates the column collection for the table + @param _rNames + The column names. + */ + virtual sdbcx::OCollection* createColumns(const TStringVector& _rNames); + + /** creates the key collection for the table + @param _rNames + The key names. + */ + virtual sdbcx::OCollection* createKeys(const TStringVector& _rNames); + + /** creates the index collection for the table + @param _rNames + The index names. + */ + virtual sdbcx::OCollection* createIndexes(const TStringVector& _rNames); + + /** used to implement the creation of the array helper which is shared amongst all instances of the class. + This method needs to be implemented in derived classes. + <BR> + The method gets called with s_aMutex acquired. + <BR> + as long as IPropertyArrayHelper has no virtual destructor, the implementation of ~OPropertyArrayUsageHelper + assumes that you created an ::cppu::OPropertyArrayHelper when deleting s_pProps. + @return an pointer to the newly created array helper. Must not be NULL. + */ + virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const; + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + + public: + OHSQLTable( sdbcx::OCollection* _pTables, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection); + OHSQLTable( sdbcx::OCollection* _pTables, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _Type, + const ::rtl::OUString& _Description = ::rtl::OUString(), + const ::rtl::OUString& _SchemaName = ::rtl::OUString(), + const ::rtl::OUString& _CatalogName = ::rtl::OUString(), + sal_Int32 _nPrivileges = 0 + ); + + // ODescriptor + virtual void construct(); + // com::sun::star::lang::XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // 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); + + // 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); + + /** + returns the ALTER TABLE XXX COLUMN statement + */ + ::rtl::OUString getAlterTableColumnPart(); + + // some methods to alter table structures + void alterColumnType(sal_Int32 nNewType,const ::rtl::OUString& _rColName,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor); + void alterDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName); + void dropDefaultValue(const ::rtl::OUString& _sNewDefault); + + }; + } +} +#endif // CONNECTIVITY_HSQLDB_TABLE_HXX + diff --git a/connectivity/source/inc/hsqldb/HTables.hxx b/connectivity/source/inc/hsqldb/HTables.hxx new file mode 100644 index 000000000000..0a892e36beba --- /dev/null +++ b/connectivity/source/inc/hsqldb/HTables.hxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CONNECTIVITY_HSQLDB_TABLES_HXX +#define CONNECTIVITY_HSQLDB_TABLES_HXX + +#include "connectivity/sdbcx/VCollection.hxx" +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +namespace connectivity +{ + namespace hsqldb + { + class OTables : public sdbcx::OCollection + { + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; + + protected: + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor(); + virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); + + void createTable( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual ::rtl::OUString getNameForObject(const sdbcx::ObjectType& _xObject); + public: + OTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, + const TStringVector &_rVector) : sdbcx::OCollection(_rParent,sal_True,_rMutex,_rVector) + ,m_xMetaData(_rMetaData) + {} + + // only the name is identical to ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + + // XDrop + void appendNew(const ::rtl::OUString& _rsNewTable); + // some helper functions + /** + returns a sql string which contains the column definition part for create or alter statements + */ + static ::rtl::OUString getColumnSqlType(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColProp); + /** + returns the "not null" part or the default part of the table statement + */ + static ::rtl::OUString getColumnSqlNotNullDefault(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColProp); + /** + returns the corresponding typename + can contain () which have to filled with values + */ + static ::rtl::OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColProp); + }; + } +} +#endif // CONNECTIVITY_HSQLDB_TABLES_HXX + diff --git a/connectivity/source/inc/hsqldb/HTools.hxx b/connectivity/source/inc/hsqldb/HTools.hxx new file mode 100644 index 000000000000..fc64b6a9db7f --- /dev/null +++ b/connectivity/source/inc/hsqldb/HTools.hxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_HTOOLS_HXX +#define CONNECTIVITY_HTOOLS_HXX + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +#include <rtl/ustrbuf.hxx> + +//........................................................................ +namespace connectivity { namespace hsqldb +{ +//........................................................................ + + //==================================================================== + //= HTools + //==================================================================== + class HTools + { + public: + /** appens a proper WHERE clause to the given buffer, which filters + for a given table name + + @param _bShortForm + <TRUE/> if the column names of the system table which is being asked + have the short form (TABLE_CAT instead of TABLE_CATALOG, and so on) + */ + static void appendTableFilterCrit( + ::rtl::OUStringBuffer& _inout_rBuffer, const ::rtl::OUString& _rCatalog, + const ::rtl::OUString _rSchema, const ::rtl::OUString _rName, + bool _bShortForm + ); + }; + +//........................................................................ +} } // namespace connectivity::hsqldb +//........................................................................ + +#endif // CONNECTIVITY_HTOOLS_HXX diff --git a/connectivity/source/inc/hsqldb/HUser.hxx b/connectivity/source/inc/hsqldb/HUser.hxx new file mode 100644 index 000000000000..ca750f597c2b --- /dev/null +++ b/connectivity/source/inc/hsqldb/HUser.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_HSQLDB_USER_HXX_ +#define _CONNECTIVITY_HSQLDB_USER_HXX_ + +#include "connectivity/sdbcx/VUser.hxx" +#include "com/sun/star/sdbc/XConnection.hpp" + +namespace connectivity +{ + namespace hsqldb + { + typedef connectivity::sdbcx::OUser OUser_TYPEDEF; + + class OHSQLUser : public OUser_TYPEDEF + { + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection; + + ::rtl::OUString getPrivilegeString(sal_Int32 nRights) const; + // return the privileges and additional the grant rights + void findPrivilegesAndGrantPrivileges(const ::rtl::OUString& objName, sal_Int32 objType,sal_Int32& nRights,sal_Int32& nRightsWithGrant) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + public: + virtual void refreshGroups(); + public: + OHSQLUser( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection); + OHSQLUser( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,const ::rtl::OUString& _Name); + + // XUser + virtual void SAL_CALL changePassword( const ::rtl::OUString& objPassword, const ::rtl::OUString& newPassword ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XAuthorizable + virtual sal_Int32 SAL_CALL getPrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getGrantablePrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + + class OUserExtend; + typedef ::comphelper::OPropertyArrayUsageHelper<OUserExtend> OUserExtend_PROP; + + class OUserExtend : public OHSQLUser, + public OUserExtend_PROP + { + protected: + ::rtl::OUString m_Password; + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + public: + OUserExtend(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection); + + virtual void construct(); + }; + } +} +#endif // _CONNECTIVITY_HSQLDB_USER_HXX_ + diff --git a/connectivity/source/inc/hsqldb/HUsers.hxx b/connectivity/source/inc/hsqldb/HUsers.hxx new file mode 100644 index 000000000000..772d07730af9 --- /dev/null +++ b/connectivity/source/inc/hsqldb/HUsers.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_HSQLDB_USERS_HXX_ +#define _CONNECTIVITY_HSQLDB_USERS_HXX_ + +#include "connectivity/sdbcx/VCollection.hxx" +#include "com/sun/star/sdbc/XConnection.hpp" +namespace connectivity +{ + namespace sdbcx + { + class IRefreshableUsers; + } + namespace hsqldb + { + class OUsers : public sdbcx::OCollection + { + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection; + connectivity::sdbcx::IRefreshableUsers* m_pParent; + public: + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor(); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); + public: + OUsers( ::cppu::OWeakObject& _rParent, + ::osl::Mutex& _rMutex, + const TStringVector &_rVector, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection, + connectivity::sdbcx::IRefreshableUsers* _pParent); + }; + } +} + +#endif // _CONNECTIVITY_HSQLDB_USERS_HXX_ + diff --git a/connectivity/source/inc/hsqldb/HView.hxx b/connectivity/source/inc/hsqldb/HView.hxx new file mode 100644 index 000000000000..5bed5acb02bb --- /dev/null +++ b/connectivity/source/inc/hsqldb/HView.hxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_HVIEW_HXX +#define CONNECTIVITY_HVIEW_HXX + +#include "connectivity/sdbcx/VView.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/sdbcx/XAlterView.hpp> +/** === end UNO includes === **/ + +#include <comphelper/uno3.hxx> +#include <cppuhelper/implbase1.hxx> + +//........................................................................ +namespace connectivity { namespace hsqldb +{ +//........................................................................ + + //==================================================================== + //= HView + //==================================================================== + typedef ::connectivity::sdbcx::OView HView_Base; + typedef ::cppu::ImplHelper1< ::com::sun::star::sdbcx::XAlterView > HView_IBASE; + class HView :public HView_Base + ,public HView_IBASE + { + public: + HView( + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection, + sal_Bool _bCaseSensitive, + const ::rtl::OUString& _rSchemaName, + const ::rtl::OUString& _rName + ); + + // UNO + DECLARE_XINTERFACE() + DECLARE_XTYPEPROVIDER() + + // XAlterView + virtual void SAL_CALL alterCommand( const ::rtl::OUString& NewCommand ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + protected: + virtual ~HView(); + + protected: + // OPropertyContainer + virtual void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& _rValue, sal_Int32 _nHandle ) const; + + private: + /** retrieves the current command of the View + + @throws ::com::sun::star::lang::WrappedTargetException + if an error occurs while retrieving the command from the database and + <arg>_bAllowSQLExceptin</arg> is <FALSE/> + @throws ::com::sun::star::sdbc::SQLException + if an error occurs while retrieving the command from the database and + <arg>_bAllowSQLException</arg> is <TRUE/> + */ + ::rtl::OUString impl_getCommand_throw( bool _bAllowSQLException ) const; + + private: + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection; + private: + using HView_Base::getFastPropertyValue; + }; + +//........................................................................ +} } // namespace connectivity::hsqldb +//........................................................................ + +#endif // CONNECTIVITY_HVIEW_HXX diff --git a/connectivity/source/inc/hsqldb/HViews.hxx b/connectivity/source/inc/hsqldb/HViews.hxx new file mode 100644 index 000000000000..5b819449d6ff --- /dev/null +++ b/connectivity/source/inc/hsqldb/HViews.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_HSQLDB_VIEWS_HXX_ +#define _CONNECTIVITY_HSQLDB_VIEWS_HXX_ + +#include "connectivity/sdbcx/VCollection.hxx" +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +namespace connectivity +{ + namespace hsqldb + { + class HViews : public sdbcx::OCollection + { + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; + sal_Bool m_bInDrop; + + protected: + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor(); + virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); + + void createView( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + public: + HViews( + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection, + ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, const TStringVector &_rVector ); + + // only the name is identical to ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + + void dropByNameImpl(const ::rtl::OUString& elementName); + }; + } +} +#endif // _CONNECTIVITY_HSQLDB_VIEWS_HXX_ + diff --git a/connectivity/source/inc/hsqldb/StorageFileAccess.h b/connectivity/source/inc/hsqldb/StorageFileAccess.h new file mode 100644 index 000000000000..6d39465b4401 --- /dev/null +++ b/connectivity/source/inc/hsqldb/StorageFileAccess.h @@ -0,0 +1,37 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include <jni.h> +/* Header for class com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess */ + +#ifndef _Included_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess +#define _Included_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess + * Method: isStreamElement + * Signature: (Ljava/lang/String;Ljava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_isStreamElement + (JNIEnv *, jobject, jstring, jstring); + +/* + * Class: com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess + * Method: removeElement + * Signature: (Ljava/lang/String;Ljava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_removeElement + (JNIEnv *, jobject, jstring, jstring); + +/* + * Class: com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess + * Method: renameElement + * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_renameElement + (JNIEnv *, jobject, jstring, jstring, jstring); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/connectivity/source/inc/hsqldb/StorageNativeInputStream.h b/connectivity/source/inc/hsqldb/StorageNativeInputStream.h new file mode 100644 index 000000000000..8f8beb511fca --- /dev/null +++ b/connectivity/source/inc/hsqldb/StorageNativeInputStream.h @@ -0,0 +1,70 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include <jni.h> +/* Header for class com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream */ + +#ifndef _Included_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream +#define _Included_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream +#ifdef __cplusplus +extern "C" { +#endif +/* Inaccessible static: class_00024com_00024sun_00024star_00024sdbcx_00024comp_00024hsqldb_00024StorageNativeOutputStream */ +/* + * Class: com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream + * Method: openStream + * Signature: (Ljava/lang/String;Ljava/lang/String;I)V + */ +JNIEXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_openStream + (JNIEnv * env, jobject obj_this,jstring key, jstring name, jint); + +/* + * Class: com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream + * Method: read + * Signature: (Ljava/lang/String;Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_read__Ljava_lang_String_2Ljava_lang_String_2 + (JNIEnv * env, jobject obj_this,jstring key, jstring name); + +/* + * Class: com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream + * Method: read + * Signature: (Ljava/lang/String;Ljava/lang/String;[BII)I + */ +JNIEXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_read__Ljava_lang_String_2Ljava_lang_String_2_3BII + (JNIEnv * env, jobject obj_this,jstring key, jstring name, jbyteArray, jint, jint); + +/* + * Class: com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream + * Method: close + * Signature: (Ljava/lang/String;Ljava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_close + (JNIEnv *, jobject, jstring, jstring); + +/* + * Class: com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream + * Method: skip + * Signature: (Ljava/lang/String;Ljava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_skip + (JNIEnv *, jobject, jstring, jstring, jlong); + +/* + * Class: com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream + * Method: available + * Signature: (Ljava/lang/String;Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_available + (JNIEnv *, jobject, jstring, jstring); + +/* + * Class: com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream + * Method: read + * Signature: (Ljava/lang/String;Ljava/lang/String;[B)I + */ +JNIEXPORT jint JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageNativeInputStream_read__Ljava_lang_String_2Ljava_lang_String_2_3B + (JNIEnv *, jobject, jstring, jstring, jbyteArray); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/connectivity/source/inc/internalnode.hxx b/connectivity/source/inc/internalnode.hxx new file mode 100644 index 000000000000..2f234f8d27b1 --- /dev/null +++ b/connectivity/source/inc/internalnode.hxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_SQLINTERNALNODE_HXX +#define _CONNECTIVITY_SQLINTERNALNODE_HXX + +#include "connectivity/dbtoolsdllapi.hxx" +#include <connectivity/sqlnode.hxx> + +namespace connectivity +{ + //========================================================================== + //= OSQLInternalNode + //========================================================================== + /** special node for avoiding memory leaks + */ + class OSQLInternalNode : public OSQLParseNode + { + public: + OSQLInternalNode(const sal_Char* pNewValue, + SQLNodeType eNodeType, + sal_uInt32 nNodeID = 0); + OSQLInternalNode(const ::rtl::OString& _rNewValue, + SQLNodeType eNodeType, + sal_uInt32 nNodeID = 0); + OSQLInternalNode(const sal_Unicode* pNewValue, + SQLNodeType eNodeType, + sal_uInt32 nNodeID = 0); + OSQLInternalNode(const ::rtl::OUString& _rNewValue, + SQLNodeType eNodeType, + sal_uInt32 nNodeID = 0); + + virtual ~OSQLInternalNode(); + }; +} + +#endif //_CONNECTIVITY_SQLINTERNALNODE_HXX diff --git a/connectivity/source/inc/java/ContextClassLoader.hxx b/connectivity/source/inc/java/ContextClassLoader.hxx new file mode 100644 index 000000000000..69df7c1b13cd --- /dev/null +++ b/connectivity/source/inc/java/ContextClassLoader.hxx @@ -0,0 +1,103 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_CONTEXTCLASSLOADER_HXX +#define CONNECTIVITY_CONTEXTCLASSLOADER_HXX + +#include "java/GlobalRef.hxx" + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +namespace comphelper +{ + class ResourceBasedEventLogger; +} + +//........................................................................ +namespace connectivity { namespace jdbc +{ +//........................................................................ + + //==================================================================== + //= ContextClassLoaderScope + //==================================================================== + /** + */ + class ContextClassLoaderScope + { + public: + /** creates the instance. If isActive returns <FALSE/> afterwards, then an exception + happend in the JVM, which should be raised as UNO exception by the caller + + @param environment + the current JNI environment + @param newClassLoader + the new class loader to set at the current thread + @param _rLoggerForErrors + the logger which should be passed to java_lang_object::ThrowLoggedSQLException in case + an error occurs + @param _rxErrorContext + the context which should be passed to java_lang_object::ThrowLoggedSQLException in case + an error occurs + + */ + ContextClassLoaderScope( + JNIEnv& environment, + const GlobalRef< jobject >& newClassLoader, + const ::comphelper::ResourceBasedEventLogger& _rLoggerForErrors, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxErrorContext + ); + + ~ContextClassLoaderScope() { pop(true); } + + void pop() { pop(false); } + + bool isActive() const + { + return ( m_currentThread.is() ) + && ( m_setContextClassLoaderMethod != NULL ); + } + + private: + ContextClassLoaderScope(ContextClassLoaderScope &); // not defined + void operator =(ContextClassLoaderScope &); // not defined + + void pop( bool clearExceptions ); + + JNIEnv& m_environment; + LocalRef< jobject > m_currentThread; + LocalRef< jobject > m_oldContextClassLoader; + jmethodID m_setContextClassLoaderMethod; + }; + + +//........................................................................ +} } // namespace connectivity::jdbc +//........................................................................ + +#endif // CONNECTIVITY_CONTEXTCLASSLOADER_HXX diff --git a/connectivity/source/inc/java/GlobalRef.hxx b/connectivity/source/inc/java/GlobalRef.hxx new file mode 100644 index 000000000000..98511037eeaa --- /dev/null +++ b/connectivity/source/inc/java/GlobalRef.hxx @@ -0,0 +1,122 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_GLOBALREF_HXX +#define CONNECTIVITY_GLOBALREF_HXX + +#include "java/LocalRef.hxx" +#include "java/lang/Object.hxx" + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +#include <jvmaccess/virtualmachine.hxx> + +//........................................................................ +namespace connectivity { namespace jdbc +{ +//........................................................................ + + //==================================================================== + //= GlobalRef + //==================================================================== + /** helper class to hold a local ref to a JNI object + */ + template< typename T > + class GlobalRef + { + public: + GlobalRef() + :m_object( NULL ) + { + } + + GlobalRef( const GlobalRef& _source ) + :m_object( NULL ) + { + *this = _source; + } + + GlobalRef& operator=( const GlobalRef& _source ) + { + if ( &_source == this ) + return *this; + + SDBThreadAttach t; + set( t.env(), _source.get() ); + return *this; + } + + ~GlobalRef() + { + reset(); + } + + void reset() + { + if ( m_object != NULL ) + { + SDBThreadAttach t; + t.env().DeleteGlobalRef( m_object ); + m_object = NULL; + } + } + + void set( JNIEnv& _environment, T _object ) + { + if ( m_object != NULL ) + _environment.DeleteGlobalRef( m_object ); + m_object = _object; + if ( m_object ) + m_object = static_cast< T >( _environment.NewGlobalRef( m_object ) ); + } + + void set( LocalRef< T >& _object ) + { + set( _object.env(), _object.release() ); + } + + T get() const + { + return m_object; + } + + bool is() const + { + return m_object != NULL; + } + + private: + T m_object; + }; + + +//........................................................................ +} } // namespace connectivity::jdbc +//........................................................................ + +#endif // CONNECTIVITY_GLOBALREF_HXX diff --git a/connectivity/source/inc/java/LocalRef.hxx b/connectivity/source/inc/java/LocalRef.hxx new file mode 100644 index 000000000000..888366b0bff2 --- /dev/null +++ b/connectivity/source/inc/java/LocalRef.hxx @@ -0,0 +1,106 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_LOCALREF_HXX +#define CONNECTIVITY_LOCALREF_HXX + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +#include <jvmaccess/virtualmachine.hxx> + +//........................................................................ +namespace connectivity { namespace jdbc +{ +//........................................................................ + + //==================================================================== + //= LocalRef + //==================================================================== + /** helper class to hold a local ref to a JNI object + + Note that this class never actually calls NewLocalRef. It is assumed that all objects + passed are already acquired with a local ref (as it usually is the case if you obtain + the object from an JNI method). + */ + template< typename T > + class LocalRef + { + public: + explicit LocalRef( JNIEnv& environment ) + :m_environment( environment ) + ,m_object( NULL ) + { + } + + LocalRef( JNIEnv& environment, T object ) + :m_environment( environment ) + ,m_object( object ) + { + } + + ~LocalRef() + { + reset(); + } + + T release() + { + T t = m_object; + m_object = NULL; + return t; + } + + void set( T object ) { reset(); m_object = object; } + + void reset() + { + if ( m_object != NULL ) + { + m_environment.DeleteLocalRef( m_object ); + m_object = NULL; + } + } + + JNIEnv& env() const { return m_environment; } + T get() const { return m_object; } + bool is() const { return m_object != NULL; } + + private: + LocalRef(LocalRef &); // not defined + void operator =(LocalRef &); // not defined + + protected: + JNIEnv& m_environment; + T m_object; + }; + +//........................................................................ +} } // namespace connectivity::jdbc +//........................................................................ + +#endif // CONNECTIVITY_LOCALREF_HXX diff --git a/connectivity/source/inc/java/io/InputStream.hxx b/connectivity/source/inc/java/io/InputStream.hxx new file mode 100644 index 000000000000..914d9ed3f263 --- /dev/null +++ b/connectivity/source/inc/java/io/InputStream.hxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_IO_INPUTSTREAM_HXX_ +#define _CONNECTIVITY_JAVA_IO_INPUTSTREAM_HXX_ + +#include "java/lang/Object.hxx" +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/io/XInputStream.hpp> + +namespace connectivity +{ + + //************************************************************** + //************ Class: java.io.InputStream + //************************************************************** + class java_io_InputStream : public java_lang_Object, + public ::cppu::WeakImplHelper1< ::com::sun::star::io::XInputStream> + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + virtual ~java_io_InputStream(); + public: + virtual jclass getMyClass() const; + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_io_InputStream( JNIEnv * pEnv, jobject myObj ); + // XInputStream + virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL available( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL closeInput( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + }; +} +#endif // _CONNECTIVITY_JAVA_IO_INPUTSTREAM_HXX_ + diff --git a/connectivity/source/inc/java/io/Reader.hxx b/connectivity/source/inc/java/io/Reader.hxx new file mode 100644 index 000000000000..6e846fd2c295 --- /dev/null +++ b/connectivity/source/inc/java/io/Reader.hxx @@ -0,0 +1,61 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_IO_READER_HXX_ +#define _CONNECTIVITY_JAVA_IO_READER_HXX_ + +#include "java/lang/Object.hxx" +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/io/XInputStream.hpp> + +namespace connectivity +{ + //************************************************************** + //************ Class: java.io.InputStream + //************************************************************** + class java_io_Reader : public java_lang_Object, + public ::cppu::WeakImplHelper1< ::com::sun::star::io::XInputStream> + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + virtual ~java_io_Reader(); + public: + virtual jclass getMyClass() const; + + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_io_Reader( JNIEnv * pEnv, jobject myObj ); + // XInputStream + virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL available( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL closeInput( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + }; +} +#endif // _CONNECTIVITY_JAVA_IO_READER_HXX_ + diff --git a/connectivity/source/inc/java/lang/Boolean.hxx b/connectivity/source/inc/java/lang/Boolean.hxx new file mode 100644 index 000000000000..35655f8c1934 --- /dev/null +++ b/connectivity/source/inc/java/lang/Boolean.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_LANG_BOOLEAN_HXX_ +#define _CONNECTIVITY_JAVA_LANG_BOOLEAN_HXX_ + +#include "java/lang/Object.hxx" +//************************************************************** +//************ Class: java.lang.Boolean +//************************************************************** +namespace connectivity +{ + class java_lang_Boolean : public java_lang_Object + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + public: + virtual jclass getMyClass() const; + virtual ~java_lang_Boolean(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_lang_Boolean( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} + + static jclass st_getMyClass(); + }; +} + +#endif // _CONNECTIVITY_JAVA_LANG_BOOLEAN_HXX_ + + diff --git a/connectivity/source/inc/java/lang/Class.hxx b/connectivity/source/inc/java/lang/Class.hxx new file mode 100644 index 000000000000..b7a7182ae202 --- /dev/null +++ b/connectivity/source/inc/java/lang/Class.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_LANG_CLASS_HXX_ +#define _CONNECTIVITY_JAVA_LANG_CLASS_HXX_ +//************************************************************** +//************ Class: java.lang.Class +//************************************************************** +#include "java/lang/Object.hxx" + +namespace connectivity +{ + class java_lang_Class : public java_lang_Object + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + public: + virtual jclass getMyClass() const; + virtual ~java_lang_Class(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_lang_Class( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} + + static java_lang_Class * forName( const ::rtl::OUString &_par0 ); + // return the jre object + jobject newInstanceObject(); + + }; +} + +#endif // _CONNECTIVITY_JAVA_LANG_CLASS_HXX_ + diff --git a/connectivity/source/inc/java/lang/Exception.hxx b/connectivity/source/inc/java/lang/Exception.hxx new file mode 100644 index 000000000000..52261bfa255b --- /dev/null +++ b/connectivity/source/inc/java/lang/Exception.hxx @@ -0,0 +1,51 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_LANG_EXCEPTION_HXX_ +#define _CONNECTIVITY_JAVA_LANG_EXCEPTION_HXX_ + +#include "java/lang/Throwable.hxx" + +namespace connectivity +{ + + //************************************************************** + //************ Class: java.lang.Exception + //************************************************************** + class java_lang_Exception : public java_lang_Throwable{ + protected: + // statische Daten fuer die Klasse + static jclass theClass; + public: + virtual jclass getMyClass() const; + virtual ~java_lang_Exception(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_lang_Exception( JNIEnv * pEnv, jobject myObj ) : java_lang_Throwable( pEnv, myObj ){} + + }; +} +#endif // _CONNECTIVITY_JAVA_LANG_EXCEPTION_HXX_ + diff --git a/connectivity/source/inc/java/lang/Object.hxx b/connectivity/source/inc/java/lang/Object.hxx new file mode 100644 index 000000000000..c00c5e67e06d --- /dev/null +++ b/connectivity/source/inc/java/lang/Object.hxx @@ -0,0 +1,175 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_LANG_OBJECT_HXX_ +#define _CONNECTIVITY_JAVA_LANG_OBJECT_HXX_ + +#if STLPORT_VERSION>=321 +// jni.h needs cstdarg for std::va_list +#include <cstdarg> +#endif +#include <osl/thread.h> +#include <com/sun/star/sdbc/SQLException.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <osl/diagnose.h> +#include <jvmaccess/virtualmachine.hxx> +#include <memory> +#include <functional> +#include <boost/shared_ptr.hpp> + +//===================================================================== + +#ifdef HAVE_64BIT_POINTERS +#error "no 64 bit pointer" +#else +#ifdef OS2 +#define PVOID_TO_INT64(x) (jlong)(sal_Int32)x +#define INT64_TO_PVOID(x) (void *)x +#endif // OS2 +#endif //HAVE_64BIT_POINTERS + +namespace comphelper +{ + class ResourceBasedEventLogger; +} + +namespace connectivity +{ + typedef ::boost::shared_ptr< jvmaccess::VirtualMachine::AttachGuard> TGuard; + class SDBThreadAttach + { + jvmaccess::VirtualMachine::AttachGuard m_aGuard; + SDBThreadAttach(SDBThreadAttach&); + SDBThreadAttach& operator= (SDBThreadAttach&); + public: + SDBThreadAttach(); + ~SDBThreadAttach(); + + JNIEnv* pEnv; + static void addRef(); + static void releaseRef(); + + public: + JNIEnv& env() const + { + // according to the documentation of jvmaccess::VirtualMachine::AttachGuard, our env is never + // NULL, so why bothering with pointer checks? + return *pEnv; + } + }; + //===================================================================== + //===================================================================== + class java_lang_Class; + class java_lang_Object + { + // Zuweisungsoperator und Copy Konstruktor sind verboten + java_lang_Object& operator= (java_lang_Object&); + java_lang_Object(java_lang_Object&); + + // nur zum Zerstoeren des C++ Pointers in vom JSbxObject + // abgeleiteten Java Objekten + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; + + protected: + // der JAVA Handle zu dieser Klasse + jobject object; + // Klassendefinition + + // neu in SJ2: + static jclass theClass; // die Klasse braucht nur einmal angefordert werden ! + + virtual jclass getMyClass() const; + + public: + // der Konstruktor, der fuer die abgeleiteten Klassen verwendet + // werden soll. + java_lang_Object( JNIEnv * pEnv, jobject myObj ); + // der eigentliche Konstruktor + java_lang_Object(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory=NULL); + + virtual ~java_lang_Object(); + + void saveRef( JNIEnv * pEnv, jobject myObj ); + jobject getJavaObject() const { return object; } + java_lang_Object * GetWrapper() { return this; } + void clearObject(JNIEnv& rEnv); + void clearObject(); + + virtual ::rtl::OUString toString() const; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() { return m_xFactory; } + + static void ThrowSQLException(JNIEnv * pEnv,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> & _rContext); + static void ThrowLoggedSQLException( + const ::comphelper::ResourceBasedEventLogger& _rLogger, + JNIEnv* pEnvironment, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext + ); + + static ::rtl::Reference< jvmaccess::VirtualMachine > getVM(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory=NULL); + + static jclass findMyClass(const char* _pClassName); + void obtainMethodId(JNIEnv* _pEnv, const char* _pMethodName, const char* _pSignature, jmethodID& _inout_MethodID) const; + + sal_Bool callBooleanMethod( const char* _pMethodName, jmethodID& _inout_MethodID ) const; + sal_Bool callBooleanMethodWithIntArg( const char* _pMethodName, jmethodID& _inout_MethodID, sal_Int32 _nArgument ) const; + jobject callResultSetMethod( JNIEnv& _rEnv, const char* _pMethodName, jmethodID& _inout_MethodID ) const; + sal_Int32 callIntMethod( const char* _pMethodName, jmethodID& _inout_MethodID,bool _bIgnoreException = false ) const; + sal_Int32 callIntMethodWithIntArg( const char* _pMethodName, jmethodID& _inout_MethodID, sal_Int32 _nArgument ) const; + sal_Int32 callIntMethodWithStringArg( const char* _pMethodName, jmethodID& _inout_MethodID,const ::rtl::OUString& _nArgument ) const; + ::rtl::OUString callStringMethod( const char* _pMethodName, jmethodID& _inout_MethodID ) const; + ::rtl::OUString callStringMethodWithIntArg( const char* _pMethodName, jmethodID& _inout_MethodID , sal_Int32 _nArgument) const; + void callVoidMethod( const char* _pMethodName, jmethodID& _inout_MethodID) const; + void callVoidMethodWithIntArg( const char* _pMethodName, jmethodID& _inout_MethodID, sal_Int32 _nArgument,bool _bIgnoreException = false ) const; + void callVoidMethodWithBoolArg( const char* _pMethodName, jmethodID& _inout_MethodID, sal_Int32 _nArgument,bool _bIgnoreException = false ) const; + void callVoidMethodWithStringArg( const char* _pMethodName, jmethodID& _inout_MethodID, const ::rtl::OUString& _nArgument ) const; + jobject callObjectMethod( JNIEnv * pEnv, const char* _pMethodName, const char* _pSignature, jmethodID& _inout_MethodID ) const; + jobject callObjectMethodWithIntArg( JNIEnv * pEnv, const char* _pMethodName, const char* _pSignature, jmethodID& _inout_MethodID , sal_Int32 _nArgument) const; + + template< typename T > + T callMethodWithIntArg(T (JNIEnv::*pCallMethod)( jobject obj, jmethodID methodID, ... ) ,const char* _pMethodName, const char* _pSignature, jmethodID& _inout_MethodID , sal_Int32 _nArgument) const + { + SDBThreadAttach t; + obtainMethodId(t.pEnv, _pMethodName,_pSignature, _inout_MethodID); + T out = (t.pEnv->*pCallMethod)( object, _inout_MethodID,_nArgument); + ThrowSQLException( t.pEnv, NULL ); + return out; + } + + template< typename T > + void callVoidMethod(const char* _pMethodName, const char* _pSignature, jmethodID& _inout_MethodID,sal_Int32 _nArgument, const T& _aValue) const + { + SDBThreadAttach t; + obtainMethodId(t.pEnv, _pMethodName,_pSignature, _inout_MethodID); + t.pEnv->CallVoidMethod( object, _inout_MethodID,_nArgument,_aValue); + ThrowSQLException( t.pEnv, NULL ); + } + + + }; +} +#endif //_CONNECTIVITY_JAVA_LANG_OBJJECT_HXX_ + + diff --git a/connectivity/source/inc/java/lang/String.hxx b/connectivity/source/inc/java/lang/String.hxx new file mode 100644 index 000000000000..3e4bfd6c1399 --- /dev/null +++ b/connectivity/source/inc/java/lang/String.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_LANG_STRING_HXX_ +#define _CONNECTIVITY_JAVA_LANG_STRING_HXX_ + +#include "java/lang/Object.hxx" + +namespace connectivity +{ + class java_lang_String : public java_lang_Object + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + public: + virtual jclass getMyClass() const; + virtual ~java_lang_String(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_lang_String( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} + + operator ::rtl::OUString(); + + static jclass st_getMyClass(); + }; + +} + +#endif // _CONNECTIVITY_JAVA_LANG_STRING_HXX_ + diff --git a/connectivity/source/inc/java/lang/Throwable.hxx b/connectivity/source/inc/java/lang/Throwable.hxx new file mode 100644 index 000000000000..a5823c24b1d9 --- /dev/null +++ b/connectivity/source/inc/java/lang/Throwable.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_LANG_THROWABLE_HXX_ +#define _CONNECTIVITY_JAVA_LANG_THROWABLE_HXX_ + +#include "java/lang/Object.hxx" + +namespace connectivity +{ + //************************************************************** + //************ Class: java.lang.Throwable + //************************************************************** + class java_lang_Throwable : public java_lang_Object + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + public: + virtual jclass getMyClass() const; + virtual ~java_lang_Throwable(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_lang_Throwable( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} + ::rtl::OUString getMessage() const; + ::rtl::OUString getLocalizedMessage() const; + + static jclass st_getMyClass(); + }; +} +#endif // _CONNECTIVITY_JAVA_LANG_THROWABLE_HXX_ + diff --git a/connectivity/source/inc/java/math/BigDecimal.hxx b/connectivity/source/inc/java/math/BigDecimal.hxx new file mode 100644 index 000000000000..ed6fbf8f814c --- /dev/null +++ b/connectivity/source/inc/java/math/BigDecimal.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_MATH_BIGDECIMAL_HXX_ +#define _CONNECTIVITY_JAVA_MATH_BIGDECIMAL_HXX_ + +#include "java/lang/Object.hxx" +//************************************************************** +//************ Class: java.lang.Boolean +//************************************************************** +namespace connectivity +{ + class java_math_BigDecimal : public java_lang_Object + { + // statische Daten fuer die Klasse + static jclass theClass; + public: + virtual jclass getMyClass() const; + virtual ~java_math_BigDecimal(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_math_BigDecimal( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} + + java_math_BigDecimal( const ::rtl::OUString& _par0 ); + java_math_BigDecimal( const double& _par0 ); + }; +} + +#endif // _CONNECTIVITY_JAVA_MATH_BIGDECIMAL_HXX_ + + diff --git a/connectivity/source/inc/java/sql/Array.hxx b/connectivity/source/inc/java/sql/Array.hxx new file mode 100644 index 000000000000..1a4f4794e7ff --- /dev/null +++ b/connectivity/source/inc/java/sql/Array.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_ARRAY_HXX_ +#define _CONNECTIVITY_JAVA_SQL_ARRAY_HXX_ + +#include "java/lang/Object.hxx" +#include <com/sun/star/sdbc/XArray.hpp> +#include <cppuhelper/implbase1.hxx> + +namespace connectivity +{ + + //************************************************************** + //************ Class: java.sql.SQLWarning + //************************************************************** + class java_sql_Array : public java_lang_Object, + public ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XArray> + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + public: + virtual jclass getMyClass() const; + virtual ~java_sql_Array(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_Array( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} + + // XArray + virtual ::rtl::OUString SAL_CALL getBaseTypeName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getBaseType( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getArray( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getArrayAtIndex( sal_Int32 index, sal_Int32 count, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getResultSet( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getResultSetAtIndex( sal_Int32 index, sal_Int32 count, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + }; +} +#endif // _CONNECTIVITY_JAVA_SQL_ARRAY_HXX_ + diff --git a/connectivity/source/inc/java/sql/Blob.hxx b/connectivity/source/inc/java/sql/Blob.hxx new file mode 100644 index 000000000000..c0392447cbe0 --- /dev/null +++ b/connectivity/source/inc/java/sql/Blob.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_SQL_BLOB_HXX_ +#define _CONNECTIVITY_JAVA_SQL_BLOB_HXX_ + +#include "java/lang/Object.hxx" +#include <com/sun/star/sdbc/XBlob.hpp> +#include <cppuhelper/implbase1.hxx> + +namespace connectivity +{ + + //************************************************************** + //************ Class: java.sql.SQLWarning + //************************************************************** + class java_sql_Blob : public java_lang_Object, + public ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XBlob> + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + virtual ~java_sql_Blob(); + public: + virtual jclass getMyClass() const; + + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_Blob( JNIEnv * pEnv, jobject myObj ); + + // XBlob + virtual sal_Int64 SAL_CALL length( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int64 pos, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL position( const ::com::sun::star::uno::Sequence< sal_Int8 >& pattern, sal_Int64 start ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL positionOfBlob( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& pattern, sal_Int64 start ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; +} +#endif // _CONNECTIVITY_JAVA_SQL_BLOB_HXX_ + diff --git a/connectivity/source/inc/java/sql/CallableStatement.hxx b/connectivity/source/inc/java/sql/CallableStatement.hxx new file mode 100644 index 000000000000..1e7cde631096 --- /dev/null +++ b/connectivity/source/inc/java/sql/CallableStatement.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_CALLABLESTATEMENT_HXX_ +#define _CONNECTIVITY_JAVA_SQL_CALLABLESTATEMENT_HXX_ + +#include "java/sql/PreparedStatement.hxx" +#include <com/sun/star/sdbc/XRow.hpp> +#include <com/sun/star/sdbc/XOutParameters.hpp> + +namespace connectivity +{ + + //************************************************************** + //************ Class: java.sql.CallableStatement + //************************************************************** + + class java_sql_CallableStatement : public java_sql_PreparedStatement, + public ::com::sun::star::sdbc::XRow, + public ::com::sun::star::sdbc::XOutParameters + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + virtual void createStatement(JNIEnv* _pEnv); + + virtual ~java_sql_CallableStatement(); + public: + DECLARE_SERVICE_INFO(); + virtual jclass getMyClass() const; + + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_CallableStatement( JNIEnv * pEnv, java_sql_Connection& _rCon, const ::rtl::OUString& sql ); + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + // XRow + virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XOutParameters + virtual void SAL_CALL registerOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL registerNumericOutParameter( sal_Int32 parameterIndex, sal_Int32 sqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; +} +#endif // _CONNECTIVITY_JAVA_SQL_CALLABLESTATEMENT_HXX_ + diff --git a/connectivity/source/inc/java/sql/Clob.hxx b/connectivity/source/inc/java/sql/Clob.hxx new file mode 100644 index 000000000000..e8c9b92b5f16 --- /dev/null +++ b/connectivity/source/inc/java/sql/Clob.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_SQL_CLOB_HXX_ +#define _CONNECTIVITY_JAVA_SQL_CLOB_HXX_ + +#include "java/lang/Object.hxx" +#include <com/sun/star/sdbc/XClob.hpp> +#include <cppuhelper/implbase1.hxx> + +namespace connectivity +{ + + //************************************************************** + //************ Class: java.sql.SQLWarning + //************************************************************** + class java_sql_Clob : public java_lang_Object, + public ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XClob> + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + virtual ~java_sql_Clob(); + public: + virtual jclass getMyClass() const; + + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_Clob( JNIEnv * pEnv, jobject myObj ); + + // XClob + virtual sal_Int64 SAL_CALL length( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSubString( sal_Int64 pos, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL position( const ::rtl::OUString& searchstr, sal_Int32 start ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL positionOfClob( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& pattern, sal_Int64 start ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; +} +#endif // _CONNECTIVITY_JAVA_SQL_CLOB_HXX_ + diff --git a/connectivity/source/inc/java/sql/Connection.hxx b/connectivity/source/inc/java/sql/Connection.hxx new file mode 100644 index 000000000000..b0b20c0e32d3 --- /dev/null +++ b/connectivity/source/inc/java/sql/Connection.hxx @@ -0,0 +1,151 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_CONNECTION_HXX_ +#define _CONNECTIVITY_JAVA_SQL_CONNECTION_HXX_ + +#include "java/lang/Object.hxx" +#include "TConnection.hxx" +#include "connectivity/CommonTools.hxx" +#include "OSubComponent.hxx" +#include <cppuhelper/weakref.hxx> +#include "AutoRetrievingBase.hxx" +#include "java/sql/ConnectionLog.hxx" +#include "java/LocalRef.hxx" +#include "java/GlobalRef.hxx" + +#include <com/sun/star/beans/NamedValue.hpp> + +namespace connectivity +{ + class java_sql_Driver; + + typedef OMetaConnection java_sql_Connection_BASE; + + class java_sql_Connection : public java_sql_Connection_BASE, + public java_lang_Object, + public OSubComponent<java_sql_Connection, java_sql_Connection_BASE>, + public OAutoRetrievingBase + { + friend class OSubComponent<java_sql_Connection, java_sql_Connection_BASE>; + const java_sql_Driver* m_pDriver; + jobject m_pDriverobject; + jdbc::GlobalRef< jobject > + m_pDriverClassLoader; + + jclass m_Driver_theClass; + java::sql::ConnectionLog + m_aLogger; + sal_Bool m_bParameterSubstitution; + sal_Bool m_bIgnoreDriverPrivileges; + sal_Bool m_bIgnoreCurrency; + ::com::sun::star::uno::Any m_aCatalogRestriction; + ::com::sun::star::uno::Any m_aSchemaRestriction; + + /** transform named parameter into unnamed one. + @param _sSQL + The SQL statement to transform. + @return + The new statement witgh unnamed parameters. + */ + ::rtl::OUString transFormPreparedStatement(const ::rtl::OUString& _sSQL); + void loadDriverFromProperties( + const ::rtl::OUString& _sDriverClass, + const ::rtl::OUString& _sDriverClassPath, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rSystemProperties + ); + /** load driver class path from system configuration. + @param _sDriverClass + The driver class name to look for in the configuration. + */ + ::rtl::OUString impl_getJavaDriverClassPath_nothrow(const ::rtl::OUString& _sDriverClass); + + protected: + // statische Daten fuer die Klasse + static jclass theClass; + + virtual ~java_sql_Connection(); + + public: + virtual jclass getMyClass() const; + + DECLARE_SERVICE_INFO(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_Connection( const java_sql_Driver& _rDriver ); + sal_Bool construct( const ::rtl::OUString& url, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info); + + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& + getConnectionInfo() const { return m_aConnectionInfo; } + + inline sal_Bool isIgnoreDriverPrivilegesEnabled() const { return m_bIgnoreDriverPrivileges;} + inline sal_Bool isIgnoreCurrencyEnabled() const { return m_bIgnoreCurrency; } + inline const ::com::sun::star::uno::Any& getCatalogRestriction() const { return m_aCatalogRestriction; } + inline const ::com::sun::star::uno::Any& getSchemaRestriction() const { return m_aSchemaRestriction; } + + /** returns the instance used for logging events related to this connection + */ + const java::sql::ConnectionLog& getLogger() const { return m_aLogger; } + + /** returns the class loader which was used to load the driver class + + Usually used in conjunction with a ContextClassLoaderScope instance. + */ + const jdbc::GlobalRef< jobject >& getDriverClassLoader() const { return m_pDriverClassLoader; } + + // OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual void SAL_CALL release() throw(); + + // XConnection + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > SAL_CALL createStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareCall( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL nativeSQL( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getAutoCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL commit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL rollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isClosed( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setCatalog( const ::rtl::OUString& catalog ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalog( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTypeMap( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTypeMap( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) 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); + }; +} +#endif // _CONNECTIVITY_JAVA_SQL_CONNECTION_HXX_ + diff --git a/connectivity/source/inc/java/sql/ConnectionLog.hxx b/connectivity/source/inc/java/sql/ConnectionLog.hxx new file mode 100644 index 000000000000..69cc8f392da2 --- /dev/null +++ b/connectivity/source/inc/java/sql/ConnectionLog.hxx @@ -0,0 +1,142 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_CONNECTIONLOG_HXX +#define CONNECTIVITY_CONNECTIONLOG_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/logging/LogLevel.hpp> +/** === end UNO includes === **/ + +#include <rtl/ustring.hxx> + +// Strange enough, GCC requires the following forward declarations of the various +// convertLogArgToString flavors to be *before* the inclusion of comphelper/logging.hxx + +namespace com { namespace sun { namespace star { namespace util +{ + struct Date; + struct Time; + struct DateTime; +} } } } + +//........................................................................ +namespace comphelper { namespace log { namespace convert +{ +//........................................................................ + + // helpers for logging more data types than are defined in comphelper/logging.hxx + ::rtl::OUString convertLogArgToString( const ::com::sun::star::util::Date& _rDate ); + ::rtl::OUString convertLogArgToString( const ::com::sun::star::util::Time& _rTime ); + ::rtl::OUString convertLogArgToString( const ::com::sun::star::util::DateTime& _rDateTime ); + +//........................................................................ +} } } +//........................................................................ + +#include <comphelper/logging.hxx> + +namespace connectivity +{ + namespace LogLevel = ::com::sun::star::logging::LogLevel; +} + +//........................................................................ +namespace connectivity { namespace java { namespace sql { +//........................................................................ + + //==================================================================== + //= ConnectionLog + //==================================================================== + typedef ::comphelper::ResourceBasedEventLogger ConnectionLog_Base; + class ConnectionLog : public ConnectionLog_Base + { + public: + enum ObjectType + { + CONNECTION = 0, + STATEMENT, + RESULTSET, + + ObjectTypeCount = RESULTSET + 1 + }; + + private: + const sal_Int32 m_nObjectID; + + public: + /// will construct an instance of ObjectType CONNECTION + ConnectionLog( const ::comphelper::ResourceBasedEventLogger& _rDriverLog ); + /// will create an instance with the same object ID / ObjectType as a given source instance + ConnectionLog( const ConnectionLog& _rSourceLog ); + /// will create an instance of arbitrary ObjectType + ConnectionLog( const ConnectionLog& _rSourceLog, ObjectType _eType ); + + sal_Int32 getObjectID() const { return m_nObjectID; } + + /// logs a given message, without any arguments, or source class/method names + bool log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID ) + { + return ConnectionLog_Base::log( _nLogLevel, _nMessageResID, m_nObjectID ); + } + + template< typename ARGTYPE1 > + bool log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1 ) const + { + return ConnectionLog_Base::log( _nLogLevel, _nMessageResID, m_nObjectID, _argument1 ); + } + + template< typename ARGTYPE1, typename ARGTYPE2 > + bool log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2 ) const + { + return ConnectionLog_Base::log( _nLogLevel, _nMessageResID, m_nObjectID, _argument1, _argument2 ); + } + + template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3 > + bool log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3 ) const + { + return ConnectionLog_Base::log( _nLogLevel, _nMessageResID, m_nObjectID, _argument1, _argument2, _argument3 ); + } + + template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4 > + bool log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4 ) const + { + return ConnectionLog_Base::log( _nLogLevel, _nMessageResID, m_nObjectID, _argument1, _argument2, _argument3, _argument4 ); + } + + template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5 > + bool log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5 ) const + { + return ConnectionLog_Base::log( _nLogLevel, _nMessageResID, m_nObjectID, _argument1, _argument2, _argument3, _argument4, _argument5 ); + } + }; + +//........................................................................ +} } } // namespace connectivity::java::sql +//........................................................................ + +#endif // CONNECTIVITY_CONNECTIONLOG_HXX diff --git a/connectivity/source/inc/java/sql/DatabaseMetaData.hxx b/connectivity/source/inc/java/sql/DatabaseMetaData.hxx new file mode 100644 index 000000000000..a517194f4ca8 --- /dev/null +++ b/connectivity/source/inc/java/sql/DatabaseMetaData.hxx @@ -0,0 +1,224 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_DATABASEMETADATA_HXX_ +#define _CONNECTIVITY_JAVA_SQL_DATABASEMETADATA_HXX_ + +#include "java/lang/Object.hxx" +#include "TDatabaseMetaDataBase.hxx" + +#include "java/sql/ConnectionLog.hxx" + +namespace connectivity +{ + class java_sql_Connection; + //************************************************************** + //************ Class: java.sql.DatabaseMetaDataDate + //************************************************************** + + class java_sql_DatabaseMetaData : public ODatabaseMetaDataBase, + public java_lang_Object + { + java_sql_Connection* m_pConnection; + java::sql::ConnectionLog m_aLogger; + + // statische Daten fuer die Klasse + static jclass theClass; + + public: + virtual jclass getMyClass() const; + virtual ~java_sql_DatabaseMetaData(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_DatabaseMetaData( JNIEnv * pEnv, jobject myObj, java_sql_Connection& _rConnection ); + + private: + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > impl_getTypeInfo_throw(); + // cached database information + virtual ::rtl::OUString impl_getIdentifierQuoteString_throw( ); + virtual sal_Bool impl_isCatalogAtStart_throw( ); + virtual ::rtl::OUString impl_getCatalogSeparator_throw( ); + virtual sal_Bool impl_supportsCatalogsInTableDefinitions_throw( ); + virtual sal_Bool impl_supportsSchemasInTableDefinitions_throw( ) ; + virtual sal_Bool impl_supportsCatalogsInDataManipulation_throw( ); + virtual sal_Bool impl_supportsSchemasInDataManipulation_throw( ) ; + virtual sal_Bool impl_supportsMixedCaseQuotedIdentifiers_throw( ); + virtual sal_Bool impl_supportsAlterTableWithAddColumn_throw( ); + virtual sal_Bool impl_supportsAlterTableWithDropColumn_throw( ); + virtual sal_Int32 impl_getMaxStatements_throw( ); + virtual sal_Int32 impl_getMaxTablesInSelect_throw( ); + virtual sal_Bool impl_storesMixedCaseQuotedIdentifiers_throw( ); + + virtual sal_Bool SAL_CALL allProceduresAreCallable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL allTablesAreSelectable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getURL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getUserName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedLow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDatabaseProductName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDatabaseProductVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDriverName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDriverVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL usesLocalFiles( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSQLKeywords( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getNumericFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getStringFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSystemFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTimeDateFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSearchStringEscape( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getExtraNameCharacters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsColumnAliasing( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTypeConversion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsGroupBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSchemaTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getProcedureTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalogTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsPositionedDelete( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsStoredProcedures( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsUnion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsUnionAll( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) 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 getMaxColumnsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) 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_Int32 SAL_CALL getMaxConnections( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxIndexLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxRowSize( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxStatementLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getProcedures( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getProcedureColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTables( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getSchemas( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCatalogs( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTableTypes( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumnPrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTablePrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getBestRowIdentifier( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope, sal_Bool nullable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getVersionColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getPrimaryKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getImportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getExportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCrossReference( const ::com::sun::star::uno::Any& primaryCatalog, const ::rtl::OUString& primarySchema, const ::rtl::OUString& primaryTable, const ::com::sun::star::uno::Any& foreignCatalog, const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getIndexInfo( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Bool unique, sal_Bool approximate ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsBatchUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getUDTs( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern, const ::com::sun::star::uno::Sequence< sal_Int32 >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + private: + sal_Bool impl_callBooleanMethod( const char* _pMethodName, jmethodID& _inout_MethodID ); + ::rtl::OUString impl_callStringMethod( const char* _pMethodName, jmethodID& _inout_MethodID ); + sal_Int32 impl_callIntMethod( const char* _pMethodName, jmethodID& _inout_MethodID ); + sal_Bool impl_callBooleanMethodWithIntArg( const char* _pMethodName, jmethodID& _inout_MethodID, sal_Int32 _nArgument ); + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > + impl_callResultSetMethod( const char* _pMethodName, jmethodID& _inout_MethodID ); + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > + impl_callResultSetMethodWithStrings( const char* _pMethodName, jmethodID& _inout_MethodID, const ::com::sun::star::uno::Any& _rCatalog, + const ::rtl::OUString& _rSchemaPattern, const ::rtl::OUString& _rLeastPattern, + const ::rtl::OUString* _pOptionalAdditionalString = NULL); + }; +} +#endif // _CONNECTIVITY_JAVA_SQL_DATABASEMETADATA_HXX_ + diff --git a/connectivity/source/inc/java/sql/Driver.hxx b/connectivity/source/inc/java/sql/Driver.hxx new file mode 100644 index 000000000000..4d148f5d752c --- /dev/null +++ b/connectivity/source/inc/java/sql/Driver.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_SQL_DRIVER_HXX_ +#define _CONNECTIVITY_JAVA_SQL_DRIVER_HXX_ + +#include <com/sun/star/sdbc/XDriver.hpp> +#include "java/lang/Object.hxx" +#include <cppuhelper/implbase2.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +#include <comphelper/logging.hxx> +#include <comphelper/componentcontext.hxx> + +namespace connectivity +{ + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL java_sql_Driver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ); + + class java_sql_Driver : public ::cppu::WeakImplHelper2< ::com::sun::star::sdbc::XDriver,::com::sun::star::lang::XServiceInfo> + { + ::comphelper::ComponentContext m_aContext; + ::comphelper::ResourceBasedEventLogger m_aLogger; + + protected: + virtual ~java_sql_Driver(); + + public: + java_sql_Driver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory); + + static rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + + // XDriver + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + virtual sal_Int32 SAL_CALL getMajorVersion( ) throw(::com::sun::star::uno::RuntimeException) ; + virtual sal_Int32 SAL_CALL getMinorVersion( ) throw(::com::sun::star::uno::RuntimeException); + + const ::comphelper::ComponentContext& getContext() const { return m_aContext; } + const ::comphelper::ResourceBasedEventLogger& getLogger() const { return m_aLogger; } + }; + +} +#endif //_CONNECTIVITY_JAVA_SQL_DRIVER_HXX_ + diff --git a/connectivity/source/inc/java/sql/DriverPropertyInfo.hxx b/connectivity/source/inc/java/sql/DriverPropertyInfo.hxx new file mode 100644 index 000000000000..b04e090666a2 --- /dev/null +++ b/connectivity/source/inc/java/sql/DriverPropertyInfo.hxx @@ -0,0 +1,61 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_SQL_DRIVERPOPERTYINFO_HXX_ +#define _CONNECTIVITY_JAVA_SQL_DRIVERPOPERTYINFO_HXX_ + +#include "java/lang/Object.hxx" +#include <com/sun/star/sdbc/DriverPropertyInfo.hpp> + +namespace connectivity +{ + +//************************************************************** +//************ Class: java.sql.DriverPropertyInfo +//************************************************************** + class java_sql_DriverPropertyInfo : public java_lang_Object + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + public: + virtual jclass getMyClass() const; + virtual ~java_sql_DriverPropertyInfo(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_DriverPropertyInfo( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} + operator ::com::sun::star::sdbc::DriverPropertyInfo(); + + ::rtl::OUString name(); + ::rtl::OUString description(); + ::rtl::OUString value(); + sal_Bool required(); + ::com::sun::star::uno::Sequence< ::rtl::OUString> choices(); + }; +} + +#endif // _CONNECTIVITY_JAVA_SQL_DRIVERPOPERTYINFO_HXX_ + diff --git a/connectivity/source/inc/java/sql/JStatement.hxx b/connectivity/source/inc/java/sql/JStatement.hxx new file mode 100644 index 000000000000..c58494fb8036 --- /dev/null +++ b/connectivity/source/inc/java/sql/JStatement.hxx @@ -0,0 +1,219 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_STATEMENT_HXX_ +#define _CONNECTIVITY_JAVA_SQL_STATEMENT_HXX_ + +#include "java/lang/Object.hxx" +#include <com/sun/star/sdbc/XStatement.hpp> +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#include <com/sun/star/sdbc/XMultipleResults.hpp> +#include <com/sun/star/sdbc/XBatchExecution.hpp> +#include <com/sun/star/sdbc/XCloseable.hpp> +#include <com/sun/star/util/XCancellable.hpp> +#include <com/sun/star/sdbc/XGeneratedResultSet.hpp> +#include <comphelper/proparrhlp.hxx> +#include <cppuhelper/compbase6.hxx> +#include <comphelper/uno3.hxx> +#include "connectivity/CommonTools.hxx" +#include "OSubComponent.hxx" +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <comphelper/broadcasthelper.hxx> + +#include "java/sql/ConnectionLog.hxx" + +namespace connectivity +{ + + typedef ::cppu::WeakComponentImplHelper6< ::com::sun::star::sdbc::XStatement, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::util::XCancellable, + ::com::sun::star::sdbc::XCloseable, + ::com::sun::star::sdbc::XGeneratedResultSet, + ::com::sun::star::sdbc::XMultipleResults> java_sql_Statement_BASE; + + class java_sql_Connection; + + //************************************************************** + //************ Class: java.sql.Statement + //************************************************************** + class java_sql_Statement_Base : public comphelper::OBaseMutex, + public java_sql_Statement_BASE, + public java_lang_Object, + public ::cppu::OPropertySetHelper, + public ::comphelper::OPropertyArrayUsageHelper<java_sql_Statement_Base> + + { + + sal_Int32 getQueryTimeOut() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getMaxFieldSize() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getMaxRows() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getResultSetConcurrency() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getResultSetType() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getFetchDirection() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getFetchSize() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + ::rtl::OUString getCursorName() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + void setQueryTimeOut(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setMaxFieldSize(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setMaxRows(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setResultSetConcurrency(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setResultSetType(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setFetchDirection(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setFetchSize(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setCursorName(const ::rtl::OUString &_par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setEscapeProcessing(sal_Bool _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + protected: + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement> m_xGeneratedStatement; + java_sql_Connection* m_pConnection; + java::sql::ConnectionLog m_aLogger; + ::rtl::OUString m_sSqlStatement; + // Properties + sal_Int32 m_nResultSetConcurrency; + sal_Int32 m_nResultSetType; + sal_Bool m_bEscapeProcessing; + ::cppu::OBroadcastHelper& rBHelper; + + + // statische Daten fuer die Klasse + static jclass theClass; + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + + virtual sal_Bool SAL_CALL convertFastPropertyValue( + ::com::sun::star::uno::Any & rConvertedValue, + ::com::sun::star::uno::Any & rOldValue, + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue + ) throw (::com::sun::star::lang::IllegalArgumentException); + + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue + ) throw (::com::sun::star::uno::Exception); + + virtual void SAL_CALL getFastPropertyValue( + ::com::sun::star::uno::Any& rValue, + sal_Int32 nHandle + ) const; + + virtual void createStatement(JNIEnv* _pEnv) = 0; + + virtual ~java_sql_Statement_Base(); + + sal_Int32 impl_getProperty(const char* _pMethodName, jmethodID& _inout_MethodID); + sal_Int32 impl_getProperty(const char* _pMethodName, jmethodID& _inout_MethodID,sal_Int32 _nDefault); + + public: + virtual jclass getMyClass() const; + + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_Statement_Base( JNIEnv * pEnv, java_sql_Connection& _rCon ); + + sal_Int32 getStatementObjectID() const { return m_aLogger.getObjectID(); } + + // OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + // XStatement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + virtual sal_Int32 SAL_CALL executeUpdate( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + virtual sal_Bool SAL_CALL execute( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) 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); + // XCancellable + virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XMultipleResults + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getResultSet( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getMoreResults( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + //XGeneratedResultSet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getGeneratedValues( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + public: + using ::cppu::OPropertySetHelper::getFastPropertyValue; + }; + + class OStatement_BASE2 :public java_sql_Statement_Base + ,public OSubComponent<OStatement_BASE2, java_sql_Statement_BASE> + + { + friend class OSubComponent<OStatement_BASE2, java_sql_Statement_BASE>; + public: + OStatement_BASE2(JNIEnv * pEnv, java_sql_Connection& _rCon ) : java_sql_Statement_Base( pEnv, _rCon ), + OSubComponent<OStatement_BASE2, java_sql_Statement_BASE>((::cppu::OWeakObject*)(&_rCon), this){} + + // OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual void SAL_CALL release() throw(); + }; + + class java_sql_Statement : public OStatement_BASE2, + public ::com::sun::star::sdbc::XBatchExecution, + public ::com::sun::star::lang::XServiceInfo + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + + virtual void createStatement(JNIEnv* _pEnv); + + virtual ~java_sql_Statement(); + public: + DECLARE_SERVICE_INFO(); + virtual jclass getMyClass() const; + + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_Statement( JNIEnv * pEnv, java_sql_Connection& _rCon ) : OStatement_BASE2( pEnv, _rCon){}; + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + // XBatchExecution + virtual void SAL_CALL addBatch( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; +} +#endif // _CONNECTIVITY_JAVA_SQL_STATEMENT_HXX_ + diff --git a/connectivity/source/inc/java/sql/PreparedStatement.hxx b/connectivity/source/inc/java/sql/PreparedStatement.hxx new file mode 100644 index 000000000000..994b0996f60c --- /dev/null +++ b/connectivity/source/inc/java/sql/PreparedStatement.hxx @@ -0,0 +1,113 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_PREPAREDSTATEMENT_HXX_ +#define _CONNECTIVITY_JAVA_SQL_PREPAREDSTATEMENT_HXX_ + +#include "java/sql/JStatement.hxx" +#include <com/sun/star/sdbc/XPreparedStatement.hpp> +#include <com/sun/star/sdbc/XParameters.hpp> +// #include <com/sun/star/sdbc/XClearParameters.hpp> +#include <com/sun/star/sdbc/XPreparedBatchExecution.hpp> +#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> + +namespace connectivity +{ + //************************************************************** + //************ Class: java.sql.PreparedStatement + //************************************************************** + + class java_sql_PreparedStatement : public OStatement_BASE2, + public ::com::sun::star::sdbc::XPreparedStatement, + public ::com::sun::star::sdbc::XResultSetMetaDataSupplier, + public ::com::sun::star::sdbc::XParameters, + public ::com::sun::star::sdbc::XPreparedBatchExecution, + public ::com::sun::star::lang::XServiceInfo + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + + virtual void createStatement(JNIEnv* _pEnv); + virtual ~java_sql_PreparedStatement(); + public: + DECLARE_SERVICE_INFO(); + virtual jclass getMyClass() const; + + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_PreparedStatement( JNIEnv * pEnv, java_sql_Connection& _rCon,const ::rtl::OUString& sql ); + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + // XPreparedStatement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL executeUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XParameters + virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearParameters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XPreparedBatchExecution + virtual void SAL_CALL addBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XResultSetMetaDataSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + public: + using java_sql_Statement_Base::executeQuery; + using java_sql_Statement_Base::executeUpdate; + using java_sql_Statement_Base::execute; + }; +} +#endif // _CONNECTIVITY_JAVA_SQL_PREPAREDSTATEMENT_HXX_ + diff --git a/connectivity/source/inc/java/sql/Ref.hxx b/connectivity/source/inc/java/sql/Ref.hxx new file mode 100644 index 000000000000..7f9d2848fc5a --- /dev/null +++ b/connectivity/source/inc/java/sql/Ref.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_SQL_REF_HXX_ +#define _CONNECTIVITY_JAVA_SQL_REF_HXX_ + +#include "java/lang/Object.hxx" +#include <com/sun/star/sdbc/XRef.hpp> +#include <cppuhelper/implbase1.hxx> + +namespace connectivity +{ + //************************************************************** + //************ Class: java.sql.Ref + //************************************************************** + class java_sql_Ref : public java_lang_Object, + public ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XRef> + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + virtual ~java_sql_Ref(); + public: + virtual jclass getMyClass() const; + + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_Ref( JNIEnv * pEnv, jobject myObj ); + + // XRef + virtual ::rtl::OUString SAL_CALL getBaseTypeName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; +} +#endif // _CONNECTIVITY_JAVA_SQL_REF_HXX_ + diff --git a/connectivity/source/inc/java/sql/ResultSet.hxx b/connectivity/source/inc/java/sql/ResultSet.hxx new file mode 100644 index 000000000000..1cac80ad10a8 --- /dev/null +++ b/connectivity/source/inc/java/sql/ResultSet.hxx @@ -0,0 +1,208 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_RESULTSET_HXX_ +#define _CONNECTIVITY_JAVA_SQL_RESULTSET_HXX_ + +#include "java/lang/Object.hxx" +#include <com/sun/star/sdbc/XResultSet.hpp> +#include <com/sun/star/sdbc/XRow.hpp> +#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> +#include <com/sun/star/sdbc/XCloseable.hpp> +#include <com/sun/star/sdbc/XColumnLocate.hpp> +#include <com/sun/star/util/XCancellable.hpp> +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#include <com/sun/star/sdbc/XResultSetUpdate.hpp> +#include <com/sun/star/sdbc/XRowUpdate.hpp> +#include <cppuhelper/compbase10.hxx> +#include <comphelper/proparrhlp.hxx> +#include "connectivity/CommonTools.hxx" +#include "java/sql/JStatement.hxx" +#include <com/sun/star/lang/XServiceInfo.hpp> +#include "java/sql/ConnectionLog.hxx" + +namespace connectivity +{ + + /* + ** java_sql_ResultSet + */ + typedef ::cppu::WeakComponentImplHelper10< ::com::sun::star::sdbc::XResultSet, + ::com::sun::star::sdbc::XRow, + ::com::sun::star::sdbc::XResultSetMetaDataSupplier, + ::com::sun::star::util::XCancellable, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::sdbc::XResultSetUpdate, + ::com::sun::star::sdbc::XRowUpdate, + ::com::sun::star::sdbc::XCloseable, + ::com::sun::star::sdbc::XColumnLocate, + ::com::sun::star::lang::XServiceInfo> java_sql_ResultSet_BASE; + + class java_sql_Connection; + class java_sql_ResultSet : public comphelper::OBaseMutex, + public java_sql_ResultSet_BASE, + public java_lang_Object, + public ::cppu::OPropertySetHelper, + public ::comphelper::OPropertyArrayUsageHelper<java_sql_ResultSet> + { + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xStatement; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData; + java::sql::ConnectionLog m_aLogger; + java_sql_Connection* m_pConnection; + + sal_Int32 getResultSetConcurrency() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getResultSetType() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getFetchDirection() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getFetchSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + ::rtl::OUString getCursorName() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + void setFetchDirection(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void setFetchSize(sal_Int32 _par0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + protected: + // statische Daten fuer die Klasse + static jclass theClass; + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + + virtual sal_Bool SAL_CALL convertFastPropertyValue( + ::com::sun::star::uno::Any & rConvertedValue, + ::com::sun::star::uno::Any & rOldValue, + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue ) + throw (::com::sun::star::lang::IllegalArgumentException); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue + ) + throw (::com::sun::star::uno::Exception); + virtual void SAL_CALL getFastPropertyValue( + ::com::sun::star::uno::Any& rValue, + sal_Int32 nHandle + ) const; + virtual ~java_sql_ResultSet(); + public: + DECLARE_SERVICE_INFO(); + virtual jclass getMyClass() const; + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_ResultSet( JNIEnv * pEnv, jobject myObj, const java::sql::ConnectionLog& _rParentLogger,java_sql_Connection& _rConnection, + java_sql_Statement_Base* pStmt = NULL ); + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + // XResultSet + virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XRow + virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XResultSetMetaDataSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCancellable + virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) 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); + // XResultSetUpdate + virtual void SAL_CALL insertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL deleteRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XRowUpdate + virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + public: + using ::cppu::OPropertySetHelper::getFastPropertyValue; + }; +} +#endif // _CONNECTIVITY_JAVA_SQL_RESULTSET_HXX_ + diff --git a/connectivity/source/inc/java/sql/ResultSetMetaData.hxx b/connectivity/source/inc/java/sql/ResultSetMetaData.hxx new file mode 100644 index 000000000000..553065991d7e --- /dev/null +++ b/connectivity/source/inc/java/sql/ResultSetMetaData.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_RESULTSETMETADATA_HXX_ +#define _CONNECTIVITY_JAVA_SQL_RESULTSETMETADATA_HXX_ + +#include "java/lang/Object.hxx" +#include <com/sun/star/sdbc/XResultSetMetaData.hpp> +#include <cppuhelper/implbase1.hxx> +#include "java/sql/ConnectionLog.hxx" + +namespace connectivity +{ + //************************************************************** + //************ Class: java.sql.ResultSetMetaData + //************************************************************** + class java_sql_Connection; + class java_sql_ResultSetMetaData : public ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XResultSetMetaData>, + public java_lang_Object + { + protected: + java::sql::ConnectionLog m_aLogger; + java_sql_Connection* m_pConnection; + sal_Int32 m_nColumnCount; + + // statische Daten fuer die Klasse + static jclass theClass; + virtual ~java_sql_ResultSetMetaData(); + public: + virtual jclass getMyClass() const; + + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_ResultSetMetaData( JNIEnv * pEnv, jobject myObj, const java::sql::ConnectionLog& _rResultSetLogger, java_sql_Connection& _rCon ); + + virtual sal_Int32 SAL_CALL getColumnCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnLabel( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSchemaName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTableName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalogName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnTypeName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnServiceName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; +} +#endif // _CONNECTIVITY_JAVA_SQL_RESULTSETMETADATA_HXX_ + diff --git a/connectivity/source/inc/java/sql/SQLException.hxx b/connectivity/source/inc/java/sql/SQLException.hxx new file mode 100644 index 000000000000..5a346edda84f --- /dev/null +++ b/connectivity/source/inc/java/sql/SQLException.hxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_SQLEXCEPTION_HXX_ +#define _CONNECTIVITY_JAVA_SQL_SQLEXCEPTION_HXX_ + +#include "java/lang/Exception.hxx" +#include <com/sun/star/sdbc/SQLException.hpp> + +namespace connectivity +{ + namespace starsdbc = ::com::sun::star::sdbc; + //************************************************************** + //************ Class: java.sql.SQLException + //************************************************************** + class java_sql_SQLException_BASE; + class java_sql_SQLException : public starsdbc::SQLException + { + public: + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_SQLException(){} + java_sql_SQLException( const java_sql_SQLException_BASE& _rException,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> & _rContext); + }; + + class java_sql_SQLException_BASE : public java_lang_Exception + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + public: + virtual jclass getMyClass() const; + virtual ~java_sql_SQLException_BASE(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_SQLException_BASE( JNIEnv * pEnv, jobject myObj ); + + ::rtl::OUString getSQLState() const; + sal_Int32 getErrorCode() const; + starsdbc::SQLException getNextException() const; + + static jclass st_getMyClass(); + }; + +} +#endif // _CONNECTIVITY_JAVA_SQL_SQLEXCEPTION_HXX_ + diff --git a/connectivity/source/inc/java/sql/SQLWarning.hxx b/connectivity/source/inc/java/sql/SQLWarning.hxx new file mode 100644 index 000000000000..60b74c3a0151 --- /dev/null +++ b/connectivity/source/inc/java/sql/SQLWarning.hxx @@ -0,0 +1,64 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_SQL_SQLWARNING_HXX_ +#define _CONNECTIVITY_JAVA_SQL_SQLWARNING_HXX_ + +#include "java/sql/SQLException.hxx" +//#ifndef _COM_SUN_STAR_SDBC_SQLWARNING_HPP_ +//#include <com/sun/star/sdbc/SQLWarning.hpp> +//#endif + +namespace connectivity +{ + // namespace starsdbc = ::com::sun::star::sdbc; + // namespace ::com::sun::star::uno = ::com::sun::star::uno; + //************************************************************** + //************ Class: java.sql.SQLWarning + //************************************************************** + class java_sql_SQLWarning_BASE : public java_sql_SQLException_BASE + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + public: + virtual jclass getMyClass() const; + virtual ~java_sql_SQLWarning_BASE(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_SQLWarning_BASE( JNIEnv * pEnv, jobject myObj ) : java_sql_SQLException_BASE( pEnv, myObj ){} + + }; + + class java_sql_SQLWarning : public java_sql_SQLException + { + public: + java_sql_SQLWarning(const java_sql_SQLWarning_BASE& _rW,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> & _rContext) + : java_sql_SQLException(_rW,_rContext) {} + }; +} +#endif // _CONNECTIVITY_JAVA_SQL_SQLWARNING_HXX_ + diff --git a/connectivity/source/inc/java/sql/Timestamp.hxx b/connectivity/source/inc/java/sql/Timestamp.hxx new file mode 100644 index 000000000000..de642014ee1c --- /dev/null +++ b/connectivity/source/inc/java/sql/Timestamp.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_JAVA_SQL_TIMESTAMP_HXX_ +#define _CONNECTIVITY_JAVA_SQL_TIMESTAMP_HXX_ + +#include "java/util/Date.hxx" +#include <com/sun/star/util/Time.hpp> +#include <com/sun/star/util/DateTime.hpp> + + +namespace connectivity +{ + //************************************************************** + //************ Class: java.sql.Date + //************************************************************** + + class java_sql_Date : public java_util_Date + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + public: + virtual jclass getMyClass() const; + virtual ~java_sql_Date(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_Date( JNIEnv * pEnv, jobject myObj ) : java_util_Date(pEnv,myObj){} + java_sql_Date( const ::com::sun::star::util::Date& _rOut ); + + operator ::com::sun::star::util::Date(); + static jclass st_getMyClass(); + }; + + + //************************************************************** + //************ Class: java.sql.Time + //************************************************************** + + class java_sql_Time : public java_util_Date + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + public: + virtual jclass getMyClass() const; + virtual ~java_sql_Time(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_Time( JNIEnv * pEnv, jobject myObj ) : java_util_Date( pEnv, myObj ){} + java_sql_Time( const ::com::sun::star::util::Time& _rOut ); + operator ::com::sun::star::util::Time(); + static jclass st_getMyClass(); + }; + + //************************************************************** + //************ Class: java.sql.Timestamp + //************************************************************** + class java_sql_Timestamp : public java_util_Date + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + public: + virtual jclass getMyClass() const; + virtual ~java_sql_Timestamp(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_sql_Timestamp( JNIEnv * pEnv, jobject myObj ) : java_util_Date( pEnv, myObj ){} + java_sql_Timestamp( const ::com::sun::star::util::DateTime& _rOut); + operator ::com::sun::star::util::DateTime(); + + sal_Int32 getNanos(); + void setNanos(sal_Int32 n); + static jclass st_getMyClass(); + }; +} +#endif // _CONNECTIVITY_JAVA_SQL_TIMESTAMP_HXX_ + diff --git a/connectivity/source/inc/java/tools.hxx b/connectivity/source/inc/java/tools.hxx new file mode 100644 index 000000000000..66f339247dfc --- /dev/null +++ b/connectivity/source/inc/java/tools.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_TOOLS_HXX_ +#define _CONNECTIVITY_JAVA_TOOLS_HXX_ + +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/uno/Sequence.h> + +#ifndef JNI_H +#include <jni.h> +#endif +#include "java/sql/SQLException.hxx" +#include <comphelper/uno3.hxx> + +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/util/Time.hpp> +#include <com/sun/star/util/Date.hpp> +#include <com/sun/star/util/DateTime.hpp> + + +namespace connectivity +{ + + jstring convertwchar_tToJavaString(JNIEnv *pEnv,const ::rtl::OUString& _Temp); + ::rtl::OUString JavaString2String(JNIEnv *pEnv,jstring _Str); + class java_util_Properties; + + java_util_Properties* createStringPropertyArray(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + template<class T,class JT> ::com::sun::star::uno::Sequence< T > copyArrayAndDelete(JNIEnv *pEnv,jobjectArray _Array, const T*, const JT* ) + { + ::com::sun::star::uno::Sequence< T > xOut; + if(_Array) + { + jsize nLen = pEnv->GetArrayLength(_Array); + xOut.realloc(nLen); + for(jsize i=0;i<nLen;++i) + { + JT xInfo(pEnv,pEnv->GetObjectArrayElement(_Array,i)); + java_lang_Object::ThrowSQLException(pEnv,NULL); + xOut.getArray()[i] = xInfo; + } + pEnv->DeleteLocalRef(_Array); + } + return xOut; + } + + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > Map2XNameAccess(JNIEnv *pEnv,jobject _pMap); + jobject convertTypeMapToJavaMap(JNIEnv *pEnv,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & _rMap); + + /** return if a exception occured + @param pEnv + The native java env + @param _bClear + <TRUE/> if the execption should be cleared + @return + <TRUE/> if an exception is occured + */ + sal_Bool isExceptionOccured(JNIEnv *pEnv,sal_Bool _bClear); + + jobject createByteInputStream(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x,sal_Int32 length); + jobject createCharArrayReader(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x,sal_Int32 length); +} + +#endif // _CONNECTIVITY_JAVA_TOOLS_HXX_ + diff --git a/connectivity/source/inc/java/util/Date.hxx b/connectivity/source/inc/java/util/Date.hxx new file mode 100644 index 000000000000..c42c09a927cf --- /dev/null +++ b/connectivity/source/inc/java/util/Date.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_JAVA_UTIL_DATE_HXX_ +#define _CONNECTIVITY_JAVA_UTIL_DATE_HXX_ + +#include "java/lang/Object.hxx" +#include <com/sun/star/util/Date.hpp> + +namespace connectivity +{ + + //************************************************************** + //************ Class: java.util.Date + //************************************************************** + + class java_util_Date : public java_lang_Object + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + public: + virtual jclass getMyClass() const; + virtual ~java_util_Date(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_util_Date( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} + }; +} +#endif // _CONNECTIVITY_JAVA_UTIL_DATE_HXX_ + diff --git a/connectivity/source/inc/java/util/Property.hxx b/connectivity/source/inc/java/util/Property.hxx new file mode 100644 index 000000000000..9e6cef045473 --- /dev/null +++ b/connectivity/source/inc/java/util/Property.hxx @@ -0,0 +1,49 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CONNECTIVITY_java_util_Properties +#define CONNECTIVITY_java_util_Properties + +#include "java/lang/Object.hxx" + +namespace connectivity +{ + class java_util_Properties : public java_lang_Object + { + protected: + // statische Daten fuer die Klasse + static jclass theClass; + public: + virtual jclass getMyClass() const; + virtual ~java_util_Properties(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + java_util_Properties( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} + java_util_Properties( ); + void setProperty(const ::rtl::OUString key, const ::rtl::OUString& value); + }; +} + +#endif // CONNECTIVITY_java_util_Properties diff --git a/connectivity/source/inc/mysql/YCatalog.hxx b/connectivity/source/inc/mysql/YCatalog.hxx new file mode 100644 index 000000000000..49450f17a342 --- /dev/null +++ b/connectivity/source/inc/mysql/YCatalog.hxx @@ -0,0 +1,73 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CONNECTIVITY_MYSQL_CATALOG_HXX +#define CONNECTIVITY_MYSQL_CATALOG_HXX + +#include "connectivity/sdbcx/VCatalog.hxx" +#include "connectivity/StdTypeDefs.hxx" + +namespace connectivity +{ + namespace mysql + { + // please don't name the class the same name as in an other namespaces + // some compilers have problems with this task as I noticed on windows + class OAdabasConnection; + class OMySQLCatalog : public connectivity::sdbcx::OCatalog + { + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection; + + /** calls XDatabaseMetaData::getTables. + @param _sKindOfObject + The type of tables to be fetched. + @param _rNames + The container for the names to be filled. <OUT/> + */ + void refreshObjects(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _sKindOfObject,TStringVector& _rNames); + + public: + // implementation of the pure virtual methods + virtual void refreshTables(); + virtual void refreshViews() ; + virtual void refreshGroups(); + virtual void refreshUsers() ; + + public: + OMySQLCatalog(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection); + + inline sdbcx::OCollection* getPrivateTables() const { return m_pTables;} + inline sdbcx::OCollection* getPrivateViews() const { return m_pViews; } + inline ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > getConnection() const { return m_xConnection; } + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + // ::cppu::OComponentHelper + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // CONNECTIVITY_MYSQL_CATALOG_HXX + diff --git a/connectivity/source/inc/mysql/YColumns.hxx b/connectivity/source/inc/mysql/YColumns.hxx new file mode 100644 index 000000000000..e6b8a416c8b7 --- /dev/null +++ b/connectivity/source/inc/mysql/YColumns.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CONNECTIVITY_MYSQL_COLUMN_HXX +#define CONNECTIVITY_MYSQL_COLUMN_HXX +#include "connectivity/TColumnsHelper.hxx" +#include "connectivity/sdbcx/VColumn.hxx" + +namespace connectivity +{ + namespace mysql + { + class OMySQLColumns : public OColumnsHelper + { + protected: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor(); + public: + OMySQLColumns( ::cppu::OWeakObject& _rParent + ,sal_Bool _bCase + ,::osl::Mutex& _rMutex + ,const TStringVector &_rVector + ,sal_Bool _bUseHardRef = sal_True + ); + }; + + class OMySQLColumn; + typedef sdbcx::OColumn OMySQLColumn_BASE; + typedef ::comphelper::OIdPropertyArrayUsageHelper<OMySQLColumn> OMySQLColumn_PROP; + + class OMySQLColumn : public OMySQLColumn_BASE, + public OMySQLColumn_PROP + { + ::rtl::OUString m_sAutoIncrement; + protected: + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const; + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + + public: + OMySQLColumn(sal_Bool _bCase); + virtual void construct(); + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // CONNECTIVITY_MYSQL_COLUMN_HXX + diff --git a/connectivity/source/inc/mysql/YDriver.hxx b/connectivity/source/inc/mysql/YDriver.hxx new file mode 100644 index 000000000000..dd231c87fda9 --- /dev/null +++ b/connectivity/source/inc/mysql/YDriver.hxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CONNECTIVITY_MYSQL_DRIVER_HXX +#define CONNECTIVITY_MYSQL_DRIVER_HXX + +#include <com/sun/star/sdbc/XDriver.hpp> +#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/compbase3.hxx> +#include <comphelper/uno3.hxx> +#include <comphelper/stl_types.hxx> +#include <comphelper/broadcasthelper.hxx> +#include "connectivity/CommonTools.hxx" + +//........................................................................ +namespace connectivity +{ +//........................................................................ + + class OMetaConnection; + + namespace mysql + { + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ODriverDelegator_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ); + + typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbc::XDriver + , ::com::sun::star::sdbcx::XDataDefinitionSupplier + , ::com::sun::star::lang::XServiceInfo + > ODriverDelegator_BASE; + + typedef ::std::pair< ::com::sun::star::uno::WeakReferenceHelper,OMetaConnection*> TWeakConnectionPair; + typedef ::std::pair< ::com::sun::star::uno::WeakReferenceHelper,TWeakConnectionPair> TWeakPair; + typedef ::std::vector< TWeakPair > TWeakPairVector; + DECLARE_STL_USTRINGACCESS_MAP(::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver >,TJDBCDrivers); + typedef enum + { + D_ODBC, + D_JDBC, + D_NATIVE + } T_DRIVERTYPE; + + + /** delegates all calls to the orignal driver and extend the existing one with the SDBCX layer. + + */ + class ODriverDelegator : public ::comphelper::OBaseMutex + ,public ODriverDelegator_BASE + { + TJDBCDrivers m_aJdbcDrivers; // all jdbc drivers + TWeakPairVector m_aConnections; // vector containing a list + // of all the Connection objects + // for this Driver + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > m_xODBCDriver; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > m_xNativeDriver; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; + ::rtl::OUString m_sOldDriverClass; + T_DRIVERTYPE m_eDriverType; + + /** load the driver we want to delegate. + The <member>m_xODBCDriver</member> or <member>m_xDBCDriver</member> may be <NULL/> if the driver could not be loaded. + @param url + The URL. + @param info + The property info contains which driver we have to delegate. + @return + The driver which was currently selected. + */ + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > loadDriver( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ); + + public: + /** creates a new delegator for a mysql driver + */ + ODriverDelegator(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory); + + // XServiceInfo + DECLARE_SERVICE_INFO(); + static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); + + // XDriver + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMajorVersion( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMinorVersion( ) throw (::com::sun::star::uno::RuntimeException); + + // XDataDefinitionSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& connection ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByURL( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + protected: + /// dtor + virtual ~ODriverDelegator(); + // OComponentHelper + virtual void SAL_CALL disposing(void); + }; + } + +//........................................................................ +} // namespace connectivity +//........................................................................ +#endif // CONNECTIVITY_MYSQL_DRIVER_HXX + diff --git a/connectivity/source/inc/mysql/YTable.hxx b/connectivity/source/inc/mysql/YTable.hxx new file mode 100644 index 000000000000..4f660282748a --- /dev/null +++ b/connectivity/source/inc/mysql/YTable.hxx @@ -0,0 +1,128 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_MYSQL_TABLE_HXX +#define CONNECTIVITY_MYSQL_TABLE_HXX + +#include "connectivity/TTableHelper.hxx" +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#include <comphelper/IdPropArrayHelper.hxx> + +namespace connectivity +{ + namespace mysql + { + + ::rtl::OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xColProp); + + class OMySQLTable; + typedef ::comphelper::OIdPropertyArrayUsageHelper< OMySQLTable > OMySQLTable_PROP; + class OMySQLTable : public OTableHelper + ,public OMySQLTable_PROP + { + sal_Int32 m_nPrivileges; // we have to set our privileges by our own + + /** executes the statmenmt. + @param _rStatement + The statement to execute. + */ + void executeStatement(const ::rtl::OUString& _rStatement ); + protected: + + /** creates the column collection for the table + @param _rNames + The column names. + */ + virtual sdbcx::OCollection* createColumns(const TStringVector& _rNames); + + /** creates the key collection for the table + @param _rNames + The key names. + */ + virtual sdbcx::OCollection* createKeys(const TStringVector& _rNames); + + /** creates the index collection for the table + @param _rNames + The index names. + */ + virtual sdbcx::OCollection* createIndexes(const TStringVector& _rNames); + + /** Returns always "RENAME TABLE " even for views. + * + * \return The start of the rename statement. + * @see http://dev.mysql.com/doc/refman/5.1/de/rename-table.html + */ + virtual ::rtl::OUString getRenameStart() const; + + /** used to implement the creation of the array helper which is shared amongst all instances of the class. + This method needs to be implemented in derived classes. + <BR> + The method gets called with s_aMutex acquired. + <BR> + as long as IPropertyArrayHelper has no virtual destructor, the implementation of ~OPropertyArrayUsageHelper + assumes that you created an ::cppu::OPropertyArrayHelper when deleting s_pProps. + @return an pointer to the newly created array helper. Must not be NULL. + */ + virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const; + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + + public: + OMySQLTable( sdbcx::OCollection* _pTables, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection); + OMySQLTable( sdbcx::OCollection* _pTables, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection, + const ::rtl::OUString& _Name, + const ::rtl::OUString& _Type, + const ::rtl::OUString& _Description = ::rtl::OUString(), + const ::rtl::OUString& _SchemaName = ::rtl::OUString(), + const ::rtl::OUString& _CatalogName = ::rtl::OUString(), + sal_Int32 _nPrivileges = 0 + ); + + // ODescriptor + virtual void construct(); + // com::sun::star::lang::XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + + // 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); + /** returns the ALTER TABLE XXX statement + */ + ::rtl::OUString getAlterTableColumnPart(); + + // some methods to alter table structures + void alterColumnType(sal_Int32 nNewType,const ::rtl::OUString& _rColName,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDescriptor); + void alterDefaultValue(const ::rtl::OUString& _sNewDefault,const ::rtl::OUString& _rColName); + void dropDefaultValue(const ::rtl::OUString& _sNewDefault); + + virtual ::rtl::OUString getTypeCreatePattern() const; + }; + } +} +#endif // CONNECTIVITY_MYSQL_TABLE_HXX + diff --git a/connectivity/source/inc/mysql/YTables.hxx b/connectivity/source/inc/mysql/YTables.hxx new file mode 100644 index 000000000000..ec19ac83140b --- /dev/null +++ b/connectivity/source/inc/mysql/YTables.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CONNECTIVITY_MYSQL_TABLES_HXX +#define CONNECTIVITY_MYSQL_TABLES_HXX + +#include "connectivity/sdbcx/VCollection.hxx" +#include "connectivity/SQLStatementHelper.hxx" +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +namespace connectivity +{ + namespace mysql + { + class OTables : public sdbcx::OCollection, + public ::dbtools::ISQLStatementHelper + { + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; + + protected: + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor(); + virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); + + void createTable( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual ::rtl::OUString getNameForObject(const sdbcx::ObjectType& _xObject); + public: + OTables(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, + const TStringVector &_rVector) : sdbcx::OCollection(_rParent,sal_True,_rMutex,_rVector) + ,m_xMetaData(_rMetaData) + {} + + // only the name is identical to ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + + // XDrop + void appendNew(const ::rtl::OUString& _rsNewTable); + // some helper functions + /** + returns a sql string which contains the column definition part for create or alter statements + */ + static ::rtl::OUString getColumnSqlType(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColProp); + /** + returns the "not null" part or the default part of the table statement + */ + static ::rtl::OUString getColumnSqlNotNullDefault(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColProp); + /** + returns the corresponding typename + can contain () which have to filled with values + */ + static ::rtl::OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColProp); + + /** convert the sql statement to fit MySQL notation + @param _sSql in/out + */ + static ::rtl::OUString adjustSQL(const ::rtl::OUString& _sSql); + + // ISQLStatementHelper + virtual void addComment(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor,::rtl::OUStringBuffer& _rOut); + }; + } +} +#endif // CONNECTIVITY_MYSQL_TABLES_HXX + diff --git a/connectivity/source/inc/mysql/YUser.hxx b/connectivity/source/inc/mysql/YUser.hxx new file mode 100644 index 000000000000..f546ae12443c --- /dev/null +++ b/connectivity/source/inc/mysql/YUser.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_MYSQL_USER_HXX_ +#define _CONNECTIVITY_MYSQL_USER_HXX_ + +#include "connectivity/sdbcx/VUser.hxx" +#include "com/sun/star/sdbc/XConnection.hpp" + +namespace connectivity +{ + namespace mysql + { + typedef connectivity::sdbcx::OUser OUser_TYPEDEF; + + class OMySQLUser : public OUser_TYPEDEF + { + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection; + + ::rtl::OUString getPrivilegeString(sal_Int32 nRights) const; + // return the privileges and additional the grant rights + void findPrivilegesAndGrantPrivileges(const ::rtl::OUString& objName, sal_Int32 objType,sal_Int32& nRights,sal_Int32& nRightsWithGrant) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + public: + virtual void refreshGroups(); + public: + OMySQLUser( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection); + OMySQLUser( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,const ::rtl::OUString& _Name); + + // XUser + virtual void SAL_CALL changePassword( const ::rtl::OUString& objPassword, const ::rtl::OUString& newPassword ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XAuthorizable + virtual sal_Int32 SAL_CALL getPrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getGrantablePrivileges( const ::rtl::OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL grantPrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL revokePrivileges( const ::rtl::OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + + class OUserExtend; + typedef ::comphelper::OPropertyArrayUsageHelper<OUserExtend> OUserExtend_PROP; + + class OUserExtend : public OMySQLUser, + public OUserExtend_PROP + { + protected: + ::rtl::OUString m_Password; + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + public: + OUserExtend(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection); + + virtual void construct(); + }; + } +} +#endif // _CONNECTIVITY_MYSQL_USER_HXX_ + diff --git a/connectivity/source/inc/mysql/YUsers.hxx b/connectivity/source/inc/mysql/YUsers.hxx new file mode 100644 index 000000000000..252925577d9b --- /dev/null +++ b/connectivity/source/inc/mysql/YUsers.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_MYSQL_USERS_HXX_ +#define _CONNECTIVITY_MYSQL_USERS_HXX_ + +#include "connectivity/sdbcx/VCollection.hxx" +#include "com/sun/star/sdbc/XConnection.hpp" +namespace connectivity +{ + namespace sdbcx + { + class IRefreshableUsers; + } + namespace mysql + { + class OUsers : public sdbcx::OCollection + { + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection; + connectivity::sdbcx::IRefreshableUsers* m_pParent; + public: + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor(); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); + public: + OUsers( ::cppu::OWeakObject& _rParent, + ::osl::Mutex& _rMutex, + const TStringVector &_rVector, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection, + connectivity::sdbcx::IRefreshableUsers* _pParent); + }; + } +} + +#endif // _CONNECTIVITY_MYSQL_USERS_HXX_ + diff --git a/connectivity/source/inc/mysql/YViews.hxx b/connectivity/source/inc/mysql/YViews.hxx new file mode 100644 index 000000000000..9fe5de9022f5 --- /dev/null +++ b/connectivity/source/inc/mysql/YViews.hxx @@ -0,0 +1,64 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_MYSQL_VIEWS_HXX_ +#define _CONNECTIVITY_MYSQL_VIEWS_HXX_ + +#include "connectivity/sdbcx/VCollection.hxx" +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +namespace connectivity +{ + namespace mysql + { + class OViews : public sdbcx::OCollection + { + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; + sal_Bool m_bInDrop; + // OCatalog* m_pParent; + protected: + virtual sdbcx::ObjectType createObject(const ::rtl::OUString& _rName); + virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor(); + virtual sdbcx::ObjectType appendObject( const ::rtl::OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + virtual void dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName); + + void createView( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ); + public: + OViews(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rMetaData,::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex, + const TStringVector &_rVector) : sdbcx::OCollection(_rParent,sal_True,_rMutex,_rVector) + ,m_xMetaData(_rMetaData) + ,m_bInDrop(sal_False) + {} + + // only the name is identical to ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + + void dropByNameImpl(const ::rtl::OUString& elementName); + }; + } +} +#endif // _CONNECTIVITY_MYSQL_VIEWS_HXX_ + diff --git a/connectivity/source/inc/odbc/OBoundParam.hxx b/connectivity/source/inc/odbc/OBoundParam.hxx new file mode 100644 index 000000000000..e3eb6d6dd49f --- /dev/null +++ b/connectivity/source/inc/odbc/OBoundParam.hxx @@ -0,0 +1,222 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_OBOUNPARAM_HXX_ +#define _CONNECTIVITY_OBOUNPARAM_HXX_ + +#include <com/sun/star/io/XInputStream.hpp> +#include "odbc/odbcbasedllapi.hxx" + +namespace connectivity +{ + namespace odbc + { + class OOO_DLLPUBLIC_ODBCBASE OBoundParam + { + + public: + OBoundParam() + { + paramLength = NULL; + binaryData = NULL; + pA1=0; + pA2=0; + pB1=0; + pB2=0; + pC1=0; + pC2=0; + pS1=0; + pS2=0; + } + ~OBoundParam() + { + delete [] binaryData; + delete [] paramLength; + } + //-------------------------------------------------------------------- + // initialize + // Perform an necessary initialization + //-------------------------------------------------------------------- + void initialize () + { + // Allocate storage for the length. Note - the length is + // stored in native format, and will have to be converted + // to a Java sal_Int32. The jdbcodbc 'C' bridge provides an + // interface to do this. + + paramLength = new sal_Int8[4]; + } + + //-------------------------------------------------------------------- + // allocBindDataBuffer + // Allocates and returns a new bind data buffer of the specified + // length + //-------------------------------------------------------------------- + sal_Int8* allocBindDataBuffer (sal_Int32 bufLen) + { + if ( binaryData ) + delete [] binaryData; + binaryData = new sal_Int8[bufLen]; + + // Reset the input stream, we are doing a new bind + setInputStream (NULL, 0); + + return binaryData; + } + + //-------------------------------------------------------------------- + // getBindDataBuffer + // Returns the data buffer to be used when binding to a parameter + //-------------------------------------------------------------------- + sal_Int8* getBindDataBuffer () + { + return binaryData; + } + + //-------------------------------------------------------------------- + // getBindLengthBuffer + // Returns the length buffer to be used when binding to a parameter + //-------------------------------------------------------------------- + sal_Int8* getBindLengthBuffer () + { + return paramLength; + } + + //-------------------------------------------------------------------- + // setInputStream + // Sets the input stream for the bound parameter + //-------------------------------------------------------------------- + void setInputStream(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream>& inputStream, + sal_Int32 len) + { + paramInputStream = inputStream; + paramInputStreamLen = len; + } + + void setSequence(const ::com::sun::star::uno::Sequence< sal_Int8 >& _aSequence) + { + aSequence = _aSequence; + } + + //-------------------------------------------------------------------- + // getInputStream + // Gets the input stream for the bound parameter + //-------------------------------------------------------------------- + ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream> getInputStream () + { + return paramInputStream; + } + + //-------------------------------------------------------------------- + // getInputStreamLen + // Gets the input stream length for the bound parameter + //-------------------------------------------------------------------- + sal_Int32 getInputStreamLen () + { + return paramInputStreamLen; + } + + //-------------------------------------------------------------------- + // setSqlType + // Sets the Java sql type used to register an OUT parameter + //-------------------------------------------------------------------- + + void setSqlType(sal_Int32 type) + { + sqlType = type; + } + + //-------------------------------------------------------------------- + // getSqlType + // Gets the Java sql type used to register an OUT parameter + //-------------------------------------------------------------------- + + sal_Int32 getSqlType () + { + return sqlType; + } + + //-------------------------------------------------------------------- + // setOutputParameter + // Sets the flag indicating if this is an OUTPUT parameter + //-------------------------------------------------------------------- + + void setOutputParameter (sal_Bool output) + { + outputParameter = output; + } + + //-------------------------------------------------------------------- + // isOutputParameter + // Gets the OUTPUT parameter flag + //-------------------------------------------------------------------- + + sal_Bool isOutputParameter () + { + return outputParameter; + } + + protected: + //==================================================================== + // Data attributes + //==================================================================== + + sal_Int8* binaryData; // Storage area to be used + // when binding the parameter + + sal_Int8* paramLength; // Storage area to be used + // for the bound length of the + // parameter. Note that this + // data is in native format. + + ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream> paramInputStream; + ::com::sun::star::uno::Sequence< sal_Int8 > aSequence; + // When an input stream is + // bound to a parameter, the + // input stream is saved + // until needed. + + sal_Int32 paramInputStreamLen; // Length of input stream + + sal_Int32 sqlType; // Java SQL type used to + // register an OUT parameter + + sal_Bool outputParameter; // true for OUTPUT parameters + + + sal_Int32 pA1; //pointers + sal_Int32 pA2; + sal_Int32 pB1; + sal_Int32 pB2; + sal_Int32 pC1; + sal_Int32 pC2; + sal_Int32 pS1; + sal_Int32 pS2;// reserved for strings(UTFChars) + }; + } +} +#endif // _CONNECTIVITY_OBOUNPARAM_HXX_ + diff --git a/connectivity/source/inc/odbc/OConnection.hxx b/connectivity/source/inc/odbc/OConnection.hxx new file mode 100644 index 000000000000..94ffd3a57263 --- /dev/null +++ b/connectivity/source/inc/odbc/OConnection.hxx @@ -0,0 +1,160 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ODBC_OCONNECTION_HXX_ +#define _CONNECTIVITY_ODBC_OCONNECTION_HXX_ + +#include <com/sun/star/sdbc/SQLWarning.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include "odbc/OFunctiondefs.hxx" +#include "odbc/odbcbasedllapi.hxx" +#include "OSubComponent.hxx" +#include "connectivity/CommonTools.hxx" +#include "TConnection.hxx" +#include "OTypeInfo.hxx" +#include <cppuhelper/weakref.hxx> +#include "AutoRetrievingBase.hxx" +#include <osl/module.h> + + +#include <map> + +namespace connectivity +{ + namespace odbc + { + + class OStatement_Base; + class ODBCDriver; + class ODatabaseMetaData; + + typedef connectivity::OMetaConnection OConnection_BASE; + typedef ::std::vector< ::connectivity::OTypeInfo> TTypeInfoVector; + + class OOO_DLLPUBLIC_ODBCBASE OConnection : + public OConnection_BASE, + public connectivity::OSubComponent<OConnection, OConnection_BASE>, + public OAutoRetrievingBase + { + friend class connectivity::OSubComponent<OConnection, OConnection_BASE>; + + protected: + //==================================================================== + // Data attributes + //==================================================================== + ::std::map< SQLHANDLE,OConnection*> m_aConnections; // holds all connectionas which are need for serveral statements + TTypeInfoVector m_aTypeInfo; // vector containing an entry + // for each row returned by + // DatabaseMetaData.getTypeInfo. + + + ::com::sun::star::sdbc::SQLWarning m_aLastWarning; // Last SQLWarning generated by + // an operation + ::rtl::OUString m_sUser; // the user name + ODBCDriver* m_pDriver; // Pointer to the owning + // driver object + + SQLHANDLE m_aConnectionHandle; + SQLHANDLE m_pDriverHandleCopy; // performance reason + sal_Int32 m_nStatementCount; + sal_Bool m_bClosed; + sal_Bool m_bUseCatalog; // should we use the catalog on filebased databases + sal_Bool m_bUseOldDateFormat; + sal_Bool m_bParameterSubstitution; + sal_Bool m_bIgnoreDriverPrivileges; + sal_Bool m_bPreventGetVersionColumns; // #i60273# + sal_Bool m_bReadOnly; + + + SQLRETURN OpenConnection(const ::rtl::OUString& aConnectStr,sal_Int32 nTimeOut, sal_Bool bSilent); + + virtual OConnection* cloneConnection(); // creates a new connection + + public: + oslGenericFunction getOdbcFunction(sal_Int32 _nIndex) const; + virtual SQLRETURN Construct( const ::rtl::OUString& url,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info) throw(::com::sun::star::sdbc::SQLException); + + OConnection(const SQLHANDLE _pDriverHandle,ODBCDriver* _pDriver); + // OConnection(const SQLHANDLE _pConnectionHandle); + virtual ~OConnection(); + + void closeAllStatements () throw( ::com::sun::star::sdbc::SQLException); + + // OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual void SAL_CALL release() throw(); + + // XServiceInfo + DECLARE_SERVICE_INFO(); + // XConnection + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > SAL_CALL createStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareCall( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL nativeSQL( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setAutoCommit( sal_Bool autoCommit ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getAutoCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL commit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL rollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isClosed( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setReadOnly( sal_Bool readOnly ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setCatalog( const ::rtl::OUString& catalog ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalog( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTransactionIsolation( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTypeMap( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTypeMap( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) 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); + // + SQLHANDLE getConnection() { return m_aConnectionHandle; } + + // should we use the catalog on filebased databases + inline sal_Bool isCatalogUsed() const { return m_bUseCatalog; } + inline sal_Bool isParameterSubstitutionEnabled() const { return m_bParameterSubstitution; } + inline sal_Bool isIgnoreDriverPrivilegesEnabled() const { return m_bIgnoreDriverPrivileges; } + inline sal_Bool preventGetVersionColumns() const { return m_bPreventGetVersionColumns; } + inline sal_Bool useOldDateFormat() const { return m_bUseOldDateFormat; } + inline SQLHANDLE getDriverHandle() const { return m_pDriverHandleCopy;} + inline ODBCDriver* getDriver() const { return m_pDriver;} + inline ::rtl::OUString getUserName() const { return m_sUser; } + + SQLHANDLE createStatementHandle(); + // close and free the handle and set it to SQL_NULLHANDLE + void freeStatementHandle(SQLHANDLE& _pHandle); + + void buildTypeInfo() throw( ::com::sun::star::sdbc::SQLException); + const TTypeInfoVector& getTypeInfo() const { return m_aTypeInfo; } + }; + } +} +#endif // _CONNECTIVITY_ODBC_OCONNECTION_HXX_ + diff --git a/connectivity/source/inc/odbc/ODatabaseMetaData.hxx b/connectivity/source/inc/odbc/ODatabaseMetaData.hxx new file mode 100644 index 000000000000..5805f336e034 --- /dev/null +++ b/connectivity/source/inc/odbc/ODatabaseMetaData.hxx @@ -0,0 +1,224 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ODBC_ODATABASEMETADATA_HXX_ +#define _CONNECTIVITY_ODBC_ODATABASEMETADATA_HXX_ + +#include "odbc/OConnection.hxx" +#include "odbc/odbcbasedllapi.hxx" +#include "TDatabaseMetaDataBase.hxx" + +namespace connectivity +{ + namespace odbc + { + //************************************************************** + //************ Class: ODatabaseMetaData + //************************************************************** + + class OOO_DLLPUBLIC_ODBCBASE ODatabaseMetaData : + public ODatabaseMetaDataBase + { + SQLHANDLE m_aConnectionHandle; + OConnection* m_pConnection; + sal_Bool m_bUseCatalog; + sal_Bool m_bOdbc3; + + // cached database information + virtual ::rtl::OUString impl_getIdentifierQuoteString_throw( ); + virtual sal_Bool impl_isCatalogAtStart_throw( ); + virtual ::rtl::OUString impl_getCatalogSeparator_throw( ); + virtual sal_Bool impl_supportsCatalogsInTableDefinitions_throw( ); + virtual sal_Bool impl_supportsSchemasInTableDefinitions_throw( ) ; + virtual sal_Bool impl_supportsCatalogsInDataManipulation_throw( ); + virtual sal_Bool impl_supportsSchemasInDataManipulation_throw( ) ; + virtual sal_Bool impl_supportsMixedCaseQuotedIdentifiers_throw( ) ; + virtual sal_Bool impl_supportsAlterTableWithAddColumn_throw( ); + virtual sal_Bool impl_supportsAlterTableWithDropColumn_throw( ); + virtual sal_Int32 impl_getMaxStatements_throw( ); + virtual sal_Int32 impl_getMaxTablesInSelect_throw( ); + virtual sal_Bool impl_storesMixedCaseQuotedIdentifiers_throw( ); + protected: + ::rtl::OUString getURLImpl(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > impl_getTypeInfo_throw(); + virtual ~ODatabaseMetaData(); + public: + + inline OConnection* getOwnConnection() const { return m_pConnection; } + inline oslGenericFunction getOdbcFunction(sal_Int32 _nIndex) const + { + return m_pConnection->getOdbcFunction(_nIndex); + } + + ODatabaseMetaData(const SQLHANDLE _pHandle,OConnection* _pCon); + + + + // XDatabaseMetaData + virtual sal_Bool SAL_CALL allProceduresAreCallable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL allTablesAreSelectable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getURL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getUserName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedLow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDatabaseProductName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDatabaseProductVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDriverName( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDriverVersion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL usesLocalFiles( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + virtual ::rtl::OUString SAL_CALL getSQLKeywords( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getNumericFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getStringFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSystemFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTimeDateFunctions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSearchStringEscape( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getExtraNameCharacters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsColumnAliasing( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTypeConversion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsGroupBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSchemaTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getProcedureTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalogTerm( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsPositionedDelete( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsStoredProcedures( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsUnion( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsUnionAll( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) 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 getMaxColumnsInOrderBy( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) 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_Int32 SAL_CALL getMaxConnections( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxIndexLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxRowSize( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxStatementLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getProcedures( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getProcedureColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTables( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getSchemas( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCatalogs( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTableTypes( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getColumnPrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, const ::rtl::OUString& columnNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getTablePrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getBestRowIdentifier( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope, sal_Bool nullable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getVersionColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getPrimaryKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getImportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getExportedKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getCrossReference( const ::com::sun::star::uno::Any& primaryCatalog, const ::rtl::OUString& primarySchema, const ::rtl::OUString& primaryTable, const ::com::sun::star::uno::Any& foreignCatalog, const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getIndexInfo( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Bool unique, sal_Bool approximate ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsBatchUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getUDTs( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern, const ::com::sun::star::uno::Sequence< sal_Int32 >& types ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_ODBC_ODATABASEMETADATA_HXX_ + diff --git a/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx b/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx new file mode 100644 index 000000000000..d0aa60a812ca --- /dev/null +++ b/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx @@ -0,0 +1,242 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ODBC_ADATABASEMETADATARESULTSET_HXX_ +#define _CONNECTIVITY_ODBC_ADATABASEMETADATARESULTSET_HXX_ + +#include <com/sun/star/sdbc/XResultSet.hpp> +#include <com/sun/star/sdbc/XRow.hpp> +#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> +#include <com/sun/star/sdbc/XCloseable.hpp> +#include <com/sun/star/sdbc/XColumnLocate.hpp> +#include <com/sun/star/util/XCancellable.hpp> +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#include <com/sun/star/sdbc/XResultSetUpdate.hpp> +#include <com/sun/star/sdbc/XRowUpdate.hpp> +#include <cppuhelper/compbase7.hxx> +#include <comphelper/proparrhlp.hxx> +#include "odbc/OStatement.hxx" +#include "odbc/ODatabaseMetaData.hxx" +#include "odbc/odbcbasedllapi.hxx" +#include <comphelper/broadcasthelper.hxx> +#include "connectivity/StdTypeDefs.hxx" + +namespace connectivity +{ + namespace odbc + { + class ODatabaseMetaDataResultSetMetaData; + /* + ** java_sql_ResultSet + */ + typedef ::cppu::WeakComponentImplHelper7< ::com::sun::star::sdbc::XResultSet, + ::com::sun::star::sdbc::XRow, + ::com::sun::star::sdbc::XResultSetMetaDataSupplier, + ::com::sun::star::util::XCancellable, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::sdbc::XCloseable, + ::com::sun::star::sdbc::XColumnLocate> ODatabaseMetaDataResultSet_BASE; + + class OOO_DLLPUBLIC_ODBCBASE ODatabaseMetaDataResultSet : + public comphelper::OBaseMutex, + public ODatabaseMetaDataResultSet_BASE, + public ::cppu::OPropertySetHelper, + public ::comphelper::OPropertyArrayUsageHelper<ODatabaseMetaDataResultSet> + { + ::connectivity::TIntVector m_aColMapping; // pos 0 is unused so we don't have to decrement 1 everytime + + ::std::map<sal_Int32, ::connectivity::TInt2IntMap > m_aValueRange; + ::std::map<sal_Int32, ::connectivity::TString2IntMap > m_aStrValueRange; + + ::std::map<sal_Int32, ::connectivity::TInt2StringMap > m_aIntValueRange; + ::std::map<sal_Int32,SWORD> m_aODBCColumnTypes; + + SQLHANDLE m_aStatementHandle; + SQLHANDLE m_aConnectionHandle; + ::com::sun::star::uno::WeakReferenceHelper m_aStatement; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData; + SQLUSMALLINT* m_pRowStatusArray; + OConnection* m_pConnection; + rtl_TextEncoding m_nTextEncoding; + sal_Int32 m_nRowPos; + sal_Int32 m_nLastColumnPos; // used for m_aRow just to know where we are + sal_Int32 m_nDriverColumnCount; // column count of the driver wich can sometimes be less than the metadata count + SQLRETURN m_nCurrentFetchState; + sal_Bool m_bWasNull; + sal_Bool m_bEOF; // after last record + sal_Bool m_bFreeHandle; + + // set the columncount of the driver + void checkColumnCount(); + sal_Int32 getResultSetConcurrency() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getResultSetType() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getFetchDirection() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getFetchSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + ::rtl::OUString getCursorName() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + SWORD impl_getColumnType_nothrow(sal_Int32 columnIndex); + + sal_Int32 mapColumn (sal_Int32 column); + + protected: + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + + virtual sal_Bool SAL_CALL convertFastPropertyValue( + ::com::sun::star::uno::Any & rConvertedValue, + ::com::sun::star::uno::Any & rOldValue, + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue ) + throw (::com::sun::star::lang::IllegalArgumentException); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue + ) + throw (::com::sun::star::uno::Exception); + virtual void SAL_CALL getFastPropertyValue( + ::com::sun::star::uno::Any& rValue, + sal_Int32 nHandle + ) const; + ~ODatabaseMetaDataResultSet(); + public: + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + ODatabaseMetaDataResultSet(OConnection* _pConnection); + + + inline oslGenericFunction getOdbcFunction(sal_Int32 _nIndex) const + { + return m_pConnection->getOdbcFunction(_nIndex); + } + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > operator *() + { + return ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >(*(ODatabaseMetaDataResultSet_BASE*)this); + } + // XResultSet + virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XRow + virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XResultSetMetaDataSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCancellable + virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) 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); + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + const ::connectivity::TIntVector& getColumnMapping() { return m_aColMapping; } + + void openTablesTypes( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openTypeInfo() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openCatalogs() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openSchemas() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openTables(const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& tableNamePattern, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& types ) + throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openColumnPrivileges( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, + const ::rtl::OUString& table, const ::rtl::OUString& columnNamePattern )throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern )throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openProcedureColumns( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& procedureNamePattern,const ::rtl::OUString& columnNamePattern )throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openProcedures( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& procedureNamePattern)throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openVersionColumns(const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, + const ::rtl::OUString& table)throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openBestRowIdentifier( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, + const ::rtl::OUString& table,sal_Int32 scope,sal_Bool nullable )throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openForeignKeys( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString* schema,const ::rtl::OUString* table, + const ::com::sun::star::uno::Any& catalog2, const ::rtl::OUString* schema2,const ::rtl::OUString* table2)throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openExportedKeys(const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema,const ::rtl::OUString& table)throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openImportedKeys(const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema,const ::rtl::OUString& table)throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openPrimaryKeys(const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema,const ::rtl::OUString& table)throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openTablePrivileges(const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schemaPattern, + const ::rtl::OUString& tableNamePattern)throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openSpecialColumns(sal_Bool _bRowVer,const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, + const ::rtl::OUString& table,sal_Int32 scope, sal_Bool nullable )throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void openIndexInfo( const ::com::sun::star::uno::Any& catalog, const ::rtl::OUString& schema, + const ::rtl::OUString& table,sal_Bool unique,sal_Bool approximate )throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + protected: + using OPropertySetHelper::getFastPropertyValue; + }; + } + +} +#endif // _CONNECTIVITY_ADO_ADATABASEMETADATARESULTSET_HXX_ + diff --git a/connectivity/source/inc/odbc/ODefs3.hxx b/connectivity/source/inc/odbc/ODefs3.hxx new file mode 100644 index 000000000000..6bd4025248c8 --- /dev/null +++ b/connectivity/source/inc/odbc/ODefs3.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_ODBC_ODEFS_HXX_ +#define _CONNECTIVITY_ODBC_ODEFS_HXX_ + +#define N3SQLAllocHandle SQLAllocHandle +#define N3SQLConnect SQLConnect +#define N3SQLDriverConnect SQLDriverConnect +#define N3SQLBrowseConnect SQLBrowseConnect +#define N3SQLDataSources SQLDataSources +#define N3SQLDrivers SQLDrivers +#define N3SQLGetInfo SQLGetInfo +#define N3SQLGetFunctions SQLGetFunctions +#define N3SQLGetTypeInfo SQLGetTypeInfo +#define N3SQLSetConnectAttr SQLSetConnectAttr +#define N3SQLGetConnectAttr SQLGetConnectAttr +#define N3SQLSetEnvAttr SQLSetEnvAttr +#define N3SQLGetEnvAttr SQLGetEnvAttr +#define N3SQLSetStmtAttr SQLSetStmtAttr +#define N3SQLGetStmtAttr SQLgetStmtAttr +#define N3SQLSetDescField SQLSetDescField +#define N3SQLGetDescField SQLGetDescField +#define N3SQLGetDescRec SQLGetDescRec +#define N3SQLSetDescRec SQLSetDescRec +#define N3SQLPrepare SQLPrepare +#define N3SQLBindParameter SQLBindParameter +#define N3SQLGetCursorName SQLGetCursorName +#define N3SQLSetCursorName SQLSetCursorName +#define N3SQLExecute SQLExecute +#define N3SQLExecDirect SQLExecDirect +#define N3SQLNativeSql SQLNativeSql +#define N3SQLDescribeParam SQLDescribeParam +#define N3SQLNumParams SQLNumParams +#define N3SQLParamData SQLParamData +#define N3SQLPutData SQLPutData +#define N3SQLRowCount SQLRowCount +#define N3SQLNumResultCols SQLNumResultCols +#define N3SQLDescribeCol SQLDescribeCol +#define N3SQLColAttribute SQLColAttribute +#define N3SQLBindCol SQLBindCol +#define N3SQLFetch SQLFetch +#define N3SQLFetchScroll SQLFetchScroll +#define N3SQLGetData SQLGetData +#define N3SQLSetPos SQLSetPos +#define N3SQLBulkOperations SQLBulkOperations +#define N3SQLMoreResults SQLMoreResults +#define N3SQLGetDiagField SQLGetDiagField +#define N3SQLGetDiagRec SQLGetDiagRec +#define N3SQLColumnPrivileges SQLColumnPrivileges +#define N3SQLColumns SQLColumns +#define N3SQLForeignKeys SQLForeignKeys +#define N3SQLPrimaryKeys SQLPrimaryKeys +#define N3SQLProcedureColumns SQLProcedureColumns +#define N3SQLProcedures SQLProcedures +#define N3SQLSpecialColumns SQLSpecialColumns +#define N3SQLStatistics SQLStatistics +#define N3SQLTablePrivileges SQLTablePrivileges +#define N3SQLTables SQLTables +#define N3SQLFreeStmt SQLFreeStmt +#define N3SQLCloseCursor SQLCloseCursor +#define N3SQLCancel SQLCancel +#define N3SQLEndTran SQLEndTran +#define N3SQLDisconnect SQLDisconnect +#define N3SQLFreeHandle SQLFreeHandle +#define N3SQLGetCursorName SQLGetCursorName + +#endif // _CONNECTIVITY_ODBC_ODEFS_HXX_ + diff --git a/connectivity/source/inc/odbc/ODriver.hxx b/connectivity/source/inc/odbc/ODriver.hxx new file mode 100644 index 000000000000..4be1e371129a --- /dev/null +++ b/connectivity/source/inc/odbc/ODriver.hxx @@ -0,0 +1,90 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ODBC_ODRIVER_HXX_ +#define _CONNECTIVITY_ODBC_ODRIVER_HXX_ + +#include <com/sun/star/sdbc/XDriver.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/compbase2.hxx> +#include "odbc/OFunctiondefs.hxx" +#include "odbc/odbcbasedllapi.hxx" +#include "connectivity/CommonTools.hxx" +#include <osl/module.h> + +namespace connectivity +{ + namespace odbc + { + typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::sdbc::XDriver, ::com::sun::star::lang::XServiceInfo > ODriver_BASE; + + class OOO_DLLPUBLIC_ODBCBASE SAL_NO_VTABLE ODBCDriver : public ODriver_BASE + { + protected: + ::osl::Mutex m_aMutex; + + connectivity::OWeakRefArray m_xConnections; // vector containing a list + // of all the Connection objects + // for this Driver + + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB; + SQLHANDLE m_pDriverHandle; + + virtual SQLHANDLE EnvironmentHandle(::rtl::OUString &_rPath) = 0; + + public: + + ODBCDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory); + + // only possibility to get the odbc functions + virtual oslGenericFunction getOdbcFunction(sal_Int32 _nIndex) const = 0; + // OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + + // XDriver + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL connect( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL acceptsURL( const ::rtl::OUString& url ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo( const ::rtl::OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMajorVersion( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMinorVersion( ) throw(::com::sun::star::uno::RuntimeException); + + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() const { return m_xORB; } + }; + } + +} +#endif //_CONNECTIVITY_ODBC_ODRIVER_HXX_ + + diff --git a/connectivity/source/inc/odbc/OFunctiondefs.hxx b/connectivity/source/inc/odbc/OFunctiondefs.hxx new file mode 100644 index 000000000000..25884342bf89 --- /dev/null +++ b/connectivity/source/inc/odbc/OFunctiondefs.hxx @@ -0,0 +1,175 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +//-------------------------------------------------------------------------- +#ifndef _CONNECTIVITY_OFUNCTIONDEFS_HXX_ +#define _CONNECTIVITY_OFUNCTIONDEFS_HXX_ + +#if defined(WNT) + +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:4005) +#endif + +// just to go with calling convention of windows +#define SQL_API __stdcall +#include <odbc/sqlext.h> +#undef SQL_API +#define SQL_API __stdcall + +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#ifndef SQL_C_BOOKMARK +#define SQL_C_BOOKMARK SQL_C_ULONG /* BOOKMARK */ +#endif + +#ifndef SQL_OPT_TRACE_OFF +#define SQL_OPT_TRACE_OFF 0UL +#endif + +#define SDB_ODBC_CHAR UCHAR + +#endif + +//-------------------------------------------------------------------------- + +#ifdef OS2 +#define ALLREADY_HAVE_OS2_TYPES +#define DONT_TD_VOID +#include <svpm.h> +#include <odbc/sqlext.h> +#define SDB_ODBC_CHAR UCHAR +#endif // OS2 + +#ifdef OS2__00 + +#ifdef ODBCIMP + +// Stub-Version: dynamische Bindung an die DLL zur Laufzeit. +// odbcstub definiert die in den Quellen benutzten NSQL...-Methoden +// als indirekte Funktionsaufrufe. +// odbcimp zieht sich selbst preos2, odbc und postos2 an. +// #include "odbc3imp.hxx" + +#else + +// Zur Zeit verwenden wir die ODBC-DLL von Watcom-SQL direkt (ueber die +// mitgelieferte Lib). + +#ifndef ODBC_OS2 +#define ODBC_OS2 +#endif + +#include <svpm.h> +#include <odbc.h> +#define SQL_API __syscall +#ifndef SQL_MAX_MESSAGE_LENGTH +#define SQL_MAX_MESSAGE_LENGTH MAX_MESSAGE_LENGTH +#endif +#ifndef SQL_MAX_DSN_LENGTH +#define SQL_MAX_DSN_LENGTH MAX_DSN_LENGTH +#endif +#ifndef SQL_AUTOCOMMIT_ON +#define SQL_AUTOCOMMIT_ON 1UL +#endif +#ifndef SQL_AUTOCOMMIT_OFF +#define SQL_AUTOCOMMIT_OFF 0UL +#endif + +#define SQL_FETCH_PRIOR SQL_FETCH_PREV +#define SQL_NO_TOTAL (-4) + +// #include "odbc3defs.hxx" + +#endif + +// In der ODBC.H von Watcom werden Strings als char * erwartet +// (nicht, wie sonst bei ODBC ueblich, als UCHAR *). +#if defined( ICC ) || defined( WTC ) +#define SDB_ODBC_CHAR unsigned char +#else +#define SDB_ODBC_CHAR char +#endif + +#endif + +//-------------------------------------------------------------------------- + +#ifdef UNX + +// Zur Zeit verwenden wir die ODBC-shared library von Q+E direkt (ueber die +// mitgelieferte Lib). + +#ifndef ODBC_UNX +#define ODBC_UNX +#endif +#define CALLBACK +#define EXPORT +#ifdef SYSTEM_ODBC_HEADERS +#include <sqlext.h> +#else +#include <odbc/sqlext.h> +#endif +#undef sal_Bool // Ist in qeodbc.h definiert, wird aber von solar.h noch einmal + // definiert. + +#define SDB_ODBC_CHAR UCHAR +#define SQL_WCHAR (-8) +#define SQL_WVARCHAR (-9) +#define SQL_WLONGVARCHAR (-10) +#define SQL_C_WCHAR SQL_WCHAR + + +#endif // UNX + +//-------------------------------------------------------------------------- + +#ifndef SQL_WCHAR +#define SQL_WCHAR (-8) +#endif +#ifndef SQL_WVARCHAR +#define SQL_WVARCHAR (-9) +#endif +#ifndef SQL_WLONGVARCHAR +#define SQL_WLONGVARCHAR (-10) +#endif +#ifndef SQL_C_WCHAR +#define SQL_C_WCHAR SQL_WCHAR +#endif + +#ifdef UNICODE +#define SQL_C_TCHAR SQL_C_WCHAR +#else +#define SQL_C_TCHAR SQL_C_CHAR +#endif + +#endif // _CONNECTIVITY_OFUNCTIONDEFS_HXX_ + + diff --git a/connectivity/source/inc/odbc/OFunctions.hxx b/connectivity/source/inc/odbc/OFunctions.hxx new file mode 100644 index 000000000000..99a8db65eb14 --- /dev/null +++ b/connectivity/source/inc/odbc/OFunctions.hxx @@ -0,0 +1,556 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ODBC_OFUNCTIONS_HXX_ +#define _CONNECTIVITY_ODBC_OFUNCTIONS_HXX_ + +#include "odbc/OFunctiondefs.hxx" +#include <rtl/ustring.hxx> +#include <osl/module.h> + +namespace connectivity +{ + +// sal_Bool LoadFunctions(oslModule pODBCso, sal_Bool _bDS=sal_True); +// sal_Bool LoadLibrary_ODBC3(::rtl::OUString &_rPath); +// sal_Bool LoadLibrary_ADABAS(::rtl::OUString &_rPath); + + // Connecting to a data source + typedef SQLRETURN (SQL_API *T3SQLAllocHandle) (SQLSMALLINT HandleType,SQLHANDLE InputHandle,SQLHANDLE * OutputHandlePtr); + + #define N3SQLAllocHandle(a,b,c) (*(T3SQLAllocHandle)getOdbcFunction(ODBC3SQLAllocHandle))(a,b,c) + + typedef SQLRETURN (SQL_API *T3SQLConnect) (SQLHDBC ConnectionHandle,SQLCHAR *ServerName,SQLSMALLINT NameLength1,SQLCHAR *UserName,SQLSMALLINT NameLength2,SQLCHAR *Authentication,SQLSMALLINT NameLength3); + + #define N3SQLConnect(a,b,c,d,e,f,g) (*(T3SQLConnect)getOdbcFunction(ODBC3SQLConnect))(a,b,c,d,e,f,g) + + typedef SQLRETURN (SQL_API *T3SQLDriverConnect) ( SQLHDBC ConnectionHandle, + HWND WindowHandle, + SQLCHAR * InConnectionString, + SQLSMALLINT StringLength1, + SQLCHAR * OutConnectionString, + SQLSMALLINT BufferLength, + SQLSMALLINT * StringLength2Ptr, + SQLUSMALLINT DriverCompletion); + + #define N3SQLDriverConnect(a,b,c,d,e,f,g,h) (*(T3SQLDriverConnect)getOdbcFunction(ODBC3SQLDriverConnect))(a,b,c,d,e,f,g,h) + + typedef SQLRETURN (SQL_API *T3SQLBrowseConnect) ( SQLHDBC ConnectionHandle, + SQLCHAR * InConnectionString, + SQLSMALLINT StringLength1, + SQLCHAR * OutConnectionString, + SQLSMALLINT BufferLength, + SQLSMALLINT * StringLength2Ptr); + + #define N3SQLBrowseConnect(a,b,c,d,e,f) (*(T3SQLBrowseConnect)getOdbcFunction(ODBC3SQLBrowseConnect))(a,b,c,d,e,f) + + // Obtaining information about a driver and data source + typedef SQLRETURN (SQL_API *T3SQLDataSources) ( SQLHENV EnvironmentHandle, + SQLUSMALLINT Direction, + SQLCHAR * ServerName, + SQLSMALLINT BufferLength1, + SQLSMALLINT * NameLength1Ptr, + SQLCHAR * Description, + SQLSMALLINT BufferLength2, + SQLSMALLINT * NameLength2Ptr); + + #define N3SQLDataSources(a,b,c,d,e,f,g,h) (*(T3SQLDataSources)getOdbcFunction(ODBC3SQLDataSources))(a,b,c,d,e,f,g,h) + + typedef SQLRETURN (SQL_API *T3SQLDrivers) ( SQLHENV EnvironmentHandle, + SQLUSMALLINT Direction, + SQLCHAR * DriverDescription, + SQLSMALLINT BufferLength1, + SQLSMALLINT * DescriptionLengthPtr, + SQLCHAR * DriverAttributes, + SQLSMALLINT BufferLength2, + SQLSMALLINT * AttributesLengthPtr); + + #define N3SQLDrivers(a,b,c,d,e,f,g,h) (*(T3SQLDrivers)getOdbcFunction(ODBC3SQLDrivers))(a,b,c,d,e,f,g,h) + + typedef SQLRETURN (SQL_API *T3SQLGetInfo) ( SQLHDBC ConnectionHandle, + SQLUSMALLINT InfoType, + SQLPOINTER InfoValuePtr, + SQLSMALLINT BufferLength, + SQLSMALLINT * StringLengthPtr); + + #define N3SQLGetInfo(a,b,c,d,e) (*(T3SQLGetInfo)getOdbcFunction(ODBC3SQLGetInfo))(a,b,c,d,e) + + typedef SQLRETURN (SQL_API *T3SQLGetFunctions) (SQLHDBC ConnectionHandle, + SQLUSMALLINT FunctionId, + SQLUSMALLINT * SupportedPtr); + + #define N3SQLGetFunctions(a,b,c) (*(T3SQLGetFunctions)getOdbcFunction(ODBC3SQLGetFunctions))(a,b,c) + + typedef SQLRETURN (SQL_API *T3SQLGetTypeInfo) ( SQLHSTMT StatementHandle, + SQLSMALLINT DataType); + + #define N3SQLGetTypeInfo(a,b) (*(T3SQLGetTypeInfo)getOdbcFunction(ODBC3SQLGetTypeInfo))(a,b) + + // Setting and retrieving driver attributes + typedef SQLRETURN (SQL_API *T3SQLSetConnectAttr)(SQLHDBC ConnectionHandle, + SQLINTEGER Attribute, + SQLPOINTER ValuePtr, + SQLINTEGER StringLength); + + #define N3SQLSetConnectAttr(a,b,c,d) (*(T3SQLSetConnectAttr)getOdbcFunction(ODBC3SQLSetConnectAttr))(a,b,c,d) + + typedef SQLRETURN (SQL_API *T3SQLGetConnectAttr) (SQLHDBC ConnectionHandle, + SQLINTEGER Attribute, + SQLPOINTER ValuePtr, + SQLINTEGER BufferLength, + SQLINTEGER* StringLength); + + #define N3SQLGetConnectAttr(a,b,c,d,e) (*(T3SQLGetConnectAttr)getOdbcFunction(ODBC3SQLGetConnectAttr))(a,b,c,d,e) + + + typedef SQLRETURN (SQL_API *T3SQLSetEnvAttr) ( SQLHENV EnvironmentHandle, + SQLINTEGER Attribute, + SQLPOINTER ValuePtr, + SQLINTEGER StringLength); + + #define N3SQLSetEnvAttr(a,b,c,d) (*(T3SQLSetEnvAttr)getOdbcFunction(ODBC3SQLSetEnvAttr))(a,b,c,d) + + typedef SQLRETURN (SQL_API *T3SQLGetEnvAttr) ( SQLHENV EnvironmentHandle, + SQLINTEGER Attribute, + SQLPOINTER ValuePtr, + SQLINTEGER BufferLength, + SQLINTEGER* StringLength); + + #define N3SQLGetEnvAttr(a,b,c,d,e) (*(T3SQLGetEnvAttr)getOdbcFunction(ODBC3SQLGetEnvAttr))(a,b,c,d,e) + + + typedef SQLRETURN (SQL_API *T3SQLSetStmtAttr) ( SQLHSTMT StatementHandle, + SQLINTEGER Attribute, + SQLPOINTER ValuePtr, + SQLINTEGER StringLength); + + #define N3SQLSetStmtAttr(a,b,c,d) (*(T3SQLSetStmtAttr)getOdbcFunction(ODBC3SQLSetStmtAttr))(a,b,c,d) + + typedef SQLRETURN (SQL_API *T3SQLGetStmtAttr) ( SQLHSTMT StatementHandle, + SQLINTEGER Attribute, + SQLPOINTER ValuePtr, + SQLINTEGER BufferLength, + SQLINTEGER* StringLength); + + #define N3SQLGetStmtAttr(a,b,c,d,e) (*(T3SQLGetStmtAttr)getOdbcFunction(ODBC3SQLGetStmtAttr))(a,b,c,d,e) + + // Setting and retrieving descriptor fields + /*typedef SQLRETURN (SQL_API *T3SQLSetDescField) (SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, + SQLSMALLINT FieldIdentifier, + SQLPOINTER ValuePtr, + SQLINTEGER BufferLength); + + #define N3SQLSetDescField(a,b,c,d,e) (*(T3SQLSetDescField)getOdbcFunction(ODBC3SQLSetDescField))(a,b,c,d,e) + + typedef SQLRETURN (SQL_API *T3SQLGetDescField) ( SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, + SQLSMALLINT FieldIdentifier, + SQLPOINTER ValuePtr, + SQLINTEGER BufferLength, + SQLINTEGER * StringLengthPtr); + + #define N3SQLGetDescField(a,b,c,d,e,f) (*(T3SQLGetDescField)getOdbcFunction(ODBC3SQLGetDescField))(a,b,c,d,e,f) + + + typedef SQLRETURN (SQL_API *T3SQLGetDescRec) ( SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, + SQLCHAR * Name, + SQLSMALLINT BufferLength, + SQLSMALLINT * StringLengthPtr, + SQLSMALLINT * TypePtr, + SQLSMALLINT * SubTypePtr, + SQLLEN * LengthPtr, + SQLSMALLINT * PrecisionPtr, + SQLSMALLINT * ScalePtr, + SQLSMALLINT * NullablePtr); + + #define N3SQLGetDescRec(a,b,c,d,e,f,g,h,i,j,k) (*(T3SQLGetDescRec)getOdbcFunction(ODBC3SQLGetDescRec))(a,b,c,d,e,f,g,h,i,j,k) + + + typedef SQLRETURN (SQL_API *T3SQLSetDescRec) ( SQLHDESC DescriptorHandle, + SQLSMALLINT RecNumber, + SQLSMALLINT Type, + SQLSMALLINT SubType, + SQLINTEGER Length, + SQLSMALLINT Precision, + SQLSMALLINT Scale, + SQLPOINTER DataPtr, + SQLLEN * StringLengthPtr, + SQLLEN * IndicatorPtr); + + #define N3SQLSetDescRec(a,b,c,d,e,f,g,h,i,j) (*(T3SQLSetDescRec)getOdbcFunction(ODBC3SQLSetDescRec))(a,b,c,d,e,f,g,h,i,j) + */ + + // Preparing SQL requests + typedef SQLRETURN (SQL_API *T3SQLPrepare) ( SQLHSTMT StatementHandle, + SQLCHAR * StatementText, + SQLINTEGER TextLength); + + #define N3SQLPrepare(a,b,c) (*(T3SQLPrepare)getOdbcFunction(ODBC3SQLPrepare))(a,b,c) + + typedef SQLRETURN (SQL_API *T3SQLBindParameter) (SQLHSTMT StatementHandle, + SQLUSMALLINT ParameterNumber, + SQLSMALLINT InputOutputType, + SQLSMALLINT ValueType, + SQLSMALLINT ParameterType, + SQLULEN ColumnSize, + SQLSMALLINT DecimalDigits, + SQLPOINTER ParameterValuePtr, + SQLLEN BufferLength, + SQLLEN * StrLen_or_IndPtr); + + #define N3SQLBindParameter(a,b,c,d,e,f,g,h,i,j) (*(T3SQLBindParameter)getOdbcFunction(ODBC3SQLBindParameter))(a,b,c,d,e,f,g,h,i,j) + + /*typedef SQLRETURN (SQL_API *T3SQLGetCursorName) (SQLHSTMT StatementHandle, + SQLCHAR * CursorName, + SQLSMALLINT BufferLength, + SQLSMALLINT * NameLengthPtr); + + #define N3SQLGetCursorName(a,b,c,d) (*(T3SQLGetCursorName)getOdbcFunction(ODBC3SQLGetCursorName))(a,b,c,d) + */ + + typedef SQLRETURN (SQL_API *T3SQLSetCursorName) (SQLHSTMT StatementHandle, + SQLCHAR * CursorName, + SQLSMALLINT NameLength); + + #define N3SQLSetCursorName(a,b,c) (*(T3SQLSetCursorName)getOdbcFunction(ODBC3SQLSetCursorName))(a,b,c) + + // Submitting requests + typedef SQLRETURN (SQL_API *T3SQLExecute) ( SQLHSTMT StatementHandle); + + #define N3SQLExecute(a) (*(T3SQLExecute)getOdbcFunction(ODBC3SQLExecute))(a) + + typedef SQLRETURN (SQL_API *T3SQLExecDirect) ( SQLHSTMT StatementHandle, + SQLCHAR * StatementText, + SQLINTEGER TextLength); + + #define N3SQLExecDirect(a,b,c) (*(T3SQLExecDirect)getOdbcFunction(ODBC3SQLExecDirect))(a,b,c) + + /*typedef SQLRETURN (SQL_API *T3SQLNativeSql) ( SQLHDBC ConnectionHandle, + SQLCHAR * InStatementText, + SQLINTEGER TextLength1, + SQLCHAR * utStatementText, + SQLINTEGER BufferLength, + SQLINTEGER * TextLength2Ptr); + + #define N3SQLNativeSql(a,b,c,d,e,f) (*(T3SQLNativeSql)getOdbcFunction(ODBC3SQLNativeSql))(a,b,c,d,e,f)*/ + + typedef SQLRETURN (SQL_API *T3SQLDescribeParam) (SQLHSTMT StatementHandle, + SQLUSMALLINT ParameterNumber, + SQLSMALLINT * DataTypePtr, + SQLULEN * ParameterSizePtr, + SQLSMALLINT * DecimalDigitsPtr, + SQLSMALLINT * NullablePtr); + + #define N3SQLDescribeParam(a,b,c,d,e,f) (*(T3SQLDescribeParam)getOdbcFunction(ODBC3SQLDescribeParam))(a,b,c,d,e,f) + + typedef SQLRETURN (SQL_API *T3SQLNumParams) ( SQLHSTMT StatementHandle, + SQLSMALLINT * ParameterCountPtr); + + #define N3SQLNumParams(a,b) (*(T3SQLNumParams)getOdbcFunction(ODBC3SQLNumParams))(a,b) + + typedef SQLRETURN (SQL_API *T3SQLParamData) ( SQLHSTMT StatementHandle, + SQLPOINTER * ValuePtrPtr); + + #define N3SQLParamData(a,b) (*(T3SQLParamData)getOdbcFunction(ODBC3SQLParamData))(a,b) + + typedef SQLRETURN (SQL_API *T3SQLPutData) ( SQLHSTMT StatementHandle, + SQLPOINTER DataPtr, + SQLLEN StrLen_or_Ind); + + #define N3SQLPutData(a,b,c) (*(T3SQLPutData)getOdbcFunction(ODBC3SQLPutData))(a,b,c) + + // Retrieving results and information about results + typedef SQLRETURN (SQL_API *T3SQLRowCount) ( SQLHSTMT StatementHandle, + SQLLEN * RowCountPtr); + + #define N3SQLRowCount(a,b) (*(T3SQLRowCount)getOdbcFunction(ODBC3SQLRowCount))(a,b) + + typedef SQLRETURN (SQL_API *T3SQLNumResultCols) (SQLHSTMT StatementHandle, + SQLSMALLINT * ColumnCountPtr); + + #define N3SQLNumResultCols(a,b) (*(T3SQLNumResultCols)getOdbcFunction(ODBC3SQLNumResultCols))(a,b) + + typedef SQLRETURN (SQL_API *T3SQLDescribeCol) ( SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, + SQLCHAR * ColumnName, + SQLSMALLINT BufferLength, + SQLSMALLINT * NameLengthPtr, + SQLSMALLINT * DataTypePtr, + SQLULEN * ColumnSizePtr, + SQLSMALLINT * DecimalDigitsPtr, + SQLSMALLINT * NullablePtr); + + #define N3SQLDescribeCol(a,b,c,d,e,f,g,h,i) (*(T3SQLDescribeCol)getOdbcFunction(ODBC3SQLDescribeCol))(a,b,c,d,e,f,g,h,i) + + typedef SQLRETURN (SQL_API *T3SQLColAttribute) (SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, + SQLUSMALLINT FieldIdentifier, + SQLPOINTER CharacterAttributePtr, + SQLSMALLINT BufferLength, + SQLSMALLINT * StringLengthPtr, + SQLLEN * NumericAttributePtr); + + #define N3SQLColAttribute(a,b,c,d,e,f,g) (*(T3SQLColAttribute)getOdbcFunction(ODBC3SQLColAttribute))(a,b,c,d,e,f,g) + + typedef SQLRETURN (SQL_API *T3SQLBindCol) ( SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, + SQLSMALLINT TargetType, + SQLPOINTER TargetValuePtr, + SQLLEN BufferLength, + SQLLEN * StrLen_or_IndPtr); + + #define N3SQLBindCol(a,b,c,d,e,f) (*(T3SQLBindCol)getOdbcFunction(ODBC3SQLBindCol))(a,b,c,d,e,f) + + typedef SQLRETURN (SQL_API *T3SQLFetch) ( SQLHSTMT StatementHandle); + + #define N3SQLFetch(a) (*(T3SQLFetch)getOdbcFunction(ODBC3SQLFetch))(a) + + typedef SQLRETURN (SQL_API *T3SQLFetchScroll) ( SQLHSTMT StatementHandle, + SQLSMALLINT FetchOrientation, + SQLLEN FetchOffset); + + #define N3SQLFetchScroll(a,b,c) (*(T3SQLFetchScroll)getOdbcFunction(ODBC3SQLFetchScroll))(a,b,c) + + typedef SQLRETURN (SQL_API *T3SQLGetData) ( SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, + SQLSMALLINT TargetType, + SQLPOINTER TargetValuePtr, + SQLLEN BufferLength, + SQLLEN * StrLen_or_IndPtr); + + #define N3SQLGetData(a,b,c,d,e,f) (*(T3SQLGetData)getOdbcFunction(ODBC3SQLGetData))(a,b,c,d,e,f) + + typedef SQLRETURN (SQL_API *T3SQLSetPos) ( SQLHSTMT StatementHandle, + SQLSETPOSIROW RowNumber, + SQLUSMALLINT Operation, + SQLUSMALLINT LockType); + + #define N3SQLSetPos(a,b,c,d) (*(T3SQLSetPos)getOdbcFunction(ODBC3SQLSetPos))(a,b,c,d) + + typedef SQLRETURN (SQL_API *T3SQLBulkOperations) ( SQLHSTMT StatementHandle, + SQLSMALLINT Operation); + + #define N3SQLBulkOperations(a,b) (*(T3SQLBulkOperations)getOdbcFunction(ODBC3SQLBulkOperations))(a,b) + + typedef SQLRETURN (SQL_API *T3SQLMoreResults) ( SQLHSTMT StatementHandle); + + #define N3SQLMoreResults(a) (*(T3SQLMoreResults)getOdbcFunction(ODBC3SQLMoreResults))(a) + + /*typedef SQLRETURN (SQL_API *T3SQLGetDiagField) (SQLSMALLINT HandleType, + SQLHANDLE Handle, + SQLSMALLINT RecNumber, + SQLSMALLINT DiagIdentifier, + SQLPOINTER DiagInfoPtr, + SQLSMALLINT BufferLength, + SQLSMALLINT * StringLengthPtr); + + #define N3SQLGetDiagField(a,b,c,d,e,f,g) (*(T3SQLGetDiagField)getOdbcFunction(ODBC3SQLGetDiagField))(a,b,c,d,e,f,g)*/ + + typedef SQLRETURN (SQL_API *T3SQLGetDiagRec) ( SQLSMALLINT HandleType, + SQLHANDLE Handle, + SQLSMALLINT RecNumber, + SQLCHAR * Sqlstate, + SQLINTEGER * NativeErrorPtr, + SQLCHAR * MessageText, + SQLSMALLINT BufferLength, + SQLSMALLINT * TextLengthPtr); + + + #define N3SQLGetDiagRec(a,b,c,d,e,f,g,h) (*(T3SQLGetDiagRec)getOdbcFunction(ODBC3SQLGetDiagRec))(a,b,c,d,e,f,g,h) + + // Obtaining information about the data source's system tables (catalog functions) + typedef SQLRETURN (SQL_API *T3SQLColumnPrivileges) (SQLHSTMT StatementHandle, + SQLCHAR * CatalogName, + SQLSMALLINT NameLength1, + SQLCHAR * SchemaName, + SQLSMALLINT NameLength2, + SQLCHAR * TableName, + SQLSMALLINT NameLength3, + SQLCHAR * ColumnName, + SQLSMALLINT NameLength4); + + #define N3SQLColumnPrivileges(a,b,c,d,e,f,g,h,i) (*(T3SQLColumnPrivileges)getOdbcFunction(ODBC3SQLColumnPrivileges))(a,b,c,d,e,f,g,h,i) + + typedef SQLRETURN (SQL_API *T3SQLColumns) ( SQLHSTMT StatementHandle, + SQLCHAR * CatalogName, + SQLSMALLINT NameLength1, + SQLCHAR * SchemaName, + SQLSMALLINT NameLength2, + SQLCHAR * TableName, + SQLSMALLINT NameLength3, + SQLCHAR * ColumnName, + SQLSMALLINT NameLength4); + + #define N3SQLColumns(a,b,c,d,e,f,g,h,i) (*(T3SQLColumns)getOdbcFunction(ODBC3SQLColumns))(a,b,c,d,e,f,g,h,i) + + typedef SQLRETURN (SQL_API *T3SQLForeignKeys) ( SQLHSTMT StatementHandle, + SQLCHAR * PKCatalogName, + SQLSMALLINT NameLength1, + SQLCHAR * PKSchemaName, + SQLSMALLINT NameLength2, + SQLCHAR * PKTableName, + SQLSMALLINT NameLength3, + SQLCHAR * FKCatalogName, + SQLSMALLINT NameLength4, + SQLCHAR * FKSchemaName, + SQLSMALLINT NameLength5, + SQLCHAR * FKTableName, + SQLSMALLINT NameLength6); + + #define N3SQLForeignKeys(a,b,c,d,e,f,g,h,i,j,k,l,m) (*(T3SQLForeignKeys)getOdbcFunction(ODBC3SQLForeignKeys))(a,b,c,d,e,f,g,h,i,j,k,l,m) + + typedef SQLRETURN (SQL_API *T3SQLPrimaryKeys) ( SQLHSTMT StatementHandle, + SQLCHAR * CatalogName, + SQLSMALLINT NameLength1, + SQLCHAR * SchemaName, + SQLSMALLINT NameLength2, + SQLCHAR * TableName, + SQLSMALLINT NameLength3); + + #define N3SQLPrimaryKeys(a,b,c,d,e,f,g) (*(T3SQLPrimaryKeys)getOdbcFunction(ODBC3SQLPrimaryKeys))(a,b,c,d,e,f,g) + + typedef SQLRETURN (SQL_API *T3SQLProcedureColumns) (SQLHSTMT StatementHandle, + SQLCHAR * CatalogName, + SQLSMALLINT NameLength1, + SQLCHAR * SchemaName, + SQLSMALLINT NameLength2, + SQLCHAR * ProcName, + SQLSMALLINT NameLength3, + SQLCHAR * ColumnName, + SQLSMALLINT NameLength4); + + #define N3SQLProcedureColumns(a,b,c,d,e,f,g,h,i) (*(T3SQLProcedureColumns)getOdbcFunction(ODBC3SQLProcedureColumns))(a,b,c,d,e,f,g,h,i) + + typedef SQLRETURN (SQL_API *T3SQLProcedures) ( SQLHSTMT StatementHandle, + SQLCHAR * CatalogName, + SQLSMALLINT NameLength1, + SQLCHAR * SchemaName, + SQLSMALLINT NameLength2, + SQLCHAR * ProcName, + SQLSMALLINT NameLength3); + + #define N3SQLProcedures(a,b,c,d,e,f,g) (*(T3SQLProcedures)getOdbcFunction(ODBC3SQLProcedures))(a,b,c,d,e,f,g) + + typedef SQLRETURN (SQL_API *T3SQLSpecialColumns) (SQLHSTMT StatementHandle, + SQLUSMALLINT IdentifierType, + SQLCHAR * CatalogName, + SQLSMALLINT NameLength1, + SQLCHAR * SchemaName, + SQLSMALLINT NameLength2, + SQLCHAR * TableName, + SQLSMALLINT NameLength3, + SQLUSMALLINT Scope, + SQLUSMALLINT Nullable); + + #define N3SQLSpecialColumns(a,b,c,d,e,f,g,h,i,j) (*(T3SQLSpecialColumns)getOdbcFunction(ODBC3SQLSpecialColumns))(a,b,c,d,e,f,g,h,i,j) + + typedef SQLRETURN (SQL_API *T3SQLStatistics) ( SQLHSTMT StatementHandle, + SQLCHAR * CatalogName, + SQLSMALLINT NameLength1, + SQLCHAR * SchemaName, + SQLSMALLINT NameLength2, + SQLCHAR * TableName, + SQLSMALLINT NameLength3, + SQLUSMALLINT Unique, + SQLUSMALLINT Reserved); + + #define N3SQLStatistics(a,b,c,d,e,f,g,h,i) (*(T3SQLStatistics)getOdbcFunction(ODBC3SQLStatistics))(a,b,c,d,e,f,g,h,i) + + typedef SQLRETURN (SQL_API *T3SQLTablePrivileges) (SQLHSTMT StatementHandle, + SQLCHAR * CatalogName, + SQLSMALLINT NameLength1, + SQLCHAR * SchemaName, + SQLSMALLINT NameLength2, + SQLCHAR * TableName, + SQLSMALLINT NameLength3); + + #define N3SQLTablePrivileges(a,b,c,d,e,f,g) (*(T3SQLTablePrivileges)getOdbcFunction(ODBC3SQLTablePrivileges))(a,b,c,d,e,f,g) + + typedef SQLRETURN (SQL_API *T3SQLTables) ( SQLHSTMT StatementHandle, + SQLCHAR * CatalogName, + SQLSMALLINT NameLength1, + SQLCHAR * SchemaName, + SQLSMALLINT NameLength2, + SQLCHAR * TableName, + SQLSMALLINT NameLength3, + SQLCHAR * TableType, + SQLSMALLINT NameLength4); + + #define N3SQLTables(a,b,c,d,e,f,g,h,i) (*(T3SQLTables)getOdbcFunction(ODBC3SQLTables))(a,b,c,d,e,f,g,h,i) + + // Terminating a statement + typedef SQLRETURN (SQL_API *T3SQLFreeStmt) ( SQLHSTMT StatementHandle, + SQLUSMALLINT Option); + + #define N3SQLFreeStmt(a,b) (*(T3SQLFreeStmt)getOdbcFunction(ODBC3SQLFreeStmt))(a,b) + + typedef SQLRETURN (SQL_API *T3SQLCloseCursor) (SQLHSTMT StatementHandle); + + #define N3SQLCloseCursor(a) (*(T3SQLCloseCursor)getOdbcFunction(ODBC3SQLCloseCursor))(a) + + typedef SQLRETURN (SQL_API *T3SQLCancel) ( SQLHSTMT StatementHandle); + + #define N3SQLCancel(a) (*(T3SQLCancel)getOdbcFunction(ODBC3SQLCancel))(a) + + typedef SQLRETURN (SQL_API *T3SQLEndTran) ( SQLSMALLINT HandleType, + SQLHANDLE Handle, + SQLSMALLINT CompletionType); + + #define N3SQLEndTran(a,b,c) (*(T3SQLEndTran)getOdbcFunction(ODBC3SQLEndTran))(a,b,c) + + // Terminating a connection + typedef SQLRETURN (SQL_API *T3SQLDisconnect) (SQLHDBC ConnectionHandle); + + #define N3SQLDisconnect(a) (*(T3SQLDisconnect)getOdbcFunction(ODBC3SQLDisconnect))(a) + + typedef SQLRETURN (SQL_API *T3SQLFreeHandle) (SQLSMALLINT HandleType, + SQLHANDLE Handle); + + #define N3SQLFreeHandle(a,b) (*(T3SQLFreeHandle)getOdbcFunction(ODBC3SQLFreeHandle))(a,b) + + typedef SQLRETURN (SQL_API *T3SQLGetCursorName) ( SQLHSTMT StatementHandle, + SQLCHAR * CursorName, + SQLSMALLINT BufferLength, + SQLSMALLINT* NameLength2); + + #define N3SQLGetCursorName(a,b,c,d) (*(T3SQLGetCursorName)getOdbcFunction(ODBC3SQLGetCursorName))(a,b,c,d) + + typedef SQLRETURN (SQL_API *T3SQLNativeSql) ( SQLHSTMT ConnectionHandle, + SQLCHAR * InStatementText, + SQLINTEGER TextLength1, + SQLCHAR * OutStatementText, + SQLINTEGER BufferLength, + SQLINTEGER * TextLength2Ptr); + + #define N3SQLNativeSql(a,b,c,d,e,f) (*(T3SQLNativeSql)getOdbcFunction(ODBC3SQLNativeSql))(a,b,c,d,e,f) +} + +#endif // _CONNECTIVITY_ODBC_OFUNCTIONS_HXX_ + + diff --git a/connectivity/source/inc/odbc/OPreparedStatement.hxx b/connectivity/source/inc/odbc/OPreparedStatement.hxx new file mode 100644 index 000000000000..ff7ca19f7d1d --- /dev/null +++ b/connectivity/source/inc/odbc/OPreparedStatement.hxx @@ -0,0 +1,171 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ODBC_OPREPAREDSTATEMENT_HXX_ +#define _CONNECTIVITY_ODBC_OPREPAREDSTATEMENT_HXX_ + +#include "odbc/odbcbasedllapi.hxx" +#include "odbc/OStatement.hxx" +#include <com/sun/star/sdbc/XPreparedStatement.hpp> +#include <com/sun/star/sdbc/XParameters.hpp> +#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> +#include <com/sun/star/sdbc/XPreparedBatchExecution.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <cppuhelper/implbase5.hxx> + +namespace connectivity +{ + namespace odbc + { + + class OBoundParam; + typedef ::cppu::ImplHelper5< ::com::sun::star::sdbc::XPreparedStatement, + ::com::sun::star::sdbc::XParameters, + ::com::sun::star::sdbc::XPreparedBatchExecution, + ::com::sun::star::sdbc::XResultSetMetaDataSupplier, + ::com::sun::star::lang::XServiceInfo> OPreparedStatement_BASE; + + class OOO_DLLPUBLIC_ODBCBASE OPreparedStatement : + public OStatement_BASE2, + public OPreparedStatement_BASE + { + protected: + struct Parameter + { + ::com::sun::star::uno::Any aValue; + sal_Int32 nDataType; + + Parameter(const ::com::sun::star::uno::Any& rValue, + sal_Int32 rDataType) : aValue(rValue),nDataType(rDataType) + { + } + + }; + + ::std::vector< Parameter> m_aParameters; + //==================================================================== + // Data attributes + //==================================================================== + SQLSMALLINT numParams; // Number of parameter markers + // for the prepared statement + + OBoundParam* boundParams; + // Array of bound parameter + // objects. Each parameter + // marker will have a + // corresponding object to + // hold bind information, and + // resulting data. + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > m_xMetaData; + sal_Bool m_bPrepared; + + void FreeParams(); + void putParamData (sal_Int32 index) throw(::com::sun::star::sdbc::SQLException); + void setStream (sal_Int32 ParameterIndex,const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream>& x, + SQLLEN length,sal_Int32 SQLtype) throw(::com::sun::star::sdbc::SQLException); + sal_Int32 getParamLength ( sal_Int32 index); + sal_Int8* getLengthBuf (sal_Int32 index); + sal_Int8* getDataBuf (sal_Int32 index); + sal_Int8* allocBindBuf ( sal_Int32 index, sal_Int32 bufLen); + void initBoundParam () throw(::com::sun::star::sdbc::SQLException); + void setParameter(sal_Int32 parameterIndex,sal_Int32 _nType,sal_Int32 _nSize,void* _pData); + + sal_Int32 getPrecision ( sal_Int32 sqlType); + + sal_Bool isPrepared() const { return m_bPrepared;} + void prepareStatement(); + void checkParameterIndex(sal_Int32 _parameterIndex); + void setDecimal( sal_Int32 parameterIndex, const ::rtl::OUString& x ); + + /** + creates the driver specific resultset (factory) + */ + virtual OResultSet* createResulSet(); + + protected: + virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue) + throw (::com::sun::star::uno::Exception); + public: + DECLARE_SERVICE_INFO(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + OPreparedStatement( OConnection* _pConnection,const ::rtl::OUString& sql); + + //XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + // XPreparedStatement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL executeUpdate( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL execute( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XParameters + virtual void SAL_CALL setNull( sal_Int32 parameterIndex, sal_Int32 sqlType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearParameters( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XPreparedBatchExecution + virtual void SAL_CALL addBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XResultSetMetaDataSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + public: + using OStatement_Base::executeQuery; + using OStatement_Base::executeUpdate; + using OStatement_Base::execute; + }; + } +} +#endif // _CONNECTIVITY_ODBC_OPREPAREDSTATEMENT_HXX_ + diff --git a/connectivity/source/inc/odbc/OResultSet.hxx b/connectivity/source/inc/odbc/OResultSet.hxx new file mode 100644 index 000000000000..41aee7db1cea --- /dev/null +++ b/connectivity/source/inc/odbc/OResultSet.hxx @@ -0,0 +1,327 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ODBC_ORESULTSET_HXX_ +#define _CONNECTIVITY_ODBC_ORESULTSET_HXX_ + +#include <com/sun/star/sdbc/XResultSet.hpp> +#include <com/sun/star/sdbc/XRow.hpp> +#include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> +#include <com/sun/star/sdbc/XCloseable.hpp> +#include <com/sun/star/sdbc/XColumnLocate.hpp> +#include <com/sun/star/util/XCancellable.hpp> +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#include <com/sun/star/sdbc/XResultSetUpdate.hpp> +#include <com/sun/star/sdbc/XRowUpdate.hpp> +#include <com/sun/star/sdbcx/XRowLocate.hpp> +#include <com/sun/star/sdbcx/XDeleteRows.hpp> +#include <cppuhelper/compbase12.hxx> +#include <comphelper/proparrhlp.hxx> +#include "odbc/OFunctions.hxx" +#include "odbc/OStatement.hxx" +#include "odbc/odbcbasedllapi.hxx" +#include "connectivity/CommonTools.hxx" +#include "connectivity/FValue.hxx" +#include "TSkipDeletedSet.hxx" + +namespace connectivity +{ + namespace odbc + { + + /* + ** java_sql_ResultSet + */ + typedef ::cppu::WeakComponentImplHelper12< ::com::sun::star::sdbc::XResultSet, + ::com::sun::star::sdbc::XRow, + ::com::sun::star::sdbc::XResultSetMetaDataSupplier, + ::com::sun::star::util::XCancellable, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::sdbc::XResultSetUpdate, + ::com::sun::star::sdbc::XRowUpdate, + ::com::sun::star::sdbcx::XRowLocate, + ::com::sun::star::sdbcx::XDeleteRows, + ::com::sun::star::sdbc::XCloseable, + ::com::sun::star::sdbc::XColumnLocate, + ::com::sun::star::lang::XServiceInfo> OResultSet_BASE; + + + typedef ::std::pair<sal_Int64,sal_Int32> TVoidPtr; + typedef ::std::allocator< TVoidPtr > TVoidAlloc; + typedef ::std::vector<TVoidPtr> TVoidVector; + // typedef ::com::sun::star::uno::Sequence<TVoidPtr> TVoidVector; + /// unary_function Functor object for class ZZ returntype is void + struct OOO_DLLPUBLIC_ODBCBASE TBookmarkPosMapCompare : ::std::binary_function< ::com::sun::star::uno::Sequence<sal_Int8>, ::com::sun::star::uno::Sequence<sal_Int8>, bool > + { + inline bool operator()( const ::com::sun::star::uno::Sequence<sal_Int8>& _rLH, + const ::com::sun::star::uno::Sequence<sal_Int8>& _rRH) const + { + if(_rLH.getLength() == _rRH.getLength()) + { + sal_Int32 nCount = _rLH.getLength(); + if(nCount != 4) + { + const sal_Int8* pLHBack = _rLH.getConstArray() + nCount - 1; + const sal_Int8* pRHBack = _rRH.getConstArray() + nCount - 1; + + sal_Int32 i; + for(i=0;i < nCount;++i,--pLHBack,--pRHBack) + { + if(!(*pLHBack) && *pRHBack) + return sal_True; + else if(*pLHBack && !(*pRHBack)) + return sal_False; + } + for(i=0,++pLHBack,++pRHBack;i < nCount;++pLHBack,++pRHBack,++i) + if(*pLHBack < *pRHBack) + return sal_True; + return sal_False; + } + else + return *reinterpret_cast<const sal_Int32*>(_rLH.getConstArray()) < *reinterpret_cast<const sal_Int32*>(_rRH.getConstArray()); + + } + else + return _rLH.getLength() < _rRH.getLength(); + } + }; + + typedef ::std::map< ::com::sun::star::uno::Sequence<sal_Int8>, sal_Int32,TBookmarkPosMapCompare > TBookmarkPosMap; + + class OOO_DLLPUBLIC_ODBCBASE OResultSet : + public comphelper::OBaseMutex, + public ::connectivity::IResultSetHelper, + public OResultSet_BASE, + public ::cppu::OPropertySetHelper, + public ::comphelper::OPropertyArrayUsageHelper<OResultSet> + { + protected: + TBookmarkPosMap m_aPosToBookmarks; + // used top hold the information about the value and the datatype to save calls to metadata + typedef ::std::vector<ORowSetValue> TDataRow; + + TVoidVector m_aBindVector; + ::std::vector<SQLLEN> m_aLengthVector; + ::std::map<sal_Int32,SWORD> m_aODBCColumnTypes; + ::com::sun::star::uno::Sequence<sal_Int8> m_aBookmark; + + TDataRow m_aRow; // only used when SQLGetData can't be called in any order + ORowSetValue m_aEmptyValue; // needed for the getValue method when no prefetch is used + SQLHANDLE m_aStatementHandle; + SQLHANDLE m_aConnectionHandle; + OStatement_Base* m_pStatement; + OSkipDeletedSet* m_pSkipDeletedSet; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xStatement; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData; + SQLUSMALLINT* m_pRowStatusArray; + rtl_TextEncoding m_nTextEncoding; + sal_Int32 m_nRowPos; + sal_Int32 m_nLastColumnPos; // used for m_aRow just to know where we are + mutable sal_uInt32 m_nUseBookmarks; + SQLRETURN m_nCurrentFetchState; + sal_Bool m_bWasNull; + sal_Bool m_bEOF; // after last record + sal_Bool m_bLastRecord; + sal_Bool m_bFreeHandle; + sal_Bool m_bInserting; + sal_Bool m_bFetchData; // true when SQLGetaData can be called in any order or when fetching data for m_aRow + sal_Bool m_bRowInserted; + sal_Bool m_bRowDeleted; + sal_Bool m_bUseFetchScroll; + + sal_Bool isBookmarkable() const; + sal_Int32 getResultSetConcurrency() const; + sal_Int32 getResultSetType() const; + sal_Int32 getFetchDirection() const; + sal_Int32 getFetchSize() const; + ::rtl::OUString getCursorName() const; + + void setFetchDirection(sal_Int32 _par0); + void setFetchSize(sal_Int32 _par0); + + + void fillRow(sal_Int32 _nToColumn); + void allocBuffer(); + void releaseBuffer(); + void updateValue(sal_Int32 columnIndex,SQLSMALLINT _nType,void* _pValue) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + void fillNeededData(SQLRETURN _nRet); + const ORowSetValue& getValue(sal_Int32 _nColumnIndex,SQLSMALLINT _nType,void* _pValue,SQLINTEGER _rSize); + sal_Bool moveImpl(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, sal_Bool _bRetrieveData); + TVoidPtr allocBindColumn(sal_Int32 _nType,sal_Int32 _nColumnIndex); + SQLRETURN unbind(sal_Bool _bUnbindHandle = sal_True); + SWORD impl_getColumnType_nothrow(sal_Int32 columnIndex); + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + + virtual sal_Bool SAL_CALL convertFastPropertyValue( + ::com::sun::star::uno::Any & rConvertedValue, + ::com::sun::star::uno::Any & rOldValue, + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue ) + throw (::com::sun::star::lang::IllegalArgumentException); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue + ) + throw (::com::sun::star::uno::Exception); + virtual void SAL_CALL getFastPropertyValue( + ::com::sun::star::uno::Any& rValue, + sal_Int32 nHandle + ) const; + public: + DECLARE_SERVICE_INFO(); + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + OResultSet( SQLHANDLE _pStatementHandle,OStatement_Base* pStmt); + virtual ~OResultSet(); + + void construct(); + + inline oslGenericFunction getOdbcFunction(sal_Int32 _nIndex) const + { + return m_pStatement->getOdbcFunction(_nIndex); + } + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > operator *() + { + return ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >(*(OResultSet_BASE*)this); + } + + inline void setMetaData(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData>& _xMetaData) { m_xMetaData = _xMetaData;} + + // ::cppu::OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + // XResultSet + virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XRow + virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XResultSetMetaDataSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XCancellable + virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) 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); + // XResultSetUpdate + virtual void SAL_CALL insertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL deleteRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XRowUpdate + virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateBytes( sal_Int32 columnIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateBinaryStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateCharacterStream( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateNumericObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Any& x, sal_Int32 scale ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XColumnLocate + virtual sal_Int32 SAL_CALL findColumn( const ::rtl::OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XRowLocate + virtual ::com::sun::star::uno::Any SAL_CALL getBookmark( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL moveRelativeToBookmark( const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL compareBookmarks( const ::com::sun::star::uno::Any& first, const ::com::sun::star::uno::Any& second ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL hashBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XDeleteRows + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + // IResultSetHelper + virtual sal_Bool move(IResultSetHelper::Movement _eCursorPosition, sal_Int32 _nOffset, sal_Bool _bRetrieveData); + virtual sal_Int32 getDriverPos() const; + virtual sal_Bool deletedVisible() const; + virtual sal_Bool isRowDeleted() const; + + protected: + using OPropertySetHelper::getFastPropertyValue; + }; + } +} +#endif // _CONNECTIVITY_ODBC_ORESULTSET_HXX_ + + diff --git a/connectivity/source/inc/odbc/OResultSetMetaData.hxx b/connectivity/source/inc/odbc/OResultSetMetaData.hxx new file mode 100644 index 000000000000..f0a1605034af --- /dev/null +++ b/connectivity/source/inc/odbc/OResultSetMetaData.hxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ODBC_ORESULTSETMETADATA_HXX_ +#define _CONNECTIVITY_ODBC_ORESULTSETMETADATA_HXX_ + +#include <com/sun/star/sdbc/XResultSetMetaData.hpp> +#include <cppuhelper/implbase1.hxx> +#include "odbc/OFunctions.hxx" +#include "odbc/odbcbasedllapi.hxx" +#ifndef _VECTOR_ +#include <vector> +#endif +#include "odbc/OConnection.hxx" + +namespace connectivity +{ + namespace odbc + { + //************************************************************** + //************ Class: ResultSetMetaData + //************************************************************** + typedef ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XResultSetMetaData> OResultSetMetaData_BASE; + + class OOO_DLLPUBLIC_ODBCBASE OResultSetMetaData : + public OResultSetMetaData_BASE + { + protected: + ::std::vector<sal_Int32> m_vMapping; // when not every column is needed + ::std::map<sal_Int32,sal_Int32> m_aColumnTypes; + + SQLHANDLE m_aStatementHandle; + OConnection* m_pConnection; + sal_Int32 m_nColCount; + sal_Bool m_bUseODBC2Types; + + ::rtl::OUString getCharColAttrib(sal_Int32 column,sal_Int32 ident) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + sal_Int32 getNumColAttrib(sal_Int32 column,sal_Int32 ident) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + public: + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + OResultSetMetaData(OConnection* _pConnection, SQLHANDLE _pStmt ) + :m_aStatementHandle( _pStmt ) + ,m_pConnection(_pConnection) + ,m_nColCount(-1) + ,m_bUseODBC2Types(sal_False) + {} + OResultSetMetaData(OConnection* _pConnection, SQLHANDLE _pStmt ,const ::std::vector<sal_Int32> & _vMapping) + :m_vMapping(_vMapping) + ,m_aStatementHandle( _pStmt ) + ,m_pConnection(_pConnection) + ,m_nColCount(_vMapping.size()-1) + ,m_bUseODBC2Types(sal_False) + {} + virtual ~OResultSetMetaData(); + + + static SQLLEN getNumColAttrib(OConnection* _pConnection + ,SQLHANDLE _aStatementHandle + ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface + ,sal_Int32 _column + ,sal_Int32 ident) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + static SQLSMALLINT getColumnODBCType(OConnection* _pConnection + ,SQLHANDLE _aStatementHandle + ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface + ,sal_Int32 column) + throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + inline oslGenericFunction getOdbcFunction(sal_Int32 _nIndex) const + { + return m_pConnection->getOdbcFunction(_nIndex); + } + /// Avoid ambigous cast error from the compiler. + inline operator ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > () throw() + { return this; } + + virtual sal_Int32 SAL_CALL getColumnCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAutoIncrement( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCaseSensitive( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isSearchable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isCurrency( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL isNullable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isSigned( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getColumnDisplaySize( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnLabel( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSchemaName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getPrecision( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getScale( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTableName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCatalogName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getColumnType( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnTypeName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isReadOnly( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isDefinitelyWritable( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getColumnServiceName( sal_Int32 column ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_ODBC_ORESULTSETMETADATA_HXX_ + diff --git a/connectivity/source/inc/odbc/OStatement.hxx b/connectivity/source/inc/odbc/OStatement.hxx new file mode 100644 index 000000000000..57c8e4c2fa09 --- /dev/null +++ b/connectivity/source/inc/odbc/OStatement.hxx @@ -0,0 +1,248 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CONNECTIVITY_ODBC_OSTATEMENT_HXX_ +#define _CONNECTIVITY_ODBC_OSTATEMENT_HXX_ + +#include <com/sun/star/sdbc/XStatement.hpp> +#include <com/sun/star/sdbc/XWarningsSupplier.hpp> +#include <com/sun/star/sdbc/XMultipleResults.hpp> +#include <com/sun/star/sdbc/XBatchExecution.hpp> +#include <com/sun/star/sdbc/XCloseable.hpp> +#include <com/sun/star/sdbc/SQLWarning.hpp> +#include <com/sun/star/sdbc/XGeneratedResultSet.hpp> +#include <com/sun/star/util/XCancellable.hpp> +#include <comphelper/proparrhlp.hxx> +#include <cppuhelper/compbase6.hxx> +#include <comphelper/uno3.hxx> +#include "connectivity/CommonTools.hxx" +#include "odbc/OFunctions.hxx" +#include "odbc/OConnection.hxx" +#include "odbc/odbcbasedllapi.hxx" +#include <list> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <comphelper/broadcasthelper.hxx> + +namespace connectivity +{ + namespace odbc + { + + typedef ::cppu::WeakComponentImplHelper6< ::com::sun::star::sdbc::XStatement, + ::com::sun::star::sdbc::XWarningsSupplier, + ::com::sun::star::util::XCancellable, + ::com::sun::star::sdbc::XCloseable, + ::com::sun::star::sdbc::XGeneratedResultSet, + ::com::sun::star::sdbc::XMultipleResults> OStatement_BASE; + + class OResultSet; + //************************************************************** + //************ Class: java.sql.Statement + //************************************************************** + class OOO_DLLPUBLIC_ODBCBASE OStatement_Base : + public comphelper::OBaseMutex, + public OStatement_BASE, + public ::cppu::OPropertySetHelper, + public ::comphelper::OPropertyArrayUsageHelper<OStatement_Base> + + { + ::com::sun::star::sdbc::SQLWarning m_aLastWarning; + protected: + ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet> m_xResultSet; // The last ResultSet created + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement> m_xGeneratedStatement; + // for this Statement + + ::std::list< ::rtl::OUString> m_aBatchList; + ::rtl::OUString m_sSqlStatement; + + OConnection* m_pConnection;// The owning Connection object + SQLHANDLE m_aStatementHandle; + SQLUSMALLINT* m_pRowStatusArray; + ::cppu::OBroadcastHelper& rBHelper; + + protected: + + sal_Int32 getQueryTimeOut() const; + sal_Int32 getMaxFieldSize() const; + sal_Int32 getMaxRows() const; + sal_Int32 getResultSetConcurrency() const; + sal_Int32 getResultSetType() const; + sal_Int32 getFetchDirection() const; + sal_Int32 getFetchSize() const; + ::rtl::OUString getCursorName() const; + sal_Bool isUsingBookmarks() const; + sal_Bool getEscapeProcessing() const; + sal_Int32 getStmtOption (short fOption) const; + + void setQueryTimeOut(sal_Int32 _par0) ; + void setMaxFieldSize(sal_Int32 _par0) ; + void setMaxRows(sal_Int32 _par0) ; + void setFetchDirection(sal_Int32 _par0) ; + void setFetchSize(sal_Int32 _par0) ; + void setCursorName(const ::rtl::OUString &_par0); + void setEscapeProcessing( const sal_Bool _bEscapeProc ); + + virtual void setResultSetConcurrency(sal_Int32 _par0) ; + virtual void setResultSetType(sal_Int32 _par0) ; + virtual void setUsingBookmarks(sal_Bool _bUseBookmark) ; + + void reset () throw( ::com::sun::star::sdbc::SQLException); + void clearMyResultSet () throw( ::com::sun::star::sdbc::SQLException); + void setWarning (const ::com::sun::star::sdbc::SQLWarning &ex) throw( ::com::sun::star::sdbc::SQLException); + sal_Bool lockIfNecessary (const ::rtl::OUString& sql) throw( ::com::sun::star::sdbc::SQLException); + sal_Int32 getColumnCount () throw( ::com::sun::star::sdbc::SQLException); + + //-------------------------------------------------------------------- + // getResultSet + // getResultSet returns the current result as a ResultSet. It + // returns NULL if the current result is not a ResultSet. + //-------------------------------------------------------------------- + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > getResultSet (sal_Bool checkCount) throw( ::com::sun::star::sdbc::SQLException); + /** + creates the driver specific resultset (factory) + */ + virtual OResultSet* createResulSet(); + + SQLLEN getRowCount () throw( ::com::sun::star::sdbc::SQLException); + + + void disposeResultSet(); + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + virtual sal_Bool SAL_CALL convertFastPropertyValue( + ::com::sun::star::uno::Any & rConvertedValue, + ::com::sun::star::uno::Any & rOldValue, + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue ) + throw (::com::sun::star::lang::IllegalArgumentException); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue + ) + throw (::com::sun::star::uno::Exception); + virtual void SAL_CALL getFastPropertyValue( + ::com::sun::star::uno::Any& rValue, + sal_Int32 nHandle + ) const; + virtual ~OStatement_Base(); + + public: + OStatement_Base(OConnection* _pConnection ); + using OStatement_BASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >; + + inline oslGenericFunction getOdbcFunction(sal_Int32 _nIndex) const + { + return m_pConnection->getOdbcFunction(_nIndex); + } + // OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual void SAL_CALL release() throw(); + virtual void SAL_CALL acquire() throw(); + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + //XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + // XStatement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + virtual sal_Int32 SAL_CALL executeUpdate( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + virtual sal_Bool SAL_CALL execute( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) ; + // XWarningsSupplier + virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) 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); + // XCancellable + virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException); + // XCloseable + virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + // XMultipleResults + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getResultSet( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getMoreResults( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + //XGeneratedResultSet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getGeneratedValues( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + // other methods + SQLHANDLE getConnectionHandle() { return m_pConnection->getConnection(); } + OConnection* getOwnConnection() const { return m_pConnection;} + /** getCursorProperties return the properties for a specific cursor type + @param _nCursorType the CursorType + @param bFirst when true the first property set is returned + + @return the cursor properties + */ + SQLUINTEGER getCursorProperties(SQLINTEGER _nCursorType,sal_Bool bFirst); + + protected: + using OPropertySetHelper::getFastPropertyValue; + }; + + class OOO_DLLPUBLIC_ODBCBASE OStatement_BASE2 : + public OStatement_Base + ,public ::connectivity::OSubComponent<OStatement_BASE2, OStatement_BASE> + + { + friend class OSubComponent<OStatement_BASE2, OStatement_BASE>; + public: + OStatement_BASE2(OConnection* _pConnection ) : OStatement_Base(_pConnection ), + ::connectivity::OSubComponent<OStatement_BASE2, OStatement_BASE>((::cppu::OWeakObject*)_pConnection, this){} + // OComponentHelper + virtual void SAL_CALL disposing(void); + // XInterface + virtual void SAL_CALL release() throw(); + }; + + class OOO_DLLPUBLIC_ODBCBASE OStatement : + public OStatement_BASE2, + public ::com::sun::star::sdbc::XBatchExecution, + public ::com::sun::star::lang::XServiceInfo + { + protected: + virtual ~OStatement(){} + public: + // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: + OStatement( OConnection* _pConnection) : OStatement_BASE2( _pConnection){} + DECLARE_SERVICE_INFO(); + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + // XBatchExecution + virtual void SAL_CALL addBatch( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL executeBatch( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + } +} +#endif // _CONNECTIVITY_ODBC_OSTATEMENT_HXX_ + diff --git a/connectivity/source/inc/odbc/OTools.hxx b/connectivity/source/inc/odbc/OTools.hxx new file mode 100644 index 000000000000..3c311242114d --- /dev/null +++ b/connectivity/source/inc/odbc/OTools.hxx @@ -0,0 +1,276 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_OTOOLS_HXX_ +#define _CONNECTIVITY_OTOOLS_HXX_ + +#include "odbc/OFunctiondefs.hxx" +#include "odbc/odbcbasedllapi.hxx" +#include <com/sun/star/sdbc/SQLException.hpp> +#include <com/sun/star/util/Date.hpp> +#include <com/sun/star/util/Time.hpp> +#include <com/sun/star/util/DateTime.hpp> +#include <osl/thread.h> +#include <rtl/ustring.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <rtl/textenc.h> + +#define ODBC3SQLAllocHandle 1 +#define ODBC3SQLConnect 2 +#define ODBC3SQLDriverConnect 3 +#define ODBC3SQLBrowseConnect 4 +#define ODBC3SQLDataSources 5 +#define ODBC3SQLDrivers 6 +#define ODBC3SQLGetInfo 7 +#define ODBC3SQLGetFunctions 8 +#define ODBC3SQLGetTypeInfo 9 +#define ODBC3SQLSetConnectAttr 10 +#define ODBC3SQLGetConnectAttr 11 +#define ODBC3SQLSetEnvAttr 12 +#define ODBC3SQLGetEnvAttr 13 +#define ODBC3SQLSetStmtAttr 14 +#define ODBC3SQLGetStmtAttr 15 +#define ODBC3SQLPrepare 16 +#define ODBC3SQLBindParameter 17 +#define ODBC3SQLSetCursorName 18 +#define ODBC3SQLExecute 19 +#define ODBC3SQLExecDirect 20 +#define ODBC3SQLDescribeParam 21 +#define ODBC3SQLNumParams 22 +#define ODBC3SQLParamData 23 +#define ODBC3SQLPutData 24 +#define ODBC3SQLRowCount 25 +#define ODBC3SQLNumResultCols 26 +#define ODBC3SQLDescribeCol 27 +#define ODBC3SQLColAttribute 28 +#define ODBC3SQLBindCol 29 +#define ODBC3SQLFetch 30 +#define ODBC3SQLFetchScroll 31 +#define ODBC3SQLGetData 32 +#define ODBC3SQLSetPos 33 +#define ODBC3SQLBulkOperations 34 +#define ODBC3SQLMoreResults 35 +#define ODBC3SQLGetDiagRec 36 +#define ODBC3SQLColumnPrivileges 37 +#define ODBC3SQLColumns 38 +#define ODBC3SQLForeignKeys 39 +#define ODBC3SQLPrimaryKeys 40 +#define ODBC3SQLProcedureColumns 41 +#define ODBC3SQLProcedures 42 +#define ODBC3SQLSpecialColumns 43 +#define ODBC3SQLStatistics 44 +#define ODBC3SQLTablePrivileges 45 +#define ODBC3SQLTables 46 +#define ODBC3SQLFreeStmt 47 +#define ODBC3SQLCloseCursor 48 +#define ODBC3SQLCancel 49 +#define ODBC3SQLEndTran 50 +#define ODBC3SQLDisconnect 51 +#define ODBC3SQLFreeHandle 52 +#define ODBC3SQLGetCursorName 53 +#define ODBC3SQLNativeSql 54 + +namespace connectivity +{ + namespace odbc + { + class OConnection; + + const sal_uInt32 ODBC_FRACTION_UNITS_PER_HSECOND = 10000000L; + const sal_Int32 MAX_PUT_DATA_LENGTH = 2000; + + class OOO_DLLPUBLIC_ODBCBASE OTools + { + public: + static void ThrowException( OConnection* _pConnection, + SQLRETURN _rRetCode, + SQLHANDLE _pContext, + SQLSMALLINT _nHandleType, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface, + sal_Bool _bNoFound=sal_True, + rtl_TextEncoding _nTextEncoding = RTL_TEXTENCODING_MS_1252) + throw(::com::sun::star::sdbc::SQLException); + + static void GetInfo(OConnection* _pConnection, + SQLHANDLE _aConnectionHandle, + SQLUSMALLINT _nInfo, + ::rtl::OUString &_rValue, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface, + rtl_TextEncoding _nTextEncoding) + throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + static void GetInfo(OConnection* _pConnection, + SQLHANDLE _aConnectionHandle, + SQLUSMALLINT _nInfo, + sal_Int32 &_rValue, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + static void GetInfo(OConnection* _pConnection, + SQLHANDLE _aConnectionHandle, + SQLUSMALLINT _nInfo, + SQLUSMALLINT &_rValue, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + static void GetInfo(OConnection* _pConnection, + SQLHANDLE _aConnectionHandle, + SQLUSMALLINT _nInfo, + SQLUINTEGER &_rValue, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + static void GetInfo(OConnection* _pConnection, + SQLHANDLE _aConnectionHandle, + SQLUSMALLINT _nInfo, + sal_Bool &_rValue, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + static sal_Int32 MapOdbcType2Jdbc(sal_Int32 _nType); + static sal_Int32 jdbcTypeToOdbc(sal_Int32 jdbcType); + + static DATE_STRUCT DateToOdbcDate(const ::com::sun::star::util::Date& x) + { + DATE_STRUCT aVal; + aVal.year = x.Year; + aVal.month = x.Month; + aVal.day = x.Day; + return aVal; + } + static TIME_STRUCT TimeToOdbcTime(const ::com::sun::star::util::Time& x) + { + TIME_STRUCT aVal; + aVal.hour = x.Hours; + aVal.minute = x.Minutes; + aVal.second = x.Seconds; + return aVal; + } + static TIMESTAMP_STRUCT DateTimeToTimestamp(const ::com::sun::star::util::DateTime& x) + { + TIMESTAMP_STRUCT aVal; + aVal.year = x.Year; + aVal.month = x.Month; + aVal.day = x.Day; + aVal.hour = x.Hours; + aVal.minute = x.Minutes; + aVal.second = x.Seconds; + aVal.fraction = x.HundredthSeconds * ODBC_FRACTION_UNITS_PER_HSECOND; + return aVal; + } + /** + getBindTypes set the ODBC type for C + @param _bUseWChar true when Unicode should be used + @param _bUseOldTimeDate true when the old datetime format should be used + @param _nOdbcType the ODBC sql type + @param fCType the C type for the ODBC type + @param fSqlType the SQL type for the ODBC type + */ + static void getBindTypes(sal_Bool _bUseWChar, + sal_Bool _bUseOldTimeDate, + SQLSMALLINT _nOdbcType, + SQLSMALLINT& fCType, + SQLSMALLINT& fSqlType); + + static ::rtl::OUString getStringValue( OConnection* _pConnection, + SQLHANDLE _aStatementHandle, + sal_Int32 columnIndex, + SQLSMALLINT _fSqlType, + sal_Bool &_bWasNull, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface, + rtl_TextEncoding _nTextEncoding) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + static ::com::sun::star::uno::Sequence<sal_Int8> getBytesValue(OConnection* _pConnection, + SQLHANDLE _aStatementHandle, + sal_Int32 columnIndex, + SQLSMALLINT _fSqlType, + sal_Bool &_bWasNull, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + static void getValue( OConnection* _pConnection, + SQLHANDLE _aStatementHandle, + sal_Int32 columnIndex, + SQLSMALLINT _nType, + sal_Bool &_bWasNull, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface, + void* _pValue, + SQLLEN _nSize) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + /** + bindData copies the from pValue to pData + @param _nOdbcType the ODBC sql type + @param _bUseWChar true when Unicode should be used + @param _pData contains a copy of the data to be set + @param _pValue contains the data to be copied + @param _nTextEncoding the text encoding + @param _nColumnSize the columnsize which is a out param + */ + static void bindData( SQLSMALLINT _nOdbcType, + sal_Bool _bUseWChar, + sal_Int8 *&_pData, + SQLLEN*& pLen, + const void* _pValue, + rtl_TextEncoding _nTextEncoding, + SQLULEN& _nColumnSize); + + static void bindParameter( OConnection* _pConnection, + SQLHANDLE _hStmt, + sal_Int32 nPos, + sal_Int8*& pDataBuffer, + sal_Int8* pLenBuffer, + SQLSMALLINT _nJDBCtype, + sal_Bool _bUseWChar, + sal_Bool _bUseOldTimeDate, + const void* _pValue, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface, + rtl_TextEncoding _nTextEncoding) + throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + static void bindValue( OConnection* _pConnection, + SQLHANDLE _aStatementHandle, + sal_Int32 columnIndex, + SQLSMALLINT _nType, + SQLSMALLINT _nMaxLen, + const void* _pValue, + void* _pData, + SQLLEN *pLen, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface, + rtl_TextEncoding _nTextEncoding, + sal_Bool _bUseOldTimeDate) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + }; + + template <class T> void getValue( OConnection* _pConnection, + SQLHANDLE _aStatementHandle, + sal_Int32 columnIndex, + SQLSMALLINT _nType, + sal_Bool &_bWasNull, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface, + T& _rValue) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) + { + OTools::getValue(_pConnection,_aStatementHandle,columnIndex,_nType,_bWasNull,_xInterface,&_rValue,sizeof _rValue); + } + //----------------------------------------------------------------------------- + + + } +} +#endif // _CONNECTIVITY_OTOOLS_HXX_ + diff --git a/connectivity/source/inc/odbc/odbcbasedllapi.hxx b/connectivity/source/inc/odbc/odbcbasedllapi.hxx new file mode 100644 index 000000000000..a1474098df63 --- /dev/null +++ b/connectivity/source/inc/odbc/odbcbasedllapi.hxx @@ -0,0 +1,40 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * +************************************************************************/ + +#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ODBCBASEDLLAPI_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_ODBC_ODBCBASEDLLAPI_HXX + +#include "sal/config.h" + +#include "sal/types.h" + +#if defined OOO_DLLIMPLEMENTATION_ODBCBASE +#define OOO_DLLPUBLIC_ODBCBASE SAL_DLLPUBLIC_EXPORT +#else +#define OOO_DLLPUBLIC_ODBCBASE SAL_DLLPUBLIC_IMPORT +#endif + +#endif diff --git a/connectivity/source/inc/propertyids.hxx b/connectivity/source/inc/propertyids.hxx new file mode 100644 index 000000000000..b28278b0477d --- /dev/null +++ b/connectivity/source/inc/propertyids.hxx @@ -0,0 +1,159 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ +#define _CONNECTIVITY_PROPERTYIDS_HXX_ + +// this define has to be set to split the names into different dll's or so's +// every dll has his own set of property names +#include <rtl/ustring.hxx> +#ifndef _MAP_ +#include <map> +#endif +#include "connectivity/dbtoolsdllapi.hxx" + +namespace dbtools +{ + class OOO_DLLPUBLIC_DBTOOLS OPropertyMap + { + ::std::map<sal_Int32 , rtl_uString*> m_aPropertyMap; + + ::rtl::OUString fillValue(sal_Int32 _nIndex); + public: + OPropertyMap() + { + } + ~OPropertyMap(); + ::rtl::OUString getNameByIndex(sal_Int32 _nIndex) const; + }; +} + +namespace connectivity +{ + namespace CONNECTIVITY_PROPERTY_NAME_SPACE + { + typedef const sal_Char* (*PVFN)(); + + struct OOO_DLLPUBLIC_DBTOOLS UStringDescription + { + const sal_Char* pZeroTerminatedName; + sal_Int32 nLength; + + UStringDescription(PVFN _fCharFkt); + operator ::rtl::OUString() const { return ::rtl::OUString(pZeroTerminatedName,nLength,RTL_TEXTENCODING_ASCII_US); } + ~UStringDescription(); + private: + UStringDescription(); + }; + } +} + + +//------------------------------------------------------------------------------ +#define DECL_PROP1IMPL(varname, type) \ +pProperties[nPos++] = ::com::sun::star::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_##varname), PROPERTY_ID_##varname, ::getCppuType(reinterpret_cast< type*>(NULL)), +//------------------------------------------------------------------------------ +#define DECL_PROP0(varname, type) \ + DECL_PROP1IMPL(varname, type) 0) +//------------------------------------------------------------------------------ +#define DECL_BOOL_PROP1IMPL(varname) \ + pProperties[nPos++] = ::com::sun::star::beans::Property(::connectivity::OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_##varname), PROPERTY_ID_##varname, ::getBooleanCppuType(), +//------------------------------------------------------------------------------ +#define DECL_BOOL_PROP0(varname) \ + DECL_BOOL_PROP1IMPL(varname) 0) + + +#define PROPERTY_ID_QUERYTIMEOUT 1 +#define PROPERTY_ID_MAXFIELDSIZE 2 +#define PROPERTY_ID_MAXROWS 3 +#define PROPERTY_ID_CURSORNAME 4 +#define PROPERTY_ID_RESULTSETCONCURRENCY 5 +#define PROPERTY_ID_RESULTSETTYPE 6 +#define PROPERTY_ID_FETCHDIRECTION 7 +#define PROPERTY_ID_FETCHSIZE 8 +#define PROPERTY_ID_ESCAPEPROCESSING 9 +#define PROPERTY_ID_USEBOOKMARKS 10 +// Column +#define PROPERTY_ID_NAME 11 +#define PROPERTY_ID_TYPE 12 +#define PROPERTY_ID_TYPENAME 13 +#define PROPERTY_ID_PRECISION 14 +#define PROPERTY_ID_SCALE 15 +#define PROPERTY_ID_ISNULLABLE 16 +#define PROPERTY_ID_ISAUTOINCREMENT 17 +#define PROPERTY_ID_ISROWVERSION 18 +#define PROPERTY_ID_DESCRIPTION 19 +#define PROPERTY_ID_DEFAULTVALUE 20 + +#define PROPERTY_ID_REFERENCEDTABLE 21 +#define PROPERTY_ID_UPDATERULE 22 +#define PROPERTY_ID_DELETERULE 23 +#define PROPERTY_ID_CATALOG 24 +#define PROPERTY_ID_ISUNIQUE 25 +#define PROPERTY_ID_ISPRIMARYKEYINDEX 26 +#define PROPERTY_ID_ISCLUSTERED 27 +#define PROPERTY_ID_ISASCENDING 28 +#define PROPERTY_ID_SCHEMANAME 29 +#define PROPERTY_ID_CATALOGNAME 30 + +#define PROPERTY_ID_COMMAND 31 +#define PROPERTY_ID_CHECKOPTION 32 +#define PROPERTY_ID_PASSWORD 33 +#define PROPERTY_ID_RELATEDCOLUMN 34 + +#define PROPERTY_ID_FUNCTION 35 +#define PROPERTY_ID_TABLENAME 36 +#define PROPERTY_ID_REALNAME 37 +#define PROPERTY_ID_DBASEPRECISIONCHANGED 38 +#define PROPERTY_ID_ISCURRENCY 39 +#define PROPERTY_ID_ISBOOKMARKABLE 40 + +#define PROPERTY_ID_INVALID_INDEX 41 +#define PROPERTY_ID_HY010 43 +#define PROPERTY_ID_LABEL 44 +#define PROPERTY_ID_DELIMITER 45 +#define PROPERTY_ID_FORMATKEY 46 +#define PROPERTY_ID_LOCALE 47 +#define PROPERTY_ID_IM001 48 + +#define PROPERTY_ID_AUTOINCREMENTCREATION 49 + +#define PROPERTY_ID_PRIVILEGES 50 +#define PROPERTY_ID_HAVINGCLAUSE 51 + +#define PROPERTY_ID_ISSIGNED 52 +#define PROPERTY_ID_AGGREGATEFUNCTION 53 +#define PROPERTY_ID_ISSEARCHABLE 54 + +#define PROPERTY_ID_APPLYFILTER 55 +#define PROPERTY_ID_FILTER 56 +#define PROPERTY_ID_MASTERFIELDS 57 +#define PROPERTY_ID_DETAILFIELDS 58 +#define PROPERTY_ID_FIELDTYPE 59 +#define PROPERTY_ID_VALUE 60 +#define PROPERTY_ID_ACTIVE_CONNECTION 61 + +#endif // _CONNECTIVITY_PROPERTYIDS_HXX_ diff --git a/connectivity/source/inc/resource/adabas_res.hrc b/connectivity/source/inc/resource/adabas_res.hrc new file mode 100644 index 000000000000..a5911dcd0e98 --- /dev/null +++ b/connectivity/source/inc/resource/adabas_res.hrc @@ -0,0 +1,43 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_RESOURCE_ADABAS_HRC +#define CONNECTIVITY_RESOURCE_ADABAS_HRC + +#include "resource/conn_shared_res.hrc" +#include "resource/common_res.hrc" + +// ============================================================================ +// = the Adabas D driver's resource strings +// ============================================================================ +#define STR_NO_DISK_SPACE ( STR_ADABAS_BASE + 1 ) +#define STR_COMMAND_NOT_FOUND ( STR_ADABAS_BASE + 2 ) +#define STR_DATABASE_NEEDS_CONVERTING ( STR_ADABAS_BASE + 3 ) +#define STR_USER_NO_DELETE ( STR_ADABAS_BASE + 9 ) + +#endif // CONNECTIVITY_RESOURCE_ADABAS_HRC + diff --git a/connectivity/source/inc/resource/ado_res.hrc b/connectivity/source/inc/resource/ado_res.hrc new file mode 100644 index 000000000000..717e194ca3a4 --- /dev/null +++ b/connectivity/source/inc/resource/ado_res.hrc @@ -0,0 +1,50 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_RESOURCE_ADO_HRC +#define CONNECTIVITY_RESOURCE_ADO_HRC + +#include "resource/conn_shared_res.hrc" +#include "resource/common_res.hrc" + +// ============================================================================ +// = the ado driver's resource strings +// ============================================================================ +#define STR_INVALID_COLUMN_DESCRIPTOR_ERROR ( STR_ADO_BASE + 1 ) +#define STR_INVALID_GROUP_DESCRIPTOR_ERROR ( STR_ADO_BASE + 2 ) +#define STR_INVALID_INDEX_DESCRIPTOR_ERROR ( STR_ADO_BASE + 3 ) +#define STR_INVALID_KEY_DESCRIPTOR_ERROR ( STR_ADO_BASE + 4 ) +#define STR_INVALID_TABLE_DESCRIPTOR_ERROR ( STR_ADO_BASE + 5 ) +#define STR_INVALID_USER_DESCRIPTOR_ERROR ( STR_ADO_BASE + 6 ) +#define STR_INVALID_VIEW_DESCRIPTOR_ERROR ( STR_ADO_BASE + 7 ) +#define STR_VIEW_NO_COMMAND_ERROR ( STR_ADO_BASE + 8 ) +#define STR_TYPE_NOT_CONVERT ( STR_ADO_BASE + 9 ) +#define STR_NO_CONNECTION ( STR_ADO_BASE + 10 ) + + +#endif // CONNECTIVITY_RESOURCE_ADO_HRC + diff --git a/connectivity/source/inc/resource/calc_res.hrc b/connectivity/source/inc/resource/calc_res.hrc new file mode 100644 index 000000000000..e71901814140 --- /dev/null +++ b/connectivity/source/inc/resource/calc_res.hrc @@ -0,0 +1,41 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_RESOURCE_CALC_HRC +#define CONNECTIVITY_RESOURCE_CALC_HRC + +#include "resource/conn_shared_res.hrc" +#include "resource/common_res.hrc" + +// ============================================================================ +// = the calc driver's resource strings +// ============================================================================ + +#define STR_LOAD_FILE_ERROR_MESSAGE ( STR_CALC_BASE + 0 ) + +#endif // CONNECTIVITY_RESOURCE_CALC_HRC + diff --git a/connectivity/source/inc/resource/common_res.hrc b/connectivity/source/inc/resource/common_res.hrc new file mode 100644 index 000000000000..ac7cb89a630e --- /dev/null +++ b/connectivity/source/inc/resource/common_res.hrc @@ -0,0 +1,78 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_RESOURCE_COMMON_HRC +#define CONNECTIVITY_RESOURCE_COMMON_HRC + +#ifndef CONNECTIVITY_SHARED_RES_HRC +#include "resource/conn_shared_res.hrc" +#endif + +// ============================================================================ +// = common strings +// ============================================================================ + +#define STR_STRING_LENGTH_EXCEEDED ( STR_COMMON_BASE + 1 ) +#define STR_CANNOT_CONVERT_STRING ( STR_COMMON_BASE + 2 ) +#define STR_URI_SYNTAX_ERROR ( STR_COMMON_BASE + 3 ) +#define STR_COULD_NOT_LOAD_FILE ( STR_COMMON_BASE + 4 ) +#define STR_QUERY_TOO_COMPLEX ( STR_COMMON_BASE + 5 ) +#define STR_OPERATOR_TOO_COMPLEX ( STR_COMMON_BASE + 6 ) +#define STR_QUERY_INVALID_LIKE_COLUMN ( STR_COMMON_BASE + 7 ) +#define STR_QUERY_INVALID_LIKE_STRING ( STR_COMMON_BASE + 8 ) +#define STR_QUERY_NOT_LIKE_TOO_COMPLEX ( STR_COMMON_BASE + 9 ) +#define STR_QUERY_LIKE_WILDCARD ( STR_COMMON_BASE + 10 ) +#define STR_QUERY_LIKE_WILDCARD_MANY ( STR_COMMON_BASE + 11 ) +#define STR_INVALID_COLUMNNAME ( STR_COMMON_BASE + 12 ) +#define STR_NO_CLASSNAME ( STR_COMMON_BASE + 13 ) +#define STR_NO_CLASSNAME_PATH ( STR_COMMON_BASE + 14 ) +#define STR_UNKNOWN_PARA_TYPE ( STR_COMMON_BASE + 15 ) +#define STR_INVALID_COLUMN_SELECTION ( STR_COMMON_BASE + 16 ) +#define STR_PARA_ONLY_PREPARED ( STR_COMMON_BASE + 17 ) +#define STR_COLUMN_NOT_UPDATEABLE ( STR_COMMON_BASE + 18 ) +#define STR_ROW_ALREADY_DELETED ( STR_COMMON_BASE + 19 ) +#define STR_UNKNOWN_COLUMN_TYPE ( STR_COMMON_BASE + 20 ) +#define STR_FORMULA_WRONG ( STR_COMMON_BASE + 21 ) +#define STR_NO_JAVA ( STR_COMMON_BASE + 22 ) +#define STR_NO_RESULTSET ( STR_COMMON_BASE + 23 ) +#define STR_NO_ROWCOUNT ( STR_COMMON_BASE + 24 ) +#define STR_ERRORMSG_SEQUENCE ( STR_COMMON_BASE + 25 ) +#define STR_INVALID_INDEX ( STR_COMMON_BASE + 26 ) +#define STR_UNSUPPORTED_FUNCTION ( STR_COMMON_BASE + 27 ) +#define STR_UNSUPPORTED_FEATURE ( STR_COMMON_BASE + 28 ) +#define STR_UNKNOWN_COLUMN_NAME ( STR_COMMON_BASE + 29 ) +#define STR_INVALID_PARA_COUNT ( STR_COMMON_BASE + 30 ) +#define STR_PRIVILEGE_NOT_GRANTED ( STR_COMMON_BASE + 31 ) +#define STR_PRIVILEGE_NOT_REVOKED ( STR_COMMON_BASE + 32 ) +#define STR_INVALID_BOOKMARK ( STR_COMMON_BASE + 33 ) +#define STR_NO_ELEMENT_NAME ( STR_COMMON_BASE + 34 ) +#define STR_NO_INPUTSTREAM ( STR_COMMON_BASE + 35 ) +#define STR_INPUTSTREAM_WRONG_LEN ( STR_COMMON_BASE + 36 ) +#define STR_WRONG_PARAM_INDEX ( STR_COMMON_BASE + 37 ) +#define STR_NO_CONNECTION_GIVEN ( STR_COMMON_BASE + 38 ) + +#endif // CONNECTIVITY_RESOURCE_COMMON_HRC diff --git a/connectivity/source/inc/resource/conn_shared_res.hrc b/connectivity/source/inc/resource/conn_shared_res.hrc new file mode 100644 index 000000000000..981f5a89b4df --- /dev/null +++ b/connectivity/source/inc/resource/conn_shared_res.hrc @@ -0,0 +1,73 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_SHARED_RES_HRC +#define CONNECTIVITY_SHARED_RES_HRC + +// ============================================================================ +// = normal resource ids, per driver + +// Mozilla driver resource ids +#define STR_MOZAB_BASE 1000 + +// common resource ids +#define STR_COMMON_BASE 1200 + +// Spreadsheet driver resource ids +#define STR_CALC_BASE 1300 + +// DBase driver resource ids +#define STR_DBASE_BASE 1400 + +// ADO driver resource ids +#define STR_ADO_BASE 1450 + +// EVOAB2 driver resource ids +#define STR_EVOAB2_BASE 1500 + +// FILE driver resource ids +#define STR_FILE_BASE 1550 + +// KAB driver resource ids +#define STR_KAB_BASE 1600 + +// MACAB driver resource ids +#define STR_MACAB_BASE 1650 + +// Adabas D driver resource ids +#define STR_ADABAS_BASE 1700 + +// hsqldb driver resource ids +#define STR_HSQLDB_BASE 1750 +// ============================================================================ +// = resource ids for log messages +#define STR_LOG_MESSAGE_BASE 10000 + +// log messages for the jdbc driver +#define STR_JDBC_LOG_MESSAGE_BASE STR_LOG_MESSAGE_BASE + 500 + +#endif diff --git a/connectivity/source/inc/resource/dbase_res.hrc b/connectivity/source/inc/resource/dbase_res.hrc new file mode 100644 index 000000000000..d4b31e614ced --- /dev/null +++ b/connectivity/source/inc/resource/dbase_res.hrc @@ -0,0 +1,61 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_RESOURCE_DBASE_HRC +#define CONNECTIVITY_RESOURCE_DBASE_HRC + +#include "resource/conn_shared_res.hrc" +#include "resource/common_res.hrc" + +// ============================================================================ +// = the calc driver's resource strings +// ============================================================================ + +#define STR_COULD_NOT_DELETE_INDEX ( STR_DBASE_BASE + 0 ) +#define STR_COULD_NOT_CREATE_INDEX_NOT_UNIQUE ( STR_DBASE_BASE + 1 ) +#define STR_SQL_NAME_ERROR ( STR_DBASE_BASE + 2 ) +#define STR_COULD_NOT_DELETE_FILE ( STR_DBASE_BASE + 3 ) +#define STR_INVALID_COLUMN_TYPE ( STR_DBASE_BASE + 4 ) +#define STR_INVALID_COLUMN_PRECISION ( STR_DBASE_BASE + 5 ) +#define STR_INVALID_PRECISION_SCALE ( STR_DBASE_BASE + 6 ) +#define STR_INVALID_COLUMN_NAME_LENGTH ( STR_DBASE_BASE + 7 ) +#define STR_DUPLICATE_VALUE_IN_COLUMN ( STR_DBASE_BASE + 8 ) +#define STR_INVALID_COLUMN_DECIMAL_VALUE ( STR_DBASE_BASE + 9 ) +#define STR_COLUMN_NOT_ALTERABLE ( STR_DBASE_BASE + 10 ) +#define STR_COLUMN_NOT_ADDABLE ( STR_DBASE_BASE + 11 ) +#define STR_COLUMN_NOT_DROP ( STR_DBASE_BASE + 12 ) +#define STR_COULD_NOT_ALTER_TABLE ( STR_DBASE_BASE + 13 ) +#define STR_INVALID_DBASE_FILE ( STR_DBASE_BASE + 14 ) +#define STR_ONL_ONE_COLUMN_PER_INDEX ( STR_DBASE_BASE + 15 ) +#define STR_COULD_NOT_CREATE_INDEX ( STR_DBASE_BASE + 16 ) +#define STR_COULD_NOT_CREATE_INDEX_NAME ( STR_DBASE_BASE + 17 ) +#define STR_INVALID_COLUMN_VALUE ( STR_DBASE_BASE + 18 ) +#define STR_TABLE_NOT_DROP ( STR_DBASE_BASE + 19 ) +#define STR_COULD_NOT_CREATE_INDEX_KEYSIZE ( STR_DBASE_BASE + 20 ) + +#endif // CONNECTIVITY_RESOURCE_DBASE_HRC + diff --git a/connectivity/source/inc/resource/evoab2_res.hrc b/connectivity/source/inc/resource/evoab2_res.hrc new file mode 100644 index 000000000000..ebe7170beb96 --- /dev/null +++ b/connectivity/source/inc/resource/evoab2_res.hrc @@ -0,0 +1,42 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_RESOURCE_EVOAB2_HRC +#define CONNECTIVITY_RESOURCE_EVOAB2_HRC + +#include "resource/conn_shared_res.hrc" +#include "resource/common_res.hrc" + +// ============================================================================ +// = the calc driver's resource strings +// ============================================================================ + +#define STR_CANNOT_OPEN_BOOK ( STR_EVOAB2_BASE + 0 ) +#define STR_SORT_BY_COL_ONLY ( STR_EVOAB2_BASE + 1 ) + +#endif // CONNECTIVITY_RESOURCE_CALC_HRC + diff --git a/connectivity/source/inc/resource/file_res.hrc b/connectivity/source/inc/resource/file_res.hrc new file mode 100644 index 000000000000..bbc451920ef4 --- /dev/null +++ b/connectivity/source/inc/resource/file_res.hrc @@ -0,0 +1,48 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_RESOURCE_FILE_HRC +#define CONNECTIVITY_RESOURCE_FILE_HRC + +#include "resource/conn_shared_res.hrc" +#include "resource/common_res.hrc" +// ============================================================================ +// = the file driver's resource strings +// ============================================================================ + +#define STR_QUERY_COMPLEX_COUNT ( STR_FILE_BASE + 0 ) +#define STR_QUERY_INVALID_BETWEEN ( STR_FILE_BASE + 1 ) +#define STR_TABLE_READONLY ( STR_FILE_BASE + 2 ) +#define STR_DELETE_ROW ( STR_FILE_BASE + 3 ) +#define STR_NO_VALID_FILE_URL ( STR_FILE_BASE + 4 ) +#define STR_QUERY_MORE_TABLES ( STR_FILE_BASE + 5 ) +#define STR_QUERY_NO_TABLE ( STR_FILE_BASE + 6 ) +#define STR_QUERY_NO_COLUMN ( STR_FILE_BASE + 7 ) +#define STR_QUERY_FUNCTION_NOT_SUPPORTED ( STR_FILE_BASE + 8 ) + +#endif // CONNECTIVITY_RESOURCE_FILE_HRC + diff --git a/connectivity/source/inc/resource/hsqldb_res.hrc b/connectivity/source/inc/resource/hsqldb_res.hrc new file mode 100644 index 000000000000..640ed8f5ce81 --- /dev/null +++ b/connectivity/source/inc/resource/hsqldb_res.hrc @@ -0,0 +1,47 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_RESOURCE_HSQLDB_HRC +#define CONNECTIVITY_RESOURCE_HSQLDB_HRC + +#include "resource/conn_shared_res.hrc" +#include "resource/common_res.hrc" + +// ============================================================================ +// = the hsqldb driver's resource strings +// ============================================================================ + +#define STR_NO_STROAGE ( STR_HSQLDB_BASE + 0 ) +#define STR_INVALID_FILE_URL ( STR_HSQLDB_BASE + 1 ) +#define STR_NO_TABLE_CONTAINER ( STR_HSQLDB_BASE + 2 ) +#define STR_NO_TABLE_EDITOR_DIALOG ( STR_HSQLDB_BASE + 3 ) +#define STR_NO_TABLENAME ( STR_HSQLDB_BASE + 4 ) +#define STR_NO_DOCUMENTUI ( STR_HSQLDB_BASE + 5 ) +#define STR_ERROR_NEW_VERSION ( STR_HSQLDB_BASE + 6 ) + +#endif // CONNECTIVITY_RESOURCE_HSQLDB_HRC + diff --git a/connectivity/source/inc/resource/jdbc_log.hrc b/connectivity/source/inc/resource/jdbc_log.hrc new file mode 100644 index 000000000000..ff2c483f0948 --- /dev/null +++ b/connectivity/source/inc/resource/jdbc_log.hrc @@ -0,0 +1,90 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_RESOURCE_JDBC_LOG_HRC +#define CONNECTIVITY_RESOURCE_JDBC_LOG_HRC + +#include "resource/conn_shared_res.hrc" + +#define STR_LOG_DRIVER_CONNECTING_URL ( STR_JDBC_LOG_MESSAGE_BASE + 1 ) +#define STR_LOG_DRIVER_SUCCESS ( STR_JDBC_LOG_MESSAGE_BASE + 2 ) +#define STR_LOG_CREATE_STATEMENT ( STR_JDBC_LOG_MESSAGE_BASE + 3 ) +#define STR_LOG_CREATED_STATEMENT_ID ( STR_JDBC_LOG_MESSAGE_BASE + 4 ) +#define STR_LOG_PREPARE_STATEMENT ( STR_JDBC_LOG_MESSAGE_BASE + 5 ) +#define STR_LOG_PREPARED_STATEMENT_ID ( STR_JDBC_LOG_MESSAGE_BASE + 6 ) +#define STR_LOG_PREPARE_CALL ( STR_JDBC_LOG_MESSAGE_BASE + 7 ) +#define STR_LOG_PREPARED_CALL_ID ( STR_JDBC_LOG_MESSAGE_BASE + 8 ) +#define STR_LOG_NATIVE_SQL ( STR_JDBC_LOG_MESSAGE_BASE + 9 ) +#define STR_LOG_LOADING_DRIVER ( STR_JDBC_LOG_MESSAGE_BASE + 10 ) +#define STR_LOG_NO_DRIVER_CLASS ( STR_JDBC_LOG_MESSAGE_BASE + 11 ) +#define STR_LOG_CONN_SUCCESS ( STR_JDBC_LOG_MESSAGE_BASE + 12 ) +#define STR_LOG_NO_SYSTEM_CONNECTION ( STR_JDBC_LOG_MESSAGE_BASE + 13 ) +#define STR_LOG_GOT_JDBC_CONNECTION ( STR_JDBC_LOG_MESSAGE_BASE + 14 ) +#define STR_LOG_SHUTDOWN_CONNECTION ( STR_JDBC_LOG_MESSAGE_BASE + 15 ) +#define STR_LOG_GENERATED_VALUES ( STR_JDBC_LOG_MESSAGE_BASE + 16 ) +#define STR_LOG_GENERATED_VALUES_FALLBACK ( STR_JDBC_LOG_MESSAGE_BASE + 17 ) +#define STR_LOG_EXECUTE_STATEMENT ( STR_JDBC_LOG_MESSAGE_BASE + 18 ) +#define STR_LOG_EXECUTE_QUERY ( STR_JDBC_LOG_MESSAGE_BASE + 19 ) +#define STR_LOG_CLOSING_STATEMENT ( STR_JDBC_LOG_MESSAGE_BASE + 20 ) +#define STR_LOG_EXECUTE_UPDATE ( STR_JDBC_LOG_MESSAGE_BASE + 21 ) +#define STR_LOG_UPDATE_COUNT ( STR_JDBC_LOG_MESSAGE_BASE + 22 ) +#define STR_LOG_RESULT_SET_CONCURRENCY ( STR_JDBC_LOG_MESSAGE_BASE + 23 ) +#define STR_LOG_RESULT_SET_TYPE ( STR_JDBC_LOG_MESSAGE_BASE + 24 ) +#define STR_LOG_FETCH_DIRECTION ( STR_JDBC_LOG_MESSAGE_BASE + 25 ) +#define STR_LOG_FETCH_SIZE ( STR_JDBC_LOG_MESSAGE_BASE + 26 ) +#define STR_LOG_SET_ESCAPE_PROCESSING ( STR_JDBC_LOG_MESSAGE_BASE + 27 ) +#define STR_LOG_EXECUTING_PREPARED ( STR_JDBC_LOG_MESSAGE_BASE + 28 ) +#define STR_LOG_EXECUTING_PREPARED_UPDATE ( STR_JDBC_LOG_MESSAGE_BASE + 29 ) +#define STR_LOG_EXECUTING_PREPARED_QUERY ( STR_JDBC_LOG_MESSAGE_BASE + 30 ) +#define STR_LOG_STRING_PARAMETER ( STR_JDBC_LOG_MESSAGE_BASE + 31 ) +#define STR_LOG_BOOLEAN_PARAMETER ( STR_JDBC_LOG_MESSAGE_BASE + 32 ) +#define STR_LOG_BYTE_PARAMETER ( STR_JDBC_LOG_MESSAGE_BASE + 33 ) +#define STR_LOG_DATE_PARAMETER ( STR_JDBC_LOG_MESSAGE_BASE + 34 ) +#define STR_LOG_TIME_PARAMETER ( STR_JDBC_LOG_MESSAGE_BASE + 35 ) +#define STR_LOG_TIMESTAMP_PARAMETER ( STR_JDBC_LOG_MESSAGE_BASE + 36 ) +#define STR_LOG_DOUBLE_PARAMETER ( STR_JDBC_LOG_MESSAGE_BASE + 37 ) +#define STR_LOG_FLOAT_PARAMETER ( STR_JDBC_LOG_MESSAGE_BASE + 38 ) +#define STR_LOG_INT_PARAMETER ( STR_JDBC_LOG_MESSAGE_BASE + 39 ) +#define STR_LOG_LONG_PARAMETER ( STR_JDBC_LOG_MESSAGE_BASE + 40 ) +#define STR_LOG_NULL_PARAMETER ( STR_JDBC_LOG_MESSAGE_BASE + 41 ) +#define STR_LOG_OBJECT_NULL_PARAMETER ( STR_JDBC_LOG_MESSAGE_BASE + 42 ) +#define STR_LOG_SHORT_PARAMETER ( STR_JDBC_LOG_MESSAGE_BASE + 43 ) +#define STR_LOG_BYTES_PARAMETER ( STR_JDBC_LOG_MESSAGE_BASE + 44 ) +#define STR_LOG_CHARSTREAM_PARAMETER ( STR_JDBC_LOG_MESSAGE_BASE + 45 ) +#define STR_LOG_BINARYSTREAM_PARAMETER ( STR_JDBC_LOG_MESSAGE_BASE + 46 ) +#define STR_LOG_CLEAR_PARAMETERS ( STR_JDBC_LOG_MESSAGE_BASE + 47 ) +#define STR_LOG_META_DATA_METHOD ( STR_JDBC_LOG_MESSAGE_BASE + 48 ) +#define STR_LOG_META_DATA_METHOD_ARG1 ( STR_JDBC_LOG_MESSAGE_BASE + 49 ) +#define STR_LOG_META_DATA_METHOD_ARG2 ( STR_JDBC_LOG_MESSAGE_BASE + 50 ) +#define STR_LOG_META_DATA_METHOD_ARG3 ( STR_JDBC_LOG_MESSAGE_BASE + 51 ) +#define STR_LOG_META_DATA_METHOD_ARG4 ( STR_JDBC_LOG_MESSAGE_BASE + 52 ) +#define STR_LOG_META_DATA_RESULT ( STR_JDBC_LOG_MESSAGE_BASE + 53 ) +#define STR_LOG_META_DATA_SUCCESS ( STR_JDBC_LOG_MESSAGE_BASE + 54 ) +#define STR_LOG_THROWING_EXCEPTION ( STR_JDBC_LOG_MESSAGE_BASE + 55 ) +#define STR_LOG_SETTING_SYSTEM_PROPERTY ( STR_JDBC_LOG_MESSAGE_BASE + 56 ) + +#endif // CONNECTIVITY_RESOURCE_JDBC_LOG_HRC diff --git a/connectivity/source/inc/resource/kab_res.hrc b/connectivity/source/inc/resource/kab_res.hrc new file mode 100644 index 000000000000..b03eecdb2b90 --- /dev/null +++ b/connectivity/source/inc/resource/kab_res.hrc @@ -0,0 +1,43 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_RESOURCE_KAB_HRC +#define CONNECTIVITY_RESOURCE_KAB_HRC + +#include "resource/conn_shared_res.hrc" +#include "resource/common_res.hrc" +// ============================================================================ +// = the kab driver's resource strings +// ============================================================================ + +#define STR_NO_KDE_INST ( STR_KAB_BASE + 0 ) +#define STR_KDE_VERSION_TOO_OLD ( STR_KAB_BASE + 1 ) +#define STR_KDE_VERSION_TOO_NEW ( STR_KAB_BASE + 2 ) +#define STR_KDE_VERSION_TOO_NEW_WORK_AROUND ( STR_KAB_BASE + 3 ) + +#endif // CONNECTIVITY_RESOURCE_KAB_HRC + diff --git a/connectivity/source/inc/resource/macab_res.hrc b/connectivity/source/inc/resource/macab_res.hrc new file mode 100644 index 000000000000..74d64aa28ad8 --- /dev/null +++ b/connectivity/source/inc/resource/macab_res.hrc @@ -0,0 +1,41 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_RESOURCE_MACAB_HRC +#define CONNECTIVITY_RESOURCE_MACAB_HRC + +#include "resource/conn_shared_res.hrc" +#include "resource/common_res.hrc" +// ============================================================================ +// = the macab driver's resource strings +// ============================================================================ + +#define STR_NO_TABLE ( STR_MACAB_BASE + 0 ) +#define STR_NO_MAC_OS_FOUND ( STR_MACAB_BASE + 1 ) + +#endif // CONNECTIVITY_RESOURCE_MACAB_HRC + diff --git a/connectivity/source/inc/resource/mozab_res.hrc b/connectivity/source/inc/resource/mozab_res.hrc new file mode 100644 index 000000000000..01e93ae17fd5 --- /dev/null +++ b/connectivity/source/inc/resource/mozab_res.hrc @@ -0,0 +1,74 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_RESOURCE_MOZAB_HRC +#define CONNECTIVITY_RESOURCE_MOZAB_HRC + +#ifndef CONNECTIVITY_SHARED_RES_HRC +#include "resource/conn_shared_res.hrc" +#endif + +// ============================================================================ +// = the mozab driver's resource strings +// ============================================================================ + +#define STR_MOZILLA_ADDRESSBOOKS ( STR_MOZAB_BASE + 0 ) +#define STR_THUNDERBIRD_ADDRESSBOOKS ( STR_MOZAB_BASE + 1 ) +#define STR_OE_ADDRESSBOOK ( STR_MOZAB_BASE + 2 ) +#define STR_OUTLOOK_MAPI_ADDRESSBOOK ( STR_MOZAB_BASE + 3 ) + // FREE +#define STR_NO_TABLE_CREATION_SUPPORT ( STR_MOZAB_BASE + 5 ) +#define STR_MOZILLA_IS_RUNNING ( STR_MOZAB_BASE + 6 ) +#define STR_COULD_NOT_RETRIEVE_AB_ENTRY ( STR_MOZAB_BASE + 7 ) +#define STR_COULD_NOT_GET_DIRECTORY_NAME ( STR_MOZAB_BASE + 8 ) +#define STR_TIMEOUT_WAITING ( STR_MOZAB_BASE + 9 ) +#define STR_ERR_EXECUTING_QUERY ( STR_MOZAB_BASE + 10 ) +#define STR_MOZILLA_IS_RUNNIG_NO_CHANGES ( STR_MOZAB_BASE + 11 ) +#define STR_FOREIGN_PROCESS_CHANGED_AB ( STR_MOZAB_BASE + 12 ) +#define STR_CANT_FIND_ROW ( STR_MOZAB_BASE + 13 ) +#define STR_CANT_FIND_CARD_FOR_ROW ( STR_MOZAB_BASE + 14 ) +#define STR_QUERY_INVALID_IS_NULL_COLUMN ( STR_MOZAB_BASE + 15 ) +#define STR_NO_HOSTNAME ( STR_MOZAB_BASE + 16 ) +#define STR_NO_BASEDN ( STR_MOZAB_BASE + 17 ) +#define STR_COULD_NOT_CONNECT_LDAP ( STR_MOZAB_BASE + 18 ) +#define STR_ERROR_REFRESH_ROW ( STR_MOZAB_BASE + 19 ) +#define STR_ILLEGAL_MOVEMENT ( STR_MOZAB_BASE + 20 ) +#define STR_ERROR_GET_ROW ( STR_MOZAB_BASE + 21 ) +#define STR_COMMIT_ROW ( STR_MOZAB_BASE + 22 ) +#define STR_INVALID_ROW_UPDATE ( STR_MOZAB_BASE + 23 ) +#define STR_ROW_CAN_NOT_SAVE ( STR_MOZAB_BASE + 24 ) +#define STR_CAN_NOT_CANCEL_ROW_UPDATE ( STR_MOZAB_BASE + 25 ) +#define STR_CAN_NOT_CREATE_ROW ( STR_MOZAB_BASE + 26 ) +#define STR_QUERY_AT_LEAST_ONE_TABLES ( STR_MOZAB_BASE + 27 ) +#define STR_NO_COUNT_SUPPORT ( STR_MOZAB_BASE + 28 ) +#define STR_STMT_TYPE_NOT_SUPPORTED ( STR_MOZAB_BASE + 29 ) +#define STR_COULD_NOT_LOAD_LIB ( STR_MOZAB_BASE + 30 ) +#define STR_UNSPECIFIED_ERROR ( STR_MOZAB_BASE + 31 ) +#define STR_COULD_NOT_CREATE_ADDRESSBOOK ( STR_MOZAB_BASE + 32 ) + +#endif // CONNECTIVITY_RESOURCE_MOZAB_HRC + diff --git a/connectivity/source/inc/resource/sharedresources.hxx b/connectivity/source/inc/resource/sharedresources.hxx new file mode 100644 index 000000000000..e7a2a1e52153 --- /dev/null +++ b/connectivity/source/inc/resource/sharedresources.hxx @@ -0,0 +1,164 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CONNECTIVITY_SHAREDRESOURCES_HXX +#define CONNECTIVITY_SHAREDRESOURCES_HXX + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +#include <rtl/ustring.hxx> +#include <list> +#include "connectivity/dbtoolsdllapi.hxx" + +//........................................................................ +namespace connectivity +{ +//........................................................................ + + typedef sal_uInt16 ResourceId; + //==================================================================== + //= SharedResources + //==================================================================== + /** helper class for accessing resources shared by different libraries + in the connectivity module + */ + class OOO_DLLPUBLIC_DBTOOLS SharedResources + { + public: + SharedResources(); + ~SharedResources(); + + /** loads a string from the shared resource file + @param _nResId + the resource ID of the string + @return + the string from the resource file + */ + ::rtl::OUString + getResourceString( + ResourceId _nResId + ) const; + + /** loads a string from the shared resource file, and replaces + a given ASCII pattern with a given string + + @param _nResId + the resource ID of the string to load + @param _pAsciiPatternToReplace + the ASCII string which is to search in the string. Must not be <NULL/>. + @param _rStringToSubstitute + the String which should substitute the ASCII pattern. + + @return + the string from the resource file, with applied string substitution + */ + ::rtl::OUString + getResourceStringWithSubstitution( + ResourceId _nResId, + const sal_Char* _pAsciiPatternToReplace, + const ::rtl::OUString& _rStringToSubstitute + ) const; + + /** loads a string from the shared resource file, and replaces + a given ASCII pattern with a given string + + @param _nResId + the resource ID of the string to load + @param _pAsciiPatternToReplace1 + the ASCII string (1) which is to search in the string. Must not be <NULL/>. + @param _rStringToSubstitute1 + the String which should substitute the ASCII pattern (1) + @param _pAsciiPatternToReplace2 + the ASCII string (2) which is to search in the string. Must not be <NULL/>. + @param _rStringToSubstitute2 + the String which should substitute the ASCII pattern (2) + + @return + the string from the resource file, with applied string substitution + */ + ::rtl::OUString + getResourceStringWithSubstitution( + ResourceId _nResId, + const sal_Char* _pAsciiPatternToReplace1, + const ::rtl::OUString& _rStringToSubstitute1, + const sal_Char* _pAsciiPatternToReplace2, + const ::rtl::OUString& _rStringToSubstitute2 + ) const; + + /** loads a string from the shared resource file, and replaces + a given ASCII pattern with a given string + + @param _nResId + the resource ID of the string to load + @param _pAsciiPatternToReplace1 + the ASCII string (1) which is to search in the string. Must not be <NULL/>. + @param _rStringToSubstitute1 + the String which should substitute the ASCII pattern (1) + @param _pAsciiPatternToReplace2 + the ASCII string (2) which is to search in the string. Must not be <NULL/>. + @param _rStringToSubstitute2 + the String which should substitute the ASCII pattern (2) + @param _pAsciiPatternToReplace3 + the ASCII string (3) which is to search in the string. Must not be <NULL/>. + @param _rStringToSubstitute3 + the String which should substitute the ASCII pattern (3) + + @return + the string from the resource file, with applied string substitution + */ + ::rtl::OUString + getResourceStringWithSubstitution( + ResourceId _nResId, + const sal_Char* _pAsciiPatternToReplace1, + const ::rtl::OUString& _rStringToSubstitute1, + const sal_Char* _pAsciiPatternToReplace2, + const ::rtl::OUString& _rStringToSubstitute2, + const sal_Char* _pAsciiPatternToReplace3, + const ::rtl::OUString& _rStringToSubstitute3 + ) const; + + /** loads a string from the shared resource file, and replaces a given ASCII pattern with a given string + + @param _nResId + the resource ID of the string to load + @param _aStringToSubstitutes + A list of substitutions. + + @return + the string from the resource file, with applied string substitution + */ + ::rtl::OUString getResourceStringWithSubstitution( ResourceId _nResId, + const ::std::list< ::std::pair<const sal_Char* , ::rtl::OUString > > _aStringToSubstitutes) const; + }; + +//........................................................................ +} // namespace connectivity +//........................................................................ + +#endif // CONNECTIVITY_SHAREDRESOURCES_HXX + diff --git a/connectivity/source/inc/sqlscan.hxx b/connectivity/source/inc/sqlscan.hxx new file mode 100644 index 000000000000..a7e21ef879fe --- /dev/null +++ b/connectivity/source/inc/sqlscan.hxx @@ -0,0 +1,90 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CONNECTIVITY_SQLSCAN_HXX +#define _CONNECTIVITY_SQLSCAN_HXX + +#include <stdarg.h> +#include "connectivity/IParseContext.hxx" +#include "connectivity/dbtoolsdllapi.hxx" + +namespace connectivity +{ + //========================================================================== + //= OSQLScanner + //========================================================================== + /** Scanner for SQL92 + */ + class OOO_DLLPUBLIC_DBTOOLS OSQLScanner + { + const IParseContext* m_pContext; // context for parse, knows all international stuff + ::rtl::OString m_sStatement; // statement to parse + ::rtl::OUString m_sErrorMessage; + + sal_Int32 m_nCurrentPos; // next position to read from the statement + sal_Bool m_bInternational; // do we have a statement which may uses + sal_Int32 m_nRule; // rule to be set + + public: + OSQLScanner(); + virtual ~OSQLScanner(); + + inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW( () ) + { return ::rtl_allocateMemory( nSize ); } + inline static void * SAL_CALL operator new( size_t,void* _pHint ) SAL_THROW( () ) + { return _pHint; } + inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW( () ) + { ::rtl_freeMemory( pMem ); } + inline static void SAL_CALL operator delete( void *,void* ) SAL_THROW( () ) + { } + + virtual sal_Int32 SQLyygetc(void); + virtual void SQLyyerror(char *fmt); + virtual void output(sal_Int32) { OSL_ASSERT("Internal error in sdblex.l: output not possible"); } + virtual void ECHO(void) { OSL_ASSERT("Internal error in sdblex.l: ECHO not possible"); } + virtual IParseContext::InternationalKeyCode getInternationalTokenID(const char* sToken) const; + + // setting the new information before scanning + void prepareScan(const ::rtl::OUString & rNewStatement, const IParseContext* pContext, sal_Bool bInternational); + const ::rtl::OUString& getErrorMessage() const {return m_sErrorMessage;} + ::rtl::OString getStatement() const { return m_sStatement; } + + sal_Int32 SQLlex(); + // set this as scanner for flex + void setScanner(sal_Bool _bNull=sal_False); + // rules settings + void SetRule(sal_Int32 nRule) {m_nRule = nRule;} + sal_Int32 GetCurrentRule() const; + sal_Int32 GetGERRule() const; + sal_Int32 GetENGRule() const; + sal_Int32 GetSQLRule() const; + sal_Int32 GetDATERule() const; + sal_Int32 GetSTRINGRule() const; + inline sal_Int32 GetCurrentPos() const { return m_nCurrentPos; } + }; +} + +#endif |