1*079eb577SAndrew Rist /************************************************************** 2*079eb577SAndrew Rist * 3*079eb577SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*079eb577SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*079eb577SAndrew Rist * distributed with this work for additional information 6*079eb577SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*079eb577SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*079eb577SAndrew Rist * "License"); you may not use this file except in compliance 9*079eb577SAndrew Rist * with the License. You may obtain a copy of the License at 10*079eb577SAndrew Rist * 11*079eb577SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*079eb577SAndrew Rist * 13*079eb577SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*079eb577SAndrew Rist * software distributed under the License is distributed on an 15*079eb577SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*079eb577SAndrew Rist * KIND, either express or implied. See the License for the 17*079eb577SAndrew Rist * specific language governing permissions and limitations 18*079eb577SAndrew Rist * under the License. 19*079eb577SAndrew Rist * 20*079eb577SAndrew Rist *************************************************************/ 21cdf0e10cSrcweir 22cdf0e10cSrcweir #ifndef MYSQLC_SRESULTSET_HXX 23cdf0e10cSrcweir #define MYSQLC_SRESULTSET_HXX 24cdf0e10cSrcweir 25cdf0e10cSrcweir #include "mysqlc_preparedstatement.hxx" 26cdf0e10cSrcweir #include "mysqlc_statement.hxx" 27cdf0e10cSrcweir #include "mysqlc_subcomponent.hxx" 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include <com/sun/star/sdbc/XCloseable.hpp> 30cdf0e10cSrcweir #include <com/sun/star/sdbc/XColumnLocate.hpp> 31cdf0e10cSrcweir #include <com/sun/star/sdbc/XResultSet.hpp> 32cdf0e10cSrcweir #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> 33cdf0e10cSrcweir #include <com/sun/star/sdbc/XResultSetUpdate.hpp> 34cdf0e10cSrcweir #include <com/sun/star/sdbc/XRow.hpp> 35cdf0e10cSrcweir #include <com/sun/star/sdbc/XRowUpdate.hpp> 36cdf0e10cSrcweir #include <com/sun/star/sdbc/XWarningsSupplier.hpp> 37cdf0e10cSrcweir #include <com/sun/star/sdbcx/XDeleteRows.hpp> 38cdf0e10cSrcweir #include <com/sun/star/sdbcx/XRowLocate.hpp> 39cdf0e10cSrcweir #include <com/sun/star/util/XCancellable.hpp> 40cdf0e10cSrcweir 41cdf0e10cSrcweir #include <cppuhelper/compbase12.hxx> 42cdf0e10cSrcweir 43cdf0e10cSrcweir 44cdf0e10cSrcweir namespace connectivity 45cdf0e10cSrcweir { 46cdf0e10cSrcweir namespace mysqlc 47cdf0e10cSrcweir { 48cdf0e10cSrcweir using ::rtl::OUString; 49cdf0e10cSrcweir using ::com::sun::star::sdbc::SQLException; 50cdf0e10cSrcweir using ::com::sun::star::uno::RuntimeException; 51cdf0e10cSrcweir using ::com::sun::star::uno::Any; 52cdf0e10cSrcweir typedef ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > my_XInputStreamRef; 53cdf0e10cSrcweir typedef my_XNameAccessRef my_XNameAccessRef; 54cdf0e10cSrcweir 55cdf0e10cSrcweir /* 56cdf0e10cSrcweir ** OResultSet 57cdf0e10cSrcweir */ 58cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper12< ::com::sun::star::sdbc::XResultSet, 59cdf0e10cSrcweir ::com::sun::star::sdbc::XRow, 60cdf0e10cSrcweir ::com::sun::star::sdbc::XResultSetMetaDataSupplier, 61cdf0e10cSrcweir ::com::sun::star::util::XCancellable, 62cdf0e10cSrcweir ::com::sun::star::sdbc::XWarningsSupplier, 63cdf0e10cSrcweir ::com::sun::star::sdbc::XResultSetUpdate, 64cdf0e10cSrcweir ::com::sun::star::sdbc::XRowUpdate, 65cdf0e10cSrcweir ::com::sun::star::sdbcx::XRowLocate, 66cdf0e10cSrcweir ::com::sun::star::sdbcx::XDeleteRows, 67cdf0e10cSrcweir ::com::sun::star::sdbc::XCloseable, 68cdf0e10cSrcweir ::com::sun::star::sdbc::XColumnLocate, 69cdf0e10cSrcweir ::com::sun::star::lang::XServiceInfo> OResultSet_BASE; 70cdf0e10cSrcweir 71cdf0e10cSrcweir class OResultSet : public OBase_Mutex, 72cdf0e10cSrcweir public OResultSet_BASE, 73cdf0e10cSrcweir public ::cppu::OPropertySetHelper, 74cdf0e10cSrcweir public OPropertyArrayUsageHelper<OResultSet> 75cdf0e10cSrcweir { 76cdf0e10cSrcweir protected: 77cdf0e10cSrcweir ::com::sun::star::uno::WeakReferenceHelper m_aStatement; 78cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData; 79cdf0e10cSrcweir sql::ResultSet *m_result; 80cdf0e10cSrcweir unsigned int fieldCount; 81cdf0e10cSrcweir rtl_TextEncoding m_encoding; 82cdf0e10cSrcweir // OPropertyArrayUsageHelper 83cdf0e10cSrcweir ::cppu::IPropertyArrayHelper* createArrayHelper() const; 84cdf0e10cSrcweir // OPropertySetHelper 85cdf0e10cSrcweir ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); 86cdf0e10cSrcweir 87cdf0e10cSrcweir sal_Bool SAL_CALL convertFastPropertyValue(Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle, const Any& rValue) 88cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException); 89cdf0e10cSrcweir 90cdf0e10cSrcweir void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const Any& rValue) 91cdf0e10cSrcweir throw (::com::sun::star::uno::Exception); 92cdf0e10cSrcweir 93cdf0e10cSrcweir void SAL_CALL getFastPropertyValue(Any& rValue, sal_Int32 nHandle) const; 94cdf0e10cSrcweir 95cdf0e10cSrcweir // you can't delete objects of this type 96cdf0e10cSrcweir virtual ~OResultSet(); 97cdf0e10cSrcweir 98cdf0e10cSrcweir public: 99cdf0e10cSrcweir DECLARE_SERVICE_INFO(); 100cdf0e10cSrcweir 101cdf0e10cSrcweir OResultSet( OCommonStatement* pStmt, sql::ResultSet *result, rtl_TextEncoding _encoding ); 102cdf0e10cSrcweir operator *()103cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > operator *() 104cdf0e10cSrcweir { 105cdf0e10cSrcweir return ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >(*(OResultSet_BASE*)this); 106cdf0e10cSrcweir } 107cdf0e10cSrcweir 108cdf0e10cSrcweir // ::cppu::OComponentHelper 109cdf0e10cSrcweir void SAL_CALL disposing(); 110cdf0e10cSrcweir 111cdf0e10cSrcweir // XInterface 112cdf0e10cSrcweir Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type & rType) 113cdf0e10cSrcweir throw(RuntimeException); 114cdf0e10cSrcweir 115cdf0e10cSrcweir void SAL_CALL acquire() throw(); 116cdf0e10cSrcweir 117cdf0e10cSrcweir void SAL_CALL release() throw(); 118cdf0e10cSrcweir 119cdf0e10cSrcweir //XTypeProvider 120cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() 121cdf0e10cSrcweir throw(RuntimeException); 122cdf0e10cSrcweir 123cdf0e10cSrcweir // XPropertySet 124cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() 125cdf0e10cSrcweir throw(RuntimeException); 126cdf0e10cSrcweir 127cdf0e10cSrcweir // XResultSet 128cdf0e10cSrcweir sal_Bool SAL_CALL next() throw(SQLException, RuntimeException); 129cdf0e10cSrcweir 130cdf0e10cSrcweir sal_Bool SAL_CALL isBeforeFirst() throw(SQLException, RuntimeException); 131cdf0e10cSrcweir 132cdf0e10cSrcweir sal_Bool SAL_CALL isAfterLast() throw(SQLException, RuntimeException); 133cdf0e10cSrcweir 134cdf0e10cSrcweir sal_Bool SAL_CALL isFirst() throw(SQLException, RuntimeException); 135cdf0e10cSrcweir 136cdf0e10cSrcweir sal_Bool SAL_CALL isLast() throw(SQLException, RuntimeException); 137cdf0e10cSrcweir 138cdf0e10cSrcweir void SAL_CALL beforeFirst() throw(SQLException, RuntimeException); 139cdf0e10cSrcweir 140cdf0e10cSrcweir void SAL_CALL afterLast() throw(SQLException, RuntimeException); 141cdf0e10cSrcweir 142cdf0e10cSrcweir sal_Bool SAL_CALL first() throw(SQLException, RuntimeException); 143cdf0e10cSrcweir 144cdf0e10cSrcweir sal_Bool SAL_CALL last() throw(SQLException, RuntimeException); 145cdf0e10cSrcweir 146cdf0e10cSrcweir sal_Int32 SAL_CALL getRow() throw(SQLException, RuntimeException); 147cdf0e10cSrcweir 148cdf0e10cSrcweir sal_Bool SAL_CALL absolute(sal_Int32 row) throw(SQLException, RuntimeException); 149cdf0e10cSrcweir 150cdf0e10cSrcweir sal_Bool SAL_CALL relative(sal_Int32 rows) throw(SQLException, RuntimeException); 151cdf0e10cSrcweir 152cdf0e10cSrcweir sal_Bool SAL_CALL previous() throw(SQLException, RuntimeException); 153cdf0e10cSrcweir 154cdf0e10cSrcweir void SAL_CALL refreshRow() throw(SQLException, RuntimeException); 155cdf0e10cSrcweir 156cdf0e10cSrcweir sal_Bool SAL_CALL rowUpdated() throw(SQLException, RuntimeException); 157cdf0e10cSrcweir 158cdf0e10cSrcweir sal_Bool SAL_CALL rowInserted() throw(SQLException, RuntimeException); 159cdf0e10cSrcweir 160cdf0e10cSrcweir sal_Bool SAL_CALL rowDeleted() throw(SQLException, RuntimeException); 161cdf0e10cSrcweir 162cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement() 163cdf0e10cSrcweir throw(SQLException, RuntimeException); 164cdf0e10cSrcweir // XRow 165cdf0e10cSrcweir sal_Bool SAL_CALL wasNull() throw(SQLException, RuntimeException); 166cdf0e10cSrcweir 167cdf0e10cSrcweir OUString SAL_CALL getString(sal_Int32 column) throw(SQLException, RuntimeException); 168cdf0e10cSrcweir 169cdf0e10cSrcweir sal_Bool SAL_CALL getBoolean(sal_Int32 column) throw(SQLException, RuntimeException); 170cdf0e10cSrcweir 171cdf0e10cSrcweir sal_Int8 SAL_CALL getByte(sal_Int32 column) throw(SQLException, RuntimeException); 172cdf0e10cSrcweir 173cdf0e10cSrcweir sal_Int16 SAL_CALL getShort(sal_Int32 column) throw(SQLException, RuntimeException); 174cdf0e10cSrcweir 175cdf0e10cSrcweir sal_Int32 SAL_CALL getInt(sal_Int32 column) throw(SQLException, RuntimeException); 176cdf0e10cSrcweir 177cdf0e10cSrcweir sal_Int64 SAL_CALL getLong(sal_Int32 column) throw(SQLException, RuntimeException); 178cdf0e10cSrcweir 179cdf0e10cSrcweir float SAL_CALL getFloat(sal_Int32 column) throw(SQLException, RuntimeException); 180cdf0e10cSrcweir 181cdf0e10cSrcweir double SAL_CALL getDouble(sal_Int32 column) throw(SQLException, RuntimeException); 182cdf0e10cSrcweir 183cdf0e10cSrcweir ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes(sal_Int32 column) 184cdf0e10cSrcweir throw(SQLException, RuntimeException); 185cdf0e10cSrcweir 186cdf0e10cSrcweir ::com::sun::star::util::Date SAL_CALL getDate(sal_Int32 column) 187cdf0e10cSrcweir throw(SQLException, RuntimeException); 188cdf0e10cSrcweir 189cdf0e10cSrcweir ::com::sun::star::util::Time SAL_CALL getTime(sal_Int32 column) 190cdf0e10cSrcweir throw(SQLException, RuntimeException); 191cdf0e10cSrcweir 192cdf0e10cSrcweir ::com::sun::star::util::DateTime SAL_CALL getTimestamp(sal_Int32 column) 193cdf0e10cSrcweir throw(SQLException, RuntimeException); 194cdf0e10cSrcweir 195cdf0e10cSrcweir my_XInputStreamRef SAL_CALL getBinaryStream(sal_Int32 column) 196cdf0e10cSrcweir throw(SQLException, RuntimeException); 197cdf0e10cSrcweir 198cdf0e10cSrcweir my_XInputStreamRef SAL_CALL getCharacterStream(sal_Int32 column) 199cdf0e10cSrcweir throw(SQLException, RuntimeException); 200cdf0e10cSrcweir 201cdf0e10cSrcweir Any SAL_CALL getObject(sal_Int32 column, const my_XNameAccessRef& typeMap) 202cdf0e10cSrcweir throw(SQLException, RuntimeException); 203cdf0e10cSrcweir 204cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef(sal_Int32 column) 205cdf0e10cSrcweir throw(SQLException, RuntimeException); 206cdf0e10cSrcweir 207cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob(sal_Int32 column) 208cdf0e10cSrcweir throw(SQLException, RuntimeException); 209cdf0e10cSrcweir 210cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob(sal_Int32 column) 211cdf0e10cSrcweir throw(SQLException, RuntimeException); 212cdf0e10cSrcweir 213cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray(sal_Int32 column) 214cdf0e10cSrcweir throw(SQLException, RuntimeException); 215cdf0e10cSrcweir 216cdf0e10cSrcweir // XResultSetMetaDataSupplier 217cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData() 218cdf0e10cSrcweir throw(SQLException, RuntimeException); 219cdf0e10cSrcweir 220cdf0e10cSrcweir // XCancellable 221cdf0e10cSrcweir void SAL_CALL cancel() throw(RuntimeException); 222cdf0e10cSrcweir 223cdf0e10cSrcweir // XCloseable 224cdf0e10cSrcweir void SAL_CALL close() throw(SQLException, RuntimeException); 225cdf0e10cSrcweir 226cdf0e10cSrcweir // XWarningsSupplier 227cdf0e10cSrcweir Any SAL_CALL getWarnings() throw(SQLException, RuntimeException); 228cdf0e10cSrcweir 229cdf0e10cSrcweir void SAL_CALL clearWarnings() throw(SQLException, RuntimeException); 230cdf0e10cSrcweir 231cdf0e10cSrcweir // XResultSetUpdate 232cdf0e10cSrcweir void SAL_CALL insertRow() throw(SQLException, RuntimeException); 233cdf0e10cSrcweir 234cdf0e10cSrcweir void SAL_CALL updateRow() throw(SQLException, RuntimeException); 235cdf0e10cSrcweir 236cdf0e10cSrcweir void SAL_CALL deleteRow() throw(SQLException, RuntimeException); 237cdf0e10cSrcweir 238cdf0e10cSrcweir void SAL_CALL cancelRowUpdates() throw(SQLException, RuntimeException); 239cdf0e10cSrcweir 240cdf0e10cSrcweir void SAL_CALL moveToInsertRow() throw(SQLException, RuntimeException); 241cdf0e10cSrcweir 242cdf0e10cSrcweir void SAL_CALL moveToCurrentRow() throw(SQLException, RuntimeException); 243cdf0e10cSrcweir 244cdf0e10cSrcweir // XRowUpdate 245cdf0e10cSrcweir void SAL_CALL updateNull(sal_Int32 column) throw(SQLException, RuntimeException); 246cdf0e10cSrcweir 247cdf0e10cSrcweir void SAL_CALL updateBoolean(sal_Int32 column, sal_Bool x) throw(SQLException, RuntimeException); 248cdf0e10cSrcweir 249cdf0e10cSrcweir void SAL_CALL updateByte(sal_Int32 column, sal_Int8 x) throw(SQLException, RuntimeException); 250cdf0e10cSrcweir 251cdf0e10cSrcweir void SAL_CALL updateShort(sal_Int32 column, sal_Int16 x) throw(SQLException, RuntimeException); 252cdf0e10cSrcweir 253cdf0e10cSrcweir void SAL_CALL updateInt(sal_Int32 column, sal_Int32 x) throw(SQLException, RuntimeException); 254cdf0e10cSrcweir 255cdf0e10cSrcweir void SAL_CALL updateLong(sal_Int32 column, sal_Int64 x) throw(SQLException, RuntimeException); 256cdf0e10cSrcweir 257cdf0e10cSrcweir void SAL_CALL updateFloat(sal_Int32 column, float x) throw(SQLException, RuntimeException); 258cdf0e10cSrcweir 259cdf0e10cSrcweir void SAL_CALL updateDouble(sal_Int32 column, double x) throw(SQLException, RuntimeException); 260cdf0e10cSrcweir 261cdf0e10cSrcweir void SAL_CALL updateString(sal_Int32 column, const OUString& x) 262cdf0e10cSrcweir throw(SQLException, RuntimeException); 263cdf0e10cSrcweir 264cdf0e10cSrcweir void SAL_CALL updateBytes(sal_Int32 column, const ::com::sun::star::uno::Sequence< sal_Int8 >& x) 265cdf0e10cSrcweir throw(SQLException, RuntimeException); 266cdf0e10cSrcweir 267cdf0e10cSrcweir void SAL_CALL updateDate(sal_Int32 column, const ::com::sun::star::util::Date& x) 268cdf0e10cSrcweir throw(SQLException, RuntimeException); 269cdf0e10cSrcweir 270cdf0e10cSrcweir void SAL_CALL updateTime(sal_Int32 column, const ::com::sun::star::util::Time& x) 271cdf0e10cSrcweir throw(SQLException, RuntimeException); 272cdf0e10cSrcweir 273cdf0e10cSrcweir void SAL_CALL updateTimestamp(sal_Int32 column, const ::com::sun::star::util::DateTime& x) 274cdf0e10cSrcweir throw(SQLException, RuntimeException); 275cdf0e10cSrcweir 276cdf0e10cSrcweir void SAL_CALL updateBinaryStream(sal_Int32 column, const my_XInputStreamRef& x, sal_Int32 length) 277cdf0e10cSrcweir throw(SQLException, RuntimeException); 278cdf0e10cSrcweir 279cdf0e10cSrcweir void SAL_CALL updateCharacterStream(sal_Int32 column, const my_XInputStreamRef& x, sal_Int32 length) 280cdf0e10cSrcweir throw(SQLException, RuntimeException); 281cdf0e10cSrcweir 282cdf0e10cSrcweir void SAL_CALL updateObject(sal_Int32 column, const Any& x) 283cdf0e10cSrcweir throw(SQLException, RuntimeException); 284cdf0e10cSrcweir 285cdf0e10cSrcweir void SAL_CALL updateNumericObject(sal_Int32 column, const Any& x, sal_Int32 scale) 286cdf0e10cSrcweir throw(SQLException, RuntimeException); 287cdf0e10cSrcweir 288cdf0e10cSrcweir // XColumnLocate 289cdf0e10cSrcweir sal_Int32 SAL_CALL findColumn(const OUString& columnName) 290cdf0e10cSrcweir throw(SQLException, RuntimeException); 291cdf0e10cSrcweir 292cdf0e10cSrcweir // XRowLocate 293cdf0e10cSrcweir Any SAL_CALL getBookmark() throw(SQLException, RuntimeException); 294cdf0e10cSrcweir 295cdf0e10cSrcweir sal_Bool SAL_CALL moveToBookmark(const Any& bookmark) 296cdf0e10cSrcweir throw(SQLException, RuntimeException); 297cdf0e10cSrcweir 298cdf0e10cSrcweir sal_Bool SAL_CALL moveRelativeToBookmark(const Any& bookmark, sal_Int32 rows) 299cdf0e10cSrcweir throw(SQLException, RuntimeException); 300cdf0e10cSrcweir 301cdf0e10cSrcweir sal_Int32 SAL_CALL compareBookmarks(const Any& first, const Any& second) 302cdf0e10cSrcweir throw(SQLException, RuntimeException); 303cdf0e10cSrcweir 304cdf0e10cSrcweir sal_Bool SAL_CALL hasOrderedBookmarks() throw(SQLException, RuntimeException); 305cdf0e10cSrcweir 306cdf0e10cSrcweir sal_Int32 SAL_CALL hashBookmark(const Any& bookmark) 307cdf0e10cSrcweir throw(SQLException, RuntimeException); 308cdf0e10cSrcweir 309cdf0e10cSrcweir // XDeleteRows 310cdf0e10cSrcweir ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL deleteRows(const ::com::sun::star::uno::Sequence< Any >& rows) 311cdf0e10cSrcweir throw(SQLException, RuntimeException); 312cdf0e10cSrcweir 313cdf0e10cSrcweir void checkColumnIndex(sal_Int32 index) throw(SQLException, RuntimeException); 314cdf0e10cSrcweir 315cdf0e10cSrcweir private: 316cdf0e10cSrcweir using ::cppu::OPropertySetHelper::getFastPropertyValue; 317cdf0e10cSrcweir }; 318cdf0e10cSrcweir } /* mysqlc */ 319cdf0e10cSrcweir } /* connectivity */ 320cdf0e10cSrcweir #endif // CONNECTIVITY_SRESULTSET_HXX 321cdf0e10cSrcweir 322cdf0e10cSrcweir /* 323cdf0e10cSrcweir * Local variables: 324cdf0e10cSrcweir * tab-width: 4 325cdf0e10cSrcweir * c-basic-offset: 4 326cdf0e10cSrcweir * End: 327cdf0e10cSrcweir * vim600: noet sw=4 ts=4 fdm=marker 328cdf0e10cSrcweir * vim<600: noet sw=4 ts=4 329cdf0e10cSrcweir */ 330