1*f6e50924SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*f6e50924SAndrew Rist * distributed with this work for additional information 6*f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*f6e50924SAndrew Rist * "License"); you may not use this file except in compliance 9*f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*f6e50924SAndrew Rist * software distributed under the License is distributed on an 15*f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*f6e50924SAndrew Rist * KIND, either express or implied. See the License for the 17*f6e50924SAndrew Rist * specific language governing permissions and limitations 18*f6e50924SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*f6e50924SAndrew Rist *************************************************************/ 21*f6e50924SAndrew Rist 22*f6e50924SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_svx.hxx" 26cdf0e10cSrcweir #include "sdbdatacolumn.hxx" 27cdf0e10cSrcweir 28cdf0e10cSrcweir //.............................................................................. 29cdf0e10cSrcweir namespace svxform 30cdf0e10cSrcweir { 31cdf0e10cSrcweir //.............................................................................. 32cdf0e10cSrcweir 33cdf0e10cSrcweir using namespace ::com::sun::star::uno; 34cdf0e10cSrcweir using namespace ::com::sun::star::lang; 35cdf0e10cSrcweir using namespace ::com::sun::star::beans; 36cdf0e10cSrcweir using namespace ::com::sun::star::sdbc; 37cdf0e10cSrcweir using namespace ::com::sun::star::util; 38cdf0e10cSrcweir using namespace ::com::sun::star::io; 39cdf0e10cSrcweir using namespace ::com::sun::star::container; 40cdf0e10cSrcweir 41cdf0e10cSrcweir //========================================================================== 42cdf0e10cSrcweir //= DataColumn - a class wrapping an object implementing a sdb::DataColumn service 43cdf0e10cSrcweir //========================================================================== DataColumn(const Reference<::com::sun::star::beans::XPropertySet> & _rxIFace)44cdf0e10cSrcweir DataColumn::DataColumn(const Reference< ::com::sun::star::beans::XPropertySet>& _rxIFace) 45cdf0e10cSrcweir { 46cdf0e10cSrcweir m_xPropertySet = _rxIFace; 47cdf0e10cSrcweir m_xColumn = Reference< ::com::sun::star::sdb::XColumn>(_rxIFace, UNO_QUERY); 48cdf0e10cSrcweir m_xColumnUpdate = Reference< ::com::sun::star::sdb::XColumnUpdate>(_rxIFace, UNO_QUERY); 49cdf0e10cSrcweir 50cdf0e10cSrcweir if (!m_xPropertySet.is() || !m_xColumn.is()) 51cdf0e10cSrcweir { 52cdf0e10cSrcweir m_xPropertySet = NULL; 53cdf0e10cSrcweir m_xColumn = NULL; 54cdf0e10cSrcweir m_xColumnUpdate = NULL; 55cdf0e10cSrcweir } 56cdf0e10cSrcweir } 57cdf0e10cSrcweir 58cdf0e10cSrcweir // Reference< XPropertySet> getPropertySetInfo() const59cdf0e10cSrcweir Reference< XPropertySetInfo> DataColumn::getPropertySetInfo() const throw( RuntimeException ) 60cdf0e10cSrcweir { 61cdf0e10cSrcweir return m_xPropertySet->getPropertySetInfo(); 62cdf0e10cSrcweir } 63cdf0e10cSrcweir setPropertyValue(const::rtl::OUString & aPropertyName,const Any & aValue)64cdf0e10cSrcweir void DataColumn::setPropertyValue(const ::rtl::OUString& aPropertyName, const Any& aValue) throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException ) 65cdf0e10cSrcweir { 66cdf0e10cSrcweir m_xPropertySet->setPropertyValue(aPropertyName, aValue); 67cdf0e10cSrcweir } 68cdf0e10cSrcweir getPropertyValue(const::rtl::OUString & PropertyName) const69cdf0e10cSrcweir Any DataColumn::getPropertyValue(const ::rtl::OUString& PropertyName) const throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) 70cdf0e10cSrcweir { 71cdf0e10cSrcweir return m_xPropertySet->getPropertyValue(PropertyName); 72cdf0e10cSrcweir } 73cdf0e10cSrcweir addPropertyChangeListener(const::rtl::OUString & aPropertyName,const Reference<XPropertyChangeListener> & xListener)74cdf0e10cSrcweir void DataColumn::addPropertyChangeListener(const ::rtl::OUString& aPropertyName, const Reference< XPropertyChangeListener>& xListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) 75cdf0e10cSrcweir { 76cdf0e10cSrcweir m_xPropertySet->addPropertyChangeListener(aPropertyName, xListener); 77cdf0e10cSrcweir } 78cdf0e10cSrcweir removePropertyChangeListener(const::rtl::OUString & aPropertyName,const Reference<XPropertyChangeListener> & aListener)79cdf0e10cSrcweir void DataColumn::removePropertyChangeListener(const ::rtl::OUString& aPropertyName, const Reference< XPropertyChangeListener>& aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) 80cdf0e10cSrcweir { 81cdf0e10cSrcweir m_xPropertySet->removePropertyChangeListener(aPropertyName, aListener); 82cdf0e10cSrcweir } 83cdf0e10cSrcweir addVetoableChangeListener(const::rtl::OUString & PropertyName,const Reference<XVetoableChangeListener> & aListener)84cdf0e10cSrcweir void DataColumn::addVetoableChangeListener(const ::rtl::OUString& PropertyName, const Reference< XVetoableChangeListener>& aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) 85cdf0e10cSrcweir { 86cdf0e10cSrcweir m_xPropertySet->addVetoableChangeListener(PropertyName, aListener); 87cdf0e10cSrcweir } 88cdf0e10cSrcweir removeVetoableChangeListener(const::rtl::OUString & PropertyName,const Reference<XVetoableChangeListener> & aListener)89cdf0e10cSrcweir void DataColumn::removeVetoableChangeListener(const ::rtl::OUString& PropertyName, const Reference< XVetoableChangeListener>& aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException ) 90cdf0e10cSrcweir { 91cdf0e10cSrcweir m_xPropertySet->removeVetoableChangeListener(PropertyName, aListener); 92cdf0e10cSrcweir } 93cdf0e10cSrcweir 94cdf0e10cSrcweir // XColumn wasNull()95cdf0e10cSrcweir sal_Bool DataColumn::wasNull() throw( SQLException, RuntimeException ) 96cdf0e10cSrcweir { 97cdf0e10cSrcweir return m_xColumn->wasNull(); 98cdf0e10cSrcweir } 99cdf0e10cSrcweir getString()100cdf0e10cSrcweir ::rtl::OUString DataColumn::getString() throw( SQLException, RuntimeException ) 101cdf0e10cSrcweir { 102cdf0e10cSrcweir return m_xColumn->getString(); 103cdf0e10cSrcweir } 104cdf0e10cSrcweir getBoolean()105cdf0e10cSrcweir sal_Bool DataColumn::getBoolean() throw( SQLException, RuntimeException ) 106cdf0e10cSrcweir { 107cdf0e10cSrcweir return m_xColumn->getBoolean(); 108cdf0e10cSrcweir } 109cdf0e10cSrcweir getByte()110cdf0e10cSrcweir sal_Int8 DataColumn::getByte() throw( SQLException, RuntimeException ) 111cdf0e10cSrcweir { 112cdf0e10cSrcweir return m_xColumn->getByte(); 113cdf0e10cSrcweir } 114cdf0e10cSrcweir getShort()115cdf0e10cSrcweir sal_Int16 DataColumn::getShort() throw( SQLException, RuntimeException ) 116cdf0e10cSrcweir { 117cdf0e10cSrcweir return m_xColumn->getShort(); 118cdf0e10cSrcweir } 119cdf0e10cSrcweir getInt()120cdf0e10cSrcweir sal_Int32 DataColumn::getInt() throw( SQLException, RuntimeException ) 121cdf0e10cSrcweir { 122cdf0e10cSrcweir return m_xColumn->getInt(); 123cdf0e10cSrcweir } 124cdf0e10cSrcweir getLong()125cdf0e10cSrcweir sal_Int64 DataColumn::getLong() throw( SQLException, RuntimeException ) 126cdf0e10cSrcweir { 127cdf0e10cSrcweir return m_xColumn->getLong(); 128cdf0e10cSrcweir } 129cdf0e10cSrcweir getFloat()130cdf0e10cSrcweir float DataColumn::getFloat() throw( SQLException, RuntimeException ) 131cdf0e10cSrcweir { 132cdf0e10cSrcweir return m_xColumn->getFloat(); 133cdf0e10cSrcweir } 134cdf0e10cSrcweir getDouble()135cdf0e10cSrcweir double DataColumn::getDouble() throw( SQLException, RuntimeException ) 136cdf0e10cSrcweir { 137cdf0e10cSrcweir return m_xColumn->getDouble(); 138cdf0e10cSrcweir } 139cdf0e10cSrcweir getBytes()140cdf0e10cSrcweir Sequence< sal_Int8 > DataColumn::getBytes() throw( SQLException, RuntimeException ) 141cdf0e10cSrcweir { 142cdf0e10cSrcweir return m_xColumn->getBytes(); 143cdf0e10cSrcweir } 144cdf0e10cSrcweir getDate()145cdf0e10cSrcweir com::sun::star::util::Date DataColumn::getDate() throw( SQLException, RuntimeException ) 146cdf0e10cSrcweir { 147cdf0e10cSrcweir return m_xColumn->getDate(); 148cdf0e10cSrcweir } 149cdf0e10cSrcweir getTime()150cdf0e10cSrcweir com::sun::star::util::Time DataColumn::getTime() throw( SQLException, RuntimeException ) 151cdf0e10cSrcweir { 152cdf0e10cSrcweir return m_xColumn->getTime(); 153cdf0e10cSrcweir } 154cdf0e10cSrcweir getTimestamp()155cdf0e10cSrcweir com::sun::star::util::DateTime DataColumn::getTimestamp() throw( SQLException, RuntimeException ) 156cdf0e10cSrcweir { 157cdf0e10cSrcweir return m_xColumn->getTimestamp(); 158cdf0e10cSrcweir } 159cdf0e10cSrcweir getBinaryStream()160cdf0e10cSrcweir Reference< XInputStream> DataColumn::getBinaryStream() throw( SQLException, RuntimeException ) 161cdf0e10cSrcweir { 162cdf0e10cSrcweir return m_xColumn->getBinaryStream(); 163cdf0e10cSrcweir } 164cdf0e10cSrcweir getCharacterStream()165cdf0e10cSrcweir Reference< XInputStream> DataColumn::getCharacterStream() throw( SQLException, RuntimeException ) 166cdf0e10cSrcweir { 167cdf0e10cSrcweir return m_xColumn->getCharacterStream(); 168cdf0e10cSrcweir } 169cdf0e10cSrcweir getObject(const Reference<XNameAccess> & typeMap)170cdf0e10cSrcweir Any DataColumn::getObject(const Reference< XNameAccess>& typeMap) throw( SQLException, RuntimeException ) 171cdf0e10cSrcweir { 172cdf0e10cSrcweir return m_xColumn->getObject(typeMap); 173cdf0e10cSrcweir } 174cdf0e10cSrcweir getRef()175cdf0e10cSrcweir Reference< XRef> DataColumn::getRef() throw( SQLException, RuntimeException ) 176cdf0e10cSrcweir { 177cdf0e10cSrcweir return m_xColumn->getRef(); 178cdf0e10cSrcweir } 179cdf0e10cSrcweir getBlob()180cdf0e10cSrcweir Reference< XBlob> DataColumn::getBlob() throw( SQLException, RuntimeException ) 181cdf0e10cSrcweir { 182cdf0e10cSrcweir return m_xColumn->getBlob(); 183cdf0e10cSrcweir } 184cdf0e10cSrcweir getClob()185cdf0e10cSrcweir Reference< XClob> DataColumn::getClob() throw( SQLException, RuntimeException ) 186cdf0e10cSrcweir { 187cdf0e10cSrcweir return m_xColumn->getClob(); 188cdf0e10cSrcweir } 189cdf0e10cSrcweir getArray()190cdf0e10cSrcweir Reference< XArray> DataColumn::getArray() throw( SQLException, RuntimeException ) 191cdf0e10cSrcweir { 192cdf0e10cSrcweir return m_xColumn->getArray(); 193cdf0e10cSrcweir } 194cdf0e10cSrcweir 195cdf0e10cSrcweir // XColumnUpdate updateNull()196cdf0e10cSrcweir void DataColumn::updateNull() throw( SQLException, RuntimeException ) 197cdf0e10cSrcweir { 198cdf0e10cSrcweir m_xColumnUpdate->updateNull(); 199cdf0e10cSrcweir } 200cdf0e10cSrcweir updateBoolean(sal_Bool x)201cdf0e10cSrcweir void DataColumn::updateBoolean(sal_Bool x) throw( SQLException, RuntimeException ) 202cdf0e10cSrcweir { 203cdf0e10cSrcweir m_xColumnUpdate->updateBoolean(x); 204cdf0e10cSrcweir } 205cdf0e10cSrcweir updateByte(sal_Int8 x)206cdf0e10cSrcweir void DataColumn::updateByte(sal_Int8 x) throw( SQLException, RuntimeException ) 207cdf0e10cSrcweir { 208cdf0e10cSrcweir m_xColumnUpdate->updateByte(x); 209cdf0e10cSrcweir } 210cdf0e10cSrcweir updateShort(sal_Int16 x)211cdf0e10cSrcweir void DataColumn::updateShort(sal_Int16 x) throw( SQLException, RuntimeException ) 212cdf0e10cSrcweir { 213cdf0e10cSrcweir m_xColumnUpdate->updateShort(x); 214cdf0e10cSrcweir } 215cdf0e10cSrcweir updateInt(sal_Int32 x)216cdf0e10cSrcweir void DataColumn::updateInt(sal_Int32 x) throw( SQLException, RuntimeException ) 217cdf0e10cSrcweir { 218cdf0e10cSrcweir m_xColumnUpdate->updateInt(x); 219cdf0e10cSrcweir } 220cdf0e10cSrcweir updateLong(sal_Int64 x)221cdf0e10cSrcweir void DataColumn::updateLong(sal_Int64 x) throw( SQLException, RuntimeException ) 222cdf0e10cSrcweir { 223cdf0e10cSrcweir m_xColumnUpdate->updateLong(x); 224cdf0e10cSrcweir } 225cdf0e10cSrcweir updateFloat(float x)226cdf0e10cSrcweir void DataColumn::updateFloat(float x) throw( SQLException, RuntimeException ) 227cdf0e10cSrcweir { 228cdf0e10cSrcweir m_xColumnUpdate->updateFloat(x); 229cdf0e10cSrcweir } 230cdf0e10cSrcweir updateDouble(double x)231cdf0e10cSrcweir void DataColumn::updateDouble(double x) throw( SQLException, RuntimeException ) 232cdf0e10cSrcweir { 233cdf0e10cSrcweir m_xColumnUpdate->updateDouble(x); 234cdf0e10cSrcweir } 235cdf0e10cSrcweir updateString(const::rtl::OUString & x)236cdf0e10cSrcweir void DataColumn::updateString(const ::rtl::OUString& x) throw( SQLException, RuntimeException ) 237cdf0e10cSrcweir { 238cdf0e10cSrcweir m_xColumnUpdate->updateString(x); 239cdf0e10cSrcweir } 240cdf0e10cSrcweir updateBytes(const Sequence<sal_Int8> & x)241cdf0e10cSrcweir void DataColumn::updateBytes(const Sequence< sal_Int8 >& x) throw( SQLException, RuntimeException ) 242cdf0e10cSrcweir { 243cdf0e10cSrcweir m_xColumnUpdate->updateBytes(x); 244cdf0e10cSrcweir } 245cdf0e10cSrcweir updateDate(const com::sun::star::util::Date & x)246cdf0e10cSrcweir void DataColumn::updateDate(const com::sun::star::util::Date& x) throw( SQLException, RuntimeException ) 247cdf0e10cSrcweir { 248cdf0e10cSrcweir m_xColumnUpdate->updateDate(x); 249cdf0e10cSrcweir } 250cdf0e10cSrcweir updateTime(const com::sun::star::util::Time & x)251cdf0e10cSrcweir void DataColumn::updateTime(const com::sun::star::util::Time& x) throw( SQLException, RuntimeException ) 252cdf0e10cSrcweir { 253cdf0e10cSrcweir m_xColumnUpdate->updateTime(x); 254cdf0e10cSrcweir } 255cdf0e10cSrcweir updateTimestamp(const com::sun::star::util::DateTime & x)256cdf0e10cSrcweir void DataColumn::updateTimestamp(const com::sun::star::util::DateTime& x) throw( SQLException, RuntimeException ) 257cdf0e10cSrcweir { 258cdf0e10cSrcweir m_xColumnUpdate->updateTimestamp(x); 259cdf0e10cSrcweir } 260cdf0e10cSrcweir updateBinaryStream(const Reference<XInputStream> & x,sal_Int32 length)261cdf0e10cSrcweir void DataColumn::updateBinaryStream(const Reference< XInputStream>& x, sal_Int32 length) throw( SQLException, RuntimeException ) 262cdf0e10cSrcweir { 263cdf0e10cSrcweir m_xColumnUpdate->updateBinaryStream(x, length); 264cdf0e10cSrcweir } 265cdf0e10cSrcweir updateCharacterStream(const Reference<XInputStream> & x,sal_Int32 length)266cdf0e10cSrcweir void DataColumn::updateCharacterStream(const Reference< XInputStream>& x, sal_Int32 length) throw( SQLException, RuntimeException ) 267cdf0e10cSrcweir { 268cdf0e10cSrcweir m_xColumnUpdate->updateCharacterStream(x, length); 269cdf0e10cSrcweir } 270cdf0e10cSrcweir updateObject(const Any & x)271cdf0e10cSrcweir void DataColumn::updateObject(const Any& x) throw( SQLException, RuntimeException ) 272cdf0e10cSrcweir { 273cdf0e10cSrcweir m_xColumnUpdate->updateObject(x); 274cdf0e10cSrcweir } 275cdf0e10cSrcweir updateNumericObject(const Any & x,sal_Int32 scale)276cdf0e10cSrcweir void DataColumn::updateNumericObject(const Any& x, sal_Int32 scale) throw( SQLException, RuntimeException ) 277cdf0e10cSrcweir { 278cdf0e10cSrcweir m_xColumnUpdate->updateNumericObject(x, scale); 279cdf0e10cSrcweir } 280cdf0e10cSrcweir 281cdf0e10cSrcweir //.............................................................................. 282cdf0e10cSrcweir } // namespace svxform 283cdf0e10cSrcweir //.............................................................................. 284