metadata.h
15.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
/*
Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
The MySQL Connector/C++ is licensed under the terms of the GPLv2
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
MySQL Connectors. There are special exceptions to the terms and
conditions of the GPLv2 as it is applied to this software, see the
FLOSS License Exception
<http://www.mysql.com/about/legal/licensing/foss-exception.html>.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _SQL_METADATA_H_
#define _SQL_METADATA_H_
#include <string>
#include <list>
#include "datatype.h"
#include "sqlstring.h"
namespace sql
{
class ResultSet;
class DatabaseMetaData
{
protected:
virtual ~DatabaseMetaData() {}
public:
enum {
attributeNoNulls = 0,
attributeNullable,
attributeNullableUnknown
};
enum {
bestRowTemporary = 0,
bestRowTransaction,
bestRowSession
};
enum {
bestRowUnknown = 0,
bestRowNotPseudo,
bestRowPseudo
};
enum {
columnNoNulls = 0,
columnNullable,
columnNullableUnknown
};
enum {
importedKeyCascade = 0,
importedKeyInitiallyDeferred,
importedKeyInitiallyImmediate,
importedKeyNoAction,
importedKeyNotDeferrable,
importedKeyRestrict,
importedKeySetDefault,
importedKeySetNull
};
enum {
procedureColumnIn = 0,
procedureColumnInOut,
procedureColumnOut,
procedureColumnResult,
procedureColumnReturn,
procedureColumnUnknown,
procedureNoNulls,
procedureNoResult,
procedureNullable,
procedureNullableUnknown,
procedureResultUnknown,
procedureReturnsResult
};
enum {
sqlStateSQL99 = 0,
sqlStateXOpen
};
enum {
tableIndexClustered = 0,
tableIndexHashed,
tableIndexOther,
tableIndexStatistic
};
enum {
versionColumnUnknown = 0,
versionColumnNotPseudo = 1,
versionColumnPseudo = 2
};
enum {
typeNoNulls = 0,
typeNullable = 1,
typeNullableUnknown = 2
};
enum {
typePredNone = 0,
typePredChar = 1,
typePredBasic = 2,
typeSearchable = 3
};
virtual bool allProceduresAreCallable() = 0;
virtual bool allTablesAreSelectable() = 0;
virtual bool dataDefinitionCausesTransactionCommit() = 0;
virtual bool dataDefinitionIgnoredInTransactions() = 0;
virtual bool deletesAreDetected(int type) = 0;
virtual bool doesMaxRowSizeIncludeBlobs() = 0;
virtual ResultSet* getAttributes(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& typeNamePattern, const sql::SQLString& attributeNamePattern) = 0;
virtual ResultSet* getBestRowIdentifier(const sql::SQLString& catalog, const sql::SQLString& schema, const sql::SQLString& table, int scope, bool nullable) = 0;
virtual ResultSet* getCatalogs() = 0;
virtual const sql::SQLString& getCatalogSeparator() = 0;
virtual const sql::SQLString& getCatalogTerm() = 0;
virtual ResultSet* getColumnPrivileges(const sql::SQLString& catalog, const sql::SQLString& schema, const sql::SQLString& table, const sql::SQLString& columnNamePattern) = 0;
virtual ResultSet* getColumns(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& tableNamePattern, const sql::SQLString& columnNamePattern) = 0;
virtual Connection* getConnection() = 0;
virtual ResultSet* getCrossReference(const sql::SQLString& primaryCatalog, const sql::SQLString& primarySchema, const sql::SQLString& primaryTable, const sql::SQLString& foreignCatalog, const sql::SQLString& foreignSchema, const sql::SQLString& foreignTable) = 0;
virtual unsigned int getDatabaseMajorVersion() = 0;
virtual unsigned int getDatabaseMinorVersion() = 0;
virtual unsigned int getDatabasePatchVersion() = 0;
virtual const sql::SQLString& getDatabaseProductName() = 0;
virtual SQLString getDatabaseProductVersion() = 0;
virtual int getDefaultTransactionIsolation() = 0;
virtual unsigned int getDriverMajorVersion() = 0;
virtual unsigned int getDriverMinorVersion() = 0;
virtual unsigned int getDriverPatchVersion() = 0;
virtual const sql::SQLString& getDriverName() = 0;
virtual const sql::SQLString& getDriverVersion() = 0;
virtual ResultSet* getExportedKeys(const sql::SQLString& catalog, const sql::SQLString& schema, const sql::SQLString& table) = 0;
virtual const sql::SQLString& getExtraNameCharacters() = 0;
virtual const sql::SQLString& getIdentifierQuoteString() = 0;
virtual ResultSet* getImportedKeys(const sql::SQLString& catalog, const sql::SQLString& schema, const sql::SQLString& table) = 0;
virtual ResultSet* getIndexInfo(const sql::SQLString& catalog, const sql::SQLString& schema, const sql::SQLString& table, bool unique, bool approximate) = 0;
virtual unsigned int getCDBCMajorVersion() = 0;
virtual unsigned int getCDBCMinorVersion() = 0;
virtual unsigned int getMaxBinaryLiteralLength() = 0;
virtual unsigned int getMaxCatalogNameLength() = 0;
virtual unsigned int getMaxCharLiteralLength() = 0;
virtual unsigned int getMaxColumnNameLength() = 0;
virtual unsigned int getMaxColumnsInGroupBy() = 0;
virtual unsigned int getMaxColumnsInIndex() = 0;
virtual unsigned int getMaxColumnsInOrderBy() = 0;
virtual unsigned int getMaxColumnsInSelect() = 0;
virtual unsigned int getMaxColumnsInTable() = 0;
virtual unsigned int getMaxConnections() = 0;
virtual unsigned int getMaxCursorNameLength() = 0;
virtual unsigned int getMaxIndexLength() = 0;
virtual unsigned int getMaxProcedureNameLength() = 0;
virtual unsigned int getMaxRowSize() = 0;
virtual unsigned int getMaxSchemaNameLength() = 0;
virtual unsigned int getMaxStatementLength() = 0;
virtual unsigned int getMaxStatements() = 0;
virtual unsigned int getMaxTableNameLength() = 0;
virtual unsigned int getMaxTablesInSelect() = 0;
virtual unsigned int getMaxUserNameLength() = 0;
virtual const sql::SQLString& getNumericFunctions() = 0;
virtual ResultSet* getPrimaryKeys(const sql::SQLString& catalog, const sql::SQLString& schema, const sql::SQLString& table) = 0;
virtual ResultSet* getProcedureColumns(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& procedureNamePattern, const sql::SQLString& columnNamePattern) = 0;
virtual ResultSet* getProcedures(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& procedureNamePattern) = 0;
virtual const sql::SQLString& getProcedureTerm() = 0;
virtual int getResultSetHoldability() = 0;
virtual ResultSet* getSchemas() = 0;
virtual const sql::SQLString& getSchemaTerm() = 0;
virtual const sql::SQLString& getSearchStringEscape() = 0;
virtual const sql::SQLString& getSQLKeywords() = 0;
virtual int getSQLStateType() = 0;
virtual const sql::SQLString& getStringFunctions() = 0;
virtual ResultSet* getSuperTables(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& tableNamePattern) = 0;
virtual ResultSet* getSuperTypes(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& typeNamePattern) = 0;
virtual const sql::SQLString& getSystemFunctions() = 0;
virtual ResultSet* getTablePrivileges(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& tableNamePattern) = 0;
virtual ResultSet* getTables(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& tableNamePattern, std::list<sql::SQLString> &types) = 0;
virtual ResultSet* getTableTypes() = 0;
virtual const sql::SQLString& getTimeDateFunctions() = 0;
virtual ResultSet* getTypeInfo() = 0;
virtual ResultSet* getUDTs(const sql::SQLString& catalog, const sql::SQLString& schemaPattern, const sql::SQLString& typeNamePattern, std::list<int> &types) = 0;
virtual SQLString getURL() = 0;
virtual SQLString getUserName() = 0;
virtual ResultSet* getVersionColumns(const sql::SQLString& catalog, const sql::SQLString& schema, const sql::SQLString& table) = 0;
virtual bool insertsAreDetected(int type) = 0;
virtual bool isCatalogAtStart() = 0;
virtual bool isReadOnly() = 0;
virtual bool locatorsUpdateCopy() = 0;
virtual bool nullPlusNonNullIsNull() = 0;
virtual bool nullsAreSortedAtEnd() = 0;
virtual bool nullsAreSortedAtStart() = 0;
virtual bool nullsAreSortedHigh() = 0;
virtual bool nullsAreSortedLow() = 0;
virtual bool othersDeletesAreVisible(int type) = 0;
virtual bool othersInsertsAreVisible(int type) = 0;
virtual bool othersUpdatesAreVisible(int type) = 0;
virtual bool ownDeletesAreVisible(int type) = 0;
virtual bool ownInsertsAreVisible(int type) = 0;
virtual bool ownUpdatesAreVisible(int type) = 0;
virtual bool storesLowerCaseIdentifiers() = 0;
virtual bool storesLowerCaseQuotedIdentifiers() = 0;
virtual bool storesMixedCaseIdentifiers() = 0;
virtual bool storesMixedCaseQuotedIdentifiers() = 0;
virtual bool storesUpperCaseIdentifiers() = 0;
virtual bool storesUpperCaseQuotedIdentifiers() = 0;
virtual bool supportsAlterTableWithAddColumn() = 0;
virtual bool supportsAlterTableWithDropColumn() = 0;
virtual bool supportsANSI92EntryLevelSQL() = 0;
virtual bool supportsANSI92FullSQL() = 0;
virtual bool supportsANSI92IntermediateSQL() = 0;
virtual bool supportsBatchUpdates() = 0;
virtual bool supportsCatalogsInDataManipulation() = 0;
virtual bool supportsCatalogsInIndexDefinitions() = 0;
virtual bool supportsCatalogsInPrivilegeDefinitions() = 0;
virtual bool supportsCatalogsInProcedureCalls() = 0;
virtual bool supportsCatalogsInTableDefinitions() = 0;
virtual bool supportsColumnAliasing() = 0;
virtual bool supportsConvert() = 0;
virtual bool supportsConvert(int fromType, int toType) = 0;
virtual bool supportsCoreSQLGrammar() = 0;
virtual bool supportsCorrelatedSubqueries() = 0;
virtual bool supportsDataDefinitionAndDataManipulationTransactions() = 0;
virtual bool supportsDataManipulationTransactionsOnly() = 0;
virtual bool supportsDifferentTableCorrelationNames() = 0;
virtual bool supportsExpressionsInOrderBy() = 0;
virtual bool supportsExtendedSQLGrammar() = 0;
virtual bool supportsFullOuterJoins() = 0;
virtual bool supportsGetGeneratedKeys() = 0;
virtual bool supportsGroupBy() = 0;
virtual bool supportsGroupByBeyondSelect() = 0;
virtual bool supportsGroupByUnrelated() = 0;
virtual bool supportsIntegrityEnhancementFacility() = 0;
virtual bool supportsLikeEscapeClause() = 0;
virtual bool supportsLimitedOuterJoins() = 0;
virtual bool supportsMinimumSQLGrammar() = 0;
virtual bool supportsMixedCaseIdentifiers() = 0;
virtual bool supportsMixedCaseQuotedIdentifiers() = 0;
virtual bool supportsMultipleOpenResults() = 0;
virtual bool supportsMultipleResultSets() = 0;
virtual bool supportsMultipleTransactions() = 0;
virtual bool supportsNamedParameters() = 0;
virtual bool supportsNonNullableColumns() = 0;
virtual bool supportsOpenCursorsAcrossCommit() = 0;
virtual bool supportsOpenCursorsAcrossRollback() = 0;
virtual bool supportsOpenStatementsAcrossCommit() = 0;
virtual bool supportsOpenStatementsAcrossRollback() = 0;
virtual bool supportsOrderByUnrelated() = 0;
virtual bool supportsOuterJoins() = 0;
virtual bool supportsPositionedDelete() = 0;
virtual bool supportsPositionedUpdate() = 0;
virtual bool supportsResultSetConcurrency(int type, int concurrency) = 0;
virtual bool supportsResultSetHoldability(int holdability) = 0;
virtual bool supportsResultSetType(int type) = 0;
virtual bool supportsSavepoints() = 0;
virtual bool supportsSchemasInDataManipulation() = 0;
virtual bool supportsSchemasInIndexDefinitions() = 0;
virtual bool supportsSchemasInPrivilegeDefinitions() = 0;
virtual bool supportsSchemasInProcedureCalls() = 0;
virtual bool supportsSchemasInTableDefinitions() = 0;
virtual bool supportsSelectForUpdate() = 0;
virtual bool supportsStatementPooling() = 0;
virtual bool supportsStoredProcedures() = 0;
virtual bool supportsSubqueriesInComparisons() = 0;
virtual bool supportsSubqueriesInExists() = 0;
virtual bool supportsSubqueriesInIns() = 0;
virtual bool supportsSubqueriesInQuantifieds() = 0;
virtual bool supportsTableCorrelationNames() = 0;
virtual bool supportsTransactionIsolationLevel(int level) = 0;
virtual bool supportsTransactions() = 0;
virtual bool supportsTypeConversion() = 0; /* SDBC */
virtual bool supportsUnion() = 0;
virtual bool supportsUnionAll() = 0;
virtual bool updatesAreDetected(int type) = 0;
virtual bool usesLocalFilePerTable() = 0;
virtual bool usesLocalFiles() = 0;
virtual ResultSet* getSchemata(const sql::SQLString& catalogName = "") = 0;
virtual ResultSet* getSchemaObjects(const sql::SQLString& catalogName = "",
const sql::SQLString& schemaName = "",
const sql::SQLString& objectType = "",
bool includingDdl = true,
const sql::SQLString& objectName = "",
const sql::SQLString& contextTableName = "") = 0;
virtual ResultSet* getSchemaObjectTypes() = 0;
};
} /* namespace sql */
#endif /* _SQL_METADATA_H_ */