LibreOffice Module connectivity (master) 1
firebird/DatabaseMetaData.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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 "DatabaseMetaData.hxx"
21#include "Util.hxx"
22
23#include <ibase.h>
24#include <rtl/ustrbuf.hxx>
25#include <sal/log.hxx>
27
28#include <com/sun/star/sdbc/ColumnSearch.hpp>
29#include <com/sun/star/sdbc/ColumnValue.hpp>
30#include <com/sun/star/sdbc/DataType.hpp>
31#include <com/sun/star/sdbc/IndexType.hpp>
32#include <com/sun/star/sdbc/ResultSetType.hpp>
33#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
34#include <com/sun/star/sdbc/SQLException.hpp>
35#include <com/sun/star/sdbc/TransactionIsolation.hpp>
36#include <com/sun/star/sdbc/XRow.hpp>
37#include <com/sun/star/sdbc/KeyRule.hpp>
38#include <com/sun/star/sdbc/Deferrability.hpp>
39
40using namespace connectivity::firebird;
41using namespace com::sun::star;
42using namespace com::sun::star::uno;
43using namespace com::sun::star::lang;
44using namespace com::sun::star::beans;
45using namespace com::sun::star::sdbc;
46
47ODatabaseMetaData::ODatabaseMetaData(Connection* _pCon)
48: m_pConnection(_pCon)
49{
50 SAL_WARN_IF(!m_pConnection.is(), "connectivity.firebird",
51 "ODatabaseMetaData::ODatabaseMetaData: No connection set!");
52}
53
55{
56}
57
58//----- Catalog Info -- UNSUPPORTED -------------------------------------------
60{
61 return OUString();
62}
63
65{
66 return -1;
67}
68
70{
71 return OUString();
72}
73
75{
76 return false;
77}
78
80{
81 return false;
82}
83
85{
86 return false;
87}
88
90{
91 return false;
92}
93
94uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCatalogs()
95{
96 OSL_FAIL("Not implemented yet!");
97 // TODO implement
99}
100
102{
103 return false;
104}
105
107{
108 return false;
109}
110
111//----- Schema Info -- UNSUPPORTED --------------------------------------------
113{
114 return false;
115}
116
118{
119 return false;
120}
121
123{
124 return false;
125}
126
128{
129 return false;
130}
131
133{
134 return false;
135}
136
138{
139 return -1;
140}
141
143{
144 return OUString();
145}
146
147uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas()
148{
149 OSL_FAIL("Not implemented yet!");
150 // TODO implement
152}
153
154//----- Max Sizes/Lengths -----------------------------------------------------
156{
157 return 32767;
158}
159
161{
162 return 32767;
163}
164
166{
167 return 32767;
168}
169
171{
172 return 31;
173}
174
176{
177 // TODO: No idea.
178 // See: http://www.firebirdsql.org/en/firebird-technical-specifications/
179 return 16;
180}
181
183{
184 return 32;
185}
186
188{
189 return 100; // Arbitrary
190}
191
193{
194 // May however be smaller.
195 // See: http://www.firebirdsql.org/en/firebird-technical-specifications/
196 return 32767;
197}
198
200{
201 return 32767;
202}
203
205{
206 return 31;
207}
208
210{
211 return 0; // 0 means no limit
212}
213
214
216{
217 return false;
218}
219
220// ---- Identifiers -----------------------------------------------------------
221// Only quoted identifiers are case sensitive, unquoted are case insensitive
223{
224 return "\"";
225}
226
228{
229 return true;
230}
231
233{
234 return false;
235}
236
238{
239 // TODO: confirm this -- the documentation is highly ambiguous
240 // However it seems this should be true as quoted identifiers ARE
241 // stored mixed case.
242 return true;
243}
244
246{
247 return false;
248}
249
250// ---- Unquoted Identifiers -------------------------------------------------
251// All unquoted identifiers are stored upper case.
253{
254 return false;
255}
256
258{
259 return false;
260}
261
263{
264 return false;
265}
266
268{
269 return true;
270}
271
272// ---- SQL Feature Support ---------------------------------------------------
274{
275 return true;
276}
277
279{
280 return true;
281}
282
284{
285 return true;
286}
287
289{
290 return true;
291}
292
294{
295 return true;
296}
297
299{
300 return true;
301}
302
304{
305 return true;
306}
307
309{
310 return true;
311}
312
314{
315 // TODO: true if embedded, but unsure about remote server
316 return true;
317}
318
320 sal_Int32)
321{
322 return false;
323}
324
326{
327 return false;
328}
329
331{
332 return true;
333}
334
336{
337 return true;
338}
339
341{
342 return 0; // 0 means no limit
343}
344
346{
347 return true;
348}
349
351{
352 return OUString();
353}
354
356{
357 return false;
358}
359// ---- Data definition stuff -------------------------------------------------
361{
362 return false;
363}
364
366{
367 return true;
368}
369
371{
372 return true;
373}
374
377{
378 return false;
379}
380//----- Transaction Support --------------------------------------------------
382{
383 return true;
384}
385
387{
388 return false;
389}
390
392{
393 return false;
394}
395
397{
398 return false;
399}
400
402{
403 return false;
404}
405
407{
408 return true;
409}
410
412 sal_Int32 aLevel)
413{
414 return aLevel == TransactionIsolation::READ_UNCOMMITTED
415 || aLevel == TransactionIsolation::READ_COMMITTED
416 || aLevel == TransactionIsolation::REPEATABLE_READ
417 || aLevel == TransactionIsolation::SERIALIZABLE;
418}
419
421{
422 return TransactionIsolation::REPEATABLE_READ;
423}
424
425
427{
428 return false;
429}
430
432{
433 return true; // should be supported at least
434}
435
437{
438 return true;
439}
440
442{
443 return 0; // 0 means no limit
444}
445
447{
448 return 31; // TODO: confirm
449}
450
452{
453 return false;
454}
455
457{
458 return true;
459}
460
462{
463 return m_pConnection->isReadOnly();
464}
465
467{
468 return m_pConnection->isEmbedded();
469}
470
472{
473 return false;
474}
475
477{
478 return false;
479}
480
482{
483 return false;
484}
485
487{
488 return true;
489}
490
492{
493 // Unsure
494 return true;
495}
496
498{
499 // Unsure
500 return false;
501}
502
503
505{
506 return false;
507}
508
510{
511 return false;
512}
513
515{
516 return true;
517}
518
520{
521 return true;
522}
523
525{
526 return true;
527}
528
530{
531 return false;
532}
533
535{
536 return false;
537}
538
540{
541 return false;
542}
543
545{
546 return false;
547}
548
550{
551 return false;
552}
553
555{
556 return false;
557}
558
560{
561 return false;
562}
563
565{
566 return false;
567}
568
570{
571 return false;
572}
573
575{
576 return false;
577}
578
579OUString SAL_CALL ODatabaseMetaData::getURL()
580{
581 return m_pConnection->getConnectionURL();
582}
583
585{
586 return OUString();
587}
588
590{
591 return OUString();
592}
593
595{
596 return OUString();
597}
598
600{
601 uno::Reference< XStatement > xSelect = m_pConnection->createStatement();
602
603 uno::Reference< XResultSet > xRs = xSelect->executeQuery("SELECT rdb$get_context('SYSTEM', 'ENGINE_VERSION') as version from rdb$database");
604 (void)xRs->next(); // first and only row
605 uno::Reference< XRow > xRow( xRs, UNO_QUERY_THROW );
606 return xRow->getString(1);
607}
608
610{
611 return "Firebird (engine12)";
612}
613
615{
616 return OUString();
617}
618
620{
621 return 1;
622}
623
625{
626 return 0;
627}
628
630{
631 return OUString();
632}
633
635{
636 return OUString();
637}
638
640{
641 return "ASCII_CHAR,ASCII_VAL,BIT_LENGTH,CHAR_LENGTH,CHAR_TO_UUID,CHARACTER_LENGTH,"
642 "GEN_UUID,HASH,LEFT,LOWER,LPAD,OCTET_LENGTH,OVERLAY,POSITION,REPLACE,REVERSE,"
643 "RIGHT,RPAD,SUBSTRING,TRIM,UPPER,UUID_TO_CHAR";
644}
645
647{
648 return "CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,DATEADD, DATEDIFF,"
649 "EXTRACT,'NOW','TODAY','TOMORROW','YESTERDAY'";
650}
651
653{
654 return OUString();
655}
656
658{
659 return "ABS,ACOS,ASIN,ATAN,ATAN2,BIN_AND,BIN_NOT,BIN_OR,BIN_SHL,"
660 "BIN_SHR,BIN_XOR,CEIL,CEILING,COS,COSH,COT,EXP,FLOOR,LN,"
661 "LOG,LOG10,MOD,PI,POWER,RAND,ROUND,SIGN,SIN,SINH,SQRT,TAN,TANH,TRUNC";
662}
663
665{
666 return false;
667}
668
670{
671 return false;
672}
673
675{
676 return false;
677}
678
680{
681 return 0; // 0 means no limit
682}
683
685{
686 return 0; // 0 means no limit
687}
688
690{
691 return 0; // 0 means no limit
692}
693
695{
696 return 31;
697}
698
700{
701 switch (setType)
702 {
703 case ResultSetType::FORWARD_ONLY:
704 return true;
705 default:
706 return false;
707 }
708}
709
711 sal_Int32 aResultSetType,
712 sal_Int32 aConcurrency)
713{
714 if (aResultSetType == ResultSetType::FORWARD_ONLY
715 && aConcurrency == ResultSetConcurrency::READ_ONLY)
716 return true;
717 else
718 return false;
719}
720
722{
723 return false;
724}
725
727{
728 return false;
729}
730
732{
733 return false;
734}
735
737{
738 return false;
739}
740
742{
743 return false;
744}
745
747{
748 return false;
749}
750
752{
753 return false;
754}
755
757{
758 return false;
759}
760
762{
763 return false;
764}
765
767{
768 // No batch support in firebird
769 return false;
770}
771
772uno::Reference< XConnection > SAL_CALL ODatabaseMetaData::getConnection()
773{
774 return m_pConnection;
775}
776
777// here follow all methods which return a resultset
778// the first methods is an example implementation how to use this resultset
779// of course you could implement it on your and you should do this because
780// the general way is more memory expensive
781
782uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( )
783{
786
789
790 aRow[0] = new ORowSetValueDecorator(); // unused
791
792 // TODO Put these statics to one place
793 // like postgreSQL's Statics class.
794
795 aRow[1] = new ORowSetValueDecorator(OUString("TABLE"));
796 aResults.push_back(aRow);
797
798 aRow[1] = new ORowSetValueDecorator(OUString("VIEW"));
799 aResults.push_back(aRow);
800
801 aRow[1] = new ORowSetValueDecorator(OUString("SYSTEM TABLE"));
802 aResults.push_back(aRow);
803
804 pResultSet->setRows(std::move(aResults));
805 return pResultSet;
806}
807
808uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo()
809{
810 SAL_INFO("connectivity.firebird", "getTypeInfo()");
811
812 // this returns an empty resultset where the column-names are already set
813 // in special the metadata of the resultset already returns the right columns
816 static ODatabaseMetaDataResultSet::ORows aResults = []()
817 {
820
821 // Common data
822 aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue(); // Literal quote marks
823 aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue(); // Literal quote marks
824 aRow[7] = new ORowSetValueDecorator(ORowSetValue(true)); // Nullable
825 aRow[8] = new ORowSetValueDecorator(ORowSetValue(true)); // Case sensitive
826 aRow[10] = new ORowSetValueDecorator(ORowSetValue(false)); // Is unsigned
827 // FIXED_PREC_SCALE: docs state "can it be a money value? " however
828 // in reality this causes Base to treat all numbers as money formatted
829 // by default which is wrong (and formatting as money value is still
830 // possible for all values).
831 aRow[11] = new ORowSetValueDecorator(ORowSetValue(false));
832 // Localised Type Name -- TODO: implement (but can be null):
833 aRow[13] = new ORowSetValueDecorator();
834 aRow[16] = new ORowSetValueDecorator(); // Unused
835 aRow[17] = new ORowSetValueDecorator(); // Unused
836 aRow[18] = new ORowSetValueDecorator(sal_Int16(10));// Radix
837
838 // Char
839 aRow[1] = new ORowSetValueDecorator(OUString("CHAR"));
840 aRow[2] = new ORowSetValueDecorator(DataType::CHAR);
841 aRow[3] = new ORowSetValueDecorator(sal_Int16(32765)); // Prevision = max length
842 aRow[6] = new ORowSetValueDecorator(OUString("length")); // Create Params
843 aRow[9] = new ORowSetValueDecorator(
844 sal_Int16(ColumnSearch::FULL)); // Searchable
845 aRow[12] = new ORowSetValueDecorator(ORowSetValue(false)); // Autoincrement
846 aRow[14] = ODatabaseMetaDataResultSet::get0Value(); // Minimum scale
847 aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
848 tmp.push_back(aRow);
849
850 // Varchar
851 aRow[1] = new ORowSetValueDecorator(OUString("VARCHAR"));
852 aRow[2] = new ORowSetValueDecorator(DataType::VARCHAR);
853 aRow[3] = new ORowSetValueDecorator(sal_Int16(32765)); // Prevision = max length
854 aRow[6] = new ORowSetValueDecorator(OUString("length")); // Create Params
855 aRow[9] = new ORowSetValueDecorator(
856 sal_Int16(ColumnSearch::FULL)); // Searchable
857 aRow[12] = new ORowSetValueDecorator(ORowSetValue(false)); // Autoincrement
858 aRow[14] = ODatabaseMetaDataResultSet::get0Value(); // Minimum scale
859 aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
860 tmp.push_back(aRow);
861
862 // Binary (CHAR); we use the Firebird synonym CHARACTER
863 // to fool LO into seeing it as different types.
864 // It is distinguished from Text type by its character set OCTETS;
865 // that will be added by Tables::createStandardColumnPart
866 aRow[1] = new ORowSetValueDecorator(OUString("CHARACTER"));
867 aRow[2] = new ORowSetValueDecorator(DataType::BINARY);
868 aRow[3] = new ORowSetValueDecorator(sal_Int16(32765)); // Prevision = max length
869 aRow[6] = new ORowSetValueDecorator(OUString("length")); // Create Params
870 aRow[9] = new ORowSetValueDecorator(
871 sal_Int16(ColumnSearch::NONE)); // Searchable
872 aRow[14] = ODatabaseMetaDataResultSet::get0Value(); // Minimum scale
873 aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
874 tmp.push_back(aRow);
875
876 // Varbinary (VARCHAR); see comment above about BINARY
877 aRow[1] = new ORowSetValueDecorator(OUString("CHARACTER VARYING"));
878 aRow[2] = new ORowSetValueDecorator(DataType::VARBINARY);
879 aRow[3] = new ORowSetValueDecorator(sal_Int16(32765)); // Prevision = max length
880 aRow[6] = new ORowSetValueDecorator(OUString("length")); // Create Params
881 aRow[9] = new ORowSetValueDecorator(
882 sal_Int16(ColumnSearch::NONE)); // Searchable
883
884 // Clob (SQL_BLOB)
885 aRow[1] = new ORowSetValueDecorator(OUString("BLOB SUB_TYPE TEXT")); // BLOB, with subtype 1
886 aRow[2] = new ORowSetValueDecorator(DataType::CLOB);
887 aRow[3] = new ORowSetValueDecorator(sal_Int32(2147483647)); // Precision = max length
888 aRow[6] = new ORowSetValueDecorator(); // Create Params
889 aRow[9] = new ORowSetValueDecorator(
890 sal_Int16(ColumnSearch::FULL)); // Searchable
891 aRow[12] = new ORowSetValueDecorator(ORowSetValue(false)); // Autoincrement
892 aRow[14] = ODatabaseMetaDataResultSet::get0Value(); // Minimum scale
893 aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
894 tmp.push_back(aRow);
895
896 // Longvarbinary (SQL_BLOB)
897 // Distinguished from simple blob with a user-defined subtype.
898 aRow[1] = new ORowSetValueDecorator(OUString("BLOB SUB_TYPE " + OUString::number(static_cast<short>(BlobSubtype::Image))) ); // BLOB, with subtype 0
899 aRow[2] = new ORowSetValueDecorator(DataType::LONGVARBINARY);
900 tmp.push_back(aRow);
901
902 // Integer Types common
903 {
904 aRow[6] = new ORowSetValueDecorator(); // Create Params
905 aRow[9] = new ORowSetValueDecorator(
906 sal_Int16(ColumnSearch::FULL)); // Searchable
907 aRow[12] = new ORowSetValueDecorator(ORowSetValue(true)); // Autoincrement
908 aRow[14] = ODatabaseMetaDataResultSet::get0Value(); // Minimum scale
909 aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
910 }
911 // Smallint (SQL_SHORT)
912 aRow[1] = new ORowSetValueDecorator(OUString("SMALLINT"));
913 aRow[2] = new ORowSetValueDecorator(DataType::SMALLINT);
914 aRow[3] = new ORowSetValueDecorator(sal_Int16(5)); // Prevision
915 tmp.push_back(aRow);
916 // Integer (SQL_LONG)
917 aRow[1] = new ORowSetValueDecorator(OUString("INTEGER"));
918 aRow[2] = new ORowSetValueDecorator(DataType::INTEGER);
919 aRow[3] = new ORowSetValueDecorator(sal_Int16(10)); // Precision
920 tmp.push_back(aRow);
921 // Bigint (SQL_INT64)
922 aRow[1] = new ORowSetValueDecorator(OUString("BIGINT"));
923 aRow[2] = new ORowSetValueDecorator(DataType::BIGINT);
924 aRow[3] = new ORowSetValueDecorator(sal_Int16(20)); // Precision
925 tmp.push_back(aRow);
926
927 // Decimal Types common
928 {
929 aRow[9] = new ORowSetValueDecorator(
930 sal_Int16(ColumnSearch::FULL)); // Searchable
931 aRow[12] = new ORowSetValueDecorator(ORowSetValue(true)); // Autoincrement
932 }
933
934 aRow[6] = new ORowSetValueDecorator(OUString("PRECISION,SCALE")); // Create params
935 // Numeric
936 aRow[1] = new ORowSetValueDecorator(OUString("NUMERIC"));
937 aRow[2] = new ORowSetValueDecorator(DataType::NUMERIC);
938 aRow[3] = new ORowSetValueDecorator(sal_Int16(18)); // Precision
939 aRow[14] = new ORowSetValueDecorator(sal_Int16(0)); // Minimum scale
940 aRow[15] = new ORowSetValueDecorator(sal_Int16(18)); // Max scale
941 tmp.push_back(aRow);
942 // Decimal
943 aRow[1] = new ORowSetValueDecorator(OUString("DECIMAL"));
944 aRow[2] = new ORowSetValueDecorator(DataType::DECIMAL);
945 aRow[3] = new ORowSetValueDecorator(sal_Int16(18)); // Precision
946 aRow[14] = new ORowSetValueDecorator(sal_Int16(0)); // Minimum scale
947 aRow[15] = new ORowSetValueDecorator(sal_Int16(18)); // Max scale
948 tmp.push_back(aRow);
949
950 aRow[6] = new ORowSetValueDecorator(); // Create Params
951 // Float (SQL_FLOAT)
952 aRow[1] = new ORowSetValueDecorator(OUString("FLOAT"));
953 aRow[2] = new ORowSetValueDecorator(DataType::FLOAT);
954 aRow[3] = new ORowSetValueDecorator(sal_Int16(7)); // Precision
955 aRow[14] = new ORowSetValueDecorator(sal_Int16(1)); // Minimum scale
956 aRow[15] = new ORowSetValueDecorator(sal_Int16(7)); // Max scale
957 tmp.push_back(aRow);
958 // Double (SQL_DOUBLE)
959 aRow[1] = new ORowSetValueDecorator(OUString("DOUBLE PRECISION"));
960 aRow[2] = new ORowSetValueDecorator(DataType::DOUBLE);
961 aRow[3] = new ORowSetValueDecorator(sal_Int16(15)); // Precision
962 aRow[14] = new ORowSetValueDecorator(sal_Int16(1)); // Minimum scale
963 aRow[15] = new ORowSetValueDecorator(sal_Int16(15)); // Max scale
964 tmp.push_back(aRow);
965
966 // TODO: no idea whether D_FLOAT corresponds to an sql type
967
968 // SQL_TIMESTAMP
969 aRow[1] = new ORowSetValueDecorator(OUString("TIMESTAMP"));
970 aRow[2] = new ORowSetValueDecorator(DataType::TIMESTAMP);
971 aRow[3] = new ORowSetValueDecorator(sal_Int32(8)); // Prevision = max length
972 aRow[6] = new ORowSetValueDecorator(); // Create Params
973 aRow[9] = new ORowSetValueDecorator(
974 sal_Int16(ColumnSearch::FULL)); // Searchable
975 aRow[12] = new ORowSetValueDecorator(ORowSetValue(false)); // Autoincrement
976 aRow[14] = ODatabaseMetaDataResultSet::get0Value(); // Minimum scale
977 aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
978 tmp.push_back(aRow);
979
980 // SQL_TYPE_TIME
981 aRow[1] = new ORowSetValueDecorator(OUString("TIME"));
982 aRow[2] = new ORowSetValueDecorator(DataType::TIME);
983 aRow[3] = new ORowSetValueDecorator(sal_Int32(8)); // Prevision = max length
984 aRow[6] = new ORowSetValueDecorator(); // Create Params
985 aRow[9] = new ORowSetValueDecorator(
986 sal_Int16(ColumnSearch::FULL)); // Searchable
987 aRow[12] = new ORowSetValueDecorator(ORowSetValue(false)); // Autoincrement
988 aRow[14] = ODatabaseMetaDataResultSet::get0Value(); // Minimum scale
989 aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
990 tmp.push_back(aRow);
991
992 // SQL_TYPE_DATE
993 aRow[1] = new ORowSetValueDecorator(OUString("DATE"));
994 aRow[2] = new ORowSetValueDecorator(DataType::DATE);
995 aRow[3] = new ORowSetValueDecorator(sal_Int32(8)); // Prevision = max length
996 aRow[6] = new ORowSetValueDecorator(); // Create Params
997 aRow[9] = new ORowSetValueDecorator(
998 sal_Int16(ColumnSearch::FULL)); // Searchable
999 aRow[12] = new ORowSetValueDecorator(ORowSetValue(false)); // Autoincrement
1000 aRow[14] = ODatabaseMetaDataResultSet::get0Value(); // Minimum scale
1001 aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
1002 tmp.push_back(aRow);
1003
1004 // SQL_BLOB
1005 aRow[1] = new ORowSetValueDecorator(OUString("BLOB SUB_TYPE BINARY"));
1006 aRow[2] = new ORowSetValueDecorator(DataType::BLOB);
1007 aRow[3] = new ORowSetValueDecorator(sal_Int32(0)); // Prevision = max length
1008 aRow[6] = new ORowSetValueDecorator(); // Create Params
1009 aRow[9] = new ORowSetValueDecorator(
1010 sal_Int16(ColumnSearch::NONE)); // Searchable
1011 aRow[12] = new ORowSetValueDecorator(ORowSetValue(false)); // Autoincrement
1012 aRow[14] = ODatabaseMetaDataResultSet::get0Value(); // Minimum scale
1013 aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
1014 tmp.push_back(aRow);
1015
1016 // SQL_BOOLEAN
1017 aRow[1] = new ORowSetValueDecorator(OUString("BOOLEAN"));
1018 aRow[2] = new ORowSetValueDecorator(DataType::BOOLEAN);
1019 aRow[3] = new ORowSetValueDecorator(sal_Int32(1)); // Prevision = max length
1020 aRow[6] = new ORowSetValueDecorator(); // Create Params
1021 aRow[9] = new ORowSetValueDecorator(
1022 sal_Int16(ColumnSearch::BASIC)); // Searchable
1023 aRow[12] = new ORowSetValueDecorator(ORowSetValue(false)); // Autoincrement
1024 aRow[14] = ODatabaseMetaDataResultSet::get0Value(); // Minimum scale
1025 aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
1026 tmp.push_back(aRow);
1027 return tmp;
1028 }();
1029 // [-loplugin:redundantfcast] false positive:
1030 pResultSet->setRows(ODatabaseMetaDataResultSet::ORows(aResults));
1031 return pResultSet;
1032}
1033
1034uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges(
1035 const Any& /*aCatalog*/,
1036 const OUString& /*sSchema*/,
1037 const OUString& sTable,
1038 const OUString& sColumnNamePattern)
1039{
1040 SAL_INFO("connectivity.firebird", "getColumnPrivileges() with "
1041 "Table: " << sTable
1042 << " & ColumnNamePattern: " << sColumnNamePattern);
1043
1046 uno::Reference< XStatement > statement = m_pConnection->createStatement();
1047
1048 static const char wld[] = "%";
1049 OUStringBuffer queryBuf(
1050 "SELECT "
1051 "priv.RDB$RELATION_NAME, " // 1 Table name
1052 "priv.RDB$GRANTOR," // 2
1053 "priv.RDB$USER, " // 3 Grantee
1054 "priv.RDB$PRIVILEGE, " // 4
1055 "priv.RDB$GRANT_OPTION, " // 5 is Grantable
1056 "priv.RDB$FIELD_NAME " // 6 Column name
1057 "FROM RDB$USER_PRIVILEGES priv ");
1058
1059 {
1060 OUString sAppend = "WHERE priv.RDB$RELATION_NAME = '%' ";
1061 queryBuf.append(sAppend.replaceAll("%", sTable));
1062 }
1063 if (!sColumnNamePattern.isEmpty())
1064 {
1065 OUString sAppend;
1066 if (sColumnNamePattern.match(wld))
1067 sAppend = "AND priv.RDB$FIELD_NAME LIKE '%' ";
1068 else
1069 sAppend = "AND priv.RDB$FIELD_NAME = '%' ";
1070
1071 queryBuf.append(sAppend.replaceAll(wld, sColumnNamePattern));
1072 }
1073
1074 queryBuf.append(" ORDER BY priv.RDB$FIELD, "
1075 "priv.RDB$PRIVILEGE");
1076
1077 OUString query = queryBuf.makeStringAndClear();
1078
1079 uno::Reference< XResultSet > rs = statement->executeQuery(query);
1080 uno::Reference< XRow > xRow( rs, UNO_QUERY_THROW );
1082
1083 ODatabaseMetaDataResultSet::ORow aCurrentRow(9);
1084 aCurrentRow[0] = new ORowSetValueDecorator(); // Unused
1085 aCurrentRow[1] = new ORowSetValueDecorator(); // 1. TABLE_CAT Unsupported
1086 aCurrentRow[2] = new ORowSetValueDecorator(); // 1. TABLE_SCHEM Unsupported
1087
1088 while( rs->next() )
1089 {
1090 // 3. TABLE_NAME
1091 aCurrentRow[3] = new ORowSetValueDecorator(sanitizeIdentifier(xRow->getString(1)));
1092 // 4. COLUMN_NAME
1093 aCurrentRow[4] = new ORowSetValueDecorator(sanitizeIdentifier(xRow->getString(6)));
1094 aCurrentRow[5] = new ORowSetValueDecorator(sanitizeIdentifier(xRow->getString(2))); // 5. GRANTOR
1095 aCurrentRow[6] = new ORowSetValueDecorator(sanitizeIdentifier(xRow->getString(3))); // 6. GRANTEE
1096 aCurrentRow[7] = new ORowSetValueDecorator(xRow->getString(4)); // 7. Privilege
1097 aCurrentRow[8] = new ORowSetValueDecorator( ( xRow->getShort(5) == 1 ) ?
1098 OUString("YES") : OUString("NO")); // 8. Grantable
1099
1100 aResults.push_back(aCurrentRow);
1101 }
1102
1103 pResultSet->setRows( std::move(aResults) );
1104
1105 return pResultSet;
1106}
1107
1108uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
1109 const Any& /*catalog*/,
1110 const OUString& /*schemaPattern*/,
1111 const OUString& tableNamePattern,
1112 const OUString& columnNamePattern)
1113{
1114 SAL_INFO("connectivity.firebird", "getColumns() with "
1115 "TableNamePattern: " << tableNamePattern <<
1116 " & ColumnNamePattern: " << columnNamePattern);
1117
1118 OUStringBuffer queryBuf("SELECT "
1119 "relfields.RDB$RELATION_NAME, " // 1
1120 "relfields.RDB$FIELD_NAME, " // 2
1121 "relfields.RDB$DESCRIPTION," // 3
1122 "relfields.RDB$DEFAULT_VALUE, " // 4
1123 "relfields.RDB$FIELD_POSITION, "// 5
1124 "fields.RDB$FIELD_TYPE, " // 6
1125 "fields.RDB$FIELD_SUB_TYPE, " // 7
1126 "fields.RDB$FIELD_LENGTH, " // 8
1127 "fields.RDB$FIELD_PRECISION, " // 9
1128 "fields.RDB$FIELD_SCALE, " // 10
1129 // Specifically use relfields null flag -- the one in fields is used
1130 // for domains, whether a specific field is nullable is set in relfields,
1131 // this is also the one we manually fiddle when changing NULL/NOT NULL
1132 // (see Table.cxx)
1133 "relfields.RDB$NULL_FLAG, " // 11
1134 "fields.RDB$CHARACTER_LENGTH, " // 12
1135 "charset.RDB$CHARACTER_SET_NAME " // 13
1136 "FROM RDB$RELATION_FIELDS relfields "
1137 "JOIN RDB$FIELDS fields "
1138 "on (fields.RDB$FIELD_NAME = relfields.RDB$FIELD_SOURCE) "
1139 "LEFT JOIN RDB$CHARACTER_SETS charset "
1140 "on (fields.RDB$CHARACTER_SET_ID = charset.RDB$CHARACTER_SET_ID) "
1141 "WHERE (1 = 1) ");
1142
1143 if (!tableNamePattern.isEmpty())
1144 {
1145 OUString sAppend;
1146 if (tableNamePattern.match("%"))
1147 sAppend = "AND relfields.RDB$RELATION_NAME LIKE '%' ";
1148 else
1149 sAppend = "AND relfields.RDB$RELATION_NAME = '%' ";
1150
1151 queryBuf.append(sAppend.replaceAll("%", tableNamePattern));
1152 }
1153
1154 if (!columnNamePattern.isEmpty())
1155 {
1156 OUString sAppend;
1157 if (columnNamePattern.match("%"))
1158 sAppend = "AND relfields.RDB$FIELD_NAME LIKE '%' ";
1159 else
1160 sAppend = "AND relfields.RDB$FIELD_NAME = '%' ";
1161
1162 queryBuf.append(sAppend.replaceAll("%", columnNamePattern));
1163 }
1164
1165 OUString query = queryBuf.makeStringAndClear();
1166
1167 uno::Reference< XStatement > statement = m_pConnection->createStatement();
1168 uno::Reference< XResultSet > rs = statement->executeQuery(query);
1169 uno::Reference< XRow > xRow( rs, UNO_QUERY_THROW );
1170
1172 ODatabaseMetaDataResultSet::ORow aCurrentRow(19);
1173
1174 aCurrentRow[0] = new ORowSetValueDecorator(); // Unused -- numbering starts from 0
1175 aCurrentRow[1] = new ORowSetValueDecorator(); // Catalog - can be null
1176 aCurrentRow[2] = new ORowSetValueDecorator(); // Schema - can be null
1177 aCurrentRow[8] = new ORowSetValueDecorator(); // Unused
1178 aCurrentRow[10] = new ORowSetValueDecorator(sal_Int32(10)); // Radix: fixed in FB
1179 aCurrentRow[14] = new ORowSetValueDecorator(); // Unused
1180 aCurrentRow[15] = new ORowSetValueDecorator(); // Unused
1181
1182 while( rs->next() )
1183 {
1184 // 3. TABLE_NAME
1185 aCurrentRow[3] = new ORowSetValueDecorator(sanitizeIdentifier(xRow->getString(1)));
1186 // 4. Column Name
1187 aCurrentRow[4] = new ORowSetValueDecorator(sanitizeIdentifier(xRow->getString(2)));
1188 // 5. Datatype
1189 short aType = getFBTypeFromBlrType(xRow->getShort(6));
1190 short aScale = xRow->getShort(10);
1191 OUString sCharsetName = xRow->getString(13);
1192 // result field may be filled with spaces
1193 sCharsetName = sCharsetName.trim();
1194 ColumnTypeInfo aInfo(aType, xRow->getShort(7), aScale,
1195 sCharsetName);
1196
1197 aCurrentRow[5] = new ORowSetValueDecorator(aInfo.getSdbcType());
1198 // 6. Typename (SQL_*)
1199 aCurrentRow[6] = new ORowSetValueDecorator(aInfo.getColumnTypeName());
1200
1201 // 7. Column Sizes
1202 {
1203 sal_Int32 aColumnSize = 0;
1204 switch (aType)
1205 {
1206 case SQL_TEXT:
1207 case SQL_VARYING:
1208 aColumnSize = xRow->getShort(12);
1209 break;
1210 case SQL_SHORT:
1211 case SQL_LONG:
1212 case SQL_FLOAT:
1213 case SQL_DOUBLE:
1214 case SQL_D_FLOAT:
1215 case SQL_INT64:
1216 case SQL_QUAD:
1217 aColumnSize = xRow->getShort(9);
1218 break;
1219 case SQL_TIMESTAMP:
1220 case SQL_BLOB:
1221 case SQL_ARRAY:
1222 case SQL_TYPE_TIME:
1223 case SQL_TYPE_DATE:
1224 case SQL_NULL:
1225 // TODO: implement.
1226 break;
1227 }
1228 aCurrentRow[7] = new ORowSetValueDecorator(aColumnSize);
1229 }
1230
1231 // 9. Decimal digits (scale)
1232 // fb stores a negative number
1233 aCurrentRow[9] = new ORowSetValueDecorator( static_cast<sal_Int16>(-aScale) );
1234
1235 // 11. Nullable
1236 if (xRow->getShort(11))
1237 {
1238 aCurrentRow[11] = new ORowSetValueDecorator(ColumnValue::NO_NULLS);
1239 }
1240 else
1241 {
1242 aCurrentRow[11] = new ORowSetValueDecorator(ColumnValue::NULLABLE);
1243 }
1244 // 12. Comments -- may be omitted
1245 {
1246 OUString aDescription;
1247 uno::Reference< XBlob > xBlob = xRow->getBlob(3);
1248 if (xBlob.is())
1249 {
1250 const sal_Int64 aBlobLength = xBlob->length();
1251 if (aBlobLength > SAL_MAX_INT32)
1252 {
1253 SAL_WARN("connectivity.firebird", "getBytes can't return " << aBlobLength << " bytes but only max " << SAL_MAX_INT32);
1254 aDescription = OUString(reinterpret_cast<char*>(xBlob->getBytes(1, SAL_MAX_INT32).getArray()),
1255 SAL_MAX_INT32,
1256 RTL_TEXTENCODING_UTF8);
1257 }
1258 else
1259 {
1260 aDescription = OUString(reinterpret_cast<char*>(xBlob->getBytes(1, static_cast<sal_Int32>(aBlobLength)).getArray()),
1261 aBlobLength,
1262 RTL_TEXTENCODING_UTF8);
1263 }
1264 }
1265 aCurrentRow[12] = new ORowSetValueDecorator(aDescription);
1266 }
1267 // 13. Default -- may be omitted.
1268 {
1269 uno::Reference< XBlob > xDefaultValueBlob = xRow->getBlob(4);
1270 if (xDefaultValueBlob.is())
1271 {
1272 // TODO: Implement
1273 }
1274 aCurrentRow[13] = new ORowSetValueDecorator();
1275 }
1276
1277 // 16. Bytes in Column for char
1278 if (aType == SQL_TEXT)
1279 {
1280 aCurrentRow[16] = new ORowSetValueDecorator(xRow->getShort(8));
1281 }
1282 else if (aType == SQL_VARYING)
1283 {
1284 aCurrentRow[16] = new ORowSetValueDecorator(sal_Int32(32767));
1285 }
1286 else
1287 {
1288 aCurrentRow[16] = new ORowSetValueDecorator(sal_Int32(0));
1289 }
1290 // 17. Index of column
1291 {
1292 short nColumnNumber = xRow->getShort(5);
1293 // Firebird stores column numbers beginning with 0 internally
1294 // SDBC expects column numbering to begin with 1.
1295 aCurrentRow[17] = new ORowSetValueDecorator(sal_Int32(nColumnNumber + 1));
1296 }
1297 // 18. Is nullable
1298 if (xRow->getShort(9))
1299 {
1300 aCurrentRow[18] = new ORowSetValueDecorator(OUString("NO"));
1301 }
1302 else
1303 {
1304 aCurrentRow[18] = new ORowSetValueDecorator(OUString("YES"));
1305 }
1306
1307 aResults.push_back(aCurrentRow);
1308 }
1310 ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eColumns);
1311 pResultSet->setRows( std::move(aResults) );
1312
1313 return pResultSet;
1314}
1315
1316uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
1317 const Any& /*catalog*/,
1318 const OUString& /*schemaPattern*/,
1319 const OUString& tableNamePattern,
1320 const Sequence< OUString >& types)
1321{
1322 SAL_INFO("connectivity.firebird", "getTables() with "
1323 "TableNamePattern: " << tableNamePattern);
1324
1326 ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTables);
1327 uno::Reference< XStatement > statement = m_pConnection->createStatement();
1328
1329 static const char wld[] = "%";
1330 OUStringBuffer queryBuf(
1331 "SELECT "
1332 "RDB$RELATION_NAME, "
1333 "RDB$SYSTEM_FLAG, "
1334 "RDB$RELATION_TYPE, "
1335 "RDB$DESCRIPTION, "
1336 "RDB$VIEW_BLR "
1337 "FROM RDB$RELATIONS "
1338 "WHERE ");
1339
1340 // TODO: GLOBAL TEMPORARY, LOCAL TEMPORARY, ALIAS, SYNONYM
1341 if (!types.hasElements() || (types.getLength() == 1 && types[0].match(wld)))
1342 {
1343 // from Firebird: src/jrd/constants.h
1344 // rel_persistent = 0, rel_view = 1, rel_external = 2
1345 // All table types? I.e. includes system tables.
1346 queryBuf.append("(RDB$RELATION_TYPE = 0 OR RDB$RELATION_TYPE = 1 OR RDB$RELATION_TYPE = 2) ");
1347 }
1348 else
1349 {
1350 queryBuf.append("( (0 = 1) ");
1351 for (OUString const & t : types)
1352 {
1353 if (t == "SYSTEM TABLE")
1354 queryBuf.append("OR (RDB$SYSTEM_FLAG = 1 AND RDB$VIEW_BLR IS NULL) ");
1355 else if (t == "TABLE")
1356 queryBuf.append("OR (RDB$SYSTEM_FLAG IS NULL OR RDB$SYSTEM_FLAG = 0 AND RDB$VIEW_BLR IS NULL) ");
1357 else if (t == "VIEW")
1358 queryBuf.append("OR (RDB$SYSTEM_FLAG IS NULL OR RDB$SYSTEM_FLAG = 0 AND RDB$VIEW_BLR IS NOT NULL) ");
1359 else
1360 throw SQLException(); // TODO: implement other types, see above.
1361 }
1362 queryBuf.append(") ");
1363 }
1364
1365 if (!tableNamePattern.isEmpty())
1366 {
1367 OUString sAppend;
1368 if (tableNamePattern.match(wld))
1369 sAppend = "AND RDB$RELATION_NAME LIKE '%' ";
1370 else
1371 sAppend = "AND RDB$RELATION_NAME = '%' ";
1372
1373 queryBuf.append(sAppend.replaceAll(wld, tableNamePattern));
1374 }
1375
1376 queryBuf.append(" ORDER BY RDB$RELATION_TYPE, RDB$RELATION_NAME");
1377
1378 OUString query = queryBuf.makeStringAndClear();
1379
1380 uno::Reference< XResultSet > rs = statement->executeQuery(query);
1381 uno::Reference< XRow > xRow( rs, UNO_QUERY_THROW );
1383
1384 ODatabaseMetaDataResultSet::ORow aCurrentRow(6);
1385 aCurrentRow[0] = new ORowSetValueDecorator(); // 0. Unused
1386 aCurrentRow[1] = new ORowSetValueDecorator(); // 1. Table_Cat Unsupported
1387 aCurrentRow[2] = new ORowSetValueDecorator(); // 2. Table_Schem Unsupported
1388
1389 while( rs->next() )
1390 {
1391 // 3. TABLE_NAME
1392 aCurrentRow[3] = new ORowSetValueDecorator(sanitizeIdentifier(xRow->getString(1)));
1393 // 4. TABLE_TYPE
1394 {
1395 // TODO: check this as the docs are a bit unclear.
1396 sal_Int16 nSystemFlag = xRow->getShort(2);
1397 sal_Int16 nTableType = xRow->getShort(3);
1398 xRow->getBlob(5); // We have to retrieve a column to verify it is null.
1399 bool aIsView = !xRow->wasNull();
1400 OUString sTableType;
1401
1402 if (nSystemFlag == 1)
1403 {
1404 sTableType = "SYSTEM TABLE";
1405 }
1406 else if (aIsView)
1407 {
1408 sTableType = "VIEW";
1409 }
1410 else
1411 {
1412 // see above about src/jrd/constants.h
1413 if (nTableType == 0 || nTableType == 2)
1414 sTableType = "TABLE";
1415 }
1416
1417 aCurrentRow[4] = new ORowSetValueDecorator(sTableType);
1418 }
1419 // 5. REMARKS
1420 {
1421 uno::Reference< XClob > xClob = xRow->getClob(4);
1422 if (xClob.is())
1423 {
1424 aCurrentRow[5] = new ORowSetValueDecorator(xClob->getSubString(1, xClob->length()));
1425 }
1426 }
1427
1428 aResults.push_back(aCurrentRow);
1429 }
1430
1431 pResultSet->setRows( std::move(aResults) );
1432
1433 return pResultSet;
1434}
1435
1436uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedureColumns(
1437 const Any&, const OUString&,
1438 const OUString&, const OUString& )
1439{
1440 SAL_WARN("connectivity.firebird", "Not yet implemented");
1441 OSL_FAIL("Not implemented yet!");
1442 // TODO implement
1443 return new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eProcedureColumns);
1444}
1445
1446uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedures(
1447 const Any&, const OUString&,
1448 const OUString& )
1449{
1450 SAL_WARN("connectivity.firebird", "Not yet implemented");
1451 OSL_FAIL("Not implemented yet!");
1452 // TODO implement
1453 return new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eProcedures);
1454}
1455
1456uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getVersionColumns(
1457 const Any&, const OUString&, const OUString& )
1458{
1459 SAL_WARN("connectivity.firebird", "Not yet implemented");
1460 OSL_FAIL("Not implemented yet!");
1461 // TODO implement
1462 return new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eVersionColumns);
1463}
1464
1465uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys(
1466 const Any&, const OUString&, const OUString& table )
1467{
1468 return ODatabaseMetaData::lcl_getKeys(false, table);
1469}
1470
1471uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys(
1472 const Any&, const OUString&, const OUString& table )
1473{
1474 return ODatabaseMetaData::lcl_getKeys(true, table);
1475}
1476
1477uno::Reference< XResultSet > ODatabaseMetaData::lcl_getKeys(const bool bIsImport, std::u16string_view table )
1478{
1481
1482 uno::Reference< XStatement > statement = m_pConnection->createStatement();
1483
1484 OUString sSQL = "SELECT "
1485 "RDB$REF_CONSTRAINTS.RDB$UPDATE_RULE, " // 1 update rule
1486 "RDB$REF_CONSTRAINTS.RDB$DELETE_RULE, " // 2 delete rule
1487 "RDB$REF_CONSTRAINTS.RDB$CONST_NAME_UQ, " // 3 primary or unique key name
1488 "RDB$REF_CONSTRAINTS.RDB$CONSTRAINT_NAME, " // 4 foreign key name
1489 "PRIM.RDB$DEFERRABLE, " // 5 deferrability
1490 "PRIM.RDB$INITIALLY_DEFERRED, " // 6 deferrability
1491 "PRIM.RDB$RELATION_NAME, " // 7 PK table name
1492 "PRIMARY_INDEX.RDB$FIELD_NAME, " // 8 PK column name
1493 "PRIMARY_INDEX.RDB$FIELD_POSITION, " // 9 PK sequence number
1494 "FOREI.RDB$RELATION_NAME, " // 10 FK table name
1495 "FOREIGN_INDEX.RDB$FIELD_NAME " // 11 FK column name
1496 "FROM RDB$REF_CONSTRAINTS "
1497 "INNER JOIN RDB$RELATION_CONSTRAINTS AS PRIM "
1498 "ON RDB$REF_CONSTRAINTS.RDB$CONST_NAME_UQ = PRIM.RDB$CONSTRAINT_NAME "
1499 "INNER JOIN RDB$RELATION_CONSTRAINTS AS FOREI "
1500 "ON RDB$REF_CONSTRAINTS.RDB$CONSTRAINT_NAME = FOREI.RDB$CONSTRAINT_NAME "
1501 "INNER JOIN RDB$INDEX_SEGMENTS AS PRIMARY_INDEX "
1502 "ON PRIM.RDB$INDEX_NAME = PRIMARY_INDEX.RDB$INDEX_NAME "
1503 "INNER JOIN RDB$INDEX_SEGMENTS AS FOREIGN_INDEX "
1504 "ON FOREI.RDB$INDEX_NAME = FOREIGN_INDEX.RDB$INDEX_NAME "
1505 "WHERE FOREI.RDB$CONSTRAINT_TYPE = 'FOREIGN KEY' ";
1506 if (bIsImport)
1507 sSQL += OUString::Concat("AND FOREI.RDB$RELATION_NAME = '")+ table +"'";
1508 else
1509 sSQL += OUString::Concat("AND PRIM.RDB$RELATION_NAME = '")+ table +"'";
1510
1511 uno::Reference< XResultSet > rs = statement->executeQuery(sSQL);
1512 uno::Reference< XRow > xRow( rs, UNO_QUERY_THROW );
1513
1515 ODatabaseMetaDataResultSet::ORow aCurrentRow(15);
1516
1517 // TODO is it necessary to initialize these?
1518 aCurrentRow[0] = new ORowSetValueDecorator(); // Unused
1519 aCurrentRow[1] = new ORowSetValueDecorator(); // PKTABLE_CAT unsupported
1520 aCurrentRow[2] = new ORowSetValueDecorator(); // PKTABLE_SCHEM unsupported
1521 aCurrentRow[5] = new ORowSetValueDecorator(); // FKTABLE_CAT unsupported
1522 aCurrentRow[6] = new ORowSetValueDecorator(); // FKTABLE_SCHEM unsupported
1523
1524 std::map< OUString,sal_Int32> aRuleMap;
1525 aRuleMap[ OUString("CASCADE")] = KeyRule::CASCADE;
1526 aRuleMap[ OUString("RESTRICT")] = KeyRule::RESTRICT;
1527 aRuleMap[ OUString("SET NULL")] = KeyRule::SET_NULL;
1528 aRuleMap[ OUString("SET DEFAULT")] = KeyRule::SET_DEFAULT;
1529 aRuleMap[ OUString("NO ACTION")] = KeyRule::NO_ACTION;
1530
1531 while(rs->next())
1532 {
1533 aCurrentRow[3] = new ORowSetValueDecorator(sanitizeIdentifier(xRow->getString(7))); // PK table
1534 aCurrentRow[4] = new ORowSetValueDecorator(sanitizeIdentifier(xRow->getString(8))); // PK column
1535 aCurrentRow[7] = new ORowSetValueDecorator(sanitizeIdentifier(xRow->getString(10))); // FK table
1536 aCurrentRow[8] = new ORowSetValueDecorator(sanitizeIdentifier(xRow->getString(11))); // FK column
1537
1538 aCurrentRow[9] = new ORowSetValueDecorator(xRow->getShort(9)); // PK sequence number
1539 aCurrentRow[10] = new ORowSetValueDecorator(aRuleMap[sanitizeIdentifier(xRow->getString(1))]); // update role
1540 aCurrentRow[11] = new ORowSetValueDecorator(aRuleMap[sanitizeIdentifier(xRow->getString(2))]); // delete role
1541
1542 aCurrentRow[12] = new ORowSetValueDecorator(sanitizeIdentifier(xRow->getString(4))); // FK name
1543 aCurrentRow[13] = new ORowSetValueDecorator(sanitizeIdentifier(xRow->getString(3))); // PK name
1544
1545 aCurrentRow[14] = new ORowSetValueDecorator(Deferrability::NONE); // deferrability
1546
1547 // deferrability is currently not supported, but may be supported in the future.
1548 /*
1549 aCurrentRow[14] = (xRow->getString(5) == "NO" ?
1550 new ORowSetValueDecorator(Deferrability::NONE)
1551 : (xRow->getString(6) == "NO" ?
1552 new ORowSetValueDecorator(Deferrability::INITIALLY_IMMEDIATE)
1553 : new ORowSetValueDecorator(Deferrability::INITIALLY_DEFERRED));
1554 */
1555
1556 aResults.push_back(aCurrentRow);
1557 }
1558
1559 pResultSet->setRows( std::move(aResults) );
1560 return pResultSet;
1561}
1562
1563uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys(
1564 const Any& /*aCatalog*/,
1565 const OUString& /*sSchema*/,
1566 const OUString& sTable)
1567{
1568 SAL_INFO("connectivity.firebird", "getPrimaryKeys() with "
1569 "Table: " << sTable);
1570
1571 OUString sAppend = "WHERE constr.RDB$RELATION_NAME = '%' ";
1572 OUString sQuery = "SELECT "
1573 "constr.RDB$RELATION_NAME, " // 1. Table Name
1574 "inds.RDB$FIELD_NAME, " // 2. Column Name
1575 "inds.RDB$FIELD_POSITION, " // 3. Sequence Number
1576 "constr.RDB$CONSTRAINT_NAME " // 4 Constraint name
1577 "FROM RDB$RELATION_CONSTRAINTS constr "
1578 "JOIN RDB$INDEX_SEGMENTS inds "
1579 "on (constr.RDB$INDEX_NAME = inds.RDB$INDEX_NAME) " +
1580 sAppend.replaceAll("%", sTable) +
1581 "AND constr.RDB$CONSTRAINT_TYPE = 'PRIMARY KEY' "
1582 "ORDER BY inds.RDB$FIELD_NAME";
1583
1584 uno::Reference< XStatement > xStatement = m_pConnection->createStatement();
1585 uno::Reference< XResultSet > xRs = xStatement->executeQuery(sQuery);
1586 uno::Reference< XRow > xRow( xRs, UNO_QUERY_THROW );
1587
1589 ODatabaseMetaDataResultSet::ORow aCurrentRow(7);
1590
1591 aCurrentRow[0] = new ORowSetValueDecorator(); // Unused -- numbering starts from 0
1592 aCurrentRow[1] = new ORowSetValueDecorator(); // Catalog - can be null
1593 aCurrentRow[2] = new ORowSetValueDecorator(); // Schema - can be null
1594
1595 while(xRs->next())
1596 {
1597 // 3. Table Name
1598 if (xRs->getRow() == 1) // Table name doesn't change, so only retrieve once
1599 {
1600 aCurrentRow[3] = new ORowSetValueDecorator(sanitizeIdentifier(xRow->getString(1)));
1601 }
1602 // 4. Column Name
1603 aCurrentRow[4] = new ORowSetValueDecorator(sanitizeIdentifier(xRow->getString(2)));
1604 // 5. KEY_SEQ (which key in the sequence)
1605 aCurrentRow[5] = new ORowSetValueDecorator(xRow->getShort(3));
1606 // 6. Primary Key Name
1607 aCurrentRow[6] = new ORowSetValueDecorator(sanitizeIdentifier(xRow->getString(4)));
1608
1609 aResults.push_back(aCurrentRow);
1610 }
1612 ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::ePrimaryKeys);
1613 pResultSet->setRows( std::move(aResults) );
1614
1615 return pResultSet;
1616}
1617
1618uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo(
1619 const Any& /*aCatalog*/,
1620 const OUString& /*sSchema*/,
1621 const OUString& sTable,
1622 sal_Bool bIsUnique,
1623 sal_Bool) // TODO: what is bIsApproximate?
1624
1625{
1626 // Apparently this method can also return a "tableIndexStatistic"
1627 // However this is only mentioned in XDatabaseMetaData.idl (whose comments
1628 // are duplicated in the postgresql driver), and is otherwise undocumented.
1629 SAL_INFO("connectivity.firebird", "getPrimaryKeys() with "
1630 "Table: " << sTable);
1631
1632 OUStringBuffer aQueryBuf("SELECT "
1633 "indices.RDB$RELATION_NAME, " // 1. Table Name
1634 "index_segments.RDB$FIELD_NAME, " // 2. Column Name
1635 "index_segments.RDB$FIELD_POSITION, " // 3. Sequence Number
1636 "indices.RDB$INDEX_NAME, " // 4. Index name
1637 "indices.RDB$UNIQUE_FLAG, " // 5. Unique Flag
1638 "indices.RDB$INDEX_TYPE " // 6. Index Type
1639 "FROM RDB$INDICES indices "
1640 "JOIN RDB$INDEX_SEGMENTS index_segments "
1641 "on (indices.RDB$INDEX_NAME = index_segments.RDB$INDEX_NAME) "
1642 "WHERE indices.RDB$RELATION_NAME = '" + sTable + "' "
1643 "AND (indices.RDB$SYSTEM_FLAG = 0) ");
1644 // Not sure whether we should exclude system indices, but otoh. we never
1645 // actually deal with system tables (system indices only apply to system
1646 // tables) within the GUI.
1647
1648 // Only filter if true (according to the docs), i.e.:
1649 // If false we return all indices, if true we return only unique indices
1650 if (bIsUnique)
1651 aQueryBuf.append("AND (indices.RDB$UNIQUE_FLAG = 1) ");
1652
1653 OUString sQuery = aQueryBuf.makeStringAndClear();
1654
1655 uno::Reference< XStatement > xStatement = m_pConnection->createStatement();
1656 uno::Reference< XResultSet > xRs = xStatement->executeQuery(sQuery);
1657 uno::Reference< XRow > xRow( xRs, UNO_QUERY_THROW );
1658
1660 ODatabaseMetaDataResultSet::ORow aCurrentRow(14);
1661
1662 aCurrentRow[0] = new ORowSetValueDecorator(); // Unused -- numbering starts from 0
1663 aCurrentRow[1] = new ORowSetValueDecorator(); // Catalog - can be null
1664 aCurrentRow[2] = new ORowSetValueDecorator(); // Schema - can be null
1665 aCurrentRow[5] = new ORowSetValueDecorator(); // Index Catalog -- can be null
1666 // Wikipedia indicates:
1667 // 'Firebird makes all indices of the database behave like well-tuned "clustered indexes" used by other architectures.'
1668 // but it's not "CLUSTERED", neither "STATISTIC" nor "HASHED" (the other specific types from offapi/com/sun/star/sdbc/IndexType.idl)
1669 // According to https://www.ibphoenix.com/resources/documents/design/doc_18,
1670 // it seems another type => OTHER
1671 aCurrentRow[7] = new ORowSetValueDecorator(IndexType::OTHER); // 7. INDEX TYPE
1672 aCurrentRow[13] = new ORowSetValueDecorator(); // Filter Condition -- can be null
1673
1674 while(xRs->next())
1675 {
1676 // 3. Table Name
1677 if (xRs->getRow() == 1) // Table name doesn't change, so only retrieve once
1678 {
1679 aCurrentRow[3] = new ORowSetValueDecorator(sanitizeIdentifier(xRow->getString(1)));
1680 }
1681
1682 // 4. NON_UNIQUE -- i.e. specifically negate here.
1683 aCurrentRow[4] = new ORowSetValueDecorator(ORowSetValue(xRow->getShort(5) == 0));
1684 // 6. INDEX NAME
1685 aCurrentRow[6] = new ORowSetValueDecorator(sanitizeIdentifier(xRow->getString(4)));
1686
1687 // 8. ORDINAL POSITION
1688 aCurrentRow[8] = new ORowSetValueDecorator(xRow->getShort(3));
1689 // 9. COLUMN NAME
1690 aCurrentRow[9] = new ORowSetValueDecorator(sanitizeIdentifier(xRow->getString(2)));
1691 // 10. ASC(ending)/DESC(ending)
1692 if (xRow->getShort(6) == 1)
1693 aCurrentRow[10] = new ORowSetValueDecorator(OUString("D"));
1694 else
1695 aCurrentRow[10] = new ORowSetValueDecorator(OUString("A"));
1696 // TODO: double check this^^^, doesn't seem to be officially documented anywhere.
1697 // 11. CARDINALITY
1698 aCurrentRow[11] = new ORowSetValueDecorator(sal_Int32(0)); // TODO: determine how to do this
1699 // 12. PAGES
1700 aCurrentRow[12] = new ORowSetValueDecorator(sal_Int32(0)); // TODO: determine how to do this
1701
1702 aResults.push_back(aCurrentRow);
1703 }
1705 ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eIndexInfo);
1706 pResultSet->setRows( std::move(aResults) );
1707
1708 return pResultSet;
1709}
1710
1711uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getBestRowIdentifier(
1712 const Any&, const OUString&, const OUString&, sal_Int32,
1713 sal_Bool )
1714{
1715 OSL_FAIL("Not implemented yet!");
1716 // TODO implement
1717 return new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eBestRowIdentifier);
1718}
1719
1720uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
1721 const Any& /*aCatalog*/,
1722 const OUString& /*sSchemaPattern*/,
1723 const OUString& sTableNamePattern)
1724{
1725 SAL_INFO("connectivity.firebird", "getTablePrivileges() with "
1726 "TableNamePattern: " << sTableNamePattern);
1727
1729 ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTablePrivileges);
1730 uno::Reference< XStatement > statement = m_pConnection->createStatement();
1731
1732 // TODO: column specific privileges are included, we may need
1733 // to have WHERE RDB$FIELD_NAME = NULL or similar.
1734 static const char wld[] = "%";
1735 OUStringBuffer queryBuf(
1736 "SELECT "
1737 "priv.RDB$RELATION_NAME, " // 1
1738 "priv.RDB$GRANTOR," // 2
1739 "priv.RDB$USER, " // 3 Grantee
1740 "priv.RDB$PRIVILEGE, " // 4
1741 "priv.RDB$GRANT_OPTION " // 5 is Grantable
1742 "FROM RDB$USER_PRIVILEGES priv ");
1743
1744 if (!sTableNamePattern.isEmpty())
1745 {
1746 OUString sAppend;
1747 if (sTableNamePattern.match(wld))
1748 sAppend = "WHERE priv.RDB$RELATION_NAME LIKE '%' ";
1749 else
1750 sAppend = "WHERE priv.RDB$RELATION_NAME = '%' ";
1751
1752 queryBuf.append(sAppend.replaceAll(wld, sTableNamePattern));
1753 }
1754 queryBuf.append(" ORDER BY priv.RDB$RELATION_TYPE, "
1755 "priv.RDB$RELATION_NAME, "
1756 "priv.RDB$PRIVILEGE");
1757
1758 OUString query = queryBuf.makeStringAndClear();
1759
1760 uno::Reference< XResultSet > rs = statement->executeQuery(query);
1761 uno::Reference< XRow > xRow( rs, UNO_QUERY_THROW );
1763
1765 aRow[0] = new ORowSetValueDecorator(); // Unused
1766 aRow[1] = new ORowSetValueDecorator(); // TABLE_CAT unsupported
1767 aRow[2] = new ORowSetValueDecorator(); // TABLE_SCHEM unsupported.
1768
1769 while( rs->next() )
1770 {
1771 // 3. TABLE_NAME
1772 aRow[3] = new ORowSetValueDecorator(sanitizeIdentifier(xRow->getString(1)));
1773 aRow[4] = new ORowSetValueDecorator(sanitizeIdentifier(xRow->getString(2))); // 4. GRANTOR
1774 aRow[5] = new ORowSetValueDecorator(sanitizeIdentifier(xRow->getString(3))); // 5. GRANTEE
1775 aRow[6] = new ORowSetValueDecorator(xRow->getString(4)); // 6. Privilege
1776 aRow[7] = new ORowSetValueDecorator(ORowSetValue(bool(xRow->getBoolean(5)))); // 7. Is Grantable
1777
1778 aResults.push_back(aRow);
1779 }
1780
1781 pResultSet->setRows( std::move(aResults) );
1782
1783 return pResultSet;
1784}
1785
1786uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference(
1787 const Any&, const OUString&,
1788 const OUString&, const Any&,
1789 const OUString&, const OUString& )
1790{
1791 OSL_FAIL("Not implemented yet!");
1792 // TODO implement
1793 return new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eCrossReference);
1794}
1795
1796uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any&, const OUString&, const OUString&, const Sequence< sal_Int32 >& )
1797{
1798 OSL_FAIL("Not implemented yet!");
1799 // TODO implement
1800 return new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eUDTs);
1801}
1802
1803/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
std::vector< ORowSetValueDecoratorRef > ORow
@ 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
@ eUDTs
describes a result set as expected by XDatabaseMetaData::getUDTs
@ eTablePrivileges
describes a result set as expected by XDatabaseMetaData::getTablePrivileges
static ORowSetValueDecoratorRef const & get0Value()
return an ORowSetValueDecorator with 0 as value
static ORowSetValueDecoratorRef const & getQuoteValue()
return an ORowSetValueDecorator with string ' as value
ORowSetValueDecorator decorates an ORowSetValue so the value is "refcounted".
Definition: FValue.hxx:402
virtual sal_Bool SAL_CALL ownUpdatesAreVisible(sal_Int32 setType) 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 supportsAlterTableWithDropColumn() 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 css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCatalogs() override
virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers() override
virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL() override
virtual sal_Bool SAL_CALL supportsCatalogsInDataManipulation() 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 getProcedureColumns(const css::uno::Any &catalog, const OUString &schemaPattern, const OUString &procedureNamePattern, const OUString &columnNamePattern) 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 css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getImportedKeys(const css::uno::Any &catalog, const OUString &schema, const OUString &table) override
virtual sal_Int32 SAL_CALL getMaxUserNameLength() override
virtual sal_Int32 SAL_CALL getMaxColumnsInTable() override
virtual sal_Bool SAL_CALL supportsMultipleTransactions() override
virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection() override
virtual sal_Bool SAL_CALL supportsResultSetConcurrency(sal_Int32 setType, sal_Int32 concurrency) override
virtual sal_Bool SAL_CALL supportsSchemasInTableDefinitions() override
virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls() override
virtual sal_Int32 SAL_CALL getMaxColumnNameLength() override
virtual sal_Bool SAL_CALL supportsMixedCaseQuotedIdentifiers() override
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTableTypes() override
virtual sal_Bool SAL_CALL supportsLimitedOuterJoins() override
virtual OUString SAL_CALL getSystemFunctions() override
virtual OUString SAL_CALL getIdentifierQuoteString() 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 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 supportsGroupByUnrelated() 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 isCatalogAtStart() 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 storesLowerCaseIdentifiers() 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 getColumnPrivileges(const css::uno::Any &catalog, const OUString &schema, const OUString &table, const OUString &columnNamePattern) override
virtual sal_Bool SAL_CALL supportsSchemasInDataManipulation() 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 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 sal_Bool SAL_CALL storesMixedCaseIdentifiers() override
virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback() 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_Int32 SAL_CALL getDriverMinorVersion() override
virtual OUString SAL_CALL getSchemaTerm() override
virtual sal_Bool SAL_CALL nullsAreSortedAtEnd() 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 css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTypeInfo() 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 sal_Bool SAL_CALL storesMixedCaseQuotedIdentifiers() 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
css::uno::Reference< css::sdbc::XResultSet > lcl_getKeys(bool bIsImport, std::u16string_view table)
virtual sal_Int32 SAL_CALL getMaxConnections() override
virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers() 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 supportsCatalogsInPrivilegeDefinitions() override
virtual OUString SAL_CALL getSQLKeywords() override
virtual OUString SAL_CALL getDatabaseProductName() override
virtual sal_Int32 SAL_CALL getMaxStatements() override
virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons() override
virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds() override
virtual sal_Bool SAL_CALL supportsUnionAll() override
virtual sal_Bool SAL_CALL supportsOrderByUnrelated() 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 getColumns(const css::uno::Any &catalog, const OUString &schemaPattern, const OUString &tableNamePattern, const OUString &columnNamePattern) override
virtual sal_Bool SAL_CALL othersUpdatesAreVisible(sal_Int32 setType) 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 sal_Bool SAL_CALL supportsColumnAliasing() override
virtual sal_Bool SAL_CALL deletesAreDetected(sal_Int32 setType) override
virtual sal_Int32 SAL_CALL getMaxRowSize() override
virtual OUString SAL_CALL getCatalogSeparator() override
virtual OUString SAL_CALL getProcedureTerm() 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 sal_Bool SAL_CALL supportsGroupBy() 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 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 sal_Bool SAL_CALL supportsAlterTableWithAddColumn() 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 sal_Bool SAL_CALL supportsSubqueriesInExists() override
virtual OUString SAL_CALL getNumericFunctions() override
virtual sal_Int32 SAL_CALL getMaxTablesInSelect() override
virtual sal_Bool SAL_CALL supportsCatalogsInTableDefinitions() override
virtual sal_Bool SAL_CALL usesLocalFiles() 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 supportsSchemasInIndexDefinitions() override
virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getPrimaryKeys(const css::uno::Any &catalog, const OUString &schema, const OUString &table) override
virtual OUString SAL_CALL getSearchStringEscape() override
virtual sal_Bool SAL_CALL supportsTransactions() override
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
@ table
short getFBTypeFromBlrType(short blrType)
Internally (i.e.
OUString sanitizeIdentifier(std::u16string_view rIdentifier)
Make sure an identifier is safe to use within the database.
store_handle_type *SAL_CALL query(OStoreObject *pHandle, store_handle_type *)
unsigned char sal_Bool