LibreOffice Module dbaccess (master) 1
dsntypes.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <config_java.h>
21#include <dsntypes.hxx>
23#include <o3tl/safeint.hxx>
24#include <o3tl/string_view.hxx>
25#include <osl/diagnose.h>
26#include <tools/wldcrd.hxx>
27#include <osl/file.hxx>
28#include <officecfg/Office/Common.hxx>
29#include <comphelper/string.hxx>
30#include <utility>
31
32namespace dbaccess
33{
34
35 using namespace ::com::sun::star;
36 using namespace ::com::sun::star::uno;
37 using namespace ::com::sun::star::beans;
38 using namespace ::com::sun::star::lang;
39
40 namespace
41 {
42 void lcl_extractHostAndPort(std::u16string_view _sUrl, OUString& _sHostname, sal_Int32& _nPortNumber)
43 {
44 if ( comphelper::string::getTokenCount(_sUrl, ':') >= 2 )
45 {
46 sal_Int32 nPos {0};
47 _sHostname = o3tl::getToken(_sUrl, 0, ':', nPos);
48 _nPortNumber = o3tl::toInt32(o3tl::getToken(_sUrl, 0, ':', nPos));
49 }
50 }
51 }
52// ODsnTypeCollection
53ODsnTypeCollection::ODsnTypeCollection(const css::uno::Reference< css::uno::XComponentContext >& _xContext)
54:m_aDriverConfig(_xContext)
55#if OSL_DEBUG_LEVEL > 0
56,m_nLivingIterators(0)
57#endif
58{
59 const uno::Sequence< OUString > aURLs = m_aDriverConfig.getURLs();
60 const OUString* pIter = aURLs.getConstArray();
61 const OUString* pEnd = pIter + aURLs.getLength();
62 for(;pIter != pEnd;++pIter )
63 {
64 m_aDsnPrefixes.push_back(*pIter);
66 }
67
68 OSL_ENSURE(m_aDsnTypesDisplayNames.size() == m_aDsnPrefixes.size(),
69 "ODsnTypeCollection::ODsnTypeCollection : invalid resources !");
70}
71
73{
74#if OSL_DEBUG_LEVEL > 0
75 OSL_ENSURE(0 == m_nLivingIterators, "ODsnTypeCollection::~ODsnTypeCollection : there are still living iterator objects!");
76#endif
77}
78
79OUString ODsnTypeCollection::getTypeDisplayName(std::u16string_view _sURL) const
80{
82}
83
84OUString ODsnTypeCollection::cutPrefix(std::u16string_view _sURL) const
85{
86 OUString sRet;
87 OUString sOldPattern;
88
89 // on Windows or with gen rendering, the urls may begin with an ~
90 std::u16string_view sCleanURL = comphelper::string::stripStart(_sURL, '~');
91
92 for (auto const& dsnPrefix : m_aDsnPrefixes)
93 {
94 WildCard aWildCard(dsnPrefix);
95 if ( sOldPattern.getLength() < dsnPrefix.getLength() && aWildCard.Matches(sCleanURL) )
96 {
97 // This relies on the fact that all patterns are of the form
98 // foo*
99 // that is, the very concept of "prefix" applies.
100 OUString prefix(comphelper::string::stripEnd(dsnPrefix, '*'));
101 OSL_ENSURE(o3tl::make_unsigned(prefix.getLength()) <= sCleanURL.size(), "How can A match B when A shorter than B?");
102 sRet = sCleanURL.substr(prefix.getLength());
103 sOldPattern = dsnPrefix;
104 }
105 }
106
107 return sRet;
108}
109
110OUString ODsnTypeCollection::getPrefix(std::u16string_view _sURL) const
111{
112 OUString sRet;
113 OUString sOldPattern;
114 for (auto const& dsnPrefix : m_aDsnPrefixes)
115 {
116 WildCard aWildCard(dsnPrefix);
117 if ( sOldPattern.getLength() < dsnPrefix.getLength() && aWildCard.Matches(_sURL) )
118 {
119 // This relies on the fact that all patterns are of the form
120 // foo*
121 // that is, the very concept of "prefix" applies.
122 sRet = comphelper::string::stripEnd(dsnPrefix, '*');
123 OSL_ENSURE(sRet.getLength() <= static_cast<sal_Int32>(_sURL.size()), "How can A match B when A shorter than B?");
124 sOldPattern = dsnPrefix;
125 }
126 }
127
128 return sRet;
129}
130
131bool ODsnTypeCollection::hasDriver( const char* _pAsciiPattern ) const
132{
133 OUString sPrefix( getPrefix( OUString::createFromAscii( _pAsciiPattern ) ) );
134 return !sPrefix.isEmpty();
135}
136
137bool ODsnTypeCollection::isConnectionUrlRequired(std::u16string_view _sURL) const
138{
139 OUString sRet;
140 OUString sOldPattern;
141 for (auto const& dsnPrefix : m_aDsnPrefixes)
142 {
143 WildCard aWildCard(dsnPrefix);
144 if ( sOldPattern.getLength() < dsnPrefix.getLength() && aWildCard.Matches(_sURL) )
145 {
146 sRet = dsnPrefix;
147 sOldPattern = dsnPrefix;
148 }
149 }
150 return !sRet.isEmpty() && sRet[sRet.getLength()-1] == '*';
151}
152
153OUString ODsnTypeCollection::getMediaType(std::u16string_view _sURL) const
154{
155 const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
156 return aFeatures.getOrDefault("MediaType",OUString());
157}
158
159OUString ODsnTypeCollection::getDatasourcePrefixFromMediaType(std::u16string_view _sMediaType,std::u16string_view _sExtension)
160{
161 OUString sURL, sFallbackURL;
162 const uno::Sequence< OUString > aURLs = m_aDriverConfig.getURLs();
163 const OUString* pIter = aURLs.getConstArray();
164 const OUString* pEnd = pIter + aURLs.getLength();
165 for(;pIter != pEnd;++pIter )
166 {
167 const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(*pIter);
168 if ( aFeatures.getOrDefault("MediaType",OUString()) == _sMediaType )
169 {
170 const OUString sFileExtension = aFeatures.getOrDefault("Extension",OUString());
171 if ( _sExtension == sFileExtension )
172 {
173 sURL = *pIter;
174 break;
175 }
176 if ( sFileExtension.isEmpty() && !_sExtension.empty() )
177 sFallbackURL = *pIter;
178 }
179 }
180
181 if ( sURL.isEmpty() && !sFallbackURL.isEmpty() )
182 sURL = sFallbackURL;
183
184 sURL = comphelper::string::stripEnd(sURL, '*');
185 return sURL;
186}
187
189{
190 return !( _sURL.startsWithIgnoreAsciiCase("sdbc:embedded:hsqldb")
191 || _sURL.startsWithIgnoreAsciiCase("sdbc:embedded:firebird")
192 || _sURL.startsWithIgnoreAsciiCase("sdbc:address:outlook")
193 || _sURL.startsWithIgnoreAsciiCase("sdbc:address:outlookexp")
194 || _sURL.startsWithIgnoreAsciiCase("sdbc:address:mozilla:")
195 || _sURL.startsWithIgnoreAsciiCase("sdbc:address:kab")
196 || _sURL.startsWithIgnoreAsciiCase("sdbc:address:evolution:local")
197 || _sURL.startsWithIgnoreAsciiCase("sdbc:address:evolution:groupwise")
198 || _sURL.startsWithIgnoreAsciiCase("sdbc:address:evolution:ldap")
199 || _sURL.startsWithIgnoreAsciiCase("sdbc:address:macab") );
200}
201
202void ODsnTypeCollection::extractHostNamePort(const OUString& _rDsn,OUString& _sDatabaseName,OUString& _rsHostname,sal_Int32& _nPortNumber) const
203{
204 OUString sUrl = cutPrefix(_rDsn);
205 if ( _rDsn.startsWithIgnoreAsciiCase("jdbc:oracle:thin:") )
206 {
207 lcl_extractHostAndPort(sUrl,_rsHostname,_nPortNumber);
208 const sal_Int32 nUrlTokens {comphelper::string::getTokenCount(sUrl, ':')};
209 if ( _rsHostname.isEmpty() && nUrlTokens == 2 )
210 {
211 _nPortNumber = -1;
212 _rsHostname = sUrl.getToken(0,':');
213 }
214 if ( !_rsHostname.isEmpty() )
215 _rsHostname = _rsHostname.copy(_rsHostname.lastIndexOf('@')+1);
216 _sDatabaseName = sUrl.copy(sUrl.lastIndexOf(':')+1);
217 }
218 else if ( _rDsn.startsWithIgnoreAsciiCase("sdbc:address:ldap:") )
219 {
220 lcl_extractHostAndPort(sUrl,_sDatabaseName,_nPortNumber);
221 }
222 else if ( _rDsn.startsWithIgnoreAsciiCase("sdbc:mysql:mysqlc:")
223 || _rDsn.startsWithIgnoreAsciiCase("sdbc:mysql:jdbc:") )
224 {
225 lcl_extractHostAndPort(sUrl,_rsHostname,_nPortNumber);
226
227 const sal_Int32 nUrlTokens {comphelper::string::getTokenCount(sUrl, '/')};
228 if ( _nPortNumber == -1 && _rsHostname.isEmpty() && nUrlTokens == 2 )
229 _rsHostname = sUrl.getToken(0,'/');
230 _sDatabaseName = sUrl.copy(sUrl.lastIndexOf('/')+1);
231 }
232 else if ( _rDsn.startsWithIgnoreAsciiCase("sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=")
233 || _rDsn.startsWithIgnoreAsciiCase("sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=") )
234 {
235 OUString sNewFileName;
236 if ( ::osl::FileBase::getFileURLFromSystemPath( sUrl, sNewFileName ) == ::osl::FileBase::E_None )
237 {
238 _sDatabaseName = sNewFileName;
239 }
240 }
241}
242
243OUString ODsnTypeCollection::getJavaDriverClass(std::u16string_view _sURL) const
244{
245 const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getProperties(_sURL);
246 return aFeatures.getOrDefault("JavaDriverClass",OUString());
247}
248
249bool ODsnTypeCollection::isFileSystemBased(std::u16string_view _sURL) const
250{
251 const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
252 return aFeatures.getOrDefault("FileSystemBased",false);
253}
254
255bool ODsnTypeCollection::supportsTableCreation(std::u16string_view _sURL) const
256{
257 const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
258 return aFeatures.getOrDefault("SupportsTableCreation",false);
259}
260
261bool ODsnTypeCollection::supportsColumnDescription(std::u16string_view _sURL) const
262{
263 const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
264 return aFeatures.getOrDefault("SupportsColumnDescription",false);
265}
266
267bool ODsnTypeCollection::supportsBrowsing(std::u16string_view _sURL) const
268{
269 const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
270 return aFeatures.getOrDefault("SupportsBrowsing",false);
271}
272
273bool ODsnTypeCollection::supportsDBCreation(std::u16string_view _sURL) const
274{
275 const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
276 return aFeatures.getOrDefault("SupportsDBCreation",false);
277}
278
279Sequence<PropertyValue> ODsnTypeCollection::getDefaultDBSettings( std::u16string_view _sURL ) const
280{
281 const ::comphelper::NamedValueCollection& aProperties = m_aDriverConfig.getProperties(_sURL);
282 return aProperties.getPropertyValues();
283}
284
285bool ODsnTypeCollection::isEmbeddedDatabase( std::u16string_view _sURL )
286{
287 return o3tl::starts_with( _sURL, u"sdbc:embedded:" );
288}
289
291{
292 if (!HAVE_FEATURE_JAVA || officecfg::Office::Common::Misc::ExperimentalMode::get())
293 return "sdbc:embedded:firebird";
294 else
295 return "sdbc:embedded:hsqldb";
296}
297
298
300{
301 OUString sDsn(comphelper::string::stripEnd(_rDsn, '*'));
302 sal_Int32 nSeparator = sDsn.indexOf(u':');
303 if (-1 == nSeparator)
304 {
305 if (!sDsn.isEmpty())
306 {
307 // there should be at least one such separator
308 OSL_FAIL("ODsnTypeCollection::implDetermineType : missing the colon !");
309 }
310
311 return DST_UNKNOWN;
312 }
313
314 // find first :
315 if (sDsn.startsWithIgnoreAsciiCase("jdbc:oracle:thin:"))
316 return DST_ORACLE_JDBC;
317
318 if (sDsn.startsWithIgnoreAsciiCase("jdbc:"))
319 return DST_JDBC;
320
321 if (sDsn.equalsIgnoreAsciiCase("sdbc:embedded:hsqldb"))
322 return DST_EMBEDDED_HSQLDB;
323
324 if (sDsn.equalsIgnoreAsciiCase("sdbc:embedded:firebird"))
326
327 if (sDsn.startsWithIgnoreAsciiCase("sdbc:embedded:"))
329
330 // find second :
331 nSeparator = sDsn.indexOf(u':', nSeparator + 1);
332 if (-1 == nSeparator)
333 {
334 // at the moment only jdbc is allowed to have just one separator
335 OSL_FAIL("ODsnTypeCollection::implDetermineType : missing the second colon !");
336 return DST_UNKNOWN;
337 }
338
339 if (sDsn.startsWithIgnoreAsciiCase("sdbc:ado:"))
340 {
341 if (sDsn.startsWithIgnoreAsciiCase("sdbc:ado:access:"))
342 {
343 if (sDsn.startsWithIgnoreAsciiCase("sdbc:ado:access:Provider=Microsoft.ACE.OLEDB.12.0;"))
344 return DST_MSACCESS_2007;
345 else
346 return DST_MSACCESS;
347 }
348 return DST_ADO;
349 }
350
351 struct KnownPrefix
352 {
353 const OUString sPrefix;
355 const bool bMatchComplete;
356
357 KnownPrefix( OUString _s, const DATASOURCE_TYPE _t, const bool _m )
358 :sPrefix(std::move( _s ))
359 ,eType ( _t )
360 ,bMatchComplete( _m )
361 {
362 }
363
364 bool match( const OUString &url) const
365 {
366 if(bMatchComplete)
367 {
368 return url.equalsIgnoreAsciiCase(sPrefix);
369 }
370 else
371 {
372 return url.startsWithIgnoreAsciiCase(sPrefix);
373 }
374 }
375 };
376 const KnownPrefix aKnowPrefixes[] =
377 {
378 KnownPrefix( "sdbc:calc:", DST_CALC, false ),
379 KnownPrefix( "sdbc:writer:", DST_WRITER, false ),
380 KnownPrefix( "sdbc:flat:", DST_FLAT, false ),
381 KnownPrefix( "sdbc:odbc:", DST_ODBC, false ),
382 KnownPrefix( "sdbc:dbase:", DST_DBASE, false ),
383 KnownPrefix( "sdbc:firebird:", DST_FIREBIRD, false ),
384 KnownPrefix( "sdbc:mysql:odbc:", DST_MYSQL_ODBC, false ),
385 KnownPrefix( "sdbc:mysql:jdbc:", DST_MYSQL_JDBC, false ),
386 KnownPrefix( "sdbc:mysql:mysqlc:", DST_MYSQL_NATIVE, false ),
387 KnownPrefix( "sdbc:mysqlc:", DST_MYSQL_NATIVE_DIRECT,false ),
388 KnownPrefix( "sdbc:postgresql:", DST_POSTGRES ,false ),
389
390 KnownPrefix( "sdbc:address:mozilla:", DST_MOZILLA, true ),
391 KnownPrefix( "sdbc:address:thunderbird:", DST_THUNDERBIRD, true ),
392 KnownPrefix( "sdbc:address:ldap:", DST_LDAP, true ),
393 KnownPrefix( "sdbc:address:outlook", DST_OUTLOOK, true ),
394 KnownPrefix( "sdbc:address:outlookexp", DST_OUTLOOKEXP, true ),
395 KnownPrefix( "sdbc:address:evolution:ldap", DST_EVOLUTION_LDAP, true ),
396 KnownPrefix( "sdbc:address:evolution:groupwise",DST_EVOLUTION_GROUPWISE,true ),
397 KnownPrefix( "sdbc:address:evolution:local", DST_EVOLUTION, true ),
398 KnownPrefix( "sdbc:address:kab", DST_KAB, true ),
399 KnownPrefix( "sdbc:address:macab", DST_MACAB, true )
400 };
401
402 for (const auto & aKnowPrefixe : aKnowPrefixes)
403 {
404 if( aKnowPrefixe.match(sDsn) )
405 {
406 return aKnowPrefixe.eType;
407 }
408 }
409
410 return DST_UNKNOWN;
411}
412
413void ODsnTypeCollection::fillPageIds(std::u16string_view _sURL,std::vector<sal_Int16>& _rOutPathIds) const
414{
416 switch(eType)
417 {
418 case DST_ADO:
419 _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_ADO);
420 break;
421 case DST_DBASE:
422 _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_DBASE);
423 break;
424 case DST_FLAT:
425 _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_TEXT);
426 break;
427 case DST_CALC:
428 case DST_WRITER:
429 _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_DOCUMENT_OR_SPREADSHEET);
430 break;
431 case DST_ODBC:
432 _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_ODBC);
433 break;
434 case DST_JDBC:
435 _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_JDBC);
436 break;
437 case DST_MYSQL_ODBC:
438 _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_MYSQL_INTRO);
439 _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_MYSQL_ODBC);
440 break;
441 case DST_MYSQL_JDBC:
442 _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_MYSQL_INTRO);
443 _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_MYSQL_JDBC);
444 break;
445 case DST_MYSQL_NATIVE:
446 _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_MYSQL_INTRO);
447 _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_MYSQL_NATIVE);
448 break;
449 case DST_ORACLE_JDBC:
450 _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_ORACLE);
451 break;
452 case DST_POSTGRES:
453 _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_POSTGRES);
454 break;
455 case DST_LDAP:
456 _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_LDAP);
457 break;
458 case DST_MSACCESS:
460 _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_MSACCESS);
461 break;
462 case DST_OUTLOOKEXP:
463 case DST_OUTLOOK:
464 case DST_MOZILLA:
465 case DST_THUNDERBIRD:
466 case DST_EVOLUTION:
469 case DST_KAB:
470 case DST_MACAB:
474 break;
475 default:
476 _rOutPathIds.push_back(PAGE_DBSETUPWIZARD_USERDEFINED);
477 break;
478 }
479}
480
481OUString ODsnTypeCollection::getType(std::u16string_view _sURL) const
482{
483 OUString sOldPattern;
484 for (auto const& dsnPrefix : m_aDsnPrefixes)
485 {
486 WildCard aWildCard(dsnPrefix);
487 if ( sOldPattern.getLength() < dsnPrefix.getLength() && aWildCard.Matches(_sURL) )
488 {
489 sOldPattern = dsnPrefix;
490 }
491 }
492 return sOldPattern;
493}
494
495sal_Int32 ODsnTypeCollection::getIndexOf(std::u16string_view _sURL) const
496{
497 sal_Int32 nRet = -1;
498 OUString sOldPattern;
499 sal_Int32 i = 0;
500 for (auto const& dsnPrefix : m_aDsnPrefixes)
501 {
502 WildCard aWildCard(dsnPrefix);
503 if ( sOldPattern.getLength() < dsnPrefix.getLength() && aWildCard.Matches(_sURL) )
504 {
505 nRet = i;
506 sOldPattern = dsnPrefix;
507 }
508 ++i;
509 }
510
511 return nRet;
512}
513
515{
516 return m_aDsnPrefixes.size();
517}
518
519// ODsnTypeCollection::TypeIterator
520ODsnTypeCollection::TypeIterator::TypeIterator(const ODsnTypeCollection* _pContainer, sal_Int32 _nInitialPos)
521 :m_pContainer(_pContainer)
522 ,m_nPosition(_nInitialPos)
523{
524 OSL_ENSURE(m_pContainer, "ODsnTypeCollection::TypeIterator::TypeIterator : invalid container!");
525#if OSL_DEBUG_LEVEL > 0
527#endif
528}
529
530ODsnTypeCollection::TypeIterator::TypeIterator(const TypeIterator& _rSource)
531 :m_pContainer(_rSource.m_pContainer)
532 ,m_nPosition(_rSource.m_nPosition)
533{
534#if OSL_DEBUG_LEVEL > 0
536#endif
537}
538
539ODsnTypeCollection::TypeIterator::~TypeIterator()
540{
541#if OSL_DEBUG_LEVEL > 0
542 --const_cast<ODsnTypeCollection*>(m_pContainer)->m_nLivingIterators;
543#endif
544}
545
546OUString const & ODsnTypeCollection::TypeIterator::getDisplayName() const
547{
548 OSL_ENSURE(m_nPosition < static_cast<sal_Int32>(m_pContainer->m_aDsnTypesDisplayNames.size()), "ODsnTypeCollection::TypeIterator::getDisplayName : invalid position!");
549 return m_pContainer->m_aDsnTypesDisplayNames[m_nPosition];
550}
551
552OUString const & ODsnTypeCollection::TypeIterator::getURLPrefix() const
553{
554 OSL_ENSURE(m_nPosition < static_cast<sal_Int32>(m_pContainer->m_aDsnPrefixes.size()), "ODsnTypeCollection::TypeIterator::getDisplayName : invalid position!");
555 return m_pContainer->m_aDsnPrefixes[m_nPosition];
556}
557
558const ODsnTypeCollection::TypeIterator& ODsnTypeCollection::TypeIterator::operator++()
559{
560 OSL_ENSURE(m_nPosition < static_cast<sal_Int32>(m_pContainer->m_aDsnTypesDisplayNames.size()), "ODsnTypeCollection::TypeIterator::operator++ : invalid position!");
561 if (m_nPosition < static_cast<sal_Int32>(m_pContainer->m_aDsnTypesDisplayNames.size()))
562 ++m_nPosition;
563 return *this;
564}
565
567{
568 return (lhs.m_pContainer == rhs.m_pContainer) && (lhs.m_nPosition == rhs.m_nPosition);
569}
570
571} // namespace dbaccess
572
573/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 m_nPosition
PropertiesInfo aProperties
bool Matches(std::u16string_view rStr) const
VALUE_TYPE getOrDefault(const OUString &_rValueName, const VALUE_TYPE &_rDefault) const
OUString getDriverTypeDisplayName(std::u16string_view _sUrl) const
css::uno::Sequence< OUString > getURLs() const
const ::comphelper::NamedValueCollection & getProperties(std::u16string_view _sURL) const
const ::comphelper::NamedValueCollection & getMetaData(std::u16string_view _sURL) const
std::vector< OUString > m_aDsnTypesDisplayNames
Definition: dsntypes.hxx:107
OUString getType(std::u16string_view _sURL) const
Definition: dsntypes.cxx:481
DATASOURCE_TYPE determineType(std::u16string_view _rDsn) const
Definition: dsntypes.cxx:299
OUString cutPrefix(std::u16string_view _sURL) const
on a given string, cut the type prefix and return the result
Definition: dsntypes.cxx:84
static OUString getEmbeddedDatabase()
Definition: dsntypes.cxx:290
bool supportsTableCreation(std::u16string_view _sURL) const
check if the given data source allows creation of tables
Definition: dsntypes.cxx:255
const ODsnTypeCollection * m_pContainer
Definition: dsntypes.hxx:198
bool hasDriver(const char *_pAsciiPattern) const
determines whether there is a driver for the given URL prefix/pattern
Definition: dsntypes.cxx:131
static bool isShowPropertiesEnabled(const OUString &_sURL)
Definition: dsntypes.cxx:188
bool isFileSystemBased(std::u16string_view _sURL) const
check if the given data source type is based on the file system - i.e. the URL is a prefix plus a fil...
Definition: dsntypes.cxx:249
OUString getMediaType(std::u16string_view _sURL) const
returns the media type of a file based database
Definition: dsntypes.cxx:153
static bool isEmbeddedDatabase(std::u16string_view _sURL)
checks if the given data source type embeds its data into the database document
Definition: dsntypes.cxx:285
OUString getPrefix(std::u16string_view _sURL) const
on a given string, return the type prefix
Definition: dsntypes.cxx:110
::connectivity::DriversConfig m_aDriverConfig
DSN prefixes which determine the type of a datasource.
Definition: dsntypes.hxx:109
bool supportsDBCreation(std::u16string_view _sURL) const
Definition: dsntypes.cxx:273
void fillPageIds(std::u16string_view _sURL, std::vector< sal_Int16 > &_rOutPathIds) const
Definition: dsntypes.cxx:413
friend class ODsnTypeCollection
Definition: dsntypes.hxx:192
OUString getTypeDisplayName(std::u16string_view _sURL) const
get the datasource type display name from a DSN string
Definition: dsntypes.cxx:79
sal_Int32 size() const
Definition: dsntypes.cxx:514
std::vector< OUString > m_aDsnPrefixes
user readable names for the datasource types
Definition: dsntypes.hxx:108
css::uno::Sequence< css::beans::PropertyValue > getDefaultDBSettings(std::u16string_view _sURL) const
returns default settings for newly created databases of the given type.
Definition: dsntypes.cxx:279
OUString getDatasourcePrefixFromMediaType(std::u16string_view _sMediaType, std::u16string_view _sExtension)
returns the dsn prefix for a given media type
Definition: dsntypes.cxx:159
void extractHostNamePort(const OUString &_rDsn, OUString &_sDatabaseName, OUString &_rHostname, sal_Int32 &_nPortNumber) const
Definition: dsntypes.cxx:202
bool supportsBrowsing(std::u16string_view _sURL) const
Definition: dsntypes.cxx:267
bool isConnectionUrlRequired(std::u16string_view _sURL) const
Definition: dsntypes.cxx:137
bool supportsColumnDescription(std::u16string_view _sURL) const
check if the given data source allows to show column description.
Definition: dsntypes.cxx:261
sal_Int32 getIndexOf(std::u16string_view _sURL) const
Definition: dsntypes.cxx:495
OUString getJavaDriverClass(std::u16string_view _sURL) const
on a given string, return the Java Driver Class
Definition: dsntypes.cxx:243
TypeIterator(const TypeIterator &_rSource)
#define PAGE_DBSETUPWIZARD_ADO
Definition: dsntypes.hxx:94
#define PAGE_DBSETUPWIZARD_MYSQL_INTRO
Definition: dsntypes.hxx:89
#define PAGE_DBSETUPWIZARD_MYSQL_NATIVE
Definition: dsntypes.hxx:100
#define PAGE_DBSETUPWIZARD_MSACCESS
Definition: dsntypes.hxx:86
#define PAGE_DBSETUPWIZARD_POSTGRES
Definition: dsntypes.hxx:101
#define PAGE_DBSETUPWIZARD_JDBC
Definition: dsntypes.hxx:93
#define PAGE_DBSETUPWIZARD_MYSQL_JDBC
Definition: dsntypes.hxx:90
#define PAGE_DBSETUPWIZARD_DOCUMENT_OR_SPREADSHEET
Definition: dsntypes.hxx:96
#define PAGE_DBSETUPWIZARD_LDAP
Definition: dsntypes.hxx:87
#define PAGE_DBSETUPWIZARD_DBASE
Definition: dsntypes.hxx:84
#define PAGE_DBSETUPWIZARD_MYSQL_ODBC
Definition: dsntypes.hxx:91
#define PAGE_DBSETUPWIZARD_USERDEFINED
Definition: dsntypes.hxx:99
#define PAGE_DBSETUPWIZARD_TEXT
Definition: dsntypes.hxx:85
#define PAGE_DBSETUPWIZARD_ODBC
Definition: dsntypes.hxx:95
#define PAGE_DBSETUPWIZARD_ORACLE
Definition: dsntypes.hxx:92
float u
OUString eType
Definition: generalpage.cxx:78
OUString sPrefix
sal_uInt16 nPos
if(aStr !=aBuf) UpdateName_Impl(m_xFollowLb.get()
OString stripEnd(const OString &rIn, char c)
OString stripStart(const OString &rIn, char c)
sal_Int32 getTokenCount(std::string_view rIn, char cTok)
bool match(const sal_Unicode *pWild, const sal_Unicode *pStr, const sal_Unicode cEscape)
bool operator==(const ODsnTypeCollection::TypeIterator &lhs, const ODsnTypeCollection::TypeIterator &rhs)
Definition: dsntypes.cxx:566
DATASOURCE_TYPE
known datasource types
Definition: dsntypes.hxx:36
@ DST_MSACCESS_2007
Definition: dsntypes.hxx:58
@ DST_MYSQL_JDBC
Definition: dsntypes.hxx:39
@ DST_CALC
Definition: dsntypes.hxx:42
@ DST_WRITER
Definition: dsntypes.hxx:65
@ DST_MOZILLA
Definition: dsntypes.hxx:48
@ DST_EVOLUTION
Definition: dsntypes.hxx:53
@ DST_EMBEDDED_UNKNOWN
Definition: dsntypes.hxx:66
@ DST_MSACCESS
Definition: dsntypes.hxx:37
@ DST_MYSQL_ODBC
Definition: dsntypes.hxx:38
@ DST_JDBC
Definition: dsntypes.hxx:45
@ DST_ODBC
Definition: dsntypes.hxx:46
@ DST_MYSQL_NATIVE
Definition: dsntypes.hxx:60
@ DST_LDAP
Definition: dsntypes.hxx:50
@ DST_DBASE
Definition: dsntypes.hxx:43
@ DST_FLAT
Definition: dsntypes.hxx:44
@ DST_OUTLOOKEXP
Definition: dsntypes.hxx:52
@ DST_ORACLE_JDBC
Definition: dsntypes.hxx:40
@ DST_POSTGRES
Definition: dsntypes.hxx:64
@ DST_EMBEDDED_FIREBIRD
Definition: dsntypes.hxx:63
@ DST_EVOLUTION_GROUPWISE
Definition: dsntypes.hxx:54
@ DST_UNKNOWN
unrecognized type
Definition: dsntypes.hxx:80
@ DST_OUTLOOK
Definition: dsntypes.hxx:51
@ DST_FIREBIRD
Definition: dsntypes.hxx:62
@ DST_EVOLUTION_LDAP
Definition: dsntypes.hxx:55
@ DST_THUNDERBIRD
Definition: dsntypes.hxx:49
@ DST_EMBEDDED_HSQLDB
Definition: dsntypes.hxx:59
@ DST_MYSQL_NATIVE_DIRECT
Definition: dsntypes.hxx:61
@ DST_MACAB
Definition: dsntypes.hxx:57
int i
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
constexpr bool starts_with(std::basic_string_view< charT, traits > sv, std::basic_string_view< charT, traits > x) noexcept
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
Reference< XComponentContext > _xContext