fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / connectivity / source / drivers / kab / KResultSetMetaData.cxx
blobed384ba19801f7d839595cf04bd0431fd03e9f3b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include "KResultSetMetaData.hxx"
22 #include "kfields.hxx"
23 #include "KDatabaseMetaData.hxx"
24 #include <com/sun/star/sdbc/DataType.hpp>
26 using namespace connectivity::kab;
27 using namespace com::sun::star::uno;
28 using namespace com::sun::star::lang;
29 using namespace com::sun::star::sdbc;
31 KabResultSetMetaData::KabResultSetMetaData()
34 // -------------------------------------------------------------------------
35 KabResultSetMetaData::~KabResultSetMetaData()
38 // -------------------------------------------------------------------------
39 void KabResultSetMetaData::setKabFields(const ::rtl::Reference<connectivity::OSQLColumns> &xColumns) throw(SQLException)
41 OSQLColumns::Vector::const_iterator aIter;
42 static const OUString aName("Name");
44 for (aIter = xColumns->get().begin(); aIter != xColumns->get().end(); ++aIter)
46 OUString aFieldName;
47 sal_uInt32 nFieldNumber;
49 (*aIter)->getPropertyValue(aName) >>= aFieldName;
50 nFieldNumber = findKabField(aFieldName);
51 m_aKabFields.push_back(nFieldNumber);
54 // -------------------------------------------------------------------------
55 sal_Int32 SAL_CALL KabResultSetMetaData::getColumnDisplaySize(sal_Int32 column) throw(SQLException, RuntimeException)
57 return m_aKabFields[column - 1] < KAB_DATA_FIELDS? 20: 50;
59 // -------------------------------------------------------------------------
60 sal_Int32 SAL_CALL KabResultSetMetaData::getColumnType(sal_Int32 column) throw(SQLException, RuntimeException)
62 return m_aKabFields[column - 1] == KAB_FIELD_REVISION? DataType::TIMESTAMP: DataType::CHAR;
64 // -------------------------------------------------------------------------
65 sal_Int32 SAL_CALL KabResultSetMetaData::getColumnCount() throw(SQLException, RuntimeException)
67 return m_aKabFields.size();
69 // -------------------------------------------------------------------------
70 sal_Bool SAL_CALL KabResultSetMetaData::isCaseSensitive(sal_Int32) throw(SQLException, RuntimeException)
72 return sal_True;
74 // -------------------------------------------------------------------------
75 OUString SAL_CALL KabResultSetMetaData::getSchemaName(sal_Int32) throw(SQLException, RuntimeException)
77 return OUString();
79 // -------------------------------------------------------------------------
80 OUString SAL_CALL KabResultSetMetaData::getColumnName(sal_Int32 column) throw(SQLException, RuntimeException)
82 sal_uInt32 nFieldNumber = m_aKabFields[column - 1];
83 ::KABC::Field::List aFields = ::KABC::Field::allFields();
84 QString aQtName;
86 switch (nFieldNumber)
88 case KAB_FIELD_REVISION:
89 aQtName = KABC::Addressee::revisionLabel();
90 break;
91 default:
92 aQtName = aFields[nFieldNumber - KAB_DATA_FIELDS]->label();
94 OUString aName((const sal_Unicode *) aQtName.ucs2());
96 return aName;
98 // -------------------------------------------------------------------------
99 OUString SAL_CALL KabResultSetMetaData::getTableName(sal_Int32) throw(SQLException, RuntimeException)
101 return KabDatabaseMetaData::getAddressBookTableName();
103 // -------------------------------------------------------------------------
104 OUString SAL_CALL KabResultSetMetaData::getCatalogName(sal_Int32) throw(SQLException, RuntimeException)
106 return OUString();
108 // -------------------------------------------------------------------------
109 OUString SAL_CALL KabResultSetMetaData::getColumnTypeName(sal_Int32) throw(SQLException, RuntimeException)
111 return OUString();
113 // -------------------------------------------------------------------------
114 OUString SAL_CALL KabResultSetMetaData::getColumnLabel(sal_Int32) throw(SQLException, RuntimeException)
116 return OUString();
118 // -------------------------------------------------------------------------
119 OUString SAL_CALL KabResultSetMetaData::getColumnServiceName(sal_Int32) throw(SQLException, RuntimeException)
121 return OUString();
123 // -------------------------------------------------------------------------
124 sal_Bool SAL_CALL KabResultSetMetaData::isCurrency(sal_Int32) throw(SQLException, RuntimeException)
126 return sal_False;
128 // -------------------------------------------------------------------------
129 sal_Bool SAL_CALL KabResultSetMetaData::isAutoIncrement(sal_Int32) throw(SQLException, RuntimeException)
131 return sal_False;
133 // -------------------------------------------------------------------------
134 sal_Bool SAL_CALL KabResultSetMetaData::isSigned(sal_Int32) throw(SQLException, RuntimeException)
136 return sal_False;
138 // -------------------------------------------------------------------------
139 sal_Int32 SAL_CALL KabResultSetMetaData::getPrecision(sal_Int32) throw(SQLException, RuntimeException)
141 return 0;
143 // -----------------------------------------------------------------------------
144 sal_Int32 SAL_CALL KabResultSetMetaData::getScale(sal_Int32) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
146 return 0;
148 // -------------------------------------------------------------------------
149 sal_Int32 SAL_CALL KabResultSetMetaData::isNullable(sal_Int32) throw(SQLException, RuntimeException)
151 return (sal_Int32) sal_True;
152 // KDE address book currently does not use NULL values.
153 // But it might do it someday
155 // -------------------------------------------------------------------------
156 sal_Bool SAL_CALL KabResultSetMetaData::isSearchable(sal_Int32) throw(SQLException, RuntimeException)
158 return sal_True;
160 // -------------------------------------------------------------------------
161 sal_Bool SAL_CALL KabResultSetMetaData::isReadOnly(sal_Int32) throw(SQLException, RuntimeException)
163 return sal_True;
165 // -------------------------------------------------------------------------
166 sal_Bool SAL_CALL KabResultSetMetaData::isDefinitelyWritable(sal_Int32) throw(SQLException, RuntimeException)
168 return sal_False;
170 // -------------------------------------------------------------------------
171 sal_Bool SAL_CALL KabResultSetMetaData::isWritable(sal_Int32) throw(SQLException, RuntimeException)
173 return sal_False;
175 // -------------------------------------------------------------------------
177 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */