Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
databasemetadata.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file databasemetadata.h
1 /*
2  This file is part of libodbc++.
3 
4  Copyright (C) 1999-2000 Manush Dodunekov <manush@stendahls.net>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING. If not, write to
18  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  Boston, MA 02111-1307, USA.
20 */
21 
22 #ifndef __ODBCXX_DATABASEMETADATA_H
23 #define __ODBCXX_DATABASEMETADATA_H
24 
25 #include <RDBC/odbc++/setup.h>
26 #include <RDBC/odbc++/types.h>
27 #include <RDBC/odbc++/connection.h>
28 
29 namespace odbc {
30 
31  class ResultSet;
32  class DriverInfo;
33 
44  friend class Connection;
45  friend class DriverInfo;
46 
47  private:
49 
52 
53  const DriverInfo* _getDriverInfo() const {
54  return connection_->_getDriverInfo();
55  }
56 
57  SQLUSMALLINT _getNumeric16(int what);
58  SQLUINTEGER _getNumeric32(int what);
59 
60  ODBCXX_STRING _getStringInfo(int what);
61  bool _ownXXXAreVisible(int type, int what);
62 
63 #if ODBCVER >= 0x0300
64  // returns all CA1 or-ed together
65  SQLUINTEGER _getAllCursorAttributes1();
66 #endif
67 
68  public:
69 
72  return connection_;
73  }
74 
76  enum {
77  bestRowTemporary = SQL_SCOPE_CURROW,
78  bestRowTransaction = SQL_SCOPE_TRANSACTION,
79  bestRowSession = SQL_SCOPE_SESSION
80  };
81 
83  enum {
84  bestRowUnknown = SQL_PC_UNKNOWN,
85  bestRowPseudo = SQL_PC_PSEUDO,
86  bestRowNotPseudo = SQL_PC_NOT_PSEUDO
87  };
88 
89 
93  enum {
94  versionColumnNotPseudo = SQL_PC_NOT_PSEUDO,
95  versionColumnPseudo = SQL_PC_PSEUDO,
96  versionColumnUnknown = SQL_PC_UNKNOWN
97  };
98 
99 
103  enum {
104  typeNoNulls = SQL_NO_NULLS,
105  typeNullable = SQL_NULLABLE,
106  typeNullableUnknown = SQL_NULLABLE_UNKNOWN
107  };
108 
113  enum {
114  columnNoNulls = SQL_NO_NULLS,
115  columnNullable = SQL_NULLABLE,
116  columnNullableUnknown = SQL_NULLABLE_UNKNOWN
117  };
118 
120  enum {
122  typePredNone = SQL_UNSEARCHABLE,
124  typePredChar = SQL_LIKE_ONLY,
126  typePredBasic = SQL_ALL_EXCEPT_LIKE,
128  typeSearchable = SQL_SEARCHABLE
129  };
130 
131 
135 #if ODBCVER >= 0x0300
136  enum {
137  importedKeyCascade = SQL_CASCADE,
138  importedKeySetNull = SQL_SET_NULL,
139  importedKeySetDefault = SQL_SET_DEFAULT,
140  importedKeyNoAction = SQL_NO_ACTION,
141  importedKeyRestrict = SQL_RESTRICT
142  };
143 #else
144  // workaround mode on
145  enum {
146  importedKeyCascade = SQL_CASCADE,
147  importedKeySetNull = SQL_SET_NULL,
148  importedKeyRestrict = SQL_RESTRICT,
149  importedKeyNoAction = SQL_RESTRICT,
150  importedKeySetDefault
151  };
152 
153 #endif
154 
155 #if ODBCVER >= 0x0300
156 #if !defined(SQL_NOT_DEFERRABLE)
157 # warning "Your sqlext.h is missing SQL_NOT_DEFERRABLE, consider upgrading"
158 # define SQL_NOT_DEFERRABLE 7
159 #endif
160 
161  enum {
162  importedKeyInitiallyDeferred = SQL_INITIALLY_DEFERRED,
163  importedKeyInitiallyImmediate = SQL_INITIALLY_IMMEDIATE,
164  importedKeyNotDeferrable = SQL_NOT_DEFERRABLE
165  };
166 #endif
167 
169  enum {
170  tableIndexClustered = SQL_INDEX_CLUSTERED,
171  tableIndexHashed = SQL_INDEX_HASHED,
172  tableIndexOther = SQL_INDEX_OTHER,
173  tableIndexStatistic = SQL_TABLE_STAT
174  };
175 
179  enum {
180  procedureColumnIn = SQL_PARAM_INPUT,
181  procedureColumnInOut = SQL_PARAM_INPUT_OUTPUT,
182  procedureColumnOut = SQL_PARAM_OUTPUT,
183  procedureColumnResult = SQL_RESULT_COL,
184  procedureColumnReturn = SQL_RETURN_VALUE,
185  procedureColumnUnknown = SQL_PARAM_TYPE_UNKNOWN
186  };
187 
191  enum {
192  procedureNoNulls = SQL_NO_NULLS,
193  procedureNullable = SQL_NULLABLE,
194  procedureNullableUnknown = SQL_NULLABLE_UNKNOWN
195  };
196 
200  enum {
201  procedureReturnsResult = SQL_PT_FUNCTION,
202  procedureNoResult = SQL_PT_PROCEDURE,
203  procedureResultUnknown = SQL_PT_UNKNOWN
204  };
205 
206 
207 
210  ODBCXX_STRING getDatabaseProductName();
211 
214  ODBCXX_STRING getDatabaseProductVersion();
215 
218  ODBCXX_STRING getDriverName();
219 
222  ODBCXX_STRING getDriverVersion();
223 
225  int getDriverMajorVersion();
226 
228  int getDriverMinorVersion();
229 
233  ODBCXX_STRING getIdentifierQuoteString();
234 
238  ODBCXX_STRING getCatalogTerm();
239 
243  ODBCXX_STRING getSchemaTerm();
244 
247  ODBCXX_STRING getTableTerm();
248 
252  ODBCXX_STRING getProcedureTerm();
253 
256  ODBCXX_STRING getUserName();
257 
264  ODBCXX_STRING getCatalogSeparator();
265 
271  bool isCatalogAtStart();
272 
276  ODBCXX_STRING getSQLKeywords();
277 
278 
281  bool supportsTransactions();
282 
286  int getDefaultTransactionIsolation();
287 
292  bool supportsTransactionIsolationLevel(int lev);
293 
306  bool supportsDataDefinitionAndDataManipulationTransactions();
307 
322  bool supportsDataManipulationTransactionsOnly();
323 
336  bool dataDefinitionCausesTransactionCommit();
337 
350  bool dataDefinitionIgnoredInTransactions();
351 
352 
355  bool supportsTableCorrelationNames();
356 
359  bool supportsDifferentTableCorrelationNames();
360 
363  bool supportsOrderByUnrelated();
364 
367  bool supportsExpressionsInOrderBy();
368 
373  bool supportsOpenCursorsAcrossCommit();
374 
375 
380  bool supportsOpenCursorsAcrossRollback();
381 
382 
387  bool supportsOpenStatementsAcrossCommit();
388 
393  bool supportsOpenStatementsAcrossRollback();
394 
400  bool supportsResultSetType(int type);
401 
408  bool supportsResultSetConcurrency(int type, int concurrency);
409 
410 
412  bool supportsCatalogsInDataManipulation();
413 
415  bool supportsCatalogsInProcedureCalls();
416 
418  bool supportsCatalogsInTableDefinitions();
419 
421  bool supportsCatalogsInIndexDefinitions();
422 
424  bool supportsCatalogsInPrivilegeDefinitions();
425 
426 
428  bool supportsSchemasInDataManipulation();
429 
431  bool supportsSchemasInProcedureCalls();
432 
434  bool supportsSchemasInTableDefinitions();
435 
437  bool supportsSchemasInIndexDefinitions();
438 
440  bool supportsSchemasInPrivilegeDefinitions();
441 
442 
445  bool nullPlusNonNullIsNull();
446 
450  bool supportsColumnAliasing();
451 
454  bool supportsConvert();
455 
458  bool supportsConvert(int fromType, int toType);
459 
462  bool supportsAlterTableWithDropColumn();
463 
466  bool supportsAlterTableWithAddColumn();
467 
471  ODBCXX_STRING getExtraNameCharacters();
472 
475  ODBCXX_STRING getSearchStringEscape();
476 
479  ODBCXX_STRING getTimeDateFunctions();
480 
483  ODBCXX_STRING getSystemFunctions();
484 
487  ODBCXX_STRING getStringFunctions();
488 
491  ODBCXX_STRING getNumericFunctions();
492 
495  bool supportsLikeEscapeClause();
496 
499  bool supportsMultipleResultSets();
500 
504  bool supportsMultipleTransactions();
505 
508  bool supportsNonNullableColumns();
509 
512  bool supportsMinimumSQLGrammar();
513 
516  bool supportsCoreSQLGrammar();
517 
520  bool supportsExtendedSQLGrammar();
521 
522 
526  bool supportsANSI92EntryLevelSQL();
527 
531  bool supportsANSI92IntermediateSQL();
532 
535  bool supportsANSI92FullSQL();
536 
542  bool supportsPositionedDelete();
543 
549  bool supportsPositionedUpdate();
550 
556  bool supportsSelectForUpdate();
557 
558 
562  bool supportsIntegrityEnhancementFacility();
563 
566  bool supportsBatchUpdates();
567 
570  bool supportsSubqueriesInComparisons();
571 
575  bool supportsSubqueriesInExists();
576 
580  bool supportsSubqueriesInIns();
581 
585  bool supportsSubqueriesInQuantifieds();
586 
587 
590  bool supportsCorrelatedSubqueries();
591 
596  bool ownUpdatesAreVisible(int type);
597 
601  bool ownDeletesAreVisible(int type);
602 
606  bool ownInsertsAreVisible(int type);
607 
612  bool othersUpdatesAreVisible(int type);
613 
618  bool othersDeletesAreVisible(int type);
619 
624  bool othersInsertsAreVisible(int type);
625 
630  bool deletesAreDetected(int type);
631 
636  bool insertsAreDetected(int type);
637 
642  bool updatesAreDetected(int type);
643 
644 
648  int getMaxBinaryLiteralLength();
649 
652  int getMaxCharLiteralLength();
653 
656  int getMaxColumnNameLength();
657 
661  int getMaxColumnsInGroupBy();
662 
665  int getMaxColumnsInIndex();
666 
670  int getMaxColumnsInOrderBy();
671 
674  int getMaxColumnsInSelect();
675 
678  int getMaxColumnsInTable();
679 
682  int getMaxCursorNameLength();
683 
686  int getMaxIndexLength();
687 
690  int getMaxSchemaNameLength();
691 
694  int getMaxProcedureNameLength();
695 
698  int getMaxCatalogNameLength();
699 
702  int getMaxRowSize();
703 
707  bool doesMaxRowSizeIncludeBlobs();
708 
709 
712  int getMaxStatementLength();
713 
716  int getMaxTableNameLength();
717 
721  int getMaxTablesInSelect();
722 
725  int getMaxUserNameLength();
726 
730  int getMaxConnections();
731 
735  int getMaxStatements();
736 
737 
741  bool supportsMixedCaseIdentifiers();
742 
746  bool supportsMixedCaseQuotedIdentifiers();
747 
751  bool supportsStoredProcedures();
752 
753 
757  bool supportsGroupBy();
758 
762  bool supportsGroupByUnrelated();
763 
767  bool supportsGroupByBeyondSelect();
768 
769 
772  bool supportsUnion();
773 
776  bool supportsUnionAll();
777 
781  bool supportsOuterJoins();
782 
785  bool supportsFullOuterJoins();
786 
790  bool supportsLimitedOuterJoins();
791 
793  bool usesLocalFilePerTable();
794 
796  bool usesLocalFiles();
797 
801  bool nullsAreSortedAtStart();
802 
806  bool nullsAreSortedAtEnd();
807 
810  bool nullsAreSortedHigh();
811 
814  bool nullsAreSortedLow();
815 
819  bool allProceduresAreCallable();
820 
824  bool allTablesAreSelectable();
825 
829  bool isReadOnly();
830 
834  bool storesLowerCaseIdentifiers();
835 
839  bool storesLowerCaseQuotedIdentifiers();
840 
844  bool storesMixedCaseIdentifiers();
845 
849  bool storesMixedCaseQuotedIdentifiers();
850 
854  bool storesUpperCaseIdentifiers();
855 
859  bool storesUpperCaseQuotedIdentifiers();
860 
861 
908  ResultSet* getTypeInfo();
909 
945  ResultSet* getColumns(const ODBCXX_STRING& catalog,
946  const ODBCXX_STRING& schemaPattern,
947  const ODBCXX_STRING& tableNamePattern,
948  const ODBCXX_STRING& columnNamePattern);
949 
950 
965  ResultSet* getTables(const ODBCXX_STRING& catalog,
966  const ODBCXX_STRING& schemaPattern,
967  const ODBCXX_STRING& tableNamePattern,
968  const std::vector<ODBCXX_STRING>& types);
969 
994  ResultSet* getTablePrivileges(const ODBCXX_STRING& catalog,
995  const ODBCXX_STRING& schemaPattern,
996  const ODBCXX_STRING& tableNamePattern);
997 
998 
1021  ResultSet* getColumnPrivileges(const ODBCXX_STRING& catalog,
1022  const ODBCXX_STRING& schema,
1023  const ODBCXX_STRING& table,
1024  const ODBCXX_STRING& columnNamePattern);
1025 
1041  ResultSet* getPrimaryKeys(const ODBCXX_STRING& catalog,
1042  const ODBCXX_STRING& schema,
1043  const ODBCXX_STRING& table);
1044 
1045 
1091  ResultSet* getIndexInfo(const ODBCXX_STRING& catalog,
1092  const ODBCXX_STRING& schema,
1093  const ODBCXX_STRING& table,
1094  bool unique, bool approximate);
1095 
1140  ResultSet* getCrossReference(const ODBCXX_STRING& primaryCatalog,
1141  const ODBCXX_STRING& primarySchema,
1142  const ODBCXX_STRING& primaryTable,
1143  const ODBCXX_STRING& foreignCatalog,
1144  const ODBCXX_STRING& foreignSchema,
1145  const ODBCXX_STRING& foreignTable);
1146 
1155  ResultSet* getImportedKeys(const ODBCXX_STRING& catalog,
1156  const ODBCXX_STRING& schema,
1157  const ODBCXX_STRING& table) {
1158  return this->getCrossReference("","","",catalog,schema,table);
1159  }
1160 
1167  ResultSet* getExportedKeys(const ODBCXX_STRING& catalog,
1168  const ODBCXX_STRING& schema,
1169  const ODBCXX_STRING& table) {
1170  return this->getCrossReference(catalog,schema,table,"","","");
1171  }
1172 
1195  ResultSet* getProcedures(const ODBCXX_STRING& catalog,
1196  const ODBCXX_STRING& schemaPattern,
1197  const ODBCXX_STRING& procedureNamePattern);
1198 
1238  ResultSet* getProcedureColumns(const ODBCXX_STRING& catalog,
1239  const ODBCXX_STRING& schemaPattern,
1240  const ODBCXX_STRING& procedureNamePattern,
1241  const ODBCXX_STRING& columnNamePattern);
1242 
1243 
1279  ResultSet* getBestRowIdentifier(const ODBCXX_STRING& catalog,
1280  const ODBCXX_STRING& schema,
1281  const ODBCXX_STRING& table,
1282  int scope,
1283  bool nullable);
1284 
1307  ResultSet* getVersionColumns(const ODBCXX_STRING& catalog,
1308  const ODBCXX_STRING& schema,
1309  const ODBCXX_STRING& table);
1310 
1311 
1312 
1318  ResultSet* getTableTypes();
1319 
1325  ResultSet* getSchemas();
1326 
1332  ResultSet* getCatalogs();
1333  };
1334 
1335 
1336 }; // namespace odbc
1337 
1338 
1339 #endif // __ODBCXX_DATABASEMETADATA_H