Tag: cws_src680_kaddrbook User: ebischoff Date: 05/09/13 11:20:47 Removed: /dba/connectivity/source/drivers/kab/ KCondition.cxx, KCondition.hxx
Added: /dba/connectivity/source/drivers/kab/ kcondition.cxx, kcondition.hxx, kfields.cxx, kfields.hxx Modified: /dba/connectivity/source/drivers/kab/ KDatabaseMetaData.cxx, KResultSet.cxx, KResultSetMetaData.cxx, KResultSetMetaData.hxx, KStatement.cxx, makefile.mk Log: - Added two new fields: "identifier" and "revision date". Now handling TIMESTAMP data type in addition to CHAR(256). - Renamed KCondition.* to kcondition.* so that my own files are clearly distinguished from the driver itself. File Changes: Directory: /dba/connectivity/source/drivers/kab/ ================================================ File [removed]: KCondition.cxx File [removed]: KCondition.hxx File [added]: kcondition.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/kab/kcondition.cxx?rev=1.1.2.1&content-type=text/vnd.viewcvs-markup Added lines: 0 -------------- File [added]: kcondition.hxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/kab/kcondition.hxx?rev=1.1.2.1&content-type=text/vnd.viewcvs-markup Added lines: 0 -------------- File [added]: kfields.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/kab/kfields.cxx?rev=1.1.2.1&content-type=text/vnd.viewcvs-markup Added lines: 0 -------------- File [added]: kfields.hxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/kab/kfields.hxx?rev=1.1.2.1&content-type=text/vnd.viewcvs-markup Added lines: 0 -------------- File [changed]: KDatabaseMetaData.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/kab/KDatabaseMetaData.cxx?r1=1.1.2.5&r2=1.1.2.6 Delta lines: +39 -11 --------------------- --- KDatabaseMetaData.cxx 12 Sep 2005 12:32:03 -0000 1.1.2.5 +++ KDatabaseMetaData.cxx 13 Sep 2005 18:20:38 -0000 1.1.2.6 @@ -2,9 +2,9 @@ * * $RCSfile: KDatabaseMetaData.cxx,v $ * - * $Revision: 1.1.2.5 $ + * $Revision: 1.1.2.6 $ * - * last change: $Author: ebischoff $ $Date: 2005/09/12 12:32:03 $ + * last change: $Author: ebischoff $ $Date: 2005/09/13 18:20:38 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -60,7 +60,9 @@ ************************************************************************/ #include "KDatabaseMetaData.hxx" -#include <kabc/field.h> +#ifndef _CONNECTIVITY_KAB_FIELDS_HXX_ +#include "kfields.hxx" +#endif #ifndef _CONNECTIVITY_FDATABASEMETADATARESULTSET_HXX_ #include "FDatabaseMetaDataResultSet.hxx" @@ -918,10 +920,6 @@ aRow[1] = ODatabaseMetaDataResultSet::getEmptyValue(); aRow[2] = ODatabaseMetaDataResultSet::getEmptyValue(); aRow[3] = new ORowSetValueDecorator(aAddresses); - aRow[5] = new ORowSetValueDecorator(DataType::CHAR); - aRow[6] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("CHAR")); - aRow[7] = new ORowSetValueDecorator((sal_Int32) 256); -// Might be VARCHAR and not CHAR[256]... aRow[8] = ODatabaseMetaDataResultSet::getEmptyValue(); aRow[9] = ODatabaseMetaDataResultSet::get0Value(); aRow[10] = new ORowSetValueDecorator((sal_Int32) 10); @@ -933,19 +931,49 @@ aRow[16] = new ORowSetValueDecorator((sal_Int32) 254); aRow[18] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("YES")); + sal_Int32 nPosition = 1; + QString aQtName; + ::rtl::OUString aName; + + aQtName = ::KABC::Addressee::uidLabel(); + aName = (const sal_Unicode *) aQtName.ucs2(); + if (match(columnNamePattern, aName, '\0')) + { + aRow[4] = new ORowSetValueDecorator(aName); + aRow[5] = new ORowSetValueDecorator(DataType::CHAR); + aRow[6] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("CHAR")); + aRow[7] = new ORowSetValueDecorator((sal_Int32) 16); + aRow[17] = new ORowSetValueDecorator(nPosition++); + aRows.push_back(aRow); + } + + aQtName = ::KABC::Addressee::revisionLabel(); + aName = (const sal_Unicode *) aQtName.ucs2(); + if (match(columnNamePattern, aName, '\0')) + { + aRow[4] = new ORowSetValueDecorator(aName); + aRow[5] = new ORowSetValueDecorator(DataType::TIMESTAMP); + aRow[6] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("TIMESTAMP")); + aRow[17] = new ORowSetValueDecorator(nPosition++); + aRows.push_back(aRow); + } + ::KABC::Field::List aFields = ::KABC::Field::allFields(); ::KABC::Field::List::iterator aField; - sal_Int32 nPosition; - for ( aField = aFields.begin(), nPosition = 1; + for ( aField = aFields.begin(); aField != aFields.end(); ++aField, ++nPosition) { - QString aQtName((*aField)->label()); - ::rtl::OUString aName((const sal_Unicode *) aQtName.ucs2()); + aQtName = (*aField)->label(); + aName = (const sal_Unicode *) aQtName.ucs2(); if (match(columnNamePattern, aName, '\0')) { aRow[4] = new ORowSetValueDecorator(aName); + aRow[5] = new ORowSetValueDecorator(DataType::CHAR); + aRow[6] = new ORowSetValueDecorator(::rtl::OUString::createFromAscii("CHAR")); + aRow[7] = new ORowSetValueDecorator((sal_Int32) 256); +// Might be VARCHAR and not CHAR[256]... aRow[17] = new ORowSetValueDecorator(nPosition); aRows.push_back(aRow); } File [changed]: KResultSet.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/kab/KResultSet.cxx?r1=1.1.2.6&r2=1.1.2.7 Delta lines: +139 -94 ---------------------- --- KResultSet.cxx 2 Sep 2005 15:22:52 -0000 1.1.2.6 +++ KResultSet.cxx 13 Sep 2005 18:20:39 -0000 1.1.2.7 @@ -2,9 +2,9 @@ * * $RCSfile: KResultSet.cxx,v $ * - * $Revision: 1.1.2.6 $ + * $Revision: 1.1.2.7 $ * - * last change: $Author: ebischoff $ $Date: 2005/09/02 15:22:52 $ + * last change: $Author: ebischoff $ $Date: 2005/09/13 18:20:39 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -67,9 +67,13 @@ #include "KConnection.hxx" #endif #ifndef _CONNECTIVITY_KAB_CONDITION_HXX_ -#include "KCondition.hxx" +#include "kcondition.hxx" +#endif +#ifndef _CONNECTIVITY_KAB_FIELDS_HXX_ +#include "kfields.hxx" #endif #include <kabc/addressbook.h> +#include <qdatetime.h> #ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ #include <com/sun/star/beans/PropertyAttribute.hpp> @@ -91,7 +95,6 @@ using namespace com::sun::star::beans; using namespace com::sun::star::sdbc; using namespace com::sun::star::sdbcx; -using namespace com::sun::star::container; using namespace com::sun::star::io; using namespace com::sun::star::util; @@ -156,6 +159,16 @@ return aRet; } // ------------------------------------------------------------------------- +void SAL_CALL KabResultSet::acquire() throw() +{ + KabResultSet_BASE::acquire(); +} +// ------------------------------------------------------------------------- +void SAL_CALL KabResultSet::release() throw() +{ + KabResultSet_BASE::release(); +} +// ------------------------------------------------------------------------- Sequence< Type > SAL_CALL KabResultSet::getTypes() throw(RuntimeException) { OTypeCollection aTypes( @@ -166,6 +179,11 @@ return comphelper::concatSequences(aTypes.getTypes(), KabResultSet_BASE::getTypes()); } // ------------------------------------------------------------------------- +::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL KabResultSet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) +{ + return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); +} +// ------------------------------------------------------------------------- sal_Int32 SAL_CALL KabResultSet::findColumn(const ::rtl::OUString& columnName) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); @@ -187,20 +205,45 @@ NULL); } // ------------------------------------------------------------------------- -Reference< XInputStream > SAL_CALL KabResultSet::getBinaryStream(sal_Int32 columnIndex) throw(SQLException, RuntimeException) +::rtl::OUString SAL_CALL KabResultSet::getString(sal_Int32 columnIndex) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); - return NULL; -} -// ------------------------------------------------------------------------- -Reference< XInputStream > SAL_CALL KabResultSet::getCharacterStream(sal_Int32 columnIndex) throw(SQLException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); + ::rtl::OUString aRet; + sal_Int32 nAddressees = m_aKabAddressees.size(); + ::KABC::Field::List aFields = ::KABC::Field::allFields(); - return NULL; + if (m_nRowPos != -1 && m_nRowPos != nAddressees && m_xMetaData.is()) + { + KabResultSetMetaData *pMeta = (KabResultSetMetaData *) m_xMetaData.get(); + sal_Int32 nFieldNumber = pMeta->fieldAtColumn(columnIndex); + QString aQtName; + + switch (nFieldNumber) + { + case KAB_FIELD_UID: + aQtName = m_aKabAddressees[m_nRowPos].uid(); + break; + case KAB_FIELD_REVISION: +// trigger an exception here +m_bWasNull = true; +return aRet; + default: + aQtName = aFields[nFieldNumber - KAB_DATA_FIELDS]->value(m_aKabAddressees[m_nRowPos]); + } +// KDE address book currently does not use NULL values. +// But it might do it someday + if (!aQtName.isNull()) + { + m_bWasNull = false; + aRet = ::rtl::OUString((const sal_Unicode *) aQtName.ucs2()); + return aRet; + } + } +// Trigger an exception ? + m_bWasNull = true; + return aRet; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL KabResultSet::getBoolean(sal_Int32 columnIndex) throw(SQLException, RuntimeException) @@ -220,30 +263,30 @@ return nRet; } // ------------------------------------------------------------------------- -Sequence< sal_Int8 > SAL_CALL KabResultSet::getBytes(sal_Int32 columnIndex) throw(SQLException, RuntimeException) +sal_Int16 SAL_CALL KabResultSet::getShort(sal_Int32 columnIndex) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); - return Sequence< sal_Int8 >(); + sal_Int16 nRet = 0; + return nRet; } // ------------------------------------------------------------------------- -Date SAL_CALL KabResultSet::getDate(sal_Int32 columnIndex) throw(SQLException, RuntimeException) +sal_Int32 SAL_CALL KabResultSet::getInt(sal_Int32 columnIndex) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); - Date nRet; + sal_Int32 nRet = 0; return nRet; } // ------------------------------------------------------------------------- -double SAL_CALL KabResultSet::getDouble(sal_Int32 columnIndex) throw(SQLException, RuntimeException) +sal_Int64 SAL_CALL KabResultSet::getLong(sal_Int32 columnIndex) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); - double nRet = 0; - return nRet; + return sal_Int64(); } // ------------------------------------------------------------------------- float SAL_CALL KabResultSet::getFloat(sal_Int32 columnIndex) throw(SQLException, RuntimeException) @@ -255,51 +298,81 @@ return nVal; } // ------------------------------------------------------------------------- -sal_Int32 SAL_CALL KabResultSet::getInt(sal_Int32 columnIndex) throw(SQLException, RuntimeException) +double SAL_CALL KabResultSet::getDouble(sal_Int32 columnIndex) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); - sal_Int32 nRet=0; + double nRet = 0; return nRet; } // ------------------------------------------------------------------------- -sal_Int32 SAL_CALL KabResultSet::getRow() throw(SQLException, RuntimeException) +Sequence< sal_Int8 > SAL_CALL KabResultSet::getBytes(sal_Int32 columnIndex) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); - return m_nRowPos; + return Sequence< sal_Int8 >(); } // ------------------------------------------------------------------------- -sal_Int64 SAL_CALL KabResultSet::getLong(sal_Int32 columnIndex) throw(SQLException, RuntimeException) +Date SAL_CALL KabResultSet::getDate(sal_Int32 columnIndex) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); - return sal_Int64(); + Date aRet; + return aRet; } // ------------------------------------------------------------------------- -Reference< XResultSetMetaData > SAL_CALL KabResultSet::getMetaData() throw(SQLException, RuntimeException) +Time SAL_CALL KabResultSet::getTime(sal_Int32 columnIndex) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); - if (!m_xMetaData.is()) - m_xMetaData = new KabResultSetMetaData(m_xStatement.get()->getOwnConnection()); - - return m_xMetaData; + Time nRet; + return nRet; } // ------------------------------------------------------------------------- -Reference< XArray > SAL_CALL KabResultSet::getArray(sal_Int32 columnIndex) throw(SQLException, RuntimeException) +DateTime SAL_CALL KabResultSet::getTimestamp(sal_Int32 columnIndex) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); - return NULL; + DateTime nRet; + sal_Int32 nAddressees = m_aKabAddressees.size(); + + if (m_nRowPos != -1 && m_nRowPos != nAddressees && m_xMetaData.is()) + { + KabResultSetMetaData *pMeta = (KabResultSetMetaData *) m_xMetaData.get(); + sal_Int32 nFieldNumber = pMeta->fieldAtColumn(columnIndex); + + if (nFieldNumber == KAB_FIELD_REVISION) + { + QDateTime nRevision(m_aKabAddressees[m_nRowPos].revision()); + + if (!nRevision.isNull()) + { + m_bWasNull = false; + nRet.Year = nRevision.date().year(); + nRet.Month = nRevision.date().month(); + nRet.Day = nRevision.date().day(); + nRet.Hours = nRevision.time().hour(); + nRet.Minutes = nRevision.time().minute(); + nRet.Seconds = nRevision.time().second(); + nRet.HundredthSeconds = nRevision.time().msec() / 10; + return nRet; + } + } + else + ; +// trigger an exception here + } +// Trigger an exception ? + m_bWasNull = true; + return nRet; } // ------------------------------------------------------------------------- -Reference< XClob > SAL_CALL KabResultSet::getClob(sal_Int32 columnIndex) throw(SQLException, RuntimeException) +Reference< XInputStream > SAL_CALL KabResultSet::getBinaryStream(sal_Int32 columnIndex) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); @@ -307,7 +380,7 @@ return NULL; } // ------------------------------------------------------------------------- -Reference< XBlob > SAL_CALL KabResultSet::getBlob(sal_Int32 columnIndex) throw(SQLException, RuntimeException) +Reference< XInputStream > SAL_CALL KabResultSet::getCharacterStream(sal_Int32 columnIndex) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); @@ -315,75 +388,55 @@ return NULL; } // ------------------------------------------------------------------------- -Reference< XRef > SAL_CALL KabResultSet::getRef(sal_Int32 columnIndex) throw(SQLException, RuntimeException) +Any SAL_CALL KabResultSet::getObject(sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); - return NULL; + return Any(); } // ------------------------------------------------------------------------- -Any SAL_CALL KabResultSet::getObject(sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& typeMap) throw(SQLException, RuntimeException) +Reference< XRef > SAL_CALL KabResultSet::getRef(sal_Int32 columnIndex) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); - return Any(); + return NULL; } // ------------------------------------------------------------------------- -sal_Int16 SAL_CALL KabResultSet::getShort(sal_Int32 columnIndex) throw(SQLException, RuntimeException) +Reference< XBlob > SAL_CALL KabResultSet::getBlob(sal_Int32 columnIndex) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); - sal_Int16 nRet=0; - return nRet; + return NULL; } // ------------------------------------------------------------------------- -::rtl::OUString SAL_CALL KabResultSet::getString(sal_Int32 columnIndex) throw(SQLException, RuntimeException) +Reference< XClob > SAL_CALL KabResultSet::getClob(sal_Int32 columnIndex) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); - ::rtl::OUString aRet; - sal_Int32 nAddressees = m_aKabAddressees.size(); - ::KABC::Field::List aFields = ::KABC::Field::allFields(); - - if (m_nRowPos != -1 && m_nRowPos != nAddressees && m_xMetaData.is()) - { - KabResultSetMetaData *pMeta = (KabResultSetMetaData *) m_xMetaData.get(); - sal_Int32 nFieldNumber = pMeta->fieldAtColumn(columnIndex); - QString aQtName(aFields[nFieldNumber]->value(m_aKabAddressees[m_nRowPos])); - - if (!aQtName.isNull()) - { - m_bWasNull = false; - aRet = ::rtl::OUString((const sal_Unicode *) aQtName.ucs2()); - return aRet; - } - } -// KDE address book currently does not use NULL values. -// But it might do it someday - m_bWasNull = true; - return aRet; + return NULL; } // ------------------------------------------------------------------------- -Time SAL_CALL KabResultSet::getTime(sal_Int32 columnIndex) throw(SQLException, RuntimeException) +Reference< XArray > SAL_CALL KabResultSet::getArray(sal_Int32 columnIndex) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); - Time nRet; - return nRet; + return NULL; } // ------------------------------------------------------------------------- -DateTime SAL_CALL KabResultSet::getTimestamp(sal_Int32 columnIndex) throw(SQLException, RuntimeException) +Reference< XResultSetMetaData > SAL_CALL KabResultSet::getMetaData() throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); - DateTime nRet; - return nRet; + if (!m_xMetaData.is()) + m_xMetaData = new KabResultSetMetaData(m_xStatement.get()->getOwnConnection()); + + return m_xMetaData; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL KabResultSet::isBeforeFirst() throw(SQLException, RuntimeException) @@ -486,6 +539,14 @@ return sal_True; } // ------------------------------------------------------------------------- +sal_Int32 SAL_CALL KabResultSet::getRow() throw(SQLException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); + + return m_nRowPos; +} +// ------------------------------------------------------------------------- sal_Bool SAL_CALL KabResultSet::absolute(sal_Int32 row) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); @@ -697,7 +758,6 @@ { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(KabResultSet_BASE::rBHelper.bDisposed); - } // ------------------------------------------------------------------------- void SAL_CALL KabResultSet::updateBinaryStream(sal_Int32 columnIndex, const Reference< XInputStream >& x, sal_Int32 length) throw(SQLException, RuntimeException) @@ -863,20 +923,5 @@ case PROPERTY_ID_FETCHSIZE: ; } -} -// ----------------------------------------------------------------------------- -void SAL_CALL KabResultSet::acquire() throw() -{ - KabResultSet_BASE::acquire(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL KabResultSet::release() throw() -{ - KabResultSet_BASE::release(); -} -// ----------------------------------------------------------------------------- -::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL KabResultSet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) -{ - return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); } // ----------------------------------------------------------------------------- File [changed]: KResultSetMetaData.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/kab/KResultSetMetaData.cxx?r1=1.1.2.1&r2=1.1.2.2 Delta lines: +24 -34 --------------------- --- KResultSetMetaData.cxx 29 Aug 2005 08:43:52 -0000 1.1.2.1 +++ KResultSetMetaData.cxx 13 Sep 2005 18:20:41 -0000 1.1.2.2 @@ -2,9 +2,9 @@ * * $RCSfile: KResultSetMetaData.cxx,v $ * - * $Revision: 1.1.2.1 $ + * $Revision: 1.1.2.2 $ * - * last change: $Author: ebischoff $ $Date: 2005/08/29 08:43:52 $ + * last change: $Author: ebischoff $ $Date: 2005/09/13 18:20:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -60,10 +60,13 @@ ************************************************************************/ #include "KResultSetMetaData.hxx" -#include <kabc/field.h> -#ifndef _DBHELPER_DBEXCEPTION_HXX_ -#include <connectivity/dbexception.hxx> +#ifndef _CONNECTIVITY_KAB_FIELDS_HXX_ +#include "kfields.hxx" +#endif + +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> #endif using namespace connectivity::kab; @@ -81,30 +84,6 @@ { } // ------------------------------------------------------------------------- -sal_uInt32 KabResultSetMetaData::findKabField(const ::rtl::OUString& columnName) throw(SQLException) -{ - // search the KDE address book field number of a given column name - - ::KABC::Field::List aFields = ::KABC::Field::allFields(); - ::KABC::Field::List::iterator aField; - sal_uInt32 nResult; - - for ( aField = aFields.begin(), nResult = 0; - aField != aFields.end(); - ++aField, ++nResult) - { - QString aQtName((*aField)->label()); - ::rtl::OUString aName((const sal_Unicode *) aQtName.ucs2()); - - if (aName == columnName) - return nResult; - } - - ::dbtools::throwGenericSQLException( - ::rtl::OUString::createFromAscii("Invalid column name: ") + columnName, - NULL); -} -// ------------------------------------------------------------------------- void KabResultSetMetaData::setKabFields(const ::vos::ORef<connectivity::OSQLColumns> &xColumns) throw(SQLException) { OSQLColumns::const_iterator aIter; @@ -123,13 +102,12 @@ // ------------------------------------------------------------------------- sal_Int32 SAL_CALL KabResultSetMetaData::getColumnDisplaySize(sal_Int32 column) throw(SQLException, RuntimeException) { - return 50; + return m_aKabFields[column - 1] < KAB_DATA_FIELDS? 20: 50; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL KabResultSetMetaData::getColumnType(sal_Int32 column) throw(SQLException, RuntimeException) { - return DataType::CHAR; -// KDE address book might support other types + return m_aKabFields[column - 1] == KAB_FIELD_REVISION? DataType::TIMESTAMP: DataType::CHAR; } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL KabResultSetMetaData::getColumnCount() throw(SQLException, RuntimeException) @@ -149,9 +127,21 @@ // ------------------------------------------------------------------------- ::rtl::OUString SAL_CALL KabResultSetMetaData::getColumnName(sal_Int32 column) throw(SQLException, RuntimeException) { - ::KABC::Field::List aFields = ::KABC::Field::allFields(); sal_uInt32 nFieldNumber = m_aKabFields[column - 1]; - QString aQtName(aFields[nFieldNumber]->label()); + ::KABC::Field::List aFields = ::KABC::Field::allFields(); + QString aQtName; + + switch (nFieldNumber) + { + case KAB_FIELD_UID: + aQtName = KABC::Addressee::uidLabel(); + break; + case KAB_FIELD_REVISION: + aQtName = KABC::Addressee::revisionLabel(); + break; + default: + aQtName = aFields[nFieldNumber - KAB_DATA_FIELDS]->label(); + } ::rtl::OUString aName((const sal_Unicode *) aQtName.ucs2()); return aName; File [changed]: KResultSetMetaData.hxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/kab/KResultSetMetaData.hxx?r1=1.1.2.1&r2=1.1.2.2 Delta lines: +9 -8 ------------------- --- KResultSetMetaData.hxx 29 Aug 2005 08:43:53 -0000 1.1.2.1 +++ KResultSetMetaData.hxx 13 Sep 2005 18:20:41 -0000 1.1.2.2 @@ -2,9 +2,9 @@ * * $RCSfile: KResultSetMetaData.hxx,v $ * - * $Revision: 1.1.2.1 $ + * $Revision: 1.1.2.2 $ * - * last change: $Author: ebischoff $ $Date: 2005/08/29 08:43:53 $ + * last change: $Author: ebischoff $ $Date: 2005/09/13 18:20:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -66,8 +66,8 @@ #include "KConnection.hxx" #endif -#ifndef _CONNECTIVITY_PARSE_SQLITERATOR_HXX_ -#include "connectivity/sqliterator.hxx" +#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_ +#include <connectivity/CommonTools.hxx> #endif #ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATA_HPP_ #include <com/sun/star/sdbc/XResultSetMetaData.hpp> @@ -75,6 +75,9 @@ #ifndef _CPPUHELPER_IMPLBASE1_HXX_ #include <cppuhelper/implbase1.hxx> #endif +#ifndef _VOS_REF_HXX_ +#include <vos/ref.hxx> +#endif namespace connectivity { @@ -101,8 +104,6 @@ inline operator ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > () throw() { return this; } - static sal_uInt32 findKabField( - const ::rtl::OUString& columnName) throw(::com::sun::star::sdbc::SQLException); void setKabFields( const ::vos::ORef<connectivity::OSQLColumns> &xColumns) throw(::com::sun::star::sdbc::SQLException); inline sal_uInt32 fieldAtColumn(sal_Int32 columnIndex) const File [changed]: KStatement.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/kab/KStatement.cxx?r1=1.1.2.6&r2=1.1.2.7 Delta lines: +3 -3 ------------------- --- KStatement.cxx 2 Sep 2005 14:09:53 -0000 1.1.2.6 +++ KStatement.cxx 13 Sep 2005 18:20:42 -0000 1.1.2.7 @@ -2,9 +2,9 @@ * * $RCSfile: KStatement.cxx,v $ * - * $Revision: 1.1.2.6 $ + * $Revision: 1.1.2.7 $ * - * last change: $Author: ebischoff $ $Date: 2005/09/02 14:09:53 $ + * last change: $Author: ebischoff $ $Date: 2005/09/13 18:20:42 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -73,7 +73,7 @@ #include "KResultSetMetaData.hxx" #endif #ifndef _CONNECTIVITY_KAB_CONDITION_HXX_ -#include "KCondition.hxx" +#include "kcondition.hxx" #endif #ifndef CONNECTIVITY_CONNECTION_HXX File [changed]: makefile.mk Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/kab/makefile.mk?r1=1.1.2.4&r2=1.1.2.5 Delta lines: +4 -3 ------------------- --- makefile.mk 31 Aug 2005 08:30:37 -0000 1.1.2.4 +++ makefile.mk 13 Sep 2005 18:20:42 -0000 1.1.2.5 @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.1.2.4 $ +# $Revision: 1.1.2.5 $ # -# last change: $Author: ebischoff $ $Date: 2005/08/31 08:30:37 $ +# last change: $Author: ebischoff $ $Date: 2005/09/13 18:20:42 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -90,7 +90,8 @@ $(SLO)$/KServices.obj \ $(SLO)$/KResultSetMetaData.obj \ $(SLO)$/KDriver.obj \ - $(SLO)$/KCondition.obj + $(SLO)$/kcondition.obj \ + $(SLO)$/kfields.obj \ CFLAGS+=$(KDE_CFLAGS) --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
