1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: sdbdatacolumn.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
33 #include "sdbdatacolumn.hxx"
35 //..............................................................................
38 //..............................................................................
40 using namespace ::com::sun::star::uno
;
41 using namespace ::com::sun::star::lang
;
42 using namespace ::com::sun::star::beans
;
43 using namespace ::com::sun::star::sdbc
;
44 using namespace ::com::sun::star::util
;
45 using namespace ::com::sun::star::io
;
46 using namespace ::com::sun::star::container
;
48 //==========================================================================
49 //= DataColumn - a class wrapping an object implementing a sdb::DataColumn service
50 //==========================================================================
51 DataColumn::DataColumn(const Reference
< ::com::sun::star::beans::XPropertySet
>& _rxIFace
)
53 m_xPropertySet
= _rxIFace
;
54 m_xColumn
= Reference
< ::com::sun::star::sdb::XColumn
>(_rxIFace
, UNO_QUERY
);
55 m_xColumnUpdate
= Reference
< ::com::sun::star::sdb::XColumnUpdate
>(_rxIFace
, UNO_QUERY
);
57 if (!m_xPropertySet
.is() || !m_xColumn
.is())
59 m_xPropertySet
= NULL
;
61 m_xColumnUpdate
= NULL
;
65 // Reference< XPropertySet>
66 Reference
< XPropertySetInfo
> DataColumn::getPropertySetInfo() const throw( RuntimeException
)
68 return m_xPropertySet
->getPropertySetInfo();
71 void DataColumn::setPropertyValue(const ::rtl::OUString
& aPropertyName
, const Any
& aValue
) throw( UnknownPropertyException
, PropertyVetoException
, IllegalArgumentException
, WrappedTargetException
, RuntimeException
)
73 m_xPropertySet
->setPropertyValue(aPropertyName
, aValue
);
76 Any
DataColumn::getPropertyValue(const ::rtl::OUString
& PropertyName
) const throw( UnknownPropertyException
, WrappedTargetException
, RuntimeException
)
78 return m_xPropertySet
->getPropertyValue(PropertyName
);
81 void DataColumn::addPropertyChangeListener(const ::rtl::OUString
& aPropertyName
, const Reference
< XPropertyChangeListener
>& xListener
) throw( UnknownPropertyException
, WrappedTargetException
, RuntimeException
)
83 m_xPropertySet
->addPropertyChangeListener(aPropertyName
, xListener
);
86 void DataColumn::removePropertyChangeListener(const ::rtl::OUString
& aPropertyName
, const Reference
< XPropertyChangeListener
>& aListener
) throw( UnknownPropertyException
, WrappedTargetException
, RuntimeException
)
88 m_xPropertySet
->removePropertyChangeListener(aPropertyName
, aListener
);
91 void DataColumn::addVetoableChangeListener(const ::rtl::OUString
& PropertyName
, const Reference
< XVetoableChangeListener
>& aListener
) throw( UnknownPropertyException
, WrappedTargetException
, RuntimeException
)
93 m_xPropertySet
->addVetoableChangeListener(PropertyName
, aListener
);
96 void DataColumn::removeVetoableChangeListener(const ::rtl::OUString
& PropertyName
, const Reference
< XVetoableChangeListener
>& aListener
) throw( UnknownPropertyException
, WrappedTargetException
, RuntimeException
)
98 m_xPropertySet
->removeVetoableChangeListener(PropertyName
, aListener
);
102 sal_Bool
DataColumn::wasNull() throw( SQLException
, RuntimeException
)
104 return m_xColumn
->wasNull();
107 ::rtl::OUString
DataColumn::getString() throw( SQLException
, RuntimeException
)
109 return m_xColumn
->getString();
112 sal_Bool
DataColumn::getBoolean() throw( SQLException
, RuntimeException
)
114 return m_xColumn
->getBoolean();
117 sal_Int8
DataColumn::getByte() throw( SQLException
, RuntimeException
)
119 return m_xColumn
->getByte();
122 sal_Int16
DataColumn::getShort() throw( SQLException
, RuntimeException
)
124 return m_xColumn
->getShort();
127 sal_Int32
DataColumn::getInt() throw( SQLException
, RuntimeException
)
129 return m_xColumn
->getInt();
132 sal_Int64
DataColumn::getLong() throw( SQLException
, RuntimeException
)
134 return m_xColumn
->getLong();
137 float DataColumn::getFloat() throw( SQLException
, RuntimeException
)
139 return m_xColumn
->getFloat();
142 double DataColumn::getDouble() throw( SQLException
, RuntimeException
)
144 return m_xColumn
->getDouble();
147 Sequence
< sal_Int8
> DataColumn::getBytes() throw( SQLException
, RuntimeException
)
149 return m_xColumn
->getBytes();
152 Date
DataColumn::getDate() throw( SQLException
, RuntimeException
)
154 return m_xColumn
->getDate();
157 Time
DataColumn::getTime() throw( SQLException
, RuntimeException
)
159 return m_xColumn
->getTime();
162 DateTime
DataColumn::getTimestamp() throw( SQLException
, RuntimeException
)
164 return m_xColumn
->getTimestamp();
167 Reference
< XInputStream
> DataColumn::getBinaryStream() throw( SQLException
, RuntimeException
)
169 return m_xColumn
->getBinaryStream();
172 Reference
< XInputStream
> DataColumn::getCharacterStream() throw( SQLException
, RuntimeException
)
174 return m_xColumn
->getCharacterStream();
177 Any
DataColumn::getObject(const Reference
< XNameAccess
>& typeMap
) throw( SQLException
, RuntimeException
)
179 return m_xColumn
->getObject(typeMap
);
182 Reference
< XRef
> DataColumn::getRef() throw( SQLException
, RuntimeException
)
184 return m_xColumn
->getRef();
187 Reference
< XBlob
> DataColumn::getBlob() throw( SQLException
, RuntimeException
)
189 return m_xColumn
->getBlob();
192 Reference
< XClob
> DataColumn::getClob() throw( SQLException
, RuntimeException
)
194 return m_xColumn
->getClob();
197 Reference
< XArray
> DataColumn::getArray() throw( SQLException
, RuntimeException
)
199 return m_xColumn
->getArray();
203 void DataColumn::updateNull() throw( SQLException
, RuntimeException
)
205 m_xColumnUpdate
->updateNull();
208 void DataColumn::updateBoolean(sal_Bool x
) throw( SQLException
, RuntimeException
)
210 m_xColumnUpdate
->updateBoolean(x
);
213 void DataColumn::updateByte(sal_Int8 x
) throw( SQLException
, RuntimeException
)
215 m_xColumnUpdate
->updateByte(x
);
218 void DataColumn::updateShort(sal_Int16 x
) throw( SQLException
, RuntimeException
)
220 m_xColumnUpdate
->updateShort(x
);
223 void DataColumn::updateInt(sal_Int32 x
) throw( SQLException
, RuntimeException
)
225 m_xColumnUpdate
->updateInt(x
);
228 void DataColumn::updateLong(sal_Int64 x
) throw( SQLException
, RuntimeException
)
230 m_xColumnUpdate
->updateLong(x
);
233 void DataColumn::updateFloat(float x
) throw( SQLException
, RuntimeException
)
235 m_xColumnUpdate
->updateFloat(x
);
238 void DataColumn::updateDouble(double x
) throw( SQLException
, RuntimeException
)
240 m_xColumnUpdate
->updateDouble(x
);
243 void DataColumn::updateString(const ::rtl::OUString
& x
) throw( SQLException
, RuntimeException
)
245 m_xColumnUpdate
->updateString(x
);
248 void DataColumn::updateBytes(const Sequence
< sal_Int8
>& x
) throw( SQLException
, RuntimeException
)
250 m_xColumnUpdate
->updateBytes(x
);
253 void DataColumn::updateDate(const com::sun::star::util::Date
& x
) throw( SQLException
, RuntimeException
)
255 m_xColumnUpdate
->updateDate(x
);
258 void DataColumn::updateTime(const Time
& x
) throw( SQLException
, RuntimeException
)
260 m_xColumnUpdate
->updateTime(x
);
263 void DataColumn::updateTimestamp(const DateTime
& x
) throw( SQLException
, RuntimeException
)
265 m_xColumnUpdate
->updateTimestamp(x
);
268 void DataColumn::updateBinaryStream(const Reference
< XInputStream
>& x
, sal_Int32 length
) throw( SQLException
, RuntimeException
)
270 m_xColumnUpdate
->updateBinaryStream(x
, length
);
273 void DataColumn::updateCharacterStream(const Reference
< XInputStream
>& x
, sal_Int32 length
) throw( SQLException
, RuntimeException
)
275 m_xColumnUpdate
->updateCharacterStream(x
, length
);
278 void DataColumn::updateObject(const Any
& x
) throw( SQLException
, RuntimeException
)
280 m_xColumnUpdate
->updateObject(x
);
283 void DataColumn::updateNumericObject(const Any
& x
, sal_Int32 scale
) throw( SQLException
, RuntimeException
)
285 m_xColumnUpdate
->updateNumericObject(x
, scale
);
288 //..............................................................................
289 } // namespace svxform
290 //..............................................................................