OmniSciDB  ab4938a6a3
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.omnisci.thrift.server.TColumn;
19 import com.omnisci.thrift.server.TColumnData;
20 import com.omnisci.thrift.server.TColumnType;
21 import com.omnisci.thrift.server.TDBInfo;
22 import com.omnisci.thrift.server.TDBObject;
23 import com.omnisci.thrift.server.TDBObjectType;
24 import com.omnisci.thrift.server.TDatumType;
25 import com.omnisci.thrift.server.TEncodingType;
26 import com.omnisci.thrift.server.TQueryResult;
27 import com.omnisci.thrift.server.TRowSet;
28 import com.omnisci.thrift.server.TTableDetails;
29 import com.omnisci.thrift.server.TTablePermissions;
30 import com.omnisci.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 
53  String databaseVersion = null;
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) + "."
150  + Integer.toString(OmniSciDriver.DriverMinorVersion);
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(
934  rowSet, 0, 0, null, null, true, com.omnisci.thrift.server.TQueryType.UNKNOWN);
935 
936  OmniSciResultSet tab = new OmniSciResultSet(result, "GetTables");
937  return tab;
938  }
939 
940  // need to add type to this currently only does str type
941  private TColumn createTColumnData(Object data, List<Boolean> nullsList) {
942  TColumnData colData = new TColumnData();
943  colData.setStr_col((List<String>) data);
944 
945  TColumn col = new TColumn(colData, nullsList);
946  return col;
947  }
948 
949  @Override
950  public ResultSet getSchemas() throws SQLException {
951  MAPDLOGGER.debug("Entered");
952 
953  List<TDBInfo> databases = null;
954 
955  try {
956  databases = con.client.get_databases(con.session);
957  } catch (TException ex) {
958  throw new SQLException("get_database failed " + ex.toString());
959  }
960 
961  // process info from databses into the resultset, then place in regular return from
962  // MapD
963  TTypeInfo strTTI =
964  new TTypeInfo(TDatumType.STR, TEncodingType.NONE, false, false, 0, 0, 0);
965  TColumnType columns[] = {createTColumnType("TABLE_SCHEM", new TTypeInfo(strTTI)),
966  createTColumnType("TABLE_CATALOG", new TTypeInfo(strTTI))};
967  // create component to contain the meta data for the rows
968  List<TColumnType> rowDesc = new ArrayList();
969  for (TColumnType col : columns) {
970  rowDesc.add(col);
971  }
972 
973  // Now add some actual details for schema name
974  List<String> schemaList = new ArrayList();
975  List<Boolean> nullList = new ArrayList();
976  List<Boolean> catalogNullList = new ArrayList();
977 
978  for (TDBInfo x : databases) {
979  schemaList.add(x.db_name);
980  nullList.add(false);
981  catalogNullList.add(true);
982  }
983 
984  TColumnData colData = new TColumnData();
985  colData.setStr_col(schemaList);
986 
987  TColumn schemaCol = new TColumn(colData, nullList);
988  TColumn catalogCol = new TColumn(null, catalogNullList);
989 
990  List<TColumn> columnsList = new ArrayList();
991  columnsList.add(schemaCol);
992  columnsList.add(catalogCol);
993 
994  // create a rowset for the result
995  TRowSet rowSet = new TRowSet(rowDesc, null, columnsList, true);
996 
997  TQueryResult result = new TQueryResult(
998  rowSet, 0, 0, null, null, true, com.omnisci.thrift.server.TQueryType.UNKNOWN);
999 
1000  OmniSciResultSet schemas = new OmniSciResultSet(result, "getSchemas");
1001  return schemas;
1002  }
1003 
1004  @Override
1005  public ResultSet getCatalogs() throws SQLException {
1006  MAPDLOGGER.debug("Entered");
1007  return getSchemas();
1008  }
1009 
1010  @Override
1011  public ResultSet getTableTypes() throws SQLException {
1012  MAPDLOGGER.debug("Entered");
1013 
1014  TTypeInfo strTTI =
1015  new TTypeInfo(TDatumType.STR, TEncodingType.NONE, false, false, 0, 0, 0);
1016  TColumnType columns[] = {createTColumnType("TABLE_TYPE", new TTypeInfo(strTTI))};
1017 
1018  Map<String, OmniSciData> dataMap = new HashMap(columns.length);
1019 
1020  // create component to contain the meta data for the rows
1021  // and create a container to store the data and the nul indicators
1022  List<TColumnType> rowDesc = new ArrayList(columns.length);
1023  for (TColumnType col : columns) {
1024  rowDesc.add(col);
1025  dataMap.put(col.col_name, new OmniSciData(col.col_type.type));
1026  }
1027 
1028  // Now add some actual details for table name
1029  dataMap.get("TABLE_TYPE").add("TABLE");
1030  dataMap.get("TABLE_TYPE").add("VIEW");
1031 
1032  List<TColumn> columnsList = new ArrayList(columns.length);
1033 
1034  for (TColumnType col : columns) {
1035  TColumn schemaCol = dataMap.get(col.col_name).getTColumn();
1036  columnsList.add(schemaCol);
1037  }
1038 
1039  // create a rowset for the result
1040  TRowSet rowSet = new TRowSet(rowDesc, null, columnsList, true);
1041 
1042  TQueryResult result = new TQueryResult(
1043  rowSet, 0, 0, null, null, true, com.omnisci.thrift.server.TQueryType.UNKNOWN);
1044 
1045  OmniSciResultSet tab = new OmniSciResultSet(result, "getTableTypes");
1046 
1047  // logger.info("Dump result "+ result.toString());
1048  return tab;
1049  }
1050 
1051  /*
1052  Retrieves a description of table columns available in the specified catalog.
1053 Only column descriptions matching the catalog, schema, table and column name criteria are
1054 returned. They are ordered by TABLE_CAT,TABLE_SCHEM, TABLE_NAME, and ORDINAL_POSITION.
1055 
1056 Each column description has the following columns:
1057 
1058 TABLE_CAT String => table catalog (may be null)
1059 TABLE_SCHEM String => table schema (may be null)
1060 TABLE_NAME String => table name
1061 COLUMN_NAME String => column name
1062 DATA_TYPE int => SQL type from java.sql.Types
1063 TYPE_NAME String => Data source dependent type name, for a UDT the type name is fully
1064 qualified COLUMN_SIZE int => column size. BUFFER_LENGTH is not used. DECIMAL_DIGITS int =>
1065 the number of fractional digits. Null is returned for data types where DECIMAL_DIGITS is
1066 not applicable. NUM_PREC_RADIX int => Radix (typically either 10 or 2) NULLABLE int => is
1067 NULL allowed. columnNoNulls - might not allow NULL values columnNullable - definitely
1068 allows NULL values columnNullableUnknown - nullability unknown REMARKS String => comment
1069 describing column (may be null) COLUMN_DEF String => default value for the column, which
1070 should be interpreted as a string when the value is enclosed in single quotes (may be
1071 null) SQL_DATA_TYPE int => unused SQL_DATETIME_SUB int => unused CHAR_OCTET_LENGTH int =>
1072 for char types the maximum number of bytes in the column ORDINAL_POSITION int => index of
1073 column in table (starting at 1) IS_NULLABLE String => ISO rules are used to determine the
1074 nullability for a column. YES --- if the column can include NULLs NO --- if the column
1075 cannot include NULLs empty string --- if the nullability for the column is unknown
1076 SCOPE_CATALOG String => catalog of table that is the scope of a reference attribute (null
1077 if DATA_TYPE isn't REF) SCOPE_SCHEMA String => schema of table that is the scope of a
1078 reference attribute (null if the DATA_TYPE isn't REF) SCOPE_TABLE String => table name
1079 that this the scope of a reference attribute (null if the DATA_TYPE isn't REF)
1080 SOURCE_DATA_TYPE short => source type of a distinct type or user-generated Ref type, SQL
1081 type from java.sql.Types (null if DATA_TYPE isn't DISTINCT or user-generated REF)
1082 IS_AUTOINCREMENT String => Indicates whether this column is auto incremented
1083 YES --- if the column is auto incremented
1084 NO --- if the column is not auto incremented
1085 empty string --- if it cannot be determined whether the column is auto incremented
1086 IS_GENERATEDCOLUMN String => Indicates whether this is a generated column
1087 YES --- if this a generated column
1088 NO --- if this not a generated column
1089 empty string --- if it cannot be determined whether this is a generated column
1090 The COLUMN_SIZE column specifies the column size for the given column. For numeric data,
1091 this is the maximum precision. For character data, this is the length in characters. For
1092 datetime datatypes, this is the length in characters of the String representation
1093 (assuming the maximum allowed precision of the fractional seconds component). For binary
1094 data, this is the length in bytes. For the ROWID datatype, this is the length in bytes.
1095 Null is returned for data types where the column size is not applicable.
1096 
1097 Parameters:
1098 catalog - a catalog name; must match the catalog name as it is stored in the database; ""
1099 retrieves those without a catalog; null means that the catalog name should not be used to
1100 narrow the search schemaPattern - a schema name pattern; must match the schema name as it
1101 is stored in the database; "" retrieves those without a schema; null means that the schema
1102 name should not be used to narrow the search tableNamePattern - a table name pattern; must
1103 match the table name as it is stored in the database columnNamePattern - a column name
1104 pattern; must match the column name as it is stored in the database Returns: ResultSet -
1105 each row is a column description Throws: SQLException - if a database access error occurs
1106  */
1107  @Override
1108  public ResultSet getColumns(String catalog,
1109  String schemaPattern,
1110  String tableNamePattern,
1111  String columnNamePattern) throws SQLException {
1112  MAPDLOGGER.debug("Entered");
1113  MAPDLOGGER.debug("TablePattern " + tableNamePattern + " columnNamePattern "
1114  + columnNamePattern);
1115  String modifiedTablePattern = tableNamePattern.replaceAll("%", ".*");
1116  String modifiedColumnPattern =
1117  (columnNamePattern == null) ? null : columnNamePattern.replaceAll("%", ".*");
1118 
1119  MAPDLOGGER.debug("TablePattern " + tableNamePattern + " modifiedColumnPattern "
1120  + modifiedColumnPattern);
1121 
1122  // declare the columns in the result set
1123  TTypeInfo strTTI =
1124  new TTypeInfo(TDatumType.STR, TEncodingType.NONE, false, false, 0, 0, 0);
1125  TTypeInfo intTTI =
1126  new TTypeInfo(TDatumType.INT, TEncodingType.NONE, false, false, 0, 0, 0);
1127  TTypeInfo smallIntTTI =
1128  new TTypeInfo(TDatumType.SMALLINT, TEncodingType.NONE, false, false, 0, 0, 0);
1129  TColumnType columns[] = {createTColumnType("TABLE_CAT", new TTypeInfo(strTTI)),
1130  createTColumnType("TABLE_SCHEM", new TTypeInfo(strTTI)),
1131  createTColumnType("TABLE_NAME", new TTypeInfo(strTTI)),
1132  createTColumnType("COLUMN_NAME", new TTypeInfo(strTTI)),
1133  createTColumnType("DATA_TYPE", new TTypeInfo(intTTI)),
1134  createTColumnType("TYPE_NAME", new TTypeInfo(strTTI)),
1135  createTColumnType("COLUMN_SIZE", new TTypeInfo(intTTI)),
1136  createTColumnType("BUFFER_LENGTH", new TTypeInfo(strTTI)),
1137  createTColumnType("DECIMAL_DIGITS", new TTypeInfo(intTTI)),
1138  createTColumnType("NUM_PREC_RADIX", new TTypeInfo(intTTI)),
1139  createTColumnType("NULLABLE", new TTypeInfo(intTTI)),
1140  createTColumnType("REMARKS", new TTypeInfo(strTTI)),
1141  createTColumnType("COLUMN_DEF", new TTypeInfo(strTTI)),
1142  createTColumnType("SQL_DATA_TYPE", new TTypeInfo(intTTI)),
1143  createTColumnType("SQL_DATETIME_SUB", new TTypeInfo(intTTI)),
1144  createTColumnType("CHAR_OCTET_LENGTH", new TTypeInfo(intTTI)),
1145  createTColumnType("ORDINAL_POSITION", new TTypeInfo(intTTI)),
1146  createTColumnType("IS_NULLABLE", new TTypeInfo(strTTI)),
1147  createTColumnType("SCOPE_CATALOG", new TTypeInfo(strTTI)),
1148  createTColumnType("SCOPE_SCHEMA", new TTypeInfo(strTTI)),
1149  createTColumnType("SCOPE_TABLE", new TTypeInfo(strTTI)),
1150  createTColumnType("SOURCE_DATA_TYPE", new TTypeInfo(smallIntTTI)),
1151  createTColumnType("IS_AUTOINCREMENT", new TTypeInfo(strTTI)),
1152  createTColumnType("IS_GENERATEDCOLUMN", new TTypeInfo(strTTI))};
1153 
1154  Map<String, OmniSciData> dataMap = new HashMap(columns.length);
1155 
1156  // create component to contain the meta data for the rows
1157  // and create a container to store the data and the nul indicators
1158  List<TColumnType> rowDesc = new ArrayList(columns.length);
1159  for (TColumnType col : columns) {
1160  rowDesc.add(col);
1161  dataMap.put(col.col_name, new OmniSciData(col.col_type.type));
1162  }
1163 
1164  // Now add some actual details for table name
1165  List<String> tables;
1166  try {
1167  tables = con.client.get_tables(con.session);
1168 
1169  for (String tableName : tables) {
1170  // check if the table matches the input pattern
1171  if (tableNamePattern == null || tableNamePattern.equals(tableName)) {
1172  // grab meta data for table
1173  TTableDetails tableDetails =
1174  con.client.get_table_details(con.session, tableName);
1175 
1176  int ordinal = 0;
1177  // iterate through the columns
1178  for (TColumnType value : tableDetails.row_desc) {
1179  ordinal++;
1180  if (columnNamePattern == null
1181  || value.col_name.matches(modifiedColumnPattern)) {
1182  dataMap.get("TABLE_CAT").setNull(true);
1183  dataMap.get("TABLE_SCHEM").setNull(true);
1184  dataMap.get("TABLE_NAME").add(tableName);
1185  dataMap.get("COLUMN_NAME").add(value.col_name);
1186  dataMap.get("DATA_TYPE").add(OmniSciType.toJava(value.col_type.type));
1187  dataMap.get("TYPE_NAME")
1188  .add((value.col_type.type.name()
1189  + (value.col_type.is_array ? "[]" : "")));
1190  if (value.col_type.type == TDatumType.DECIMAL) {
1191  dataMap.get("COLUMN_SIZE").add(value.col_type.precision);
1192  } else {
1193  dataMap.get("COLUMN_SIZE").add(100);
1194  }
1195  dataMap.get("BUFFER_LENGTH").setNull(true);
1196  if (value.col_type.type == TDatumType.DECIMAL) {
1197  dataMap.get("DECIMAL_DIGITS").add(value.col_type.scale);
1198  } else {
1199  dataMap.get("DECIMAL_DIGITS").setNull(true);
1200  }
1201  dataMap.get("NUM_PREC_RADIX").add(10);
1202  dataMap.get("NULLABLE")
1203  .add(value.col_type.nullable ? DatabaseMetaData.columnNullable
1204  : DatabaseMetaData.columnNoNulls);
1205  dataMap.get("REMARKS").add(" ");
1206  dataMap.get("COLUMN_DEF").setNull(true);
1207  dataMap.get("SQL_DATA_TYPE").add(0);
1208  dataMap.get("SQL_DATETIME_SUB").setNull(true);
1209  dataMap.get("CHAR_OCTET_LENGTH").add(0);
1210  dataMap.get("ORDINAL_POSITION").add(ordinal);
1211  dataMap.get("IS_NULLABLE").add(value.col_type.nullable ? "YES" : "NO");
1212  dataMap.get("SCOPE_CATALOG").setNull(true);
1213  dataMap.get("SCOPE_SCHEMA").setNull(true);
1214  dataMap.get("SCOPE_TABLE").setNull(true);
1215  dataMap.get("SOURCE_DATA_TYPE")
1216  .add(OmniSciType.toJava(value.col_type.type));
1217  dataMap.get("IS_AUTOINCREMENT").add("NO");
1218  dataMap.get("IS_GENERATEDCOLUMN").add("NO");
1219  }
1220  }
1221  }
1222  }
1223  } catch (TException ex) {
1224  throw new SQLException("get_tables failed " + ex.toString());
1225  }
1226 
1227  List<TColumn> columnsList = new ArrayList(columns.length);
1228 
1229  for (TColumnType col : columns) {
1230  TColumn schemaCol = dataMap.get(col.col_name).getTColumn();
1231  // logger.info("Tcolumn is "+ schemaCol.toString());
1232  columnsList.add(schemaCol);
1233  }
1234 
1235  // create a rowset for the result
1236  TRowSet rowSet = new TRowSet(rowDesc, null, columnsList, true);
1237 
1238  TQueryResult result = new TQueryResult(
1239  rowSet, 0, 0, null, null, true, com.omnisci.thrift.server.TQueryType.UNKNOWN);
1240 
1241  OmniSciResultSet cols = new OmniSciResultSet(result, "getColumns");
1242  return cols;
1243  }
1244 
1245  @Override
1246  public ResultSet getColumnPrivileges(
1247  String catalog, String schema, String table, String columnNamePattern)
1248  throws SQLException {
1249  MAPDLOGGER.debug("Entered");
1250  throw new UnsupportedOperationException("Not supported yet,"
1251  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1252  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1253  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1254  }
1255 
1256  public ResultSet getEmptyResultSet() {
1257  return new OmniSciResultSet();
1258  }
1259 
1260  // this method is needed to build an empty resultset with columns names and datatypes
1261  public ResultSet getEmptyResultSetWithDesc(TColumnType columns[])
1262  throws SQLException { // for compatibility and future
1263  Map<String, OmniSciData> dataMap = new HashMap(columns.length);
1264  List<TColumnType> rowDesc = new ArrayList(columns.length);
1265  for (TColumnType col : columns) {
1266  rowDesc.add(col);
1267  dataMap.put(col.col_name, new OmniSciData(col.col_type.type));
1268  }
1269  List<TColumn> columnsList = new ArrayList(columns.length);
1270  for (TColumnType col : columns) {
1271  TColumn schemaCol = dataMap.get(col.col_name).getTColumn();
1272  columnsList.add(schemaCol);
1273  }
1274  TRowSet rowSet = new TRowSet(rowDesc, null, columnsList, true);
1275  TQueryResult result = new TQueryResult(
1276  rowSet, 0, 0, null, null, true, com.omnisci.thrift.server.TQueryType.UNKNOWN);
1277  OmniSciResultSet cols = new OmniSciResultSet(result, "getColumns");
1278  return cols;
1279  }
1280 
1281  private void tablePermProcess(
1282  List<String> tables, Map<String, OmniSciData> dataMap, String tableNamePattern)
1283  throws TException {
1284  for (String table : tables) {
1285  if (tableNamePattern != null && !table.matches(tableNamePattern)) {
1286  continue;
1287  }
1288  List<TDBObject> db_objects = con.client.get_db_object_privs(
1289  con.session, table, TDBObjectType.TableDBObjectType);
1290 
1291  // check if the table matches the input pattern
1292  for (TDBObject db_object : db_objects) {
1293  // If the user is a super user then the objectName will be super
1294  // and needs to be changed to the table name.
1295  if (db_object.objectName.equalsIgnoreCase("super")) {
1296  db_object.objectName = table;
1297  }
1298  // A bunch of db objects come back. Any with a different name throw away
1299  if (!db_object.objectName.equalsIgnoreCase(table)) {
1300  continue;
1301  }
1302 
1303  // Create set of table permissions based ont he db_object. This seems to
1304  // be the only way - though being hardwired on the number of privs is not great.
1305  TTablePermissions tt = new TTablePermissions(db_object.privs.get(0),
1306  db_object.privs.get(1),
1307  db_object.privs.get(2),
1308  db_object.privs.get(3),
1309  db_object.privs.get(4),
1310  db_object.privs.get(5),
1311  db_object.privs.get(6),
1312  db_object.privs.get(7));
1313 
1314  int ordinal = 1;
1315  for (TTablePermissions._Fields field = tt.fieldForId(ordinal); field != null;
1316  field = tt.fieldForId(++ordinal)) {
1317  Boolean x = (Boolean) tt.getFieldValue(field);
1318  if (x == false) {
1319  continue;
1320  }
1321  // standardise the fieldName upper case and remove trailing '_'. create_ =>
1322  // CREATE
1323  dataMap.get("PRIVILEGE")
1324  .add(field.getFieldName().toUpperCase().replace("_", ""));
1325  dataMap.get("TABLE_CAT").setNull(true);
1326  dataMap.get("TABLE_SCHEM").setNull(true);
1327  dataMap.get("TABLE_NAME").add(db_object.objectName);
1328  dataMap.get("GRANTOR").setNull(true);
1329  dataMap.get("GRANTEE").add(db_object.grantee);
1330  dataMap.get("IS_GRANTABLE").add("NO");
1331  }
1332  }
1333  }
1334  }
1335 
1336  @Override
1337  public ResultSet getTablePrivileges(
1338  String catalog, String schemaPattern, String tableNamePattern)
1339  throws SQLException {
1340  MAPDLOGGER.debug("Entered");
1341 
1342  String modifiedTablePattern =
1343  (tableNamePattern == null) ? null : tableNamePattern.replaceAll("%", ".*");
1344 
1345  MAPDLOGGER.debug("TablePattern " + tableNamePattern + " modifiedTableNamePattern "
1346  + modifiedTablePattern);
1347 
1348  // declare the columns in the result set
1349  final TTypeInfo strTTI =
1350  new TTypeInfo(TDatumType.STR, TEncodingType.NONE, false, false, 0, 0, 0);
1351  final TDatumType datumType = strTTI.type;
1352 
1353  Map<String, OmniSciData> dataMap = new HashMap() {
1354  {
1355  put("TABLE_CAT", new OmniSciData(datumType));
1356  put("TABLE_SCHEM", new OmniSciData(datumType));
1357  put("TABLE_NAME", new OmniSciData(datumType));
1358  put("GRANTOR", new OmniSciData(datumType));
1359  put("GRANTEE", new OmniSciData(datumType));
1360  put("PRIVILEGE", new OmniSciData(datumType));
1361  put("IS_GRANTABLE", new OmniSciData(datumType));
1362  }
1363  };
1364 
1365  try {
1366  // Get all the tables and then pattern match them in tablePermProcess
1367  List<String> tables = con.client.get_tables(con.session);
1368  tablePermProcess(tables, dataMap, modifiedTablePattern);
1369  } catch (TException ex) {
1370  throw new SQLException("get_privileges failed " + ex.toString());
1371  }
1372 
1373  // create component to contain the meta data for the rows
1374  // and create a container to store the data and the nul indicators
1375  // List<TColumnType> rowDesc = new ArrayList(columns.length);
1376 
1377  List<TColumnType> rowDesc = new ArrayList(dataMap.size());
1378  List<TColumn> columnsList = new ArrayList(dataMap.size());
1379 
1380  for (Map.Entry<String, OmniSciData> pair : dataMap.entrySet()) {
1381  columnsList.add(pair.getValue().getTColumn());
1382  rowDesc.add(createTColumnType(pair.getKey(), new TTypeInfo(strTTI)));
1383  }
1384 
1385  // create a rowset for the result
1386  TRowSet rowSet = new TRowSet(rowDesc, null, columnsList, true);
1387 
1388  TQueryResult result = new TQueryResult(
1389  rowSet, 0, 0, null, null, true, com.omnisci.thrift.server.TQueryType.UNKNOWN);
1390 
1391  OmniSciResultSet cols = new OmniSciResultSet(result, "getPrivileges");
1392  return cols;
1393  }
1394 
1395  @Override
1396  public ResultSet getBestRowIdentifier(
1397  String catalog, String schema, String table, int scope, boolean nullable)
1398  throws SQLException {
1399  MAPDLOGGER.debug("Entered");
1400  throw new UnsupportedOperationException("Not supported yet,"
1401  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1402  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1403  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1404  }
1405 
1406  @Override
1407  public ResultSet getVersionColumns(String catalog, String schema, String table)
1408  throws SQLException {
1409  MAPDLOGGER.debug("Entered");
1410  throw new UnsupportedOperationException("Not supported yet,"
1411  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1412  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1413  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1414  }
1415 
1416  @Override
1417  public ResultSet getPrimaryKeys(String catalog, String schema, String table)
1418  throws SQLException {
1419  MAPDLOGGER.debug("Entered");
1420 
1421  TTypeInfo strTTI =
1422  new TTypeInfo(TDatumType.STR, TEncodingType.NONE, false, false, 0, 0, 0);
1423  TTypeInfo intTTI =
1424  new TTypeInfo(TDatumType.INT, TEncodingType.NONE, false, false, 0, 0, 0);
1425  TTypeInfo smallIntTTI =
1426  new TTypeInfo(TDatumType.SMALLINT, TEncodingType.NONE, false, false, 0, 0, 0);
1427  TColumnType columns[] = {createTColumnType("TABLE_CAT", new TTypeInfo(strTTI)),
1428  createTColumnType("TABLE_SCHEM", new TTypeInfo(strTTI)),
1429  createTColumnType("TABLE_NAME", new TTypeInfo(strTTI)),
1430  createTColumnType("COLUMN_NAME", new TTypeInfo(strTTI)),
1431  createTColumnType("KEY_SEQ", new TTypeInfo(smallIntTTI)),
1432  createTColumnType("PK_NAME", new TTypeInfo(strTTI))};
1433 
1434  return getEmptyResultSetWithDesc(columns);
1435  }
1436 
1437  @Override
1438  public ResultSet getImportedKeys(String catalog, String schema, String table)
1439  throws SQLException {
1440  MAPDLOGGER.debug("Entered");
1441 
1442  TTypeInfo strTTI =
1443  new TTypeInfo(TDatumType.STR, TEncodingType.NONE, false, false, 0, 0, 0);
1444  TTypeInfo intTTI =
1445  new TTypeInfo(TDatumType.INT, TEncodingType.NONE, false, false, 0, 0, 0);
1446  TTypeInfo smallIntTTI =
1447  new TTypeInfo(TDatumType.SMALLINT, TEncodingType.NONE, false, false, 0, 0, 0);
1448  TColumnType columns[] = {createTColumnType("PKTABLE_CAT", new TTypeInfo(strTTI)),
1449  createTColumnType("PKTABLE_SCHEM", new TTypeInfo(strTTI)),
1450  createTColumnType("PKTABLE_NAME", new TTypeInfo(strTTI)),
1451  createTColumnType("PKCOLUMN_NAME", new TTypeInfo(strTTI)),
1452  createTColumnType("FKTABLE_CAT", new TTypeInfo(strTTI)),
1453  createTColumnType("FKTABLE_SCHEM", new TTypeInfo(strTTI)),
1454  createTColumnType("FKTABLE_NAME", new TTypeInfo(strTTI)),
1455  createTColumnType("FKCOLUMN_NAME", new TTypeInfo(strTTI)),
1456  createTColumnType("KEY_SEQ", new TTypeInfo(smallIntTTI)),
1457  createTColumnType("UPDATE_RULE", new TTypeInfo(smallIntTTI)),
1458  createTColumnType("DELETE_RULE", new TTypeInfo(smallIntTTI)),
1459  createTColumnType("FK_NAME", new TTypeInfo(strTTI)),
1460  createTColumnType("PK_NAME", new TTypeInfo(strTTI)),
1461  createTColumnType("DEFERRABILITY", new TTypeInfo(smallIntTTI))};
1462 
1463  return getEmptyResultSetWithDesc(columns);
1464  }
1465 
1466  @Override
1467  public ResultSet getExportedKeys(String catalog, String schema, String table)
1468  throws SQLException {
1469  MAPDLOGGER.debug("Entered");
1470 
1471  TTypeInfo strTTI =
1472  new TTypeInfo(TDatumType.STR, TEncodingType.NONE, false, false, 0, 0, 0);
1473  TTypeInfo intTTI =
1474  new TTypeInfo(TDatumType.INT, TEncodingType.NONE, false, false, 0, 0, 0);
1475  TTypeInfo smallIntTTI =
1476  new TTypeInfo(TDatumType.SMALLINT, TEncodingType.NONE, false, false, 0, 0, 0);
1477  TColumnType columns[] = {createTColumnType("FKTABLE_CAT", new TTypeInfo(strTTI)),
1478  createTColumnType("FKTABLE_SCHEM", new TTypeInfo(strTTI)),
1479  createTColumnType("FKTABLE_NAME", new TTypeInfo(strTTI)),
1480  createTColumnType("FKCOLUMN_NAME", new TTypeInfo(strTTI)),
1481  createTColumnType("PKTABLE_CAT", new TTypeInfo(strTTI)),
1482  createTColumnType("PKTABLE_SCHEM", new TTypeInfo(strTTI)),
1483  createTColumnType("PKTABLE_NAME", new TTypeInfo(strTTI)),
1484  createTColumnType("PKCOLUMN_NAME", new TTypeInfo(strTTI)),
1485  createTColumnType("KEY_SEQ", new TTypeInfo(smallIntTTI)),
1486  createTColumnType("UPDATE_RULE", new TTypeInfo(smallIntTTI)),
1487  createTColumnType("DELETE_RULE", new TTypeInfo(smallIntTTI)),
1488  createTColumnType("PK_NAME", new TTypeInfo(strTTI)),
1489  createTColumnType("FK_NAME", new TTypeInfo(strTTI)),
1490  createTColumnType("DEFERRABILITY", new TTypeInfo(smallIntTTI))};
1491 
1492  return getEmptyResultSetWithDesc(columns);
1493  }
1494 
1495  @Override
1496  public ResultSet getCrossReference(String parentCatalog,
1497  String parentSchema,
1498  String parentTable,
1499  String foreignCatalog,
1500  String foreignSchema,
1501  String foreignTable) throws SQLException {
1502  MAPDLOGGER.debug("Entered");
1503  throw new UnsupportedOperationException("Not supported yet,"
1504  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1505  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1506  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1507  }
1508 
1509  /*
1510  Retrieves a description of all the data types supported by this database. They are
1511 ordered by DATA_TYPE and then by how closely the data type maps to the corresponding JDBC
1512 SQL type. If the database supports SQL distinct types, then getTypeInfo() will return a
1513 single row with a TYPE_NAME of DISTINCT and a DATA_TYPE of Types.DISTINCT. If the database
1514 supports SQL structured types, then getTypeInfo() will return a single row with a
1515 TYPE_NAME of STRUCT and a DATA_TYPE of Types.STRUCT.
1516 
1517 If SQL distinct or structured types are supported, then information on the individual
1518 types may be obtained from the getUDTs() method.
1519 
1520 Each type description has the following columns:
1521 
1522 TYPE_NAME String => Type name
1523 DATA_TYPE int => SQL data type from java.sql.Types
1524 PRECISION int => maximum precision
1525 LITERAL_PREFIX String => prefix used to quote a literal (may be null)
1526 LITERAL_SUFFIX String => suffix used to quote a literal (may be null)
1527 CREATE_PARAMS String => parameters used in creating the type (may be null)
1528 NULLABLE short => can you use NULL for this type.
1529 typeNoNulls - does not allow NULL values
1530 typeNullable - allows NULL values
1531 typeNullableUnknown - nullability unknown
1532 CASE_SENSITIVE boolean=> is it case sensitive.
1533 SEARCHABLE short => can you use "WHERE" based on this type:
1534 typePredNone - No support
1535 typePredChar - Only supported with WHERE .. LIKE
1536 typePredBasic - Supported except for WHERE .. LIKE
1537 typeSearchable - Supported for all WHERE ..
1538 UNSIGNED_ATTRIBUTE boolean => is it unsigned.
1539 FIXED_PREC_SCALE boolean => can it be a money value.
1540 AUTO_INCREMENT boolean => can it be used for an auto-increment value.
1541 LOCAL_TYPE_NAME String => localized version of type name (may be null)
1542 MINIMUM_SCALE short => minimum scale supported
1543 MAXIMUM_SCALE short => maximum scale supported
1544 SQL_DATA_TYPE int => unused
1545 SQL_DATETIME_SUB int => unused
1546 NUM_PREC_RADIX int => usually 2 or 10
1547 The PRECISION column represents the maximum column size that the server supports for the
1548 given datatype. For numeric data, this is the maximum precision. For character data, this
1549 is the length in characters. For datetime datatypes, this is the length in characters of
1550 the String representation (assuming the maximum allowed precision of the fractional
1551 seconds component). For binary data, this is the length in bytes. For the ROWID datatype,
1552 this is the length in bytes. Null is returned for data types where the column size is not
1553 applicable.
1554 
1555 Returns:
1556 a ResultSet object in which each row is an SQL type description
1557 Throws:
1558 SQLException - if a database access error occurs
1559  */
1560  @Override
1561  public ResultSet getTypeInfo() throws SQLException {
1562  MAPDLOGGER.debug("Entered");
1563 
1564  // declare the columns in the result set
1565  TTypeInfo strTTI =
1566  new TTypeInfo(TDatumType.STR, TEncodingType.NONE, false, false, 0, 0, 0);
1567  TTypeInfo intTTI =
1568  new TTypeInfo(TDatumType.INT, TEncodingType.NONE, false, false, 0, 0, 0);
1569  TTypeInfo smallIntTTI =
1570  new TTypeInfo(TDatumType.SMALLINT, TEncodingType.NONE, false, false, 0, 0, 0);
1571  TTypeInfo boolTTI =
1572  new TTypeInfo(TDatumType.BOOL, TEncodingType.NONE, false, false, 0, 0, 0);
1573  TColumnType columns[] = {createTColumnType("TYPE_NAME", new TTypeInfo(strTTI)),
1574  createTColumnType("DATA_TYPE", new TTypeInfo(intTTI)),
1575  createTColumnType("PRECISION", new TTypeInfo(intTTI)),
1576  createTColumnType("LITERAL_PREFIX", new TTypeInfo(strTTI)),
1577  createTColumnType("LITERAL_SUFFIX", new TTypeInfo(strTTI)),
1578  createTColumnType("CREATE_PARAMS", new TTypeInfo(strTTI)),
1579  createTColumnType("NULLABLE", new TTypeInfo(smallIntTTI)),
1580  createTColumnType("CASE_SENSITIVE", new TTypeInfo(boolTTI)),
1581  createTColumnType("SEARCHABLE", new TTypeInfo(smallIntTTI)),
1582  createTColumnType("UNSIGNED_ATTRIBUTE", new TTypeInfo(boolTTI)),
1583  createTColumnType("FIXED_PREC_SCALE", new TTypeInfo(boolTTI)),
1584  createTColumnType("AUTO_INCREMENT", new TTypeInfo(boolTTI)),
1585  createTColumnType("LOCAL_TYPE_NAME", new TTypeInfo(strTTI)),
1586  createTColumnType("MINIMUM_SCALE", new TTypeInfo(smallIntTTI)),
1587  createTColumnType("MAXIMUM_SCALE", new TTypeInfo(smallIntTTI)),
1588  createTColumnType("SQL_DATA_TYPE", new TTypeInfo(intTTI)),
1589  createTColumnType("SQL_DATETIME_SUB", new TTypeInfo(intTTI)),
1590  createTColumnType("NUM_PREC_RADIX", new TTypeInfo(intTTI))};
1591 
1592  Map<String, OmniSciData> dataMap = new HashMap(columns.length);
1593 
1594  // create component to contain the meta data for the rows
1595  // and create a container to store the data and the nul indicators
1596  List<TColumnType> rowDesc = new ArrayList(columns.length);
1597  for (TColumnType col : columns) {
1598  rowDesc.add(col);
1599  dataMap.put(col.col_name, new OmniSciData(col.col_type.type));
1600  }
1601  // TODO this is currently a work in progress need to add actual details here
1602  // Now add some actual details for table name
1603  dataMap.get("TYPE_NAME").setNull(true); // String => Type name
1604  dataMap.get("DATA_TYPE").setNull(true); // int => SQL data type from java.sql.Types
1605  dataMap.get("PRECISION").setNull(true); // int => maximum precision
1606  dataMap.get("LITERAL_PREFIX").setNull(true); //.setNull(true);// String => prefix used
1607  // to quote a literal (may be null)
1608  dataMap.get("LITERAL_SUFFIX").setNull(true); //.setNull(true);// String => suffix used
1609  // to quote a literal (may be null)
1610  dataMap.get("CREATE_PARAMS")
1611  .setNull(
1612  true); // String => parameters used in creating the type (may be null)
1613  dataMap.get("NULLABLE").setNull(true); // short => can you use NULL for this type.
1614  // typeNoNulls - does not allow NULL values
1615  // typeNullable - allows NULL values
1616  // typeNullableUnknown - nullability unknown
1617  dataMap.get("CASE_SENSITIVE").setNull(true); // boolean=> is it case sensitive.
1618  dataMap.get("SEARCHABLE")
1619  .setNull(true); // short => can you use "WHERE" based on this type:
1620  // typePredNone - No support
1621  // typePredChar - Only supported with WHERE .. LIKE
1622  // typePredBasic - Supported except for WHERE .. LIKE
1623  // typeSearchable - Supported for all WHERE ..
1624  dataMap.get("UNSIGNED_ATTRIBUTE").setNull(true); // boolean => is it unsigned.
1625  dataMap.get("FIXED_PREC_SCALE").setNull(true); // boolean => can it be a money value.
1626  dataMap.get("AUTO_INCREMENT")
1627  .setNull(false); // boolean => can it be used for an auto-increment value.
1628  dataMap.get("LOCAL_TYPE_NAME")
1629  .setNull(true); // String => localized version of type name (may be null)
1630  dataMap.get("MINIMUM_SCALE").setNull(true); // short => minimum scale supported
1631  dataMap.get("MAXIMUM_SCALE").setNull(true); // short => maximum scale supported
1632  dataMap.get("SQL_DATA_TYPE").setNull(true); // int => unused
1633  dataMap.get("SQL_DATETIME_SUB").setNull(true); // int => unused
1634  dataMap.get("NUM_PREC_RADIX").setNull(true); //
1635 
1636  List<TColumn> columnsList = new ArrayList(columns.length);
1637 
1638  for (TColumnType col : columns) {
1639  TColumn schemaCol = dataMap.get(col.col_name).getTColumn();
1640  // logger.info("Tcolumn is "+ schemaCol.toString());
1641  columnsList.add(schemaCol);
1642  }
1643 
1644  // create a rowset for the result
1645  TRowSet rowSet = new TRowSet(rowDesc, null, columnsList, true);
1646 
1647  TQueryResult result = new TQueryResult(
1648  rowSet, 0, 0, null, null, true, com.omnisci.thrift.server.TQueryType.UNKNOWN);
1649 
1650  OmniSciResultSet cols = new OmniSciResultSet(result, "getTypeInfo");
1651  return cols;
1652  }
1653 
1654  @Override
1655  public ResultSet getIndexInfo(String catalog,
1656  String schema,
1657  String table,
1658  boolean unique,
1659  boolean approximate) throws SQLException {
1660  MAPDLOGGER.debug("Entered");
1661  return getEmptyResultSet();
1662  }
1663 
1664  @Override
1665  public boolean supportsResultSetType(int type) throws SQLException {
1666  MAPDLOGGER.debug("Entered");
1667  return false;
1668  }
1669 
1670  @Override
1671  public boolean supportsResultSetConcurrency(int type, int concurrency)
1672  throws SQLException {
1673  MAPDLOGGER.debug("Entered");
1674  return false;
1675  }
1676 
1677  @Override
1678  public boolean ownUpdatesAreVisible(int type) throws SQLException {
1679  MAPDLOGGER.debug("Entered");
1680  return false;
1681  }
1682 
1683  @Override
1684  public boolean ownDeletesAreVisible(int type) throws SQLException {
1685  MAPDLOGGER.debug("Entered");
1686  return false;
1687  }
1688 
1689  @Override
1690  public boolean ownInsertsAreVisible(int type) throws SQLException {
1691  MAPDLOGGER.debug("Entered");
1692  return false;
1693  }
1694 
1695  @Override
1696  public boolean othersUpdatesAreVisible(int type) throws SQLException {
1697  MAPDLOGGER.debug("Entered");
1698  return false;
1699  }
1700 
1701  @Override
1702  public boolean othersDeletesAreVisible(int type) throws SQLException {
1703  MAPDLOGGER.debug("Entered");
1704  return false;
1705  }
1706 
1707  @Override
1708  public boolean othersInsertsAreVisible(int type) throws SQLException {
1709  MAPDLOGGER.debug("Entered");
1710  return false;
1711  }
1712 
1713  @Override
1714  public boolean updatesAreDetected(int type) throws SQLException {
1715  MAPDLOGGER.debug("Entered");
1716  return false;
1717  }
1718 
1719  @Override
1720  public boolean deletesAreDetected(int type) throws SQLException {
1721  MAPDLOGGER.debug("Entered");
1722  return false;
1723  }
1724 
1725  @Override
1726  public boolean insertsAreDetected(int type) throws SQLException {
1727  MAPDLOGGER.debug("Entered");
1728  return false;
1729  }
1730 
1731  @Override
1732  public boolean supportsBatchUpdates() throws SQLException {
1733  MAPDLOGGER.debug("Entered");
1734  return true;
1735  }
1736 
1737  @Override
1738  public ResultSet getUDTs(
1739  String catalog, String schemaPattern, String typeNamePattern, int[] types)
1740  throws SQLException {
1741  MAPDLOGGER.debug("Entered");
1742  throw new UnsupportedOperationException("Not supported yet,"
1743  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1744  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1745  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1746  }
1747 
1748  @Override
1749  public Connection getConnection() throws SQLException {
1750  MAPDLOGGER.debug("Entered");
1751  return con;
1752  }
1753 
1754  @Override
1755  public boolean supportsSavepoints() throws SQLException {
1756  MAPDLOGGER.debug("Entered");
1757  return false;
1758  }
1759 
1760  @Override
1761  public boolean supportsNamedParameters() throws SQLException {
1762  MAPDLOGGER.debug("Entered");
1763  return false;
1764  }
1765 
1766  @Override
1767  public boolean supportsMultipleOpenResults() throws SQLException {
1768  MAPDLOGGER.debug("Entered");
1769  return false;
1770  }
1771 
1772  @Override
1773  public boolean supportsGetGeneratedKeys() throws SQLException {
1774  MAPDLOGGER.debug("Entered");
1775  return false;
1776  }
1777 
1778  @Override
1779  public ResultSet getSuperTypes(
1780  String catalog, String schemaPattern, String typeNamePattern)
1781  throws SQLException {
1782  MAPDLOGGER.debug("Entered");
1783  throw new UnsupportedOperationException("Not supported yet,"
1784  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1785  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1786  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1787  }
1788 
1789  @Override
1790  public ResultSet getSuperTables(
1791  String catalog, String schemaPattern, String tableNamePattern)
1792  throws SQLException {
1793  MAPDLOGGER.debug("Entered");
1794  throw new UnsupportedOperationException("Not supported yet,"
1795  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1796  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1797  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1798  }
1799 
1800  @Override
1801  public ResultSet getAttributes(String catalog,
1802  String schemaPattern,
1803  String typeNamePattern,
1804  String attributeNamePattern) throws SQLException {
1805  MAPDLOGGER.debug("Entered");
1806  throw new UnsupportedOperationException("Not supported yet,"
1807  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1808  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1809  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1810  }
1811 
1812  @Override
1813  public boolean supportsResultSetHoldability(int holdability) throws SQLException {
1814  MAPDLOGGER.debug("Entered");
1815  return false;
1816  }
1817 
1818  @Override
1819  public int getResultSetHoldability() throws SQLException {
1820  MAPDLOGGER.debug("Entered");
1821  return ResultSet.CLOSE_CURSORS_AT_COMMIT;
1822  }
1823 
1824  @Override
1825  public int getDatabaseMajorVersion() throws SQLException {
1826  MAPDLOGGER.debug("Entered");
1827  return this.databaseMajorVersion;
1828  }
1829 
1830  @Override
1831  public int getDatabaseMinorVersion() throws SQLException {
1832  MAPDLOGGER.debug("Entered");
1833  return this.databaseMinorVersion;
1834  }
1835 
1836  @Override
1837  public int getJDBCMajorVersion() throws SQLException {
1838  MAPDLOGGER.debug("Entered");
1839  return 0;
1840  }
1841 
1842  @Override
1843  public int getJDBCMinorVersion() throws SQLException { // logger.debug("Entered");
1844  MAPDLOGGER.debug("Entered");
1845  return 0;
1846  }
1847 
1848  @Override
1849  public int getSQLStateType() throws SQLException {
1850  MAPDLOGGER.debug("Entered");
1851  return 0;
1852  }
1853 
1854  @Override
1855  public boolean locatorsUpdateCopy() throws SQLException {
1856  MAPDLOGGER.debug("Entered");
1857  return false;
1858  }
1859 
1860  @Override
1861  public boolean supportsStatementPooling() throws SQLException {
1862  MAPDLOGGER.debug("Entered");
1863  return false;
1864  }
1865 
1866  @Override
1867  public RowIdLifetime getRowIdLifetime() throws SQLException {
1868  MAPDLOGGER.debug("Entered");
1869  return RowIdLifetime.ROWID_VALID_OTHER;
1870  }
1871 
1872  @Override
1873  public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException {
1874  MAPDLOGGER.debug("Entered");
1875  return getSchemas();
1876  }
1877 
1878  @Override
1879  public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException {
1880  MAPDLOGGER.debug("Entered");
1881  return false;
1882  }
1883 
1884  @Override
1885  public boolean autoCommitFailureClosesAllResultSets() throws SQLException {
1886  MAPDLOGGER.debug("Entered");
1887  return false;
1888  }
1889 
1890  @Override
1891  public ResultSet getClientInfoProperties() throws SQLException {
1892  MAPDLOGGER.debug("Entered");
1893  throw new UnsupportedOperationException("Not supported yet,"
1894  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1895  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1896  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1897  }
1898 
1899  @Override
1900  public ResultSet getFunctions(
1901  String catalog, String schemaPattern, String functionNamePattern)
1902  throws SQLException {
1903  MAPDLOGGER.debug("Entered");
1904  throw new UnsupportedOperationException("Not supported yet,"
1905  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1906  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1907  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1908  }
1909 
1910  @Override
1911  public ResultSet getFunctionColumns(String catalog,
1912  String schemaPattern,
1913  String functionNamePattern,
1914  String columnNamePattern) throws SQLException {
1915  MAPDLOGGER.debug("Entered");
1916  throw new UnsupportedOperationException("Not supported yet,"
1917  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1918  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1919  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1920  }
1921 
1922  @Override
1923  public ResultSet getPseudoColumns(String catalog,
1924  String schemaPattern,
1925  String tableNamePattern,
1926  String columnNamePattern) throws SQLException {
1927  MAPDLOGGER.debug("Entered");
1928  throw new UnsupportedOperationException("Not supported yet,"
1929  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1930  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1931  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1932  }
1933 
1934  @Override
1935  public boolean generatedKeyAlwaysReturned() throws SQLException {
1936  MAPDLOGGER.debug("Entered");
1937  return false;
1938  }
1939 
1940  @Override
1941  public <T> T unwrap(Class<T> iface) throws SQLException {
1942  MAPDLOGGER.debug("Entered");
1943  return null;
1944  }
1945 
1946  @Override
1947  public boolean isWrapperFor(Class<?> iface) throws SQLException {
1948  MAPDLOGGER.debug("Entered");
1949  return false;
1950  }
1951 }
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)