OmniSciDB  1dac507f6e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OmniSciDatabaseMetaData.java
Go to the documentation of this file.
1 /*
2  * Copyright 2018 MapD Technologies, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.omnisci.jdbc;
17 
18 import com.mapd.thrift.server.TColumn;
19 import com.mapd.thrift.server.TColumnData;
20 import com.mapd.thrift.server.TColumnType;
21 import com.mapd.thrift.server.TDBInfo;
22 import com.mapd.thrift.server.TDBObject;
23 import com.mapd.thrift.server.TDBObjectType;
24 import com.mapd.thrift.server.TDatumType;
25 import com.mapd.thrift.server.TEncodingType;
26 import com.mapd.thrift.server.TQueryResult;
27 import com.mapd.thrift.server.TRowSet;
28 import com.mapd.thrift.server.TTableDetails;
29 import com.mapd.thrift.server.TTablePermissions;
30 import com.mapd.thrift.server.TTypeInfo;
31 
32 import org.apache.thrift.TException;
33 import org.slf4j.Logger;
34 import org.slf4j.LoggerFactory;
35 
36 import java.sql.Connection;
37 import java.sql.DatabaseMetaData;
38 import java.sql.ResultSet;
39 import java.sql.RowIdLifetime;
40 import java.sql.SQLException;
41 import java.util.*;
42 
47 class OmniSciDatabaseMetaData implements DatabaseMetaData {
48  final static Logger MAPDLOGGER = LoggerFactory.getLogger(OmniSciDatabaseMetaData.class);
49 
54 
55  public OmniSciDatabaseMetaData(OmniSciConnection connection) throws SQLException {
56  this.con = connection;
57 
58  try {
59  databaseVersion = con.client.get_version();
60  } catch (TException ex) {
61  throw new SQLException("Failed to get DB version " + ex.toString());
62  }
63  String vers[] = databaseVersion.split("\\.");
64  try {
65  databaseMajorVersion = Integer.parseInt(vers[0]);
66  databaseMinorVersion = Integer.parseInt(vers[1]);
67  } catch (NumberFormatException ex) {
68  throw new SQLException(
69  "Non-numeric version returned from OmniSci server: " + ex.getMessage());
70  }
71  }
72 
73  @Override
74  public boolean allProceduresAreCallable() throws SQLException {
75  MAPDLOGGER.debug("Entered");
76  return false;
77  }
78 
79  @Override
80  public boolean allTablesAreSelectable() throws SQLException {
81  MAPDLOGGER.debug("Entered");
82  return true;
83  }
84 
85  @Override
86  public String getURL() throws SQLException {
87  MAPDLOGGER.debug("Entered");
88  return con.url;
89  }
90 
91  @Override
92  public String getUserName() throws SQLException {
93  MAPDLOGGER.debug("Entered");
94  return (String) con.cP.get(Connection_enums.user);
95  }
96 
97  @Override
98  public boolean isReadOnly() throws SQLException {
99  MAPDLOGGER.debug("Entered");
100  return true;
101  }
102 
103  @Override
104  public boolean nullsAreSortedHigh() throws SQLException {
105  MAPDLOGGER.debug("Entered");
106  return true;
107  }
108 
109  @Override
110  public boolean nullsAreSortedLow() throws SQLException {
111  MAPDLOGGER.debug("Entered");
112  return false;
113  }
114 
115  @Override
116  public boolean nullsAreSortedAtStart() throws SQLException {
117  MAPDLOGGER.debug("Entered");
118  return false;
119  }
120 
121  @Override
122  public boolean nullsAreSortedAtEnd() throws SQLException {
123  MAPDLOGGER.debug("Entered");
124  return true;
125  }
126 
127  @Override
128  public String getDatabaseProductName() throws SQLException {
129  MAPDLOGGER.debug("Entered");
130  return "MapD DB";
131  }
132 
133  @Override
135  throws SQLException { // logger.debug("Entered");
136  MAPDLOGGER.debug("Entered");
137  return this.databaseVersion;
138  }
139 
140  @Override
141  public String getDriverName() throws SQLException {
142  MAPDLOGGER.debug("Entered");
143  return "MapD Basic JDBC Driver";
144  }
145 
146  @Override
147  public String getDriverVersion() throws SQLException { // logger.debug("Entered");
148  MAPDLOGGER.debug("Entered");
149  return Integer.toString(OmniSciDriver.DriverMajorVersion) + "."
151  }
152 
153  @Override
154  public int getDriverMajorVersion() {
156  }
157 
158  @Override
159  public int getDriverMinorVersion() {
161  }
162 
163  @Override
164  public boolean usesLocalFiles() throws SQLException {
165  MAPDLOGGER.debug("Entered");
166  return false;
167  }
168 
169  @Override
170  public boolean usesLocalFilePerTable() throws SQLException {
171  MAPDLOGGER.debug("Entered");
172  return false;
173  }
174 
175  @Override
176  public boolean supportsMixedCaseIdentifiers() throws SQLException {
177  MAPDLOGGER.debug("Entered");
178  return true;
179  }
180 
181  @Override
182  public boolean storesUpperCaseIdentifiers() throws SQLException {
183  MAPDLOGGER.debug("Entered");
184  return false;
185  }
186 
187  @Override
188  public boolean storesLowerCaseIdentifiers() throws SQLException {
189  MAPDLOGGER.debug("Entered");
190  return false;
191  }
192 
193  @Override
194  public boolean storesMixedCaseIdentifiers() throws SQLException {
195  MAPDLOGGER.debug("Entered");
196  return true;
197  }
198 
199  @Override
200  public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException {
201  MAPDLOGGER.debug("Entered");
202  return true;
203  }
204 
205  @Override
206  public boolean storesUpperCaseQuotedIdentifiers() throws SQLException {
207  MAPDLOGGER.debug("Entered");
208  return false;
209  }
210 
211  @Override
212  public boolean storesLowerCaseQuotedIdentifiers() throws SQLException {
213  MAPDLOGGER.debug("Entered");
214  return false;
215  }
216 
217  @Override
218  public boolean storesMixedCaseQuotedIdentifiers() throws SQLException {
219  MAPDLOGGER.debug("Entered");
220  return false;
221  }
222 
223  @Override
224  public String getIdentifierQuoteString() throws SQLException {
225  MAPDLOGGER.debug("Entered");
226  return " ";
227  }
228 
229  @Override
230  public String getSQLKeywords() throws SQLException {
231  MAPDLOGGER.debug("Entered");
232  return "";
233  }
234 
235  @Override
236  public String getNumericFunctions() throws SQLException {
237  MAPDLOGGER.debug("Entered");
238  return "ACOS(float), ACOS(number), ASIN, ATAN2, CEIL, COS, COT, DEGREES, EXP, FLOOR, LN, LOG, PI(), POWER, SQRT"
239  + ", RADIANS, ROUND, SIN, TAN, ATAN, ABS, MOD SIGN, TRUNCATE";
240  }
241 
242  @Override
243  public String getStringFunctions() throws SQLException {
244  MAPDLOGGER.debug("Entered");
245  return "CHAR_LENGTH, CHAR, KEY_FOR_STRING";
246  }
247 
248  @Override
249  public String getSystemFunctions() throws SQLException {
250  MAPDLOGGER.debug("Entered");
251  return "";
252  }
253 
254  @Override
255  public String getTimeDateFunctions() throws SQLException {
256  MAPDLOGGER.debug("Entered");
257  // return "NOW,CURDATE,SECOND,HOUR,YEAR,EXTRACT,QUARTER,WEEK,MONTH,DATETRUNC";
258  return "DATE_TRUNC, NOW, EXTRACT";
259  }
260 
261  @Override
262  public String getSearchStringEscape() throws SQLException {
263  MAPDLOGGER.debug("Entered");
264  return "\\";
265  }
266 
267  @Override
268  public String getExtraNameCharacters() throws SQLException {
269  MAPDLOGGER.debug("Entered");
270  return "";
271  }
272 
273  @Override
274  public boolean supportsAlterTableWithAddColumn() throws SQLException {
275  MAPDLOGGER.debug("Entered");
276  return false;
277  }
278 
279  @Override
280  public boolean supportsAlterTableWithDropColumn() throws SQLException {
281  MAPDLOGGER.debug("Entered");
282  return false;
283  }
284 
285  @Override
286  public boolean supportsColumnAliasing() throws SQLException {
287  MAPDLOGGER.debug("Entered");
288  return true;
289  }
290 
291  @Override
292  public boolean nullPlusNonNullIsNull() throws SQLException {
293  MAPDLOGGER.debug("Entered");
294  return true;
295  }
296 
297  @Override
298  public boolean supportsConvert() throws SQLException {
299  MAPDLOGGER.debug("Entered");
300  return false;
301  }
302 
303  @Override
304  public boolean supportsConvert(int fromType, int toType) throws SQLException {
305  MAPDLOGGER.debug("Entered");
306  return false;
307  }
308 
309  @Override
310  public boolean supportsTableCorrelationNames() throws SQLException {
311  MAPDLOGGER.debug("Entered");
312  return false;
313  }
314 
315  @Override
316  public boolean supportsDifferentTableCorrelationNames() throws SQLException {
317  MAPDLOGGER.debug("Entered");
318  return false;
319  }
320 
321  @Override
322  public boolean supportsExpressionsInOrderBy() throws SQLException {
323  MAPDLOGGER.debug("Entered");
324  return false;
325  }
326 
327  @Override
328  public boolean supportsOrderByUnrelated() throws SQLException {
329  MAPDLOGGER.debug("Entered");
330  return true;
331  }
332 
333  @Override
334  public boolean supportsGroupBy() throws SQLException {
335  MAPDLOGGER.debug("Entered");
336  return true;
337  }
338 
339  @Override
340  public boolean supportsGroupByUnrelated() throws SQLException {
341  MAPDLOGGER.debug("Entered");
342  return true;
343  }
344 
345  @Override
346  public boolean supportsGroupByBeyondSelect() throws SQLException {
347  MAPDLOGGER.debug("Entered");
348  return true;
349  }
350 
351  @Override
352  public boolean supportsLikeEscapeClause() throws SQLException {
353  MAPDLOGGER.debug("Entered");
354  return false;
355  }
356 
357  @Override
358  public boolean supportsMultipleResultSets() throws SQLException {
359  MAPDLOGGER.debug("Entered");
360  return false;
361  }
362 
363  @Override
364  public boolean supportsMultipleTransactions() throws SQLException {
365  MAPDLOGGER.debug("Entered");
366  return false;
367  }
368 
369  @Override
370  public boolean supportsNonNullableColumns() throws SQLException {
371  MAPDLOGGER.debug("Entered");
372  return true;
373  }
374 
375  @Override
376  public boolean supportsMinimumSQLGrammar() throws SQLException {
377  MAPDLOGGER.debug("Entered");
378  return true;
379  }
380 
381  @Override
382  public boolean supportsCoreSQLGrammar() throws SQLException {
383  MAPDLOGGER.debug("Entered");
384  return true;
385  }
386 
387  @Override
388  public boolean supportsExtendedSQLGrammar() throws SQLException {
389  MAPDLOGGER.debug("Entered");
390  return true;
391  }
392 
393  @Override
394  public boolean supportsANSI92EntryLevelSQL() throws SQLException {
395  MAPDLOGGER.debug("Entered");
396  return true;
397  }
398 
399  @Override
400  public boolean supportsANSI92IntermediateSQL() throws SQLException {
401  MAPDLOGGER.debug("Entered");
402  return false;
403  }
404 
405  @Override
406  public boolean supportsANSI92FullSQL() throws SQLException {
407  MAPDLOGGER.debug("Entered");
408  return false;
409  }
410 
411  @Override
412  public boolean supportsIntegrityEnhancementFacility() throws SQLException {
413  MAPDLOGGER.debug("Entered");
414  return false;
415  }
416 
417  @Override
418  public boolean supportsOuterJoins() throws SQLException {
419  MAPDLOGGER.debug("Entered");
420  return false;
421  }
422 
423  @Override
424  public boolean supportsFullOuterJoins() throws SQLException {
425  MAPDLOGGER.debug("Entered");
426  return false;
427  }
428 
429  @Override
430  public boolean supportsLimitedOuterJoins() throws SQLException {
431  MAPDLOGGER.debug("Entered");
432  return true;
433  }
434 
435  @Override
436  public String getSchemaTerm() throws SQLException {
437  MAPDLOGGER.debug("Entered");
438  return "Database";
439  }
440 
441  @Override
442  public String getProcedureTerm() throws SQLException {
443  MAPDLOGGER.debug("Entered");
444  return "N/A";
445  }
446 
447  @Override
448  public String getCatalogTerm() throws SQLException {
449  MAPDLOGGER.debug("Entered");
450  return "N/A";
451  }
452 
453  @Override
454  public boolean isCatalogAtStart() throws SQLException {
455  MAPDLOGGER.debug("Entered");
456  return true;
457  }
458 
459  @Override
460  public String getCatalogSeparator() throws SQLException {
461  MAPDLOGGER.debug("Entered");
462  return ".";
463  }
464 
465  @Override
466  public boolean supportsSchemasInDataManipulation() throws SQLException {
467  MAPDLOGGER.debug("Entered");
468  return false;
469  }
470 
471  @Override
472  public boolean supportsSchemasInProcedureCalls() throws SQLException {
473  MAPDLOGGER.debug("Entered");
474  return false;
475  }
476 
477  @Override
478  public boolean supportsSchemasInTableDefinitions() throws SQLException {
479  MAPDLOGGER.debug("Entered");
480  return false;
481  }
482 
483  @Override
484  public boolean supportsSchemasInIndexDefinitions() throws SQLException {
485  MAPDLOGGER.debug("Entered");
486  return false;
487  }
488 
489  @Override
490  public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException {
491  MAPDLOGGER.debug("Entered");
492  return false;
493  }
494 
495  @Override
496  public boolean supportsCatalogsInDataManipulation() throws SQLException {
497  MAPDLOGGER.debug("Entered");
498  return false;
499  }
500 
501  @Override
502  public boolean supportsCatalogsInProcedureCalls() throws SQLException {
503  MAPDLOGGER.debug("Entered");
504  return false;
505  }
506 
507  @Override
508  public boolean supportsCatalogsInTableDefinitions() throws SQLException {
509  MAPDLOGGER.debug("Entered");
510  return false;
511  }
512 
513  @Override
514  public boolean supportsCatalogsInIndexDefinitions() throws SQLException {
515  MAPDLOGGER.debug("Entered");
516  return false;
517  }
518 
519  @Override
520  public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException {
521  MAPDLOGGER.debug("Entered");
522  return false;
523  }
524 
525  @Override
526  public boolean supportsPositionedDelete() throws SQLException {
527  MAPDLOGGER.debug("Entered");
528  return false;
529  }
530 
531  @Override
532  public boolean supportsPositionedUpdate() throws SQLException {
533  MAPDLOGGER.debug("Entered");
534  return false;
535  }
536 
537  @Override
538  public boolean supportsSelectForUpdate() throws SQLException {
539  MAPDLOGGER.debug("Entered");
540  return false;
541  }
542 
543  @Override
544  public boolean supportsStoredProcedures() throws SQLException {
545  MAPDLOGGER.debug("Entered");
546  return false;
547  }
548 
549  @Override
550  public boolean supportsSubqueriesInComparisons() throws SQLException {
551  MAPDLOGGER.debug("Entered");
552  return true;
553  }
554 
555  @Override
556  public boolean supportsSubqueriesInExists() throws SQLException {
557  MAPDLOGGER.debug("Entered");
558  return true;
559  }
560 
561  @Override
562  public boolean supportsSubqueriesInIns() throws SQLException {
563  MAPDLOGGER.debug("Entered");
564  return true;
565  }
566 
567  @Override
568  public boolean supportsSubqueriesInQuantifieds() throws SQLException {
569  MAPDLOGGER.debug("Entered");
570  return true;
571  }
572 
573  @Override
574  public boolean supportsCorrelatedSubqueries() throws SQLException {
575  MAPDLOGGER.debug("Entered");
576  return false;
577  }
578 
579  @Override
580  public boolean supportsUnion() throws SQLException {
581  MAPDLOGGER.debug("Entered");
582  return false;
583  }
584 
585  @Override
586  public boolean supportsUnionAll() throws SQLException {
587  MAPDLOGGER.debug("Entered");
588  return false;
589  }
590 
591  @Override
592  public boolean supportsOpenCursorsAcrossCommit() throws SQLException {
593  MAPDLOGGER.debug("Entered");
594  return false;
595  }
596 
597  @Override
598  public boolean supportsOpenCursorsAcrossRollback() throws SQLException {
599  MAPDLOGGER.debug("Entered");
600  return false;
601  }
602 
603  @Override
604  public boolean supportsOpenStatementsAcrossCommit() throws SQLException {
605  MAPDLOGGER.debug("Entered");
606  return false;
607  }
608 
609  @Override
610  public boolean supportsOpenStatementsAcrossRollback() throws SQLException {
611  MAPDLOGGER.debug("Entered");
612  return false;
613  }
614 
615  @Override
616  public int getMaxBinaryLiteralLength() throws SQLException {
617  MAPDLOGGER.debug("Entered");
618  return 0;
619  }
620 
621  @Override
622  public int getMaxCharLiteralLength() throws SQLException {
623  MAPDLOGGER.debug("Entered");
624  return 0;
625  }
626 
627  @Override
628  public int getMaxColumnNameLength() throws SQLException {
629  MAPDLOGGER.debug("Entered");
630  return 0;
631  }
632 
633  @Override
634  public int getMaxColumnsInGroupBy() throws SQLException {
635  MAPDLOGGER.debug("Entered");
636  return 0;
637  }
638 
639  @Override
640  public int getMaxColumnsInIndex() throws SQLException {
641  MAPDLOGGER.debug("Entered");
642  return 0;
643  }
644 
645  @Override
646  public int getMaxColumnsInOrderBy() throws SQLException {
647  MAPDLOGGER.debug("Entered");
648  return 0;
649  }
650 
651  @Override
652  public int getMaxColumnsInSelect() throws SQLException {
653  MAPDLOGGER.debug("Entered");
654  return 0;
655  }
656 
657  @Override
658  public int getMaxColumnsInTable() throws SQLException {
659  MAPDLOGGER.debug("Entered");
660  return 0;
661  }
662 
663  @Override
664  public int getMaxConnections() throws SQLException {
665  MAPDLOGGER.debug("Entered");
666  return 0;
667  }
668 
669  @Override
670  public int getMaxCursorNameLength() throws SQLException {
671  MAPDLOGGER.debug("Entered");
672  return 0;
673  }
674 
675  @Override
676  public int getMaxIndexLength() throws SQLException {
677  MAPDLOGGER.debug("Entered");
678  return 0;
679  }
680 
681  @Override
682  public int getMaxSchemaNameLength() throws SQLException {
683  MAPDLOGGER.debug("Entered");
684  return 0;
685  }
686 
687  @Override
688  public int getMaxProcedureNameLength() throws SQLException {
689  MAPDLOGGER.debug("Entered");
690  return 0;
691  }
692 
693  @Override
694  public int getMaxCatalogNameLength() throws SQLException {
695  MAPDLOGGER.debug("Entered");
696  return 0;
697  }
698 
699  @Override
700  public int getMaxRowSize() throws SQLException {
701  MAPDLOGGER.debug("Entered");
702  return 0;
703  }
704 
705  @Override
706  public boolean doesMaxRowSizeIncludeBlobs() throws SQLException {
707  MAPDLOGGER.debug("Entered");
708  return false;
709  }
710 
711  @Override
712  public int getMaxStatementLength() throws SQLException {
713  MAPDLOGGER.debug("Entered");
714  return 0;
715  }
716 
717  @Override
718  public int getMaxStatements() throws SQLException {
719  MAPDLOGGER.debug("Entered");
720  return 0;
721  }
722 
723  @Override
724  public int getMaxTableNameLength() throws SQLException {
725  MAPDLOGGER.debug("Entered");
726  return 0;
727  }
728 
729  @Override
730  public int getMaxTablesInSelect() throws SQLException {
731  MAPDLOGGER.debug("Entered");
732  return 0;
733  }
734 
735  @Override
736  public int getMaxUserNameLength() throws SQLException {
737  MAPDLOGGER.debug("Entered");
738  return 0;
739  }
740 
741  @Override
742  public int getDefaultTransactionIsolation() throws SQLException {
743  MAPDLOGGER.debug("Entered");
744  return Connection.TRANSACTION_NONE;
745  }
746 
747  @Override
748  public boolean supportsTransactions() throws SQLException {
749  MAPDLOGGER.debug("Entered");
750  return false;
751  }
752 
753  @Override
754  public boolean supportsTransactionIsolationLevel(int level) throws SQLException {
755  MAPDLOGGER.debug("Entered");
756  return false;
757  }
758 
759  @Override
761  throws SQLException {
762  MAPDLOGGER.debug("Entered");
763  return false;
764  }
765 
766  @Override
767  public boolean supportsDataManipulationTransactionsOnly() throws SQLException {
768  MAPDLOGGER.debug("Entered");
769  return false;
770  }
771 
772  @Override
773  public boolean dataDefinitionCausesTransactionCommit() throws SQLException {
774  MAPDLOGGER.debug("Entered");
775  return false;
776  }
777 
778  @Override
779  public boolean dataDefinitionIgnoredInTransactions() throws SQLException {
780  MAPDLOGGER.debug("Entered");
781  return false;
782  }
783 
784  @Override
785  public ResultSet getProcedures(
786  String catalog, String schemaPattern, String procedureNamePattern)
787  throws SQLException {
788  MAPDLOGGER.debug("Entered");
789  return null;
790  // throw new UnsupportedOperationException("Not supported yet," + " line:" + new
791  // Throwable().getStackTrace()[0].
792  // getLineNumber() + " class:" + new
793  // Throwable().getStackTrace()[0].getClassName() + " method:" + new
794  // Throwable(). getStackTrace()[0].getMethodName());
795  }
796 
797  @Override
798  public ResultSet getProcedureColumns(String catalog,
799  String schemaPattern,
800  String procedureNamePattern,
801  String columnNamePattern) throws SQLException {
802  MAPDLOGGER.debug("Entered");
803  throw new UnsupportedOperationException("Not supported yet,"
804  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
805  + " class:" + new Throwable().getStackTrace()[0].getClassName()
806  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
807  }
808 
809  /*
810  * Wrappers for creating new TColumnType. Required so that the Thrift struct
811  * can be modified without breaking code.
812  */
813  public TColumnType createTColumnType(String colName, TTypeInfo colType) {
814  return createTColumnType(colName, colType, false);
815  }
816 
817  public TColumnType createTColumnType(String colName, TTypeInfo colType, Boolean irk) {
818  TColumnType ct = new TColumnType();
819  ct.col_name = colName;
820  ct.col_type = colType;
821  ct.is_reserved_keyword = irk;
822  ct.is_system = false;
823  ct.is_physical = false;
824  return ct;
825  }
826 
827  /*
828 Retrieves a description of the tables available in the given catalog. Only table
829 descriptions matching the catalog, schema, table name and type criteria are returned. They
830 are ordered by TABLE_TYPE, TABLE_CAT, TABLE_SCHEM and TABLE_NAME. Each table description
831 has the following columns:
832 
833 TABLE_CAT String => table catalog (may be null)
834 TABLE_SCHEM String => table schema (may be null)
835 TABLE_NAME String => table name
836 TABLE_TYPE String => table type. Typical types are "TABLE", "VIEW", "SYSTEM TABLE",
837 "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM". REMARKS String => explanatory
838 comment on the table TYPE_CAT String => the types catalog (may be null) TYPE_SCHEM String
839 => the types schema (may be null) TYPE_NAME String => type name (may be null)
840 SELF_REFERENCING_COL_NAME String => name of the designated "identifier" column of a typed
841 table (may be null) REF_GENERATION String => specifies how values in
842 SELF_REFERENCING_COL_NAME are created. Values are "SYSTEM", "USER", "DERIVED". (may be
843 null) Note: Some databases may not return information for all tables.
844 
845 Parameters:
846 catalog - a catalog name; must match the catalog name as it is stored in the database; ""
847 retrieves those without a catalog; null means that the catalog name should not be used to
848 narrow the search schemaPattern - a schema name pattern; must match the schema name as it
849 is stored in the database; "" retrieves those without a schema; null means that the schema
850 name should not be used to narrow the search tableNamePattern - a table name pattern; must
851 match the table name as it is stored in the database types - a list of table types, which
852 must be from the list of table types returned from getTableTypes(),to include; null
853 returns all types Returns: ResultSet - each row is a table description Throws:
854 SQLException - if a database access error occurs
855  */
856  @Override
857  public ResultSet getTables(
858  String catalog, String schemaPattern, String tableNamePattern, String[] types)
859  throws SQLException {
860  MAPDLOGGER.debug("Entered");
861 
862  List<String> tables;
863  try {
864  tables = con.client.get_tables(con.session);
865  } catch (TException ex) {
866  throw new SQLException("get_tables failed " + ex.toString());
867  }
868 
869  List<String> views;
870  try {
871  views = con.client.get_views(con.session);
872  } catch (TException ex) {
873  throw new SQLException("get_views failed " + ex.toString());
874  }
875 
876  TTypeInfo strTTI =
877  new TTypeInfo(TDatumType.STR, TEncodingType.NONE, false, false, 0, 0, 0);
878  TColumnType columns[] = {createTColumnType("TABLE_CAT", new TTypeInfo(strTTI)),
879  createTColumnType("TABLE_SCHEM", new TTypeInfo(strTTI)),
880  createTColumnType("TABLE_NAME", new TTypeInfo(strTTI)),
881  createTColumnType("TABLE_TYPE", new TTypeInfo(strTTI)),
882  createTColumnType("REMARKS", new TTypeInfo(strTTI)),
883  createTColumnType("TYPE_CAT", new TTypeInfo(strTTI)),
884  createTColumnType("TYPE_SCHEM", new TTypeInfo(strTTI)),
885  createTColumnType("TYPE_NAME", new TTypeInfo(strTTI)),
886  createTColumnType("SELF_REFERENCING_COL_NAME", new TTypeInfo(strTTI)),
887  createTColumnType("REF_GENERATION", new TTypeInfo(strTTI))};
888 
889  Map<String, ArrayList<String>> dataMap = new HashMap(columns.length);
890  Map<String, ArrayList<Boolean>> nullMap = new HashMap(columns.length);
891 
892  // create component to contain the meta data for the rows
893  // and create a container to store the data and the nul indicators
894  List<TColumnType> rowDesc = new ArrayList(columns.length);
895  for (TColumnType col : columns) {
896  rowDesc.add(col);
897  dataMap.put(col.col_name, new ArrayList());
898  nullMap.put(col.col_name, new ArrayList());
899  }
900  if (schemaPattern == null
901  || schemaPattern.toLowerCase().equals(con.getCatalog().toLowerCase())) {
902  // Now add some actual details for table name
903  for (String x : tables) {
904  dataMap.get("TABLE_NAME").add(x);
905  nullMap.get("TABLE_NAME").add(false);
906  nullMap.get("TABLE_SCHEM").add(true);
907  nullMap.get("TABLE_CAT").add(true);
908  if (views.contains(x) == true) {
909  dataMap.get("TABLE_TYPE").add("VIEW");
910  } else {
911  dataMap.get("TABLE_TYPE").add("TABLE");
912  }
913  nullMap.get("TABLE_TYPE").add(false);
914  nullMap.get("REMARKS").add(true);
915  nullMap.get("TYPE_CAT").add(true);
916  nullMap.get("TYPE_SCHEM").add(true);
917  nullMap.get("TYPE_NAME").add(true);
918  nullMap.get("SELF_REFERENCING_COL_NAME").add(true);
919  nullMap.get("REF_GENERATION").add(true);
920  }
921  }
922  List<TColumn> columnsList = new ArrayList(columns.length);
923 
924  for (TColumnType col : columns) {
925  TColumn schemaCol =
926  createTColumnData(dataMap.get(col.col_name), nullMap.get(col.col_name));
927  columnsList.add(schemaCol);
928  }
929 
930  // create a rowset for the result
931  TRowSet rowSet = new TRowSet(rowDesc, null, columnsList, true);
932 
933  TQueryResult result = new TQueryResult(rowSet, 0, 0, null);
934 
935  OmniSciResultSet tab = new OmniSciResultSet(result, "GetTables");
936  return tab;
937  }
938 
939  // need to add type to this currently only does str type
940  private TColumn createTColumnData(Object data, List<Boolean> nullsList) {
941  TColumnData colData = new TColumnData();
942  colData.setStr_col((List<String>) data);
943 
944  TColumn col = new TColumn(colData, nullsList);
945  return col;
946  }
947 
948  @Override
949  public ResultSet getSchemas() throws SQLException {
950  MAPDLOGGER.debug("Entered");
951 
952  List<TDBInfo> databases = null;
953 
954  try {
955  databases = con.client.get_databases(con.session);
956  } catch (TException ex) {
957  throw new SQLException("get_database failed " + ex.toString());
958  }
959 
960  // process info from databses into the resultset, then place in regular return from
961  // MapD
962  TTypeInfo strTTI =
963  new TTypeInfo(TDatumType.STR, TEncodingType.NONE, false, false, 0, 0, 0);
964  TColumnType columns[] = {createTColumnType("TABLE_SCHEM", new TTypeInfo(strTTI)),
965  createTColumnType("TABLE_CATALOG", new TTypeInfo(strTTI))};
966  // create component to contain the meta data for the rows
967  List<TColumnType> rowDesc = new ArrayList();
968  for (TColumnType col : columns) {
969  rowDesc.add(col);
970  }
971 
972  // Now add some actual details for schema name
973  List<String> schemaList = new ArrayList();
974  List<Boolean> nullList = new ArrayList();
975  List<Boolean> catalogNullList = new ArrayList();
976 
977  for (TDBInfo x : databases) {
978  schemaList.add(x.db_name);
979  nullList.add(false);
980  catalogNullList.add(true);
981  }
982 
983  TColumnData colData = new TColumnData();
984  colData.setStr_col(schemaList);
985 
986  TColumn schemaCol = new TColumn(colData, nullList);
987  TColumn catalogCol = new TColumn(null, catalogNullList);
988 
989  List<TColumn> columnsList = new ArrayList();
990  columnsList.add(schemaCol);
991  columnsList.add(catalogCol);
992 
993  // create a rowset for the result
994  TRowSet rowSet = new TRowSet(rowDesc, null, columnsList, true);
995 
996  TQueryResult result = new TQueryResult(rowSet, 0, 0, null);
997 
998  OmniSciResultSet schemas = new OmniSciResultSet(result, "getSchemas");
999  return schemas;
1000  }
1001 
1002  @Override
1003  public ResultSet getCatalogs() throws SQLException {
1004  MAPDLOGGER.debug("Entered");
1005  return getSchemas();
1006  }
1007 
1008  @Override
1009  public ResultSet getTableTypes() throws SQLException {
1010  MAPDLOGGER.debug("Entered");
1011 
1012  TTypeInfo strTTI =
1013  new TTypeInfo(TDatumType.STR, TEncodingType.NONE, false, false, 0, 0, 0);
1014  TColumnType columns[] = {createTColumnType("TABLE_TYPE", new TTypeInfo(strTTI))};
1015 
1016  Map<String, OmniSciData> dataMap = new HashMap(columns.length);
1017 
1018  // create component to contain the meta data for the rows
1019  // and create a container to store the data and the nul indicators
1020  List<TColumnType> rowDesc = new ArrayList(columns.length);
1021  for (TColumnType col : columns) {
1022  rowDesc.add(col);
1023  dataMap.put(col.col_name, new OmniSciData(col.col_type.type));
1024  }
1025 
1026  // Now add some actual details for table name
1027  dataMap.get("TABLE_TYPE").add("TABLE");
1028  dataMap.get("TABLE_TYPE").add("VIEW");
1029 
1030  List<TColumn> columnsList = new ArrayList(columns.length);
1031 
1032  for (TColumnType col : columns) {
1033  TColumn schemaCol = dataMap.get(col.col_name).getTColumn();
1034  columnsList.add(schemaCol);
1035  }
1036 
1037  // create a rowset for the result
1038  TRowSet rowSet = new TRowSet(rowDesc, null, columnsList, true);
1039 
1040  TQueryResult result = new TQueryResult(rowSet, 0, 0, null);
1041 
1042  OmniSciResultSet tab = new OmniSciResultSet(result, "getTableTypes");
1043 
1044  // logger.info("Dump result "+ result.toString());
1045  return tab;
1046  }
1047 
1048  /*
1049  Retrieves a description of table columns available in the specified catalog.
1050 Only column descriptions matching the catalog, schema, table and column name criteria are
1051 returned. They are ordered by TABLE_CAT,TABLE_SCHEM, TABLE_NAME, and ORDINAL_POSITION.
1052 
1053 Each column description has the following columns:
1054 
1055 TABLE_CAT String => table catalog (may be null)
1056 TABLE_SCHEM String => table schema (may be null)
1057 TABLE_NAME String => table name
1058 COLUMN_NAME String => column name
1059 DATA_TYPE int => SQL type from java.sql.Types
1060 TYPE_NAME String => Data source dependent type name, for a UDT the type name is fully
1061 qualified COLUMN_SIZE int => column size. BUFFER_LENGTH is not used. DECIMAL_DIGITS int =>
1062 the number of fractional digits. Null is returned for data types where DECIMAL_DIGITS is
1063 not applicable. NUM_PREC_RADIX int => Radix (typically either 10 or 2) NULLABLE int => is
1064 NULL allowed. columnNoNulls - might not allow NULL values columnNullable - definitely
1065 allows NULL values columnNullableUnknown - nullability unknown REMARKS String => comment
1066 describing column (may be null) COLUMN_DEF String => default value for the column, which
1067 should be interpreted as a string when the value is enclosed in single quotes (may be
1068 null) SQL_DATA_TYPE int => unused SQL_DATETIME_SUB int => unused CHAR_OCTET_LENGTH int =>
1069 for char types the maximum number of bytes in the column ORDINAL_POSITION int => index of
1070 column in table (starting at 1) IS_NULLABLE String => ISO rules are used to determine the
1071 nullability for a column. YES --- if the column can include NULLs NO --- if the column
1072 cannot include NULLs empty string --- if the nullability for the column is unknown
1073 SCOPE_CATALOG String => catalog of table that is the scope of a reference attribute (null
1074 if DATA_TYPE isn't REF) SCOPE_SCHEMA String => schema of table that is the scope of a
1075 reference attribute (null if the DATA_TYPE isn't REF) SCOPE_TABLE String => table name
1076 that this the scope of a reference attribute (null if the DATA_TYPE isn't REF)
1077 SOURCE_DATA_TYPE short => source type of a distinct type or user-generated Ref type, SQL
1078 type from java.sql.Types (null if DATA_TYPE isn't DISTINCT or user-generated REF)
1079 IS_AUTOINCREMENT String => Indicates whether this column is auto incremented
1080 YES --- if the column is auto incremented
1081 NO --- if the column is not auto incremented
1082 empty string --- if it cannot be determined whether the column is auto incremented
1083 IS_GENERATEDCOLUMN String => Indicates whether this is a generated column
1084 YES --- if this a generated column
1085 NO --- if this not a generated column
1086 empty string --- if it cannot be determined whether this is a generated column
1087 The COLUMN_SIZE column specifies the column size for the given column. For numeric data,
1088 this is the maximum precision. For character data, this is the length in characters. For
1089 datetime datatypes, this is the length in characters of the String representation
1090 (assuming the maximum allowed precision of the fractional seconds component). For binary
1091 data, this is the length in bytes. For the ROWID datatype, this is the length in bytes.
1092 Null is returned for data types where the column size is not applicable.
1093 
1094 Parameters:
1095 catalog - a catalog name; must match the catalog name as it is stored in the database; ""
1096 retrieves those without a catalog; null means that the catalog name should not be used to
1097 narrow the search schemaPattern - a schema name pattern; must match the schema name as it
1098 is stored in the database; "" retrieves those without a schema; null means that the schema
1099 name should not be used to narrow the search tableNamePattern - a table name pattern; must
1100 match the table name as it is stored in the database columnNamePattern - a column name
1101 pattern; must match the column name as it is stored in the database Returns: ResultSet -
1102 each row is a column description Throws: SQLException - if a database access error occurs
1103  */
1104  @Override
1105  public ResultSet getColumns(String catalog,
1106  String schemaPattern,
1107  String tableNamePattern,
1108  String columnNamePattern) throws SQLException {
1109  MAPDLOGGER.debug("Entered");
1110  MAPDLOGGER.debug("TablePattern " + tableNamePattern + " columnNamePattern "
1111  + columnNamePattern);
1112  String modifiedTablePattern = tableNamePattern.replaceAll("%", ".*");
1113  String modifiedColumnPattern =
1114  (columnNamePattern == null) ? null : columnNamePattern.replaceAll("%", ".*");
1115 
1116  MAPDLOGGER.debug("TablePattern " + tableNamePattern + " modifiedColumnPattern "
1117  + modifiedColumnPattern);
1118 
1119  // declare the columns in the result set
1120  TTypeInfo strTTI =
1121  new TTypeInfo(TDatumType.STR, TEncodingType.NONE, false, false, 0, 0, 0);
1122  TTypeInfo intTTI =
1123  new TTypeInfo(TDatumType.INT, TEncodingType.NONE, false, false, 0, 0, 0);
1124  TTypeInfo smallIntTTI =
1125  new TTypeInfo(TDatumType.SMALLINT, TEncodingType.NONE, false, false, 0, 0, 0);
1126  TColumnType columns[] = {createTColumnType("TABLE_CAT", new TTypeInfo(strTTI)),
1127  createTColumnType("TABLE_SCHEM", new TTypeInfo(strTTI)),
1128  createTColumnType("TABLE_NAME", new TTypeInfo(strTTI)),
1129  createTColumnType("COLUMN_NAME", new TTypeInfo(strTTI)),
1130  createTColumnType("DATA_TYPE", new TTypeInfo(intTTI)),
1131  createTColumnType("TYPE_NAME", new TTypeInfo(strTTI)),
1132  createTColumnType("COLUMN_SIZE", new TTypeInfo(intTTI)),
1133  createTColumnType("BUFFER_LENGTH", new TTypeInfo(strTTI)),
1134  createTColumnType("DECIMAL_DIGITS", new TTypeInfo(intTTI)),
1135  createTColumnType("NUM_PREC_RADIX", new TTypeInfo(intTTI)),
1136  createTColumnType("NULLABLE", new TTypeInfo(intTTI)),
1137  createTColumnType("REMARKS", new TTypeInfo(strTTI)),
1138  createTColumnType("COLUMN_DEF", new TTypeInfo(strTTI)),
1139  createTColumnType("SQL_DATA_TYPE", new TTypeInfo(intTTI)),
1140  createTColumnType("SQL_DATETIME_SUB", new TTypeInfo(intTTI)),
1141  createTColumnType("CHAR_OCTET_LENGTH", new TTypeInfo(intTTI)),
1142  createTColumnType("ORDINAL_POSITION", new TTypeInfo(intTTI)),
1143  createTColumnType("IS_NULLABLE", new TTypeInfo(strTTI)),
1144  createTColumnType("SCOPE_CATALOG", new TTypeInfo(strTTI)),
1145  createTColumnType("SCOPE_SCHEMA", new TTypeInfo(strTTI)),
1146  createTColumnType("SCOPE_TABLE", new TTypeInfo(strTTI)),
1147  createTColumnType("SOURCE_DATA_TYPE", new TTypeInfo(smallIntTTI)),
1148  createTColumnType("IS_AUTOINCREMENT", new TTypeInfo(strTTI)),
1149  createTColumnType("IS_GENERATEDCOLUMN", new TTypeInfo(strTTI))};
1150 
1151  Map<String, OmniSciData> dataMap = new HashMap(columns.length);
1152 
1153  // create component to contain the meta data for the rows
1154  // and create a container to store the data and the nul indicators
1155  List<TColumnType> rowDesc = new ArrayList(columns.length);
1156  for (TColumnType col : columns) {
1157  rowDesc.add(col);
1158  dataMap.put(col.col_name, new OmniSciData(col.col_type.type));
1159  }
1160 
1161  // Now add some actual details for table name
1162  List<String> tables;
1163  try {
1164  tables = con.client.get_tables(con.session);
1165 
1166  for (String tableName : tables) {
1167  // check if the table matches the input pattern
1168  if (tableNamePattern == null || tableNamePattern.equals(tableName)) {
1169  // grab meta data for table
1170  TTableDetails tableDetails =
1171  con.client.get_table_details(con.session, tableName);
1172 
1173  int ordinal = 0;
1174  // iterate through the columns
1175  for (TColumnType value : tableDetails.row_desc) {
1176  ordinal++;
1177  if (columnNamePattern == null
1178  || value.col_name.matches(modifiedColumnPattern)) {
1179  dataMap.get("TABLE_CAT").setNull(true);
1180  dataMap.get("TABLE_SCHEM").setNull(true);
1181  dataMap.get("TABLE_NAME").add(tableName);
1182  dataMap.get("COLUMN_NAME").add(value.col_name);
1183  dataMap.get("DATA_TYPE").add(OmniSciType.toJava(value.col_type.type));
1184  dataMap.get("TYPE_NAME")
1185  .add((value.col_type.type.name()
1186  + (value.col_type.is_array ? "[]" : "")));
1187  if (value.col_type.type == TDatumType.DECIMAL) {
1188  dataMap.get("COLUMN_SIZE").add(value.col_type.precision);
1189  } else {
1190  dataMap.get("COLUMN_SIZE").add(100);
1191  }
1192  dataMap.get("BUFFER_LENGTH").setNull(true);
1193  if (value.col_type.type == TDatumType.DECIMAL) {
1194  dataMap.get("DECIMAL_DIGITS").add(value.col_type.scale);
1195  } else {
1196  dataMap.get("DECIMAL_DIGITS").setNull(true);
1197  }
1198  dataMap.get("NUM_PREC_RADIX").add(10);
1199  dataMap.get("NULLABLE")
1200  .add(value.col_type.nullable ? DatabaseMetaData.columnNullable
1201  : DatabaseMetaData.columnNoNulls);
1202  dataMap.get("REMARKS").add(" ");
1203  dataMap.get("COLUMN_DEF").setNull(true);
1204  dataMap.get("SQL_DATA_TYPE").add(0);
1205  dataMap.get("SQL_DATETIME_SUB").setNull(true);
1206  dataMap.get("CHAR_OCTET_LENGTH").add(0);
1207  dataMap.get("ORDINAL_POSITION").add(ordinal);
1208  dataMap.get("IS_NULLABLE").add(value.col_type.nullable ? "YES" : "NO");
1209  dataMap.get("SCOPE_CATALOG").setNull(true);
1210  dataMap.get("SCOPE_SCHEMA").setNull(true);
1211  dataMap.get("SCOPE_TABLE").setNull(true);
1212  dataMap.get("SOURCE_DATA_TYPE")
1213  .add(OmniSciType.toJava(value.col_type.type));
1214  dataMap.get("IS_AUTOINCREMENT").add("NO");
1215  dataMap.get("IS_GENERATEDCOLUMN").add("NO");
1216  }
1217  }
1218  }
1219  }
1220  } catch (TException ex) {
1221  throw new SQLException("get_tables failed " + ex.toString());
1222  }
1223 
1224  List<TColumn> columnsList = new ArrayList(columns.length);
1225 
1226  for (TColumnType col : columns) {
1227  TColumn schemaCol = dataMap.get(col.col_name).getTColumn();
1228  // logger.info("Tcolumn is "+ schemaCol.toString());
1229  columnsList.add(schemaCol);
1230  }
1231 
1232  // create a rowset for the result
1233  TRowSet rowSet = new TRowSet(rowDesc, null, columnsList, true);
1234 
1235  TQueryResult result = new TQueryResult(rowSet, 0, 0, null);
1236 
1237  OmniSciResultSet cols = new OmniSciResultSet(result, "getColumns");
1238  return cols;
1239  }
1240 
1241  @Override
1242  public ResultSet getColumnPrivileges(
1243  String catalog, String schema, String table, String columnNamePattern)
1244  throws SQLException {
1245  MAPDLOGGER.debug("Entered");
1246  throw new UnsupportedOperationException("Not supported yet,"
1247  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1248  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1249  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1250  }
1251 
1252  public ResultSet getEmptyResultSet() {
1253  return new OmniSciResultSet();
1254  }
1255 
1256  // this method is needed to build an empty resultset with columns names and datatypes
1257  public ResultSet getEmptyResultSetWithDesc(TColumnType columns[])
1258  throws SQLException { // for compatibility and future
1259  Map<String, OmniSciData> dataMap = new HashMap(columns.length);
1260  List<TColumnType> rowDesc = new ArrayList(columns.length);
1261  for (TColumnType col : columns) {
1262  rowDesc.add(col);
1263  dataMap.put(col.col_name, new OmniSciData(col.col_type.type));
1264  }
1265  List<TColumn> columnsList = new ArrayList(columns.length);
1266  for (TColumnType col : columns) {
1267  TColumn schemaCol = dataMap.get(col.col_name).getTColumn();
1268  columnsList.add(schemaCol);
1269  }
1270  TRowSet rowSet = new TRowSet(rowDesc, null, columnsList, true);
1271  TQueryResult result = new TQueryResult(rowSet, 0, 0, null);
1272  OmniSciResultSet cols = new OmniSciResultSet(result, "getColumns");
1273  return cols;
1274  }
1275 
1276  private void tablePermProcess(
1277  List<String> tables, Map<String, OmniSciData> dataMap, String tableNamePattern)
1278  throws TException {
1279  for (String table : tables) {
1280  if (tableNamePattern != null && !table.matches(tableNamePattern)) {
1281  continue;
1282  }
1283  List<TDBObject> db_objects = con.client.get_db_object_privs(
1284  con.session, table, TDBObjectType.TableDBObjectType);
1285 
1286  // check if the table matches the input pattern
1287  for (TDBObject db_object : db_objects) {
1288  // If the user is a super user then the objectName will be super
1289  // and needs to be changed to the table name.
1290  if (db_object.objectName.equalsIgnoreCase("super")) {
1291  db_object.objectName = table;
1292  }
1293  // A bunch of db objects come back. Any with a different name throw away
1294  if (!db_object.objectName.equalsIgnoreCase(table)) {
1295  continue;
1296  }
1297 
1298  // Create set of table permissions based ont he db_object. This seems to
1299  // be the only way - though being hardwired on the number of privs is not great.
1300  TTablePermissions tt = new TTablePermissions(db_object.privs.get(0),
1301  db_object.privs.get(1),
1302  db_object.privs.get(2),
1303  db_object.privs.get(3),
1304  db_object.privs.get(4),
1305  db_object.privs.get(5),
1306  db_object.privs.get(6),
1307  db_object.privs.get(7));
1308 
1309  int ordinal = 1;
1310  for (TTablePermissions._Fields field = tt.fieldForId(ordinal); field != null;
1311  field = tt.fieldForId(++ordinal)) {
1312  Boolean x = (Boolean) tt.getFieldValue(field);
1313  if (x == false) {
1314  continue;
1315  }
1316  // standardise the fieldName upper case and remove trailing '_'. create_ =>
1317  // CREATE
1318  dataMap.get("PRIVILEGE")
1319  .add(field.getFieldName().toUpperCase().replace("_", ""));
1320  dataMap.get("TABLE_CAT").setNull(true);
1321  dataMap.get("TABLE_SCHEM").setNull(true);
1322  dataMap.get("TABLE_NAME").add(db_object.objectName);
1323  dataMap.get("GRANTOR").setNull(true);
1324  dataMap.get("GRANTEE").add(db_object.grantee);
1325  dataMap.get("IS_GRANTABLE").add("NO");
1326  }
1327  }
1328  }
1329  }
1330 
1331  @Override
1332  public ResultSet getTablePrivileges(
1333  String catalog, String schemaPattern, String tableNamePattern)
1334  throws SQLException {
1335  MAPDLOGGER.debug("Entered");
1336 
1337  String modifiedTablePattern =
1338  (tableNamePattern == null) ? null : tableNamePattern.replaceAll("%", ".*");
1339 
1340  MAPDLOGGER.debug("TablePattern " + tableNamePattern + " modifiedTableNamePattern "
1341  + modifiedTablePattern);
1342 
1343  // declare the columns in the result set
1344  final TTypeInfo strTTI =
1345  new TTypeInfo(TDatumType.STR, TEncodingType.NONE, false, false, 0, 0, 0);
1346  final TDatumType datumType = strTTI.type;
1347 
1348  Map<String, OmniSciData> dataMap = new HashMap() {
1349  {
1350  put("TABLE_CAT", new OmniSciData(datumType));
1351  put("TABLE_SCHEM", new OmniSciData(datumType));
1352  put("TABLE_NAME", new OmniSciData(datumType));
1353  put("GRANTOR", new OmniSciData(datumType));
1354  put("GRANTEE", new OmniSciData(datumType));
1355  put("PRIVILEGE", new OmniSciData(datumType));
1356  put("IS_GRANTABLE", new OmniSciData(datumType));
1357  }
1358  };
1359 
1360  try {
1361  // Get all the tables and then pattern match them in tablePermProcess
1362  List<String> tables = con.client.get_tables(con.session);
1363  tablePermProcess(tables, dataMap, modifiedTablePattern);
1364  } catch (TException ex) {
1365  throw new SQLException("get_privileges failed " + ex.toString());
1366  }
1367 
1368  // create component to contain the meta data for the rows
1369  // and create a container to store the data and the nul indicators
1370  // List<TColumnType> rowDesc = new ArrayList(columns.length);
1371 
1372  List<TColumnType> rowDesc = new ArrayList(dataMap.size());
1373  List<TColumn> columnsList = new ArrayList(dataMap.size());
1374 
1375  for (Map.Entry<String, OmniSciData> pair : dataMap.entrySet()) {
1376  columnsList.add(pair.getValue().getTColumn());
1377  rowDesc.add(createTColumnType(pair.getKey(), new TTypeInfo(strTTI)));
1378  }
1379 
1380  // create a rowset for the result
1381  TRowSet rowSet = new TRowSet(rowDesc, null, columnsList, true);
1382 
1383  TQueryResult result = new TQueryResult(rowSet, 0, 0, null);
1384 
1385  OmniSciResultSet cols = new OmniSciResultSet(result, "getPrivileges");
1386  return cols;
1387  }
1388 
1389  @Override
1390  public ResultSet getBestRowIdentifier(
1391  String catalog, String schema, String table, int scope, boolean nullable)
1392  throws SQLException {
1393  MAPDLOGGER.debug("Entered");
1394  throw new UnsupportedOperationException("Not supported yet,"
1395  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1396  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1397  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1398  }
1399 
1400  @Override
1401  public ResultSet getVersionColumns(String catalog, String schema, String table)
1402  throws SQLException {
1403  MAPDLOGGER.debug("Entered");
1404  throw new UnsupportedOperationException("Not supported yet,"
1405  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1406  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1407  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1408  }
1409 
1410  @Override
1411  public ResultSet getPrimaryKeys(String catalog, String schema, String table)
1412  throws SQLException {
1413  MAPDLOGGER.debug("Entered");
1414 
1415  TTypeInfo strTTI =
1416  new TTypeInfo(TDatumType.STR, TEncodingType.NONE, false, false, 0, 0, 0);
1417  TTypeInfo intTTI =
1418  new TTypeInfo(TDatumType.INT, TEncodingType.NONE, false, false, 0, 0, 0);
1419  TTypeInfo smallIntTTI =
1420  new TTypeInfo(TDatumType.SMALLINT, TEncodingType.NONE, false, false, 0, 0, 0);
1421  TColumnType columns[] = {createTColumnType("TABLE_CAT", new TTypeInfo(strTTI)),
1422  createTColumnType("TABLE_SCHEM", new TTypeInfo(strTTI)),
1423  createTColumnType("TABLE_NAME", new TTypeInfo(strTTI)),
1424  createTColumnType("COLUMN_NAME", new TTypeInfo(strTTI)),
1425  createTColumnType("KEY_SEQ", new TTypeInfo(smallIntTTI)),
1426  createTColumnType("PK_NAME", new TTypeInfo(strTTI))};
1427 
1428  return getEmptyResultSetWithDesc(columns);
1429  }
1430 
1431  @Override
1432  public ResultSet getImportedKeys(String catalog, String schema, String table)
1433  throws SQLException {
1434  MAPDLOGGER.debug("Entered");
1435 
1436  TTypeInfo strTTI =
1437  new TTypeInfo(TDatumType.STR, TEncodingType.NONE, false, false, 0, 0, 0);
1438  TTypeInfo intTTI =
1439  new TTypeInfo(TDatumType.INT, TEncodingType.NONE, false, false, 0, 0, 0);
1440  TTypeInfo smallIntTTI =
1441  new TTypeInfo(TDatumType.SMALLINT, TEncodingType.NONE, false, false, 0, 0, 0);
1442  TColumnType columns[] = {createTColumnType("PKTABLE_CAT", new TTypeInfo(strTTI)),
1443  createTColumnType("PKTABLE_SCHEM", new TTypeInfo(strTTI)),
1444  createTColumnType("PKTABLE_NAME", new TTypeInfo(strTTI)),
1445  createTColumnType("PKCOLUMN_NAME", new TTypeInfo(strTTI)),
1446  createTColumnType("FKTABLE_CAT", new TTypeInfo(strTTI)),
1447  createTColumnType("FKTABLE_SCHEM", new TTypeInfo(strTTI)),
1448  createTColumnType("FKTABLE_NAME", new TTypeInfo(strTTI)),
1449  createTColumnType("FKCOLUMN_NAME", new TTypeInfo(strTTI)),
1450  createTColumnType("KEY_SEQ", new TTypeInfo(smallIntTTI)),
1451  createTColumnType("UPDATE_RULE", new TTypeInfo(smallIntTTI)),
1452  createTColumnType("DELETE_RULE", new TTypeInfo(smallIntTTI)),
1453  createTColumnType("FK_NAME", new TTypeInfo(strTTI)),
1454  createTColumnType("PK_NAME", new TTypeInfo(strTTI)),
1455  createTColumnType("DEFERRABILITY", new TTypeInfo(smallIntTTI))};
1456 
1457  return getEmptyResultSetWithDesc(columns);
1458  }
1459 
1460  @Override
1461  public ResultSet getExportedKeys(String catalog, String schema, String table)
1462  throws SQLException {
1463  MAPDLOGGER.debug("Entered");
1464 
1465  TTypeInfo strTTI =
1466  new TTypeInfo(TDatumType.STR, TEncodingType.NONE, false, false, 0, 0, 0);
1467  TTypeInfo intTTI =
1468  new TTypeInfo(TDatumType.INT, TEncodingType.NONE, false, false, 0, 0, 0);
1469  TTypeInfo smallIntTTI =
1470  new TTypeInfo(TDatumType.SMALLINT, TEncodingType.NONE, false, false, 0, 0, 0);
1471  TColumnType columns[] = {createTColumnType("FKTABLE_CAT", new TTypeInfo(strTTI)),
1472  createTColumnType("FKTABLE_SCHEM", new TTypeInfo(strTTI)),
1473  createTColumnType("FKTABLE_NAME", new TTypeInfo(strTTI)),
1474  createTColumnType("FKCOLUMN_NAME", new TTypeInfo(strTTI)),
1475  createTColumnType("PKTABLE_CAT", new TTypeInfo(strTTI)),
1476  createTColumnType("PKTABLE_SCHEM", new TTypeInfo(strTTI)),
1477  createTColumnType("PKTABLE_NAME", new TTypeInfo(strTTI)),
1478  createTColumnType("PKCOLUMN_NAME", new TTypeInfo(strTTI)),
1479  createTColumnType("KEY_SEQ", new TTypeInfo(smallIntTTI)),
1480  createTColumnType("UPDATE_RULE", new TTypeInfo(smallIntTTI)),
1481  createTColumnType("DELETE_RULE", new TTypeInfo(smallIntTTI)),
1482  createTColumnType("PK_NAME", new TTypeInfo(strTTI)),
1483  createTColumnType("FK_NAME", new TTypeInfo(strTTI)),
1484  createTColumnType("DEFERRABILITY", new TTypeInfo(smallIntTTI))};
1485 
1486  return getEmptyResultSetWithDesc(columns);
1487  }
1488 
1489  @Override
1490  public ResultSet getCrossReference(String parentCatalog,
1491  String parentSchema,
1492  String parentTable,
1493  String foreignCatalog,
1494  String foreignSchema,
1495  String foreignTable) throws SQLException {
1496  MAPDLOGGER.debug("Entered");
1497  throw new UnsupportedOperationException("Not supported yet,"
1498  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1499  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1500  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1501  }
1502 
1503  /*
1504  Retrieves a description of all the data types supported by this database. They are
1505 ordered by DATA_TYPE and then by how closely the data type maps to the corresponding JDBC
1506 SQL type. If the database supports SQL distinct types, then getTypeInfo() will return a
1507 single row with a TYPE_NAME of DISTINCT and a DATA_TYPE of Types.DISTINCT. If the database
1508 supports SQL structured types, then getTypeInfo() will return a single row with a
1509 TYPE_NAME of STRUCT and a DATA_TYPE of Types.STRUCT.
1510 
1511 If SQL distinct or structured types are supported, then information on the individual
1512 types may be obtained from the getUDTs() method.
1513 
1514 Each type description has the following columns:
1515 
1516 TYPE_NAME String => Type name
1517 DATA_TYPE int => SQL data type from java.sql.Types
1518 PRECISION int => maximum precision
1519 LITERAL_PREFIX String => prefix used to quote a literal (may be null)
1520 LITERAL_SUFFIX String => suffix used to quote a literal (may be null)
1521 CREATE_PARAMS String => parameters used in creating the type (may be null)
1522 NULLABLE short => can you use NULL for this type.
1523 typeNoNulls - does not allow NULL values
1524 typeNullable - allows NULL values
1525 typeNullableUnknown - nullability unknown
1526 CASE_SENSITIVE boolean=> is it case sensitive.
1527 SEARCHABLE short => can you use "WHERE" based on this type:
1528 typePredNone - No support
1529 typePredChar - Only supported with WHERE .. LIKE
1530 typePredBasic - Supported except for WHERE .. LIKE
1531 typeSearchable - Supported for all WHERE ..
1532 UNSIGNED_ATTRIBUTE boolean => is it unsigned.
1533 FIXED_PREC_SCALE boolean => can it be a money value.
1534 AUTO_INCREMENT boolean => can it be used for an auto-increment value.
1535 LOCAL_TYPE_NAME String => localized version of type name (may be null)
1536 MINIMUM_SCALE short => minimum scale supported
1537 MAXIMUM_SCALE short => maximum scale supported
1538 SQL_DATA_TYPE int => unused
1539 SQL_DATETIME_SUB int => unused
1540 NUM_PREC_RADIX int => usually 2 or 10
1541 The PRECISION column represents the maximum column size that the server supports for the
1542 given datatype. For numeric data, this is the maximum precision. For character data, this
1543 is the length in characters. For datetime datatypes, this is the length in characters of
1544 the String representation (assuming the maximum allowed precision of the fractional
1545 seconds component). For binary data, this is the length in bytes. For the ROWID datatype,
1546 this is the length in bytes. Null is returned for data types where the column size is not
1547 applicable.
1548 
1549 Returns:
1550 a ResultSet object in which each row is an SQL type description
1551 Throws:
1552 SQLException - if a database access error occurs
1553  */
1554  @Override
1555  public ResultSet getTypeInfo() throws SQLException {
1556  MAPDLOGGER.debug("Entered");
1557 
1558  // declare the columns in the result set
1559  TTypeInfo strTTI =
1560  new TTypeInfo(TDatumType.STR, TEncodingType.NONE, false, false, 0, 0, 0);
1561  TTypeInfo intTTI =
1562  new TTypeInfo(TDatumType.INT, TEncodingType.NONE, false, false, 0, 0, 0);
1563  TTypeInfo smallIntTTI =
1564  new TTypeInfo(TDatumType.SMALLINT, TEncodingType.NONE, false, false, 0, 0, 0);
1565  TTypeInfo boolTTI =
1566  new TTypeInfo(TDatumType.BOOL, TEncodingType.NONE, false, false, 0, 0, 0);
1567  TColumnType columns[] = {createTColumnType("TYPE_NAME", new TTypeInfo(strTTI)),
1568  createTColumnType("DATA_TYPE", new TTypeInfo(intTTI)),
1569  createTColumnType("PRECISION", new TTypeInfo(intTTI)),
1570  createTColumnType("LITERAL_PREFIX", new TTypeInfo(strTTI)),
1571  createTColumnType("LITERAL_SUFFIX", new TTypeInfo(strTTI)),
1572  createTColumnType("CREATE_PARAMS", new TTypeInfo(strTTI)),
1573  createTColumnType("NULLABLE", new TTypeInfo(smallIntTTI)),
1574  createTColumnType("CASE_SENSITIVE", new TTypeInfo(boolTTI)),
1575  createTColumnType("SEARCHABLE", new TTypeInfo(smallIntTTI)),
1576  createTColumnType("UNSIGNED_ATTRIBUTE", new TTypeInfo(boolTTI)),
1577  createTColumnType("FIXED_PREC_SCALE", new TTypeInfo(boolTTI)),
1578  createTColumnType("AUTO_INCREMENT", new TTypeInfo(boolTTI)),
1579  createTColumnType("LOCAL_TYPE_NAME", new TTypeInfo(strTTI)),
1580  createTColumnType("MINIMUM_SCALE", new TTypeInfo(smallIntTTI)),
1581  createTColumnType("MAXIMUM_SCALE", new TTypeInfo(smallIntTTI)),
1582  createTColumnType("SQL_DATA_TYPE", new TTypeInfo(intTTI)),
1583  createTColumnType("SQL_DATETIME_SUB", new TTypeInfo(intTTI)),
1584  createTColumnType("NUM_PREC_RADIX", new TTypeInfo(intTTI))};
1585 
1586  Map<String, OmniSciData> dataMap = new HashMap(columns.length);
1587 
1588  // create component to contain the meta data for the rows
1589  // and create a container to store the data and the nul indicators
1590  List<TColumnType> rowDesc = new ArrayList(columns.length);
1591  for (TColumnType col : columns) {
1592  rowDesc.add(col);
1593  dataMap.put(col.col_name, new OmniSciData(col.col_type.type));
1594  }
1595  // TODO this is currently a work in progress need to add actual details here
1596  // Now add some actual details for table name
1597  dataMap.get("TYPE_NAME").setNull(true); // String => Type name
1598  dataMap.get("DATA_TYPE").setNull(true); // int => SQL data type from java.sql.Types
1599  dataMap.get("PRECISION").setNull(true); // int => maximum precision
1600  dataMap.get("LITERAL_PREFIX").setNull(true); //.setNull(true);// String => prefix used
1601  // to quote a literal (may be null)
1602  dataMap.get("LITERAL_SUFFIX").setNull(true); //.setNull(true);// String => suffix used
1603  // to quote a literal (may be null)
1604  dataMap.get("CREATE_PARAMS")
1605  .setNull(
1606  true); // String => parameters used in creating the type (may be null)
1607  dataMap.get("NULLABLE").setNull(true); // short => can you use NULL for this type.
1608  // typeNoNulls - does not allow NULL values
1609  // typeNullable - allows NULL values
1610  // typeNullableUnknown - nullability unknown
1611  dataMap.get("CASE_SENSITIVE").setNull(true); // boolean=> is it case sensitive.
1612  dataMap.get("SEARCHABLE")
1613  .setNull(true); // short => can you use "WHERE" based on this type:
1614  // typePredNone - No support
1615  // typePredChar - Only supported with WHERE .. LIKE
1616  // typePredBasic - Supported except for WHERE .. LIKE
1617  // typeSearchable - Supported for all WHERE ..
1618  dataMap.get("UNSIGNED_ATTRIBUTE").setNull(true); // boolean => is it unsigned.
1619  dataMap.get("FIXED_PREC_SCALE").setNull(true); // boolean => can it be a money value.
1620  dataMap.get("AUTO_INCREMENT")
1621  .setNull(false); // boolean => can it be used for an auto-increment value.
1622  dataMap.get("LOCAL_TYPE_NAME")
1623  .setNull(true); // String => localized version of type name (may be null)
1624  dataMap.get("MINIMUM_SCALE").setNull(true); // short => minimum scale supported
1625  dataMap.get("MAXIMUM_SCALE").setNull(true); // short => maximum scale supported
1626  dataMap.get("SQL_DATA_TYPE").setNull(true); // int => unused
1627  dataMap.get("SQL_DATETIME_SUB").setNull(true); // int => unused
1628  dataMap.get("NUM_PREC_RADIX").setNull(true); //
1629 
1630  List<TColumn> columnsList = new ArrayList(columns.length);
1631 
1632  for (TColumnType col : columns) {
1633  TColumn schemaCol = dataMap.get(col.col_name).getTColumn();
1634  // logger.info("Tcolumn is "+ schemaCol.toString());
1635  columnsList.add(schemaCol);
1636  }
1637 
1638  // create a rowset for the result
1639  TRowSet rowSet = new TRowSet(rowDesc, null, columnsList, true);
1640 
1641  TQueryResult result = new TQueryResult(rowSet, 0, 0, null);
1642 
1643  OmniSciResultSet cols = new OmniSciResultSet(result, "getTypeInfo");
1644  return cols;
1645  }
1646 
1647  @Override
1648  public ResultSet getIndexInfo(String catalog,
1649  String schema,
1650  String table,
1651  boolean unique,
1652  boolean approximate) throws SQLException {
1653  MAPDLOGGER.debug("Entered");
1654  return getEmptyResultSet();
1655  }
1656 
1657  @Override
1658  public boolean supportsResultSetType(int type) throws SQLException {
1659  MAPDLOGGER.debug("Entered");
1660  return false;
1661  }
1662 
1663  @Override
1664  public boolean supportsResultSetConcurrency(int type, int concurrency)
1665  throws SQLException {
1666  MAPDLOGGER.debug("Entered");
1667  return false;
1668  }
1669 
1670  @Override
1671  public boolean ownUpdatesAreVisible(int type) throws SQLException {
1672  MAPDLOGGER.debug("Entered");
1673  return false;
1674  }
1675 
1676  @Override
1677  public boolean ownDeletesAreVisible(int type) throws SQLException {
1678  MAPDLOGGER.debug("Entered");
1679  return false;
1680  }
1681 
1682  @Override
1683  public boolean ownInsertsAreVisible(int type) throws SQLException {
1684  MAPDLOGGER.debug("Entered");
1685  return false;
1686  }
1687 
1688  @Override
1689  public boolean othersUpdatesAreVisible(int type) throws SQLException {
1690  MAPDLOGGER.debug("Entered");
1691  return false;
1692  }
1693 
1694  @Override
1695  public boolean othersDeletesAreVisible(int type) throws SQLException {
1696  MAPDLOGGER.debug("Entered");
1697  return false;
1698  }
1699 
1700  @Override
1701  public boolean othersInsertsAreVisible(int type) throws SQLException {
1702  MAPDLOGGER.debug("Entered");
1703  return false;
1704  }
1705 
1706  @Override
1707  public boolean updatesAreDetected(int type) throws SQLException {
1708  MAPDLOGGER.debug("Entered");
1709  return false;
1710  }
1711 
1712  @Override
1713  public boolean deletesAreDetected(int type) throws SQLException {
1714  MAPDLOGGER.debug("Entered");
1715  return false;
1716  }
1717 
1718  @Override
1719  public boolean insertsAreDetected(int type) throws SQLException {
1720  MAPDLOGGER.debug("Entered");
1721  return false;
1722  }
1723 
1724  @Override
1725  public boolean supportsBatchUpdates() throws SQLException {
1726  MAPDLOGGER.debug("Entered");
1727  return true;
1728  }
1729 
1730  @Override
1731  public ResultSet getUDTs(
1732  String catalog, String schemaPattern, String typeNamePattern, int[] types)
1733  throws SQLException {
1734  MAPDLOGGER.debug("Entered");
1735  throw new UnsupportedOperationException("Not supported yet,"
1736  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1737  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1738  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1739  }
1740 
1741  @Override
1742  public Connection getConnection() throws SQLException {
1743  MAPDLOGGER.debug("Entered");
1744  return con;
1745  }
1746 
1747  @Override
1748  public boolean supportsSavepoints() throws SQLException {
1749  MAPDLOGGER.debug("Entered");
1750  return false;
1751  }
1752 
1753  @Override
1754  public boolean supportsNamedParameters() throws SQLException {
1755  MAPDLOGGER.debug("Entered");
1756  return false;
1757  }
1758 
1759  @Override
1760  public boolean supportsMultipleOpenResults() throws SQLException {
1761  MAPDLOGGER.debug("Entered");
1762  return false;
1763  }
1764 
1765  @Override
1766  public boolean supportsGetGeneratedKeys() throws SQLException {
1767  MAPDLOGGER.debug("Entered");
1768  return false;
1769  }
1770 
1771  @Override
1772  public ResultSet getSuperTypes(
1773  String catalog, String schemaPattern, String typeNamePattern)
1774  throws SQLException {
1775  MAPDLOGGER.debug("Entered");
1776  throw new UnsupportedOperationException("Not supported yet,"
1777  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1778  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1779  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1780  }
1781 
1782  @Override
1783  public ResultSet getSuperTables(
1784  String catalog, String schemaPattern, String tableNamePattern)
1785  throws SQLException {
1786  MAPDLOGGER.debug("Entered");
1787  throw new UnsupportedOperationException("Not supported yet,"
1788  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1789  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1790  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1791  }
1792 
1793  @Override
1794  public ResultSet getAttributes(String catalog,
1795  String schemaPattern,
1796  String typeNamePattern,
1797  String attributeNamePattern) throws SQLException {
1798  MAPDLOGGER.debug("Entered");
1799  throw new UnsupportedOperationException("Not supported yet,"
1800  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1801  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1802  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1803  }
1804 
1805  @Override
1806  public boolean supportsResultSetHoldability(int holdability) throws SQLException {
1807  MAPDLOGGER.debug("Entered");
1808  return false;
1809  }
1810 
1811  @Override
1812  public int getResultSetHoldability() throws SQLException {
1813  MAPDLOGGER.debug("Entered");
1814  return ResultSet.CLOSE_CURSORS_AT_COMMIT;
1815  }
1816 
1817  @Override
1818  public int getDatabaseMajorVersion() throws SQLException {
1819  MAPDLOGGER.debug("Entered");
1820  return this.databaseMajorVersion;
1821  }
1822 
1823  @Override
1824  public int getDatabaseMinorVersion() throws SQLException {
1825  MAPDLOGGER.debug("Entered");
1826  return this.databaseMinorVersion;
1827  }
1828 
1829  @Override
1830  public int getJDBCMajorVersion() throws SQLException {
1831  MAPDLOGGER.debug("Entered");
1832  return 0;
1833  }
1834 
1835  @Override
1836  public int getJDBCMinorVersion() throws SQLException { // logger.debug("Entered");
1837  MAPDLOGGER.debug("Entered");
1838  return 0;
1839  }
1840 
1841  @Override
1842  public int getSQLStateType() throws SQLException {
1843  MAPDLOGGER.debug("Entered");
1844  return 0;
1845  }
1846 
1847  @Override
1848  public boolean locatorsUpdateCopy() throws SQLException {
1849  MAPDLOGGER.debug("Entered");
1850  return false;
1851  }
1852 
1853  @Override
1854  public boolean supportsStatementPooling() throws SQLException {
1855  MAPDLOGGER.debug("Entered");
1856  return false;
1857  }
1858 
1859  @Override
1860  public RowIdLifetime getRowIdLifetime() throws SQLException {
1861  MAPDLOGGER.debug("Entered");
1862  return RowIdLifetime.ROWID_VALID_OTHER;
1863  }
1864 
1865  @Override
1866  public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException {
1867  MAPDLOGGER.debug("Entered");
1868  return getSchemas();
1869  }
1870 
1871  @Override
1872  public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException {
1873  MAPDLOGGER.debug("Entered");
1874  return false;
1875  }
1876 
1877  @Override
1878  public boolean autoCommitFailureClosesAllResultSets() throws SQLException {
1879  MAPDLOGGER.debug("Entered");
1880  return false;
1881  }
1882 
1883  @Override
1884  public ResultSet getClientInfoProperties() throws SQLException {
1885  MAPDLOGGER.debug("Entered");
1886  throw new UnsupportedOperationException("Not supported yet,"
1887  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1888  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1889  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1890  }
1891 
1892  @Override
1893  public ResultSet getFunctions(
1894  String catalog, String schemaPattern, String functionNamePattern)
1895  throws SQLException {
1896  MAPDLOGGER.debug("Entered");
1897  throw new UnsupportedOperationException("Not supported yet,"
1898  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1899  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1900  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1901  }
1902 
1903  @Override
1904  public ResultSet getFunctionColumns(String catalog,
1905  String schemaPattern,
1906  String functionNamePattern,
1907  String columnNamePattern) throws SQLException {
1908  MAPDLOGGER.debug("Entered");
1909  throw new UnsupportedOperationException("Not supported yet,"
1910  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1911  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1912  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1913  }
1914 
1915  @Override
1916  public ResultSet getPseudoColumns(String catalog,
1917  String schemaPattern,
1918  String tableNamePattern,
1919  String columnNamePattern) throws SQLException {
1920  MAPDLOGGER.debug("Entered");
1921  throw new UnsupportedOperationException("Not supported yet,"
1922  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1923  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1924  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1925  }
1926 
1927  @Override
1928  public boolean generatedKeyAlwaysReturned() throws SQLException {
1929  MAPDLOGGER.debug("Entered");
1930  return false;
1931  }
1932 
1933  @Override
1934  public <T> T unwrap(Class<T> iface) throws SQLException {
1935  MAPDLOGGER.debug("Entered");
1936  return null;
1937  }
1938 
1939  @Override
1940  public boolean isWrapperFor(Class<?> iface) throws SQLException {
1941  MAPDLOGGER.debug("Entered");
1942  return false;
1943  }
1944 }
static final int DriverMajorVersion
ResultSet getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate)
ResultSet getVersionColumns(String catalog, String schema, String table)
ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern)
ResultSet getProcedures(String catalog, String schemaPattern, String procedureNamePattern)
ResultSet getCrossReference(String parentCatalog, String parentSchema, String parentTable, String foreignCatalog, String foreignSchema, String foreignTable)
ResultSet getPseudoColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern)
ResultSet getSuperTables(String catalog, String schemaPattern, String tableNamePattern)
static final int DriverMinorVersion
OmniSciDatabaseMetaData(OmniSciConnection connection)
const rapidjson::Value & field(const rapidjson::Value &obj, const char field[]) noexcept
Definition: JsonAccessors.h:31
ResultSet getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern)
ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types)
static int toJava(TDatumType type)
ResultSet getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern)
ResultSet getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern)
ResultSet getPrimaryKeys(String catalog, String schema, String table)
TColumnType createTColumnType(String colName, TTypeInfo colType, Boolean irk)
ResultSet getBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable)
ResultSet getEmptyResultSetWithDesc(TColumnType columns[])
ResultSet getImportedKeys(String catalog, String schema, String table)
TColumn createTColumnData(Object data, List< Boolean > nullsList)
ResultSet getSchemas(String catalog, String schemaPattern)
ResultSet getSuperTypes(String catalog, String schemaPattern, String typeNamePattern)
ResultSet getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types)
ResultSet getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern)
ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern)
boolean supportsConvert(int fromType, int toType)
TColumnType createTColumnType(String colName, TTypeInfo colType)
ResultSet getAttributes(String catalog, String schemaPattern, String typeNamePattern, String attributeNamePattern)
boolean supportsResultSetConcurrency(int type, int concurrency)
void tablePermProcess(List< String > tables, Map< String, OmniSciData > dataMap, String tableNamePattern)
ResultSet getExportedKeys(String catalog, String schema, String table)