Update ooo320-m1
[ooovba.git] / connectivity / source / drivers / postgresql / pq_updateableresultset.hxx
blob78033b06f465194a5b1a54b98c526acec501bed7
1 #include "pq_sequenceresultset.hxx"
2 #include "pq_resultsetmetadata.hxx"
4 #include <com/sun/star/sdbc/XResultSetUpdate.hpp>
5 #include <com/sun/star/sdbc/XRowUpdate.hpp>
7 namespace pq_sdbc_driver
10 struct UpdateableField
12 UpdateableField( )
13 : isTouched(false)
15 com::sun::star::uno::Any value;
16 bool isTouched;
19 typedef ::std::vector< UpdateableField , Allocator< UpdateableField > > UpdateableFieldVector;
21 class UpdateableResultSet :
22 public SequenceResultSet,
23 public com::sun::star::sdbc::XResultSetUpdate,
24 public com::sun::star::sdbc::XRowUpdate
26 ConnectionSettings **m_ppSettings;
27 rtl::OUString m_schema;
28 rtl::OUString m_table;
29 com::sun::star::uno::Sequence< rtl::OUString > m_primaryKey;
30 UpdateableFieldVector m_updateableField;
31 com::sun::star::uno::Reference< com::sun::star::sdbc::XResultSetMetaData > m_meta;
32 bool m_insertRow;
34 protected:
35 UpdateableResultSet(
36 const ::rtl::Reference< RefCountedMutex > & mutex,
37 const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > &owner,
38 const com::sun::star::uno::Sequence< rtl::OUString > &colNames,
39 const com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< com::sun::star::uno::Any > > &data,
40 ConnectionSettings **ppSettings,
41 const rtl::OUString &schema,
42 const rtl::OUString &table,
43 const com::sun::star::uno::Sequence< ::rtl::OUString > &primaryKey)
44 : SequenceResultSet( mutex, owner, colNames, data, (*ppSettings)->tc ),
45 m_insertRow( false ),
46 m_primaryKey( primaryKey ),
47 m_table( table ),
48 m_schema( schema ),
49 m_ppSettings( ppSettings )
53 rtl::OUString buildWhereClause();
54 void checkUpdate( sal_Int32 column );
56 public:
57 static com::sun::star::uno::Reference< com::sun::star::sdbc::XCloseable > createFromPGResultSet(
58 const ::rtl::Reference< RefCountedMutex > & mutex,
59 const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > &owner,
60 ConnectionSettings **ppSettings,
61 PGresult *result,
62 const rtl::OUString &schema,
63 const rtl::OUString &table,
64 const com::sun::star::uno::Sequence< ::rtl::OUString > &primaryKey );
66 public: // XInterface
67 virtual void SAL_CALL acquire() throw() { SequenceResultSet::acquire(); }
68 virtual void SAL_CALL release() throw() { SequenceResultSet::release(); }
69 virtual com::sun::star::uno::Any SAL_CALL queryInterface(
70 const com::sun::star::uno::Type & reqType )
71 throw (com::sun::star::uno::RuntimeException);
73 public: // XTypeProvider
74 virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL getTypes()
75 throw( com::sun::star::uno::RuntimeException );
76 virtual com::sun::star::uno::Sequence< sal_Int8> SAL_CALL getImplementationId()
77 throw( com::sun::star::uno::RuntimeException );
79 public: // XResultSetUpdate
80 virtual void SAL_CALL insertRow( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
81 virtual void SAL_CALL updateRow( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
82 virtual void SAL_CALL deleteRow( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
83 virtual void SAL_CALL cancelRowUpdates( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
84 virtual void SAL_CALL moveToInsertRow( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
85 virtual void SAL_CALL moveToCurrentRow( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
87 public: // XRowUpdate
88 virtual void SAL_CALL updateNull( sal_Int32 columnIndex ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
89 virtual void SAL_CALL updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
90 virtual void SAL_CALL updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
91 virtual void SAL_CALL updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
92 virtual void SAL_CALL updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
93 virtual void SAL_CALL updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
94 virtual void SAL_CALL updateFloat( sal_Int32 columnIndex, float x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
95 virtual void SAL_CALL updateDouble( sal_Int32 columnIndex, double x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
96 virtual void SAL_CALL updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
97 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);
98 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);
99 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);
100 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);
101 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);
102 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);
103 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);
104 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);
106 public: // XResultSetMetaDataSupplier
107 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData( )
108 throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
111 static com::sun::star::uno::Sequence< com::sun::star::uno::Type > getStaticTypes( bool updateable )
112 throw( com::sun::star::uno::RuntimeException );