LibreOffice Module connectivity (master) 1
ODatabaseMetaData.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
21#include <odbc/OTools.hxx>
24#include <com/sun/star/sdbc/DataType.hpp>
25#include <com/sun/star/sdbc/ResultSetType.hpp>
26#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
27#include <com/sun/star/sdbc/TransactionIsolation.hpp>
29#include <rtl/ustrbuf.hxx>
30#include <sal/log.hxx>
31#include <o3tl/string_view.hxx>
32
33using namespace connectivity::odbc;
34using namespace com::sun::star::uno;
35using namespace com::sun::star::lang;
36using namespace com::sun::star::beans;
37using namespace com::sun::star::sdbc;
38
39ODatabaseMetaData::ODatabaseMetaData(const SQLHANDLE _pHandle,OConnection* _pCon)
40 : ::connectivity::ODatabaseMetaDataBase(_pCon,_pCon->getConnectionInfo())
41 ,m_aConnectionHandle(_pHandle)
42 ,m_pConnection(_pCon)
43 ,m_bUseCatalog(true)
44{
45 OSL_ENSURE(m_pConnection,"ODatabaseMetaData::ODatabaseMetaData: No connection set!");
47 {
48 osl_atomic_increment( &m_refCount );
49 try
50 {
52 }
53 catch(SQLException& )
54 { // doesn't matter here
55 }
56 osl_atomic_decrement( &m_refCount );
57 }
58}
59
61{
62}
63
65{
67 try
68 {
70 xRef = pResult;
71 pResult->openTypeInfo();
72 }
73 catch(SQLException&)
74 {
75 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTypeInfo);
76 }
77
78 return xRef;
79}
80
82{
84 if(!m_bUseCatalog)
85 {
86 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eCatalogs);
87 }
88 else
89 {
90 try
91 {
93 xRef = pResult;
94 pResult->openCatalogs();
95 }
96 catch(SQLException&)
97 {
98 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eCatalogs);
99 }
100 }
101
102 return xRef;
103}
104
106{
107 OUString aVal;
108 if ( m_bUseCatalog )
109 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_NAME_SEPARATOR,aVal,*this,m_pConnection->getTextEncoding());
110
111 return aVal;
112}
113
115{
117 try
118 {
120 xRef = pResult;
121 pResult->openSchemas();
122 }
123 catch(SQLException&)
124 {
125 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eSchemas);
126 }
127 return xRef;
128}
129
131 const Any& catalog, const OUString& schema, const OUString& table,
132 const OUString& columnNamePattern )
133{
135 try
136 {
138 xRef = pResult;
139 pResult->openColumnPrivileges(m_bUseCatalog ? catalog : Any(),schema,table,columnNamePattern);
140 }
141 catch(SQLException&)
142 {
143 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumnPrivileges);
144 }
145 return xRef;
146}
147
149 const Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern,
150 const OUString& columnNamePattern )
151{
153 try
154 {
156 xRef = pResult;
157 pResult->openColumns(m_bUseCatalog ? catalog : Any(),schemaPattern,tableNamePattern,columnNamePattern);
158 }
159 catch(SQLException&)
160 {
161 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eColumns);
162 }
163 return xRef;
164}
165
167 const Any& catalog, const OUString& schemaPattern,
168 const OUString& tableNamePattern, const Sequence< OUString >& types )
169{
171 try
172 {
174 xRef = pResult;
175 pResult->openTables(m_bUseCatalog ? catalog : Any(),schemaPattern,tableNamePattern,types);
176 }
177 catch(SQLException&)
178 {
179 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTables);
180 }
181 return xRef;
182}
183
185 const Any& catalog, const OUString& schemaPattern,
186 const OUString& procedureNamePattern, const OUString& columnNamePattern )
187{
189 try
190 {
192 xRef = pResult;
193 pResult->openProcedureColumns(m_bUseCatalog ? catalog : Any(),schemaPattern,procedureNamePattern,columnNamePattern);
194 }
195 catch(SQLException&)
196 {
197 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eProcedureColumns);
198 }
199 return xRef;
200}
201
203 const Any& catalog, const OUString& schemaPattern,
204 const OUString& procedureNamePattern )
205{
207 try
208 {
210 xRef = pResult;
211 pResult->openProcedures(m_bUseCatalog ? catalog : Any(),schemaPattern,procedureNamePattern);
212 }
213 catch(SQLException&)
214 {
215 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eProcedures);
216 }
217 return xRef;
218}
219
221 const Any& catalog, const OUString& schema, const OUString& table )
222{
224 bool bSuccess = false;
225 try
226 {
228 {
230 xRef = pResult;
231 pResult->openVersionColumns(m_bUseCatalog ? catalog : Any(),schema,table);
232 bSuccess = true;
233 }
234 }
235 catch(SQLException&)
236 {
237 }
238
239 if ( !bSuccess )
240 {
241 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eVersionColumns);
242 }
243
244 return xRef;
245}
246
248{
249 SQLUINTEGER nValue;
250 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_BINARY_LITERAL_LEN,nValue,*this);
251 return nValue;
252}
253
255{
256 SQLUINTEGER nValue;
258 return nValue;
259}
260
262{
263 SQLUSMALLINT nValue;
264 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_CATALOG_NAME_LEN,nValue,*this);
265 return nValue;
266}
267
269{
270 SQLUINTEGER nValue;
271 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_CHAR_LITERAL_LEN,nValue,*this);
272 return nValue;
273}
274
276{
277 SQLUSMALLINT nValue;
278 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMN_NAME_LEN,nValue,*this);
279 return nValue;
280}
281
283{
284 SQLUSMALLINT nValue;
285 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_INDEX,nValue,*this);
286 return nValue;
287}
288
290{
291 SQLUSMALLINT nValue;
292 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_CURSOR_NAME_LEN,nValue,*this);
293 return nValue;
294}
295
297{
298 SQLUSMALLINT nValue;
299 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_DRIVER_CONNECTIONS/*SQL_ACTIVE_CONNECTIONS*/,nValue,*this);
300 return nValue;
301}
302
304{
305 SQLUSMALLINT nValue;
306 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_TABLE,nValue,*this);
307 return nValue;
308}
309
311{
312 SQLUINTEGER nValue;
313 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_STATEMENT_LEN,nValue,*this);
314 return nValue;
315}
316
318{
319 SQLUSMALLINT nValue;
320 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_TABLE_NAME_LEN,nValue,*this);
321 return nValue;
322}
323
325{
326 SQLUSMALLINT nValue;
327 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_TABLES_IN_SELECT,nValue,*this);
328 return nValue;
329}
330
332 const Any& catalog, const OUString& schema, const OUString& table )
333{
335 try
336 {
338 xRef = pResult;
339 pResult->openExportedKeys(m_bUseCatalog ? catalog : Any(),schema,table);
340 }
341 catch(SQLException&)
342 {
343 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eExportedKeys);
344 }
345 return xRef;
346}
347
349 const Any& catalog, const OUString& schema, const OUString& table )
350{
352 try
353 {
355 xRef = pResult;
356 pResult->openImportedKeys(m_bUseCatalog ? catalog : Any(),schema,table);
357 }
358 catch(SQLException&)
359 {
360 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eImportedKeys);
361 }
362 return xRef;
363}
364
366 const Any& catalog, const OUString& schema, const OUString& table )
367{
369 try
370 {
372 xRef = pResult;
373 pResult->openPrimaryKeys(m_bUseCatalog ? catalog : Any(),schema,table);
374 }
375 catch(SQLException&)
376 {
377 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::ePrimaryKeys);
378 }
379 return xRef;
380}
381
383 const Any& catalog, const OUString& schema, const OUString& table,
384 sal_Bool unique, sal_Bool approximate )
385{
387 try
388 {
390 xRef = pResult;
391 pResult->openIndexInfo(m_bUseCatalog ? catalog : Any(),schema,table,unique,approximate);
392 }
393 catch(SQLException&)
394 {
395 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eIndexInfo);
396 }
397 return xRef;
398}
399
401 const Any& catalog, const OUString& schema, const OUString& table, sal_Int32 scope,
402 sal_Bool nullable )
403{
405 try
406 {
408 xRef = pResult;
409 pResult->openBestRowIdentifier(m_bUseCatalog ? catalog : Any(),schema,table,scope,nullable);
410 }
411 catch(SQLException&)
412 {
413 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eBestRowIdentifier);
414 }
415 return xRef;
416}
417
419 const Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern )
420{
422 {
423 return new OResultSetPrivileges(this,catalog,schemaPattern,tableNamePattern);
424 }
426 pResult->openTablePrivileges(m_bUseCatalog ? catalog : Any(),schemaPattern,tableNamePattern);
427 return pResult;
428}
429
431 const Any& primaryCatalog, const OUString& primarySchema,
432 const OUString& primaryTable, const Any& foreignCatalog,
433 const OUString& foreignSchema, const OUString& foreignTable )
434{
436 try
437 {
439 xRef = pResult;
440 pResult->openForeignKeys(m_bUseCatalog ? primaryCatalog : Any(),primarySchema.toChar() == '%' ? &primarySchema : nullptr,&primaryTable,
441 m_bUseCatalog ? foreignCatalog : Any(), foreignSchema.toChar() == '%' ? &foreignSchema : nullptr,&foreignTable);
442 }
443 catch(SQLException&)
444 {
445 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eCrossReference);
446 }
447 return xRef;
448}
449
451{
452 OUString aVal;
453 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_ROW_SIZE_INCLUDES_LONG,aVal,*this,m_pConnection->getTextEncoding());
454 return aVal.toChar() == 'Y';
455}
456
458{
459 SQLUSMALLINT nValue;
460 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_QUOTED_IDENTIFIER_CASE,nValue,*this);
461 return nValue == SQL_IC_LOWER;
462}
463
465{
466 SQLUSMALLINT nValue;
467 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_CASE,nValue,*this);
468 return nValue == SQL_IC_LOWER;
469}
470
472{
473 SQLUSMALLINT nValue;
474 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_QUOTED_IDENTIFIER_CASE,nValue,*this);
475 return nValue == SQL_IC_MIXED;
476}
477
479{
480 SQLUSMALLINT nValue;
481 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_CASE,nValue,*this);
482 return nValue == SQL_IC_MIXED;
483}
484
486{
487 SQLUSMALLINT nValue;
488 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_QUOTED_IDENTIFIER_CASE,nValue,*this);
489 return nValue == SQL_IC_UPPER;
490}
491
493{
494 SQLUSMALLINT nValue;
495 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_CASE,nValue,*this);
496 return nValue == SQL_IC_UPPER;
497}
498
500{
501 SQLUINTEGER nValue;
503 return (nValue & SQL_AT_ADD_COLUMN) == SQL_AT_ADD_COLUMN;
504}
505
507{
508 SQLUINTEGER nValue;
510 return ((nValue & SQL_AT_DROP_COLUMN) == SQL_AT_DROP_COLUMN) ||
511 ((nValue & SQL_AT_DROP_COLUMN_CASCADE) == SQL_AT_DROP_COLUMN_CASCADE) ||
512 ((nValue & SQL_AT_DROP_COLUMN_RESTRICT) == SQL_AT_DROP_COLUMN_RESTRICT);
513}
514
516{
517 SQLUINTEGER nValue;
519 return nValue;
520}
521
523{
524 SQLUSMALLINT nValue;
525 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NON_NULLABLE_COLUMNS,nValue,*this);
526 return nValue == SQL_NNC_NON_NULL;
527}
528
530{
531 OUString aVal;
532 if(m_bUseCatalog)
534 return aVal;
535}
536
538{
539 OUString aVal;
540 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_QUOTE_CHAR,aVal,*this,m_pConnection->getTextEncoding());
541 return aVal;
542}
543
545{
546 OUString aVal;
548 return aVal;
549}
550
552{
553 SQLUSMALLINT nValue;
554 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
555 return nValue != SQL_CN_NONE;
556}
557
559{
560 SQLUSMALLINT nValue=0;
561 if ( m_bUseCatalog )
562 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CATALOG_LOCATION,nValue,*this);
563 return nValue == SQL_CL_START;
564}
565
567{
568 SQLUSMALLINT nValue;
570 return nValue == SQL_TC_DDL_IGNORE;
571}
572
574{
575 SQLUSMALLINT nValue;
577 return nValue == SQL_TC_DDL_COMMIT;
578}
579
581{
582 SQLUSMALLINT nValue;
584 return nValue == SQL_TC_DML;
585}
586
588{
589 SQLUSMALLINT nValue;
591 return nValue == SQL_TC_ALL;
592}
593
595{
596 SQLUINTEGER nValue;
597 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DYNAMIC_CURSOR_ATTRIBUTES1,nValue,*this);
598 return (nValue & SQL_CA1_POS_DELETE) == SQL_CA1_POS_DELETE;
599}
600
602{
603 SQLUINTEGER nValue;
604 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DYNAMIC_CURSOR_ATTRIBUTES1,nValue,*this);
605 return (nValue & SQL_CA1_POS_UPDATE) == SQL_CA1_POS_UPDATE;
606}
607
609{
610 SQLUSMALLINT nValue;
611 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_ROLLBACK_BEHAVIOR,nValue,*this);
612 return nValue == SQL_CB_PRESERVE || nValue == SQL_CB_CLOSE;
613}
614
616{
617 SQLUSMALLINT nValue;
618 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_COMMIT_BEHAVIOR,nValue,*this);
619 return nValue == SQL_CB_PRESERVE || nValue == SQL_CB_CLOSE;
620}
621
623{
624 SQLUSMALLINT nValue;
625 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_COMMIT_BEHAVIOR,nValue,*this);
626 return nValue == SQL_CB_PRESERVE;
627}
628
630{
631 SQLUSMALLINT nValue;
632 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_ROLLBACK_BEHAVIOR,nValue,*this);
633 return nValue == SQL_CB_PRESERVE;
634}
635
637{
638 SQLUINTEGER nValue;
639 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TXN_ISOLATION_OPTION,nValue,*this);
640 return (nValue & static_cast<SQLUINTEGER>(level)) == static_cast<SQLUINTEGER>(level);
641}
642
644{
645 SQLUINTEGER nValue;
647 return (nValue & SQL_SU_DML_STATEMENTS) == SQL_SU_DML_STATEMENTS;
648}
649
651{
652 SQLUINTEGER nValue;
653 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SQL_CONFORMANCE,nValue,*this);
654 return static_cast<bool>(nValue & SQL_SC_SQL92_FULL);
655}
656
658{
659 SQLUINTEGER nValue;
660 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SQL_CONFORMANCE,nValue,*this);
661 return static_cast<bool>(nValue &SQL_SC_SQL92_ENTRY);
662}
663
665{
666 OUString aStr;
668 return aStr.toChar() == 'Y';
669}
670
672{
673 SQLUINTEGER nValue;
675 return (nValue & SQL_SU_INDEX_DEFINITION) == SQL_SU_INDEX_DEFINITION;
676}
677
679{
680 SQLUINTEGER nValue;
682 return (nValue & SQL_SU_TABLE_DEFINITION) == SQL_SU_TABLE_DEFINITION;
683}
684
686{
687 SQLUINTEGER nValue=0;
688 if(m_bUseCatalog)
690 return (nValue & SQL_CU_TABLE_DEFINITION) == SQL_CU_TABLE_DEFINITION;
691}
692
694{
695 SQLUINTEGER nValue=0;
696 if(m_bUseCatalog)
698 return (nValue & SQL_CU_INDEX_DEFINITION) == SQL_CU_INDEX_DEFINITION;
699}
700
702{
703 SQLUINTEGER nValue=0;
704 if(m_bUseCatalog)
706 return (nValue & SQL_CU_DML_STATEMENTS) == SQL_CU_DML_STATEMENTS;
707}
708
710{
711 SQLUINTEGER nValue;
712 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_OJ_CAPABILITIES,nValue,*this);
713 return ((nValue & (SQL_OJ_FULL|SQL_OJ_LEFT|SQL_OJ_RIGHT|SQL_OJ_NESTED|SQL_OJ_NOT_ORDERED|SQL_OJ_ALL_COMPARISON_OPS|SQL_OJ_INNER)) != 0);
714}
715
717{
719 try
720 {
722 xRef = pResult;
723 pResult->openTablesTypes();
724 }
725 catch(SQLException&)
726 {
727 xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes);
728 }
729 return xRef;
730}
731
733{
734 SQLUSMALLINT nValue;
735 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_CONCURRENT_ACTIVITIES,nValue,*this);
736 return nValue;
737}
738
740{
741 SQLUSMALLINT nValue;
742 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_PROCEDURE_NAME_LEN,nValue,*this);
743 return nValue;
744}
745
747{
748 SQLUSMALLINT nValue;
749 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_SCHEMA_NAME_LEN,nValue,*this);
750 return nValue;
751}
752
754{
755 SQLUSMALLINT nValue;
757 return nValue != SQL_TC_NONE;
758}
759
761{
762 OUString aValue;
763 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ACCESSIBLE_PROCEDURES,aValue,*this,m_pConnection->getTextEncoding());
764 return aValue.toChar() == 'Y';
765}
766
768{
769 OUString aValue;
771 return aValue.toChar() == 'Y';
772}
773
775{
776 SQLUINTEGER nValue;
777 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DYNAMIC_CURSOR_ATTRIBUTES1,nValue,*this);
778 return (nValue & SQL_CA1_POSITIONED_UPDATE) == SQL_CA1_POSITIONED_UPDATE;
779}
780
782{
783 OUString aValue;
785 return aValue.toChar() == 'Y';
786}
787
789{
790 return m_pConnection->isReadOnly();
791}
792
794{
795 SQLUSMALLINT nValue;
797 return nValue == SQL_FILE_CATALOG;
798}
799
801{
802 SQLUSMALLINT nValue;
804 return nValue == SQL_FILE_TABLE;
805}
806
808{
809 SQLUINTEGER nValue;
810 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_FUNCTIONS,nValue,*this);
811 return (nValue & SQL_FN_CVT_CONVERT) == SQL_FN_CVT_CONVERT;
812}
813
815{
816 SQLUSMALLINT nValue;
817 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONCAT_NULL_BEHAVIOR,nValue,*this);
818 return nValue == SQL_CB_NULL;
819}
820
822{
823 OUString aValue;
825 return aValue.toChar() == 'Y';
826}
827
829{
830 SQLUSMALLINT nValue;
831 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
832 return nValue != SQL_CN_NONE;
833}
834
835sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 fromType, sal_Int32 toType )
836{
837 if(fromType == toType)
838 return true;
839
840 SQLUINTEGER nValue=0;
841 switch(fromType)
842 {
843 case DataType::BIT:
845 break;
846 case DataType::TINYINT:
847 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_TINYINT,nValue,*this);
848 break;
849 case DataType::SMALLINT:
850 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_SMALLINT,nValue,*this);
851 break;
852 case DataType::INTEGER:
853 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_INTEGER,nValue,*this);
854 break;
855 case DataType::BIGINT:
857 break;
858 case DataType::FLOAT:
860 break;
861 case DataType::REAL:
863 break;
864 case DataType::DOUBLE:
866 break;
867 case DataType::NUMERIC:
868 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_NUMERIC,nValue,*this);
869 break;
870 case DataType::DECIMAL:
871 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_DECIMAL,nValue,*this);
872 break;
873 case DataType::CHAR:
875 break;
876 case DataType::VARCHAR:
877 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_VARCHAR,nValue,*this);
878 break;
879 case DataType::LONGVARCHAR:
880 case DataType::CLOB:
881 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_LONGVARCHAR,nValue,*this);
882 break;
883 case DataType::DATE:
885 break;
886 case DataType::TIME:
888 break;
889 case DataType::TIMESTAMP:
890 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_TIMESTAMP,nValue,*this);
891 break;
892 case DataType::BINARY:
894 break;
895 case DataType::VARBINARY:
896 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_VARBINARY,nValue,*this);
897 break;
898 case DataType::LONGVARBINARY:
899 case DataType::BLOB:
900 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CONVERT_LONGVARBINARY,nValue,*this);
901 break;
902 case DataType::SQLNULL:
903 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
904 break;
905 case DataType::OTHER:
906 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
907 break;
908 case DataType::OBJECT:
909 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
910 break;
911 case DataType::DISTINCT:
912 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
913 break;
914 case DataType::STRUCT:
915 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
916 break;
917 case DataType::ARRAY:
918 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
919 break;
920 case DataType::REF:
921 // OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CORRELATION_NAME,nValue,*this);
922 break;
923 }
924 bool bConvert = false;
925 switch(toType)
926 {
927 case DataType::BIT:
928 bConvert = (nValue & SQL_CVT_BIT) == SQL_CVT_BIT;
929 break;
930 case DataType::TINYINT:
931 bConvert = (nValue & SQL_CVT_TINYINT) == SQL_CVT_TINYINT;
932 break;
933 case DataType::SMALLINT:
934 bConvert = (nValue & SQL_CVT_SMALLINT) == SQL_CVT_SMALLINT;
935 break;
936 case DataType::INTEGER:
937 bConvert = (nValue & SQL_CVT_INTEGER) == SQL_CVT_INTEGER;
938 break;
939 case DataType::BIGINT:
940 bConvert = (nValue & SQL_CVT_BIGINT) == SQL_CVT_BIGINT;
941 break;
942 case DataType::FLOAT:
943 bConvert = (nValue & SQL_CVT_FLOAT) == SQL_CVT_FLOAT;
944 break;
945 case DataType::REAL:
946 bConvert = (nValue & SQL_CVT_REAL) == SQL_CVT_REAL;
947 break;
948 case DataType::DOUBLE:
949 bConvert = (nValue & SQL_CVT_DOUBLE) == SQL_CVT_DOUBLE;
950 break;
951 case DataType::NUMERIC:
952 bConvert = (nValue & SQL_CVT_NUMERIC) == SQL_CVT_NUMERIC;
953 break;
954 case DataType::DECIMAL:
955 bConvert = (nValue & SQL_CVT_DECIMAL) == SQL_CVT_DECIMAL;
956 break;
957 case DataType::CHAR:
958 bConvert = (nValue & SQL_CVT_CHAR) == SQL_CVT_CHAR;
959 break;
960 case DataType::VARCHAR:
961 bConvert = (nValue & SQL_CVT_VARCHAR) == SQL_CVT_VARCHAR;
962 break;
963 case DataType::LONGVARCHAR:
964 case DataType::CLOB:
965 bConvert = (nValue & SQL_CVT_LONGVARCHAR) == SQL_CVT_LONGVARCHAR;
966 break;
967 case DataType::DATE:
968 bConvert = (nValue & SQL_CVT_DATE) == SQL_CVT_DATE;
969 break;
970 case DataType::TIME:
971 bConvert = (nValue & SQL_CVT_TIME) == SQL_CVT_TIME;
972 break;
973 case DataType::TIMESTAMP:
974 bConvert = (nValue & SQL_CVT_TIMESTAMP) == SQL_CVT_TIMESTAMP;
975 break;
976 case DataType::BINARY:
977 bConvert = (nValue & SQL_CVT_BINARY) == SQL_CVT_BINARY;
978 break;
979 case DataType::VARBINARY:
980 bConvert = (nValue & SQL_CVT_VARBINARY) == SQL_CVT_VARBINARY;
981 break;
982 case DataType::LONGVARBINARY:
983 case DataType::BLOB:
984 bConvert = (nValue & SQL_CVT_LONGVARBINARY) == SQL_CVT_LONGVARBINARY;
985 break;
986 }
987
988 return bConvert;
989}
990
992{
993 OUString aValue;
994 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_EXPRESSIONS_IN_ORDERBY,aValue,*this,m_pConnection->getTextEncoding());
995 return aValue.toChar() == 'Y';
996}
997
999{
1000 SQLUSMALLINT nValue;
1002 return nValue != SQL_GB_NOT_SUPPORTED;
1003}
1004
1006{
1007 SQLUSMALLINT nValue;
1009 return nValue != SQL_GB_GROUP_BY_CONTAINS_SELECT;
1010}
1011
1013{
1014 SQLUSMALLINT nValue;
1016 return nValue == SQL_GB_NO_RELATION;
1017}
1018
1020{
1021 OUString aValue;
1022 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MULTIPLE_ACTIVE_TXN,aValue,*this,m_pConnection->getTextEncoding());
1023 return aValue.toChar() == 'Y';
1024}
1025
1027{
1028 OUString aValue;
1030 return aValue.toChar() == 'Y';
1031}
1032
1034{
1035 OUString aValue;
1036 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_LIKE_ESCAPE_CLAUSE,aValue,*this,m_pConnection->getTextEncoding());
1037 return aValue.toChar() == 'Y';
1038}
1039
1041{
1042 OUString aValue;
1043 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ORDER_BY_COLUMNS_IN_SELECT,aValue,*this,m_pConnection->getTextEncoding());
1044 return aValue.toChar() == 'N';
1045}
1046
1048{
1049 SQLUINTEGER nValue;
1051 return (nValue & SQL_U_UNION) == SQL_U_UNION;
1052}
1053
1055{
1056 SQLUINTEGER nValue;
1058 return (nValue & SQL_U_UNION_ALL) == SQL_U_UNION_ALL;
1059}
1060
1062{
1063 SQLUSMALLINT nValue;
1064 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_IDENTIFIER_CASE,nValue,*this);
1065 return nValue == SQL_IC_MIXED;
1066}
1067
1069{
1070 SQLUSMALLINT nValue;
1071 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_QUOTED_IDENTIFIER_CASE,nValue,*this);
1072 return nValue == SQL_IC_MIXED;
1073}
1074
1076{
1077 SQLUSMALLINT nValue;
1078 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NULL_COLLATION,nValue,*this);
1079 return nValue == SQL_NC_END;
1080}
1081
1083{
1084 SQLUSMALLINT nValue;
1085 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NULL_COLLATION,nValue,*this);
1086 return nValue == SQL_NC_START;
1087}
1088
1090{
1091 SQLUSMALLINT nValue;
1092 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NULL_COLLATION,nValue,*this);
1093 return nValue == SQL_NC_HIGH;
1094}
1095
1097{
1098 SQLUSMALLINT nValue;
1099 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NULL_COLLATION,nValue,*this);
1100 return nValue == SQL_NC_LOW;
1101}
1102
1104{
1105 SQLUINTEGER nValue;
1107 return (nValue & SQL_SU_PROCEDURE_INVOCATION) == SQL_SU_PROCEDURE_INVOCATION;
1108}
1109
1111{
1112 SQLUINTEGER nValue;
1114 return (nValue & SQL_SU_PRIVILEGE_DEFINITION) == SQL_SU_PRIVILEGE_DEFINITION;
1115}
1116
1118{
1119 SQLUINTEGER nValue=0;
1120 if(m_bUseCatalog)
1122 return (nValue & SQL_CU_PROCEDURE_INVOCATION) == SQL_CU_PROCEDURE_INVOCATION;
1123}
1124
1126{
1127 SQLUINTEGER nValue=0;
1128 if(m_bUseCatalog)
1130 return (nValue & SQL_CU_PRIVILEGE_DEFINITION) == SQL_CU_PRIVILEGE_DEFINITION;
1131}
1132
1134{
1135 SQLUINTEGER nValue;
1137 return (nValue & SQL_SQ_CORRELATED_SUBQUERIES) == SQL_SQ_CORRELATED_SUBQUERIES;
1138}
1139
1141{
1142 SQLUINTEGER nValue;
1144 return (nValue & SQL_SQ_COMPARISON) == SQL_SQ_COMPARISON;
1145}
1146
1148{
1149 SQLUINTEGER nValue;
1151 return (nValue & SQL_SQ_EXISTS) == SQL_SQ_EXISTS;
1152}
1153
1155{
1156 SQLUINTEGER nValue;
1158 return (nValue & SQL_SQ_IN) == SQL_SQ_IN;
1159}
1160
1162{
1163 SQLUINTEGER nValue;
1165 return (nValue & SQL_SQ_QUANTIFIED) == SQL_SQ_QUANTIFIED;
1166}
1167
1169{
1170 SQLUINTEGER nValue;
1171 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SQL_CONFORMANCE,nValue,*this);
1172 return static_cast<bool>(nValue & SQL_SC_SQL92_INTERMEDIATE);
1173}
1174
1176{
1177 OUString aValue;
1179 return aValue;
1180}
1181
1182OUString SAL_CALL ODatabaseMetaData::getURL( )
1183{
1184 OUString aValue = m_pConnection->getURL();
1185 if ( aValue.isEmpty() )
1186 {
1187 aValue = "sdbc:odbc:" + getURLImpl();
1188 }
1189 return aValue;
1190}
1191
1193{
1194 OUString aValue;
1196 return aValue;
1197}
1198
1200{
1201 OUString aValue;
1203 return aValue;
1204}
1205
1207{
1208 OUString aValue;
1210 return aValue;
1211}
1212
1214{
1215 OUString aValue;
1217 return aValue;
1218}
1219
1221{
1222 OUString aValue;
1224 return aValue;
1225}
1226
1228{
1229 OUString aValue;
1231 return aValue;
1232}
1233
1235{
1236 OUString aValue;
1238 return aValue;
1239}
1240
1242{
1243 OUString aValue;
1245 return o3tl::toInt32(aValue.subView(0,aValue.indexOf('.')));
1246}
1247catch (const SQLException &)
1248{
1249 return 0;
1250}
1251
1253{
1254 SQLUINTEGER nValue;
1255 sal_Int32 nValueTranslated;
1256 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DEFAULT_TXN_ISOLATION,nValue,*this);
1257 switch(nValue)
1258 {
1259 case SQL_TXN_READ_UNCOMMITTED:
1260 nValueTranslated = css::sdbc::TransactionIsolation::READ_UNCOMMITTED;
1261 break;
1262 case SQL_TXN_READ_COMMITTED:
1263 nValueTranslated = css::sdbc::TransactionIsolation::READ_COMMITTED;
1264 break;
1265 case SQL_TXN_REPEATABLE_READ:
1266 nValueTranslated = css::sdbc::TransactionIsolation::REPEATABLE_READ;
1267 break;
1268 case SQL_TXN_SERIALIZABLE:
1269 nValueTranslated = css::sdbc::TransactionIsolation::SERIALIZABLE;
1270 break;
1271 default:
1272 nValueTranslated = 0;
1273 }
1274 return nValueTranslated;
1275}
1276
1278{
1279 OUString aValue;
1281 return o3tl::toInt32(aValue.subView(0,aValue.lastIndexOf('.')));
1282}
1283catch (const SQLException &)
1284{
1285 return 0;
1286}
1287
1289{
1290 OUString aValue;
1292 return aValue;
1293}
1294
1296{
1297 OUString aValue;
1298 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SEARCH_PATTERN_ESCAPE,aValue,*this,m_pConnection->getTextEncoding());
1299 return aValue;
1300}
1301
1303{
1304 SQLUINTEGER nValue;
1305 OUStringBuffer aValue;
1306 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_STRING_FUNCTIONS,nValue,*this);
1307 if(nValue & SQL_FN_STR_ASCII)
1308 aValue.append("ASCII,");
1309 if(nValue & SQL_FN_STR_BIT_LENGTH)
1310 aValue.append("BIT_LENGTH,");
1311 if(nValue & SQL_FN_STR_CHAR)
1312 aValue.append("CHAR,");
1313 if(nValue & SQL_FN_STR_CHAR_LENGTH)
1314 aValue.append("CHAR_LENGTH,");
1315 if(nValue & SQL_FN_STR_CHARACTER_LENGTH)
1316 aValue.append("CHARACTER_LENGTH,");
1317 if(nValue & SQL_FN_STR_CONCAT)
1318 aValue.append("CONCAT,");
1319 if(nValue & SQL_FN_STR_DIFFERENCE)
1320 aValue.append("DIFFERENCE,");
1321 if(nValue & SQL_FN_STR_INSERT)
1322 aValue.append("INSERT,");
1323 if(nValue & SQL_FN_STR_LCASE)
1324 aValue.append("LCASE,");
1325 if(nValue & SQL_FN_STR_LEFT)
1326 aValue.append("LEFT,");
1327 if(nValue & SQL_FN_STR_LENGTH)
1328 aValue.append("LENGTH,");
1329 if(nValue & SQL_FN_STR_LOCATE)
1330 aValue.append("LOCATE,");
1331 if(nValue & SQL_FN_STR_LOCATE_2)
1332 aValue.append("LOCATE_2,");
1333 if(nValue & SQL_FN_STR_LTRIM)
1334 aValue.append("LTRIM,");
1335 if(nValue & SQL_FN_STR_OCTET_LENGTH)
1336 aValue.append("OCTET_LENGTH,");
1337 if(nValue & SQL_FN_STR_POSITION)
1338 aValue.append("POSITION,");
1339 if(nValue & SQL_FN_STR_REPEAT)
1340 aValue.append("REPEAT,");
1341 if(nValue & SQL_FN_STR_REPLACE)
1342 aValue.append("REPLACE,");
1343 if(nValue & SQL_FN_STR_RIGHT)
1344 aValue.append("RIGHT,");
1345 if(nValue & SQL_FN_STR_RTRIM)
1346 aValue.append("RTRIM,");
1347 if(nValue & SQL_FN_STR_SOUNDEX)
1348 aValue.append("SOUNDEX,");
1349 if(nValue & SQL_FN_STR_SPACE)
1350 aValue.append("SPACE,");
1351 if(nValue & SQL_FN_STR_SUBSTRING)
1352 aValue.append("SUBSTRING,");
1353 if(nValue & SQL_FN_STR_UCASE)
1354 aValue.append("UCASE,");
1355
1356
1357 if ( !aValue.isEmpty() )
1358 aValue.setLength(aValue.getLength()-1);
1359
1360 return aValue.makeStringAndClear();
1361}
1362
1364{
1365 SQLUINTEGER nValue;
1366 OUStringBuffer aValue;
1367 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_TIMEDATE_FUNCTIONS,nValue,*this);
1368
1369 if(nValue & SQL_FN_TD_CURRENT_DATE)
1370 aValue.append("CURRENT_DATE,");
1371 if(nValue & SQL_FN_TD_CURRENT_TIME)
1372 aValue.append("CURRENT_TIME,");
1373 if(nValue & SQL_FN_TD_CURRENT_TIMESTAMP)
1374 aValue.append("CURRENT_TIMESTAMP,");
1375 if(nValue & SQL_FN_TD_CURDATE)
1376 aValue.append("CURDATE,");
1377 if(nValue & SQL_FN_TD_CURTIME)
1378 aValue.append("CURTIME,");
1379 if(nValue & SQL_FN_TD_DAYNAME)
1380 aValue.append("DAYNAME,");
1381 if(nValue & SQL_FN_TD_DAYOFMONTH)
1382 aValue.append("DAYOFMONTH,");
1383 if(nValue & SQL_FN_TD_DAYOFWEEK)
1384 aValue.append("DAYOFWEEK,");
1385 if(nValue & SQL_FN_TD_DAYOFYEAR)
1386 aValue.append("DAYOFYEAR,");
1387 if(nValue & SQL_FN_TD_EXTRACT)
1388 aValue.append("EXTRACT,");
1389 if(nValue & SQL_FN_TD_HOUR)
1390 aValue.append("HOUR,");
1391 if(nValue & SQL_FN_TD_MINUTE)
1392 aValue.append("MINUTE,");
1393 if(nValue & SQL_FN_TD_MONTH)
1394 aValue.append("MONTH,");
1395 if(nValue & SQL_FN_TD_MONTHNAME)
1396 aValue.append("MONTHNAME,");
1397 if(nValue & SQL_FN_TD_NOW)
1398 aValue.append("NOW,");
1399 if(nValue & SQL_FN_TD_QUARTER)
1400 aValue.append("QUARTER,");
1401 if(nValue & SQL_FN_TD_SECOND)
1402 aValue.append("SECOND,");
1403 if(nValue & SQL_FN_TD_TIMESTAMPADD)
1404 aValue.append("TIMESTAMPADD,");
1405 if(nValue & SQL_FN_TD_TIMESTAMPDIFF)
1406 aValue.append("TIMESTAMPDIFF,");
1407 if(nValue & SQL_FN_TD_WEEK)
1408 aValue.append("WEEK,");
1409 if(nValue & SQL_FN_TD_YEAR)
1410 aValue.append("YEAR,");
1411
1412 if ( !aValue.isEmpty() )
1413 aValue.setLength(aValue.getLength()-1);
1414
1415 return aValue.makeStringAndClear();
1416}
1417
1419{
1420 SQLUINTEGER nValue;
1421 OUStringBuffer aValue;
1422 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SYSTEM_FUNCTIONS,nValue,*this);
1423
1424 if(nValue & SQL_FN_SYS_DBNAME)
1425 aValue.append("DBNAME,");
1426 if(nValue & SQL_FN_SYS_IFNULL)
1427 aValue.append("IFNULL,");
1428 if(nValue & SQL_FN_SYS_USERNAME)
1429 aValue.append("USERNAME,");
1430
1431 if ( !aValue.isEmpty() )
1432 aValue.setLength(aValue.getLength()-1);
1433
1434 return aValue.makeStringAndClear();
1435}
1436
1438{
1439 SQLUINTEGER nValue;
1440 OUStringBuffer aValue;
1441 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_NUMERIC_FUNCTIONS,nValue,*this);
1442
1443 if(nValue & SQL_FN_NUM_ABS)
1444 aValue.append("ABS,");
1445 if(nValue & SQL_FN_NUM_ACOS)
1446 aValue.append("ACOS,");
1447 if(nValue & SQL_FN_NUM_ASIN)
1448 aValue.append("ASIN,");
1449 if(nValue & SQL_FN_NUM_ATAN)
1450 aValue.append("ATAN,");
1451 if(nValue & SQL_FN_NUM_ATAN2)
1452 aValue.append("ATAN2,");
1453 if(nValue & SQL_FN_NUM_CEILING)
1454 aValue.append("CEILING,");
1455 if(nValue & SQL_FN_NUM_COS)
1456 aValue.append("COS,");
1457 if(nValue & SQL_FN_NUM_COT)
1458 aValue.append("COT,");
1459 if(nValue & SQL_FN_NUM_DEGREES)
1460 aValue.append("DEGREES,");
1461 if(nValue & SQL_FN_NUM_EXP)
1462 aValue.append("EXP,");
1463 if(nValue & SQL_FN_NUM_FLOOR)
1464 aValue.append("FLOOR,");
1465 if(nValue & SQL_FN_NUM_LOG)
1466 aValue.append("LOGF,");
1467 if(nValue & SQL_FN_NUM_LOG10)
1468 aValue.append("LOG10,");
1469 if(nValue & SQL_FN_NUM_MOD)
1470 aValue.append("MOD,");
1471 if(nValue & SQL_FN_NUM_PI)
1472 aValue.append("PI,");
1473 if(nValue & SQL_FN_NUM_POWER)
1474 aValue.append("POWER,");
1475 if(nValue & SQL_FN_NUM_RADIANS)
1476 aValue.append("RADIANS,");
1477 if(nValue & SQL_FN_NUM_RAND)
1478 aValue.append("RAND,");
1479 if(nValue & SQL_FN_NUM_ROUND)
1480 aValue.append("ROUND,");
1481 if(nValue & SQL_FN_NUM_SIGN)
1482 aValue.append("SIGN,");
1483 if(nValue & SQL_FN_NUM_SIN)
1484 aValue.append("SIN,");
1485 if(nValue & SQL_FN_NUM_SQRT)
1486 aValue.append("SQRT,");
1487 if(nValue & SQL_FN_NUM_TAN)
1488 aValue.append("TAN,");
1489 if(nValue & SQL_FN_NUM_TRUNCATE)
1490 aValue.append("TRUNCATE,");
1491
1492 if ( !aValue.isEmpty() )
1493 aValue.setLength(aValue.getLength()-1);
1494
1495 return aValue.makeStringAndClear();
1496}
1497
1499{
1500 SQLUINTEGER nValue;
1501 // SQL_ODBC_SQL_CONFORMANCE is deprecated in ODBC 3.x, but there does not seem te be any equivalent.
1502 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_SQL_CONFORMANCE,nValue,*this);
1503 SAL_WARN_IF(! (nValue == SQL_OSC_MINIMUM || nValue == SQL_OSC_CORE || nValue == SQL_OSC_EXTENDED),
1504 "connectivity.odbc",
1505 "SQL_ODBC_SQL_CONFORMANCE is neither MINIMAL nor CORE nor EXTENDED");
1506 return nValue == SQL_OSC_EXTENDED;
1507}
1508
1510{
1511 SQLUINTEGER nValue;
1512 // SQL_ODBC_SQL_CONFORMANCE is deprecated in ODBC 3.x, but there does not seem te be any equivalent.
1513 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_SQL_CONFORMANCE,nValue,*this);
1514 SAL_WARN_IF(! (nValue == SQL_OSC_MINIMUM || nValue == SQL_OSC_CORE || nValue == SQL_OSC_EXTENDED),
1515 "connectivity.odbc",
1516 "SQL_ODBC_SQL_CONFORMANCE is neither MINIMAL nor CORE nor EXTENDED");
1517 return nValue == SQL_OSC_CORE || nValue == SQL_OSC_EXTENDED;
1518}
1519
1521{
1522 SQLUINTEGER nValue;
1523 // SQL_ODBC_SQL_CONFORMANCE is deprecated in ODBC 3.x, but there does not seem te be any equivalent.
1524 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_SQL_CONFORMANCE,nValue,*this);
1525 SAL_WARN_IF(! (nValue == SQL_OSC_MINIMUM || nValue == SQL_OSC_CORE || nValue == SQL_OSC_EXTENDED),
1526 "connectivity.odbc",
1527 "SQL_ODBC_SQL_CONFORMANCE is neither MINIMAL nor CORE nor EXTENDED");
1528 return nValue == SQL_OSC_MINIMUM || nValue == SQL_OSC_CORE || nValue == SQL_OSC_EXTENDED;
1529}
1530
1532{
1533 SQLUINTEGER nValue;
1534 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_OJ_CAPABILITIES,nValue,*this);
1535 return (nValue & SQL_OJ_FULL) == SQL_OJ_FULL;
1536}
1537
1539{
1540 return supportsFullOuterJoins( );
1541}
1542
1544{
1545 SQLUSMALLINT nValue;
1546 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_GROUP_BY,nValue,*this);
1547 return nValue;
1548}
1549
1551{
1552 SQLUSMALLINT nValue;
1553 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_ORDER_BY,nValue,*this);
1554 return nValue;
1555}
1556
1558{
1559 SQLUSMALLINT nValue;
1560 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_COLUMNS_IN_SELECT,nValue,*this);
1561 return nValue;
1562}
1563
1565{
1566 SQLUSMALLINT nValue;
1567 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_MAX_USER_NAME_LEN,nValue,*this);
1568 return nValue;
1569}
1570
1572{
1573 SQLUINTEGER nValue;
1574 OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CURSOR_SENSITIVITY,nValue,*this);
1575 return (nValue & static_cast<SQLUINTEGER>(setType)) == static_cast<SQLUINTEGER>(setType);
1576}
1577
1578sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency )
1579{
1580 SQLUINTEGER nValue;
1581 SQLUSMALLINT nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 );
1582 switch(setType)
1583 {
1584 default:
1585 case ResultSetType::FORWARD_ONLY:
1586 nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2;
1587 break;
1588 case ResultSetType::SCROLL_INSENSITIVE:
1589 nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2;
1590 break;
1591 case ResultSetType::SCROLL_SENSITIVE:
1592 nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2;
1593 break;
1594 }
1595
1597 bool bRet = false;
1598 switch(concurrency)
1599 {
1600 case ResultSetConcurrency::READ_ONLY:
1601 bRet = (nValue & SQL_CA2_READ_ONLY_CONCURRENCY) == SQL_CA2_READ_ONLY_CONCURRENCY;
1602 break;
1603 case ResultSetConcurrency::UPDATABLE:
1604 bRet = (nValue & SQL_CA2_OPT_VALUES_CONCURRENCY) == SQL_CA2_OPT_VALUES_CONCURRENCY;
1605 break;
1606 }
1607 return bRet;
1608}
1609
1611{
1612 SQLUINTEGER nValue;
1613 SQLUSMALLINT nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 );
1614 switch(setType)
1615 {
1616 default:
1617 case ResultSetType::FORWARD_ONLY:
1618 nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2;
1619 break;
1620 case ResultSetType::SCROLL_INSENSITIVE:
1621 nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2;
1622 break;
1623 case ResultSetType::SCROLL_SENSITIVE:
1624 nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2;
1625 break;
1626 }
1627
1629 return (nValue & SQL_CA2_SENSITIVITY_UPDATES) == SQL_CA2_SENSITIVITY_UPDATES;
1630}
1631
1633{
1634 SQLUINTEGER nValue;
1635 SQLUSMALLINT nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 );
1636 switch(setType)
1637 {
1638 default:
1639 case ResultSetType::FORWARD_ONLY:
1640 nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2;
1641 break;
1642 case ResultSetType::SCROLL_INSENSITIVE:
1643 nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2;
1644 break;
1645 case ResultSetType::SCROLL_SENSITIVE:
1646 nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2;
1647 break;
1648 }
1649
1651 return (nValue & SQL_CA2_SENSITIVITY_DELETIONS) != SQL_CA2_SENSITIVITY_DELETIONS;
1652}
1653
1655{
1656 SQLUINTEGER nValue;
1657 SQLUSMALLINT nAskFor( SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 );
1658 switch(setType)
1659 {
1660 default:
1661 case ResultSetType::FORWARD_ONLY:
1662 nAskFor = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2;
1663 break;
1664 case ResultSetType::SCROLL_INSENSITIVE:
1665 nAskFor = SQL_STATIC_CURSOR_ATTRIBUTES2;
1666 break;
1667 case ResultSetType::SCROLL_SENSITIVE:
1668 nAskFor = SQL_DYNAMIC_CURSOR_ATTRIBUTES2;
1669 break;
1670 }
1671
1673 return (nValue & SQL_CA2_SENSITIVITY_ADDITIONS) == SQL_CA2_SENSITIVITY_ADDITIONS;
1674}
1675
1677{
1678 return ownUpdatesAreVisible(setType);
1679}
1680
1682{
1683 return ownDeletesAreVisible(setType);
1684}
1685
1687{
1688 return ownInsertsAreVisible(setType);
1689}
1690
1691sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected( sal_Int32 /*setType*/ )
1692{
1693 return false;
1694}
1695
1696sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected( sal_Int32 /*setType*/ )
1697{
1698 return false;
1699}
1700
1701sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected( sal_Int32 /*setType*/ )
1702{
1703 return false;
1704}
1705
1707{
1708 return false;
1709}
1710
1711Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& /*catalog*/, const OUString& /*schemaPattern*/, const OUString& /*typeNamePattern*/, const Sequence< sal_Int32 >& /*types*/ )
1712{
1713 return nullptr;
1714}
1715
1716
1717/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@ eTableTypes
describes a result set as expected by XDatabaseMetaData::getTableTypes
@ eVersionColumns
describes a result set as expected by XDatabaseMetaData::getVersionColumns
@ ePrimaryKeys
describes a result set as expected by XDatabaseMetaData::getPrimaryKeys
@ eIndexInfo
describes a result set as expected by XDatabaseMetaData::getIndexInfo
@ eImportedKeys
describes a result set as expected by XDatabaseMetaData::getImportedKeys
@ eTypeInfo
describes a result set as expected by XDatabaseMetaData::getTypeInfo
@ eSchemas
describes a result set as expected by XDatabaseMetaData::getSchemas
@ eColumnPrivileges
describes a result set as expected by XDatabaseMetaData::getColumnPrivileges
@ eProcedures
describes a result set as expected by XDatabaseMetaData::getProcedures
@ eTables
describes a result set as expected by XDatabaseMetaData::getTables
@ eCrossReference
describes a result set as expected by XDatabaseMetaData::getCrossReference
@ eExportedKeys
describes a result set as expected by XDatabaseMetaData::getExportedKeys
@ eBestRowIdentifier
describes a result set as expected by XDatabaseMetaData::getBestRowIdentifier
@ eColumns
describes a result set as expected by XDatabaseMetaData::getColumns
@ eCatalogs
describes a result set as expected by XDatabaseMetaData::getCatalogs
@ eProcedureColumns
describes a result set as expected by XDatabaseMetaData::getProcedureColumns
rtl_TextEncoding getTextEncoding() const
Definition: TConnection.hxx:61
const OUString & getURL() const
Definition: TConnection.hxx:62
bool isIgnoreDriverPrivilegesEnabled() const
virtual sal_Bool SAL_CALL isReadOnly() override
virtual sal_Bool SAL_CALL ownUpdatesAreVisible(sal_Int32 setType) override
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTablePrivileges(const css::uno::Any &catalog, const OUString &schemaPattern, const OUString &tableNamePattern) override
virtual sal_Bool SAL_CALL supportsPositionedDelete() override
virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy() override
virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions() override
virtual sal_Bool SAL_CALL supportsLikeEscapeClause() override
virtual sal_Int32 SAL_CALL getMaxColumnsInIndex() override
virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly() override
virtual sal_Int32 SAL_CALL getMaxIndexLength() override
virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit() override
virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers() override
virtual sal_Int32 SAL_CALL getMaxCatalogNameLength() override
virtual sal_Int32 SAL_CALL getMaxTableNameLength() override
virtual sal_Bool SAL_CALL insertsAreDetected(sal_Int32 setType) override
virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers() override
virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL() override
virtual OUString SAL_CALL getTimeDateFunctions() override
virtual sal_Bool SAL_CALL nullsAreSortedLow() override
virtual sal_Bool SAL_CALL supportsConvert(sal_Int32 fromType, sal_Int32 toType) override
virtual sal_Int32 SAL_CALL getMaxCursorNameLength() override
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getSchemas() override
virtual OUString SAL_CALL getExtraNameCharacters() override
virtual sal_Int32 SAL_CALL getMaxColumnsInOrderBy() override
virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers() override
virtual sal_Int32 SAL_CALL getMaxUserNameLength() override
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCatalogs() override
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTableTypes() override
virtual sal_Int32 SAL_CALL getMaxColumnsInTable() override
virtual sal_Bool SAL_CALL supportsMultipleTransactions() override
virtual sal_Bool SAL_CALL supportsResultSetConcurrency(sal_Int32 setType, sal_Int32 concurrency) override
virtual OUString impl_getCatalogSeparator_throw() override
virtual OUString impl_getIdentifierQuoteString_throw() override
virtual bool impl_isCatalogAtStart_throw() override
virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls() override
virtual sal_Int32 SAL_CALL getMaxColumnNameLength() override
virtual sal_Bool SAL_CALL supportsLimitedOuterJoins() override
virtual OUString SAL_CALL getSystemFunctions() override
virtual sal_Int32 SAL_CALL getMaxProcedureNameLength() override
virtual sal_Int32 SAL_CALL getMaxSchemaNameLength() override
virtual sal_Bool SAL_CALL othersDeletesAreVisible(sal_Int32 setType) override
virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit() override
virtual sal_Bool SAL_CALL isReadOnly() override
virtual sal_Bool SAL_CALL supportsGroupByUnrelated() override
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getProcedureColumns(const css::uno::Any &catalog, const OUString &schemaPattern, const OUString &procedureNamePattern, const OUString &columnNamePattern) override
virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel(sal_Int32 level) override
virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar() override
virtual sal_Int32 SAL_CALL getMaxCharLiteralLength() override
virtual sal_Bool SAL_CALL supportsPositionedUpdate() override
virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility() override
virtual sal_Bool SAL_CALL nullsAreSortedAtStart() override
virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers() override
virtual bool impl_supportsAlterTableWithAddColumn_throw() override
virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions() override
virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy() override
virtual sal_Bool SAL_CALL supportsFullOuterJoins() override
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getProcedures(const css::uno::Any &catalog, const OUString &schemaPattern, const OUString &procedureNamePattern) override
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getUDTs(const css::uno::Any &catalog, const OUString &schemaPattern, const OUString &typeNamePattern, const css::uno::Sequence< sal_Int32 > &types) override
virtual sal_Bool SAL_CALL nullPlusNonNullIsNull() override
virtual sal_Bool SAL_CALL othersInsertsAreVisible(sal_Int32 setType) override
virtual sal_Bool SAL_CALL supportsCoreSQLGrammar() override
virtual sal_Bool SAL_CALL nullsAreSortedHigh() override
virtual sal_Bool SAL_CALL allProceduresAreCallable() override
virtual sal_Int32 SAL_CALL getMaxColumnsInSelect() override
virtual bool impl_supportsCatalogsInDataManipulation_throw() override
virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers() override
virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback() override
virtual sal_Int32 SAL_CALL getDriverMinorVersion() override
virtual OUString SAL_CALL getSchemaTerm() override
virtual sal_Bool SAL_CALL nullsAreSortedAtEnd() override
virtual bool impl_supportsMixedCaseQuotedIdentifiers_throw() override
virtual OUString SAL_CALL getDriverVersion() override
virtual sal_Bool SAL_CALL ownDeletesAreVisible(sal_Int32 setType) override
virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL() override
virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit() override
virtual sal_Int32 SAL_CALL getMaxStatementLength() override
virtual sal_Bool SAL_CALL supportsANSI92FullSQL() override
virtual sal_Bool SAL_CALL allTablesAreSelectable() override
virtual sal_Bool SAL_CALL supportsSelectForUpdate() override
virtual OUString SAL_CALL getURL() override
virtual sal_Bool SAL_CALL supportsResultSetType(sal_Int32 setType) override
virtual OUString SAL_CALL getCatalogTerm() override
virtual sal_Bool SAL_CALL supportsMultipleResultSets() override
virtual OUString SAL_CALL getUserName() override
virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation() override
virtual OUString SAL_CALL getDatabaseProductVersion() override
virtual bool impl_supportsSchemasInTableDefinitions_throw() override
virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar() override
virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect() override
virtual OUString SAL_CALL getStringFunctions() override
virtual sal_Int32 SAL_CALL getDriverMajorVersion() override
virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs() override
virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength() override
virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback() override
virtual sal_Bool SAL_CALL supportsTypeConversion() override
virtual sal_Int32 SAL_CALL getMaxConnections() override
virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers() override
virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions() override
virtual bool impl_storesMixedCaseQuotedIdentifiers_throw() override
virtual OUString SAL_CALL getSQLKeywords() override
virtual OUString SAL_CALL getDatabaseProductName() override
virtual bool impl_supportsCatalogsInTableDefinitions_throw() override
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumns(const css::uno::Any &catalog, const OUString &schemaPattern, const OUString &tableNamePattern, const OUString &columnNamePattern) override
virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons() override
virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds() override
virtual sal_Int32 impl_getMaxTablesInSelect_throw() override
virtual sal_Bool SAL_CALL supportsUnionAll() override
virtual sal_Bool SAL_CALL supportsOrderByUnrelated() override
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCrossReference(const css::uno::Any &primaryCatalog, const OUString &primarySchema, const OUString &primaryTable, const css::uno::Any &foreignCatalog, const OUString &foreignSchema, const OUString &foreignTable) override
virtual sal_Bool SAL_CALL othersUpdatesAreVisible(sal_Int32 setType) override
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTables(const css::uno::Any &catalog, const OUString &schemaPattern, const OUString &tableNamePattern, const css::uno::Sequence< OUString > &types) override
virtual bool impl_supportsAlterTableWithDropColumn_throw() override
virtual sal_Bool SAL_CALL ownInsertsAreVisible(sal_Int32 setType) override
virtual sal_Bool SAL_CALL supportsSubqueriesInIns() override
virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions() override
virtual sal_Bool SAL_CALL usesLocalFilePerTable() override
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getBestRowIdentifier(const css::uno::Any &catalog, const OUString &schema, const OUString &table, sal_Int32 scope, sal_Bool nullable) override
virtual sal_Bool SAL_CALL supportsColumnAliasing() override
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getVersionColumns(const css::uno::Any &catalog, const OUString &schema, const OUString &table) override
virtual sal_Bool SAL_CALL deletesAreDetected(sal_Int32 setType) override
virtual sal_Int32 SAL_CALL getMaxRowSize() override
virtual OUString SAL_CALL getProcedureTerm() override
virtual sal_Bool SAL_CALL supportsGroupBy() override
virtual bool impl_supportsSchemasInDataManipulation_throw() override
virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions() override
virtual sal_Bool SAL_CALL supportsBatchUpdates() override
virtual sal_Bool SAL_CALL supportsNonNullableColumns() override
virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames() override
virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries() override
virtual sal_Bool SAL_CALL supportsUnion() override
virtual OUString SAL_CALL getDriverName() override
virtual sal_Bool SAL_CALL supportsTableCorrelationNames() override
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getIndexInfo(const css::uno::Any &catalog, const OUString &schema, const OUString &table, sal_Bool unique, sal_Bool approximate) override
virtual sal_Bool SAL_CALL supportsStoredProcedures() override
virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls() override
virtual sal_Bool SAL_CALL supportsOuterJoins() override
virtual sal_Bool SAL_CALL updatesAreDetected(sal_Int32 setType) override
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getPrimaryKeys(const css::uno::Any &catalog, const OUString &schema, const OUString &table) override
virtual sal_Int32 impl_getMaxStatements_throw() override
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getImportedKeys(const css::uno::Any &catalog, const OUString &schema, const OUString &table) override
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumnPrivileges(const css::uno::Any &catalog, const OUString &schema, const OUString &table, const OUString &columnNamePattern) override
virtual sal_Bool SAL_CALL supportsSubqueriesInExists() override
virtual OUString SAL_CALL getNumericFunctions() override
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getExportedKeys(const css::uno::Any &catalog, const OUString &schema, const OUString &table) override
virtual sal_Bool SAL_CALL usesLocalFiles() override
virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions() override
virtual OUString SAL_CALL getSearchStringEscape() override
virtual sal_Bool SAL_CALL supportsTransactions() override
virtual css::uno::Reference< css::sdbc::XResultSet > impl_getTypeInfo_throw() override
static void GetInfo(OConnection const *_pConnection, SQLHANDLE _aConnectionHandle, SQLUSMALLINT _nInfo, OUString &_rValue, const css::uno::Reference< css::uno::XInterface > &_xInterface, rtl_TextEncoding _nTextEncoding)
ULONG m_refCount
sal_Int16 nValue
#define SAL_WARN_IF(condition, area, stream)
aStr
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
unsigned char sal_Bool