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