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