tdf#158198 sw: prevent xBookmark.getAnchor().setString("") from deleting
[LibreOffice.git] / connectivity / source / drivers / evoab2 / NResultSetMetaData.cxx
bloba828b127fe68a811ed80b2961f3266c47a437309
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 .
20 #include "NResultSetMetaData.hxx"
21 #include "NDatabaseMetaData.hxx"
22 #include <connectivity/dbexception.hxx>
23 #include <strings.hrc>
24 #include <utility>
26 using namespace connectivity::evoab;
27 using namespace com::sun::star::uno;
28 using namespace com::sun::star::sdbc;
30 OEvoabResultSetMetaData::OEvoabResultSetMetaData(OUString _aTableName)
31 : m_aTableName(std::move(_aTableName))
36 OEvoabResultSetMetaData::~OEvoabResultSetMetaData()
40 void OEvoabResultSetMetaData::setEvoabFields(const ::rtl::Reference<connectivity::OSQLColumns> &xColumns)
42 static constexpr OUStringLiteral aName = u"Name";
44 for (const auto& rxColumn : *xColumns)
46 OUString aFieldName;
48 rxColumn->getPropertyValue(aName) >>= aFieldName;
49 guint nFieldNumber = findEvoabField(aFieldName);
50 if (nFieldNumber == guint(-1))
52 connectivity::SharedResources aResource;
53 const OUString sError( aResource.getResourceStringWithSubstitution(
54 STR_INVALID_COLUMNNAME,
55 "$columnname$", aFieldName
56 ) );
57 ::dbtools::throwGenericSQLException( sError, *this );
59 m_aEvoabFields.push_back(nFieldNumber);
64 sal_Int32 SAL_CALL OEvoabResultSetMetaData::getColumnDisplaySize( sal_Int32 /*nColumnNum*/ )
66 return 50;
69 sal_Int32 SAL_CALL OEvoabResultSetMetaData::getColumnType( sal_Int32 nColumnNum )
71 sal_uInt32 nField = m_aEvoabFields[nColumnNum - 1];
72 return evoab::getFieldType (nField);
75 sal_Int32 SAL_CALL OEvoabResultSetMetaData::getColumnCount( )
77 return m_aEvoabFields.size();
80 sal_Bool SAL_CALL OEvoabResultSetMetaData::isCaseSensitive( sal_Int32 /*nColumnNum*/ )
82 return true;
85 OUString SAL_CALL OEvoabResultSetMetaData::getSchemaName( sal_Int32 /*nColumnNum*/ )
87 return OUString();
90 OUString SAL_CALL OEvoabResultSetMetaData::getColumnName( sal_Int32 nColumnNum )
92 sal_uInt32 nField = m_aEvoabFields[nColumnNum - 1];
93 return evoab::getFieldName( nField );
96 OUString SAL_CALL OEvoabResultSetMetaData::getColumnTypeName( sal_Int32 nColumnNum )
98 sal_uInt32 nField = m_aEvoabFields[nColumnNum - 1];
99 return evoab::getFieldTypeName( nField );
102 OUString SAL_CALL OEvoabResultSetMetaData::getColumnLabel( sal_Int32 nColumnNum )
104 return getColumnName(nColumnNum);
107 OUString SAL_CALL OEvoabResultSetMetaData::getColumnServiceName( sal_Int32 /*nColumnNum*/ )
109 return OUString();
112 OUString SAL_CALL OEvoabResultSetMetaData::getTableName( sal_Int32 /*nColumnNum*/ )
114 return m_aTableName;//OUString("TABLE");
117 OUString SAL_CALL OEvoabResultSetMetaData::getCatalogName( sal_Int32 /*nColumnNum*/ )
119 return OUString();
123 sal_Bool SAL_CALL OEvoabResultSetMetaData::isCurrency( sal_Int32 /*nColumnNum*/ )
125 return false;
128 sal_Bool SAL_CALL OEvoabResultSetMetaData::isAutoIncrement( sal_Int32 /*nColumnNum*/ )
130 return false;
133 sal_Bool SAL_CALL OEvoabResultSetMetaData::isSigned( sal_Int32 /*nColumnNum*/ )
135 return false;
138 sal_Int32 SAL_CALL OEvoabResultSetMetaData::getPrecision( sal_Int32 /*nColumnNum*/ )
140 return 0;
143 sal_Int32 SAL_CALL OEvoabResultSetMetaData::getScale( sal_Int32 /*nColumnNum*/ )
145 return 0;
148 sal_Int32 SAL_CALL OEvoabResultSetMetaData::isNullable( sal_Int32 /*nColumnNum*/ )
150 return 0;
153 sal_Bool SAL_CALL OEvoabResultSetMetaData::isSearchable( sal_Int32 /*nColumnNum*/ )
155 return true;
158 sal_Bool SAL_CALL OEvoabResultSetMetaData::isReadOnly( sal_Int32 /*nColumnNum*/ )
160 return true;
163 sal_Bool SAL_CALL OEvoabResultSetMetaData::isDefinitelyWritable( sal_Int32 /*nColumnNum*/ )
165 return false;
168 sal_Bool SAL_CALL OEvoabResultSetMetaData::isWritable( sal_Int32 /*nColumnNum*/ )
170 return false;
174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */