OmniSciDB  16c4e035a1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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_for_database(con.session, catalog);
864  } catch (TException ex) {
865  throw new SQLException("get_tables_for_database 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_for_database(con.session, catalog);
1167  } catch (TException ex) {
1168  throw new SQLException("get_tables_for_database failed " + ex.toString());
1169  }
1170 
1171  for (String tableName : tables) {
1172  // check if the table matches the input pattern
1173  if (tableNamePattern == null || tableNamePattern.equals(tableName)) {
1174  // grab meta data for table
1175  TTableDetails tableDetails;
1176  try {
1177  tableDetails = con.client.get_table_details(con.session, tableName);
1178  } catch (TException ex) {
1179  throw new SQLException("get_table_details failed " + ex.toString());
1180  }
1181 
1182  int ordinal = 0;
1183  // iterate through the columns
1184  for (TColumnType value : tableDetails.row_desc) {
1185  ordinal++;
1186  if (columnNamePattern == null
1187  || value.col_name.matches(modifiedColumnPattern)) {
1188  dataMap.get("TABLE_CAT").setNull(true);
1189  dataMap.get("TABLE_SCHEM").setNull(true);
1190  dataMap.get("TABLE_NAME").add(tableName);
1191  dataMap.get("COLUMN_NAME").add(value.col_name);
1192  dataMap.get("DATA_TYPE").add(OmniSciType.toJava(value.col_type.type));
1193  dataMap.get("TYPE_NAME")
1194  .add((value.col_type.type.name()
1195  + (value.col_type.is_array ? "[]" : "")));
1196  if (value.col_type.type == TDatumType.DECIMAL) {
1197  dataMap.get("COLUMN_SIZE").add(value.col_type.precision);
1198  } else {
1199  dataMap.get("COLUMN_SIZE").add(100);
1200  }
1201  dataMap.get("BUFFER_LENGTH").setNull(true);
1202  if (value.col_type.type == TDatumType.DECIMAL) {
1203  dataMap.get("DECIMAL_DIGITS").add(value.col_type.scale);
1204  } else {
1205  dataMap.get("DECIMAL_DIGITS").setNull(true);
1206  }
1207  dataMap.get("NUM_PREC_RADIX").add(10);
1208  dataMap.get("NULLABLE")
1209  .add(value.col_type.nullable ? DatabaseMetaData.columnNullable
1210  : DatabaseMetaData.columnNoNulls);
1211  dataMap.get("REMARKS").add(" ");
1212  dataMap.get("COLUMN_DEF").setNull(true);
1213  dataMap.get("SQL_DATA_TYPE").add(0);
1214  dataMap.get("SQL_DATETIME_SUB").setNull(true);
1215  dataMap.get("CHAR_OCTET_LENGTH").add(0);
1216  dataMap.get("ORDINAL_POSITION").add(ordinal);
1217  dataMap.get("IS_NULLABLE").add(value.col_type.nullable ? "YES" : "NO");
1218  dataMap.get("SCOPE_CATALOG").setNull(true);
1219  dataMap.get("SCOPE_SCHEMA").setNull(true);
1220  dataMap.get("SCOPE_TABLE").setNull(true);
1221  dataMap.get("SOURCE_DATA_TYPE").add(OmniSciType.toJava(value.col_type.type));
1222  dataMap.get("IS_AUTOINCREMENT").add("NO");
1223  dataMap.get("IS_GENERATEDCOLUMN").add("NO");
1224  }
1225  }
1226  }
1227  }
1228 
1229  List<TColumn> columnsList = new ArrayList(columns.length);
1230 
1231  for (TColumnType col : columns) {
1232  TColumn schemaCol = dataMap.get(col.col_name).getTColumn();
1233  // logger.info("Tcolumn is "+ schemaCol.toString());
1234  columnsList.add(schemaCol);
1235  }
1236 
1237  // create a rowset for the result
1238  TRowSet rowSet = new TRowSet(rowDesc, null, columnsList, true);
1239 
1240  TQueryResult result = new TQueryResult(
1241  rowSet, 0, 0, null, null, true, com.omnisci.thrift.server.TQueryType.UNKNOWN);
1242 
1243  OmniSciResultSet cols = new OmniSciResultSet(result, "getColumns");
1244  return cols;
1245  }
1246 
1247  @Override
1248  public ResultSet getColumnPrivileges(
1249  String catalog, String schema, String table, String columnNamePattern)
1250  throws SQLException {
1251  MAPDLOGGER.debug("Entered");
1252  throw new UnsupportedOperationException("Not supported yet,"
1253  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1254  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1255  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1256  }
1257 
1258  public ResultSet getEmptyResultSet() {
1259  return new OmniSciResultSet();
1260  }
1261 
1262  // this method is needed to build an empty resultset with columns names and datatypes
1263  public ResultSet getEmptyResultSetWithDesc(TColumnType columns[])
1264  throws SQLException { // for compatibility and future
1265  Map<String, OmniSciData> dataMap = new HashMap(columns.length);
1266  List<TColumnType> rowDesc = new ArrayList(columns.length);
1267  for (TColumnType col : columns) {
1268  rowDesc.add(col);
1269  dataMap.put(col.col_name, new OmniSciData(col.col_type.type));
1270  }
1271  List<TColumn> columnsList = new ArrayList(columns.length);
1272  for (TColumnType col : columns) {
1273  TColumn schemaCol = dataMap.get(col.col_name).getTColumn();
1274  columnsList.add(schemaCol);
1275  }
1276  TRowSet rowSet = new TRowSet(rowDesc, null, columnsList, true);
1277  TQueryResult result = new TQueryResult(
1278  rowSet, 0, 0, null, null, true, com.omnisci.thrift.server.TQueryType.UNKNOWN);
1279  OmniSciResultSet cols = new OmniSciResultSet(result, "getColumns");
1280  return cols;
1281  }
1282 
1283  private void tablePermProcess(
1284  List<String> tables, Map<String, OmniSciData> dataMap, String tableNamePattern)
1285  throws TException {
1286  for (String table : tables) {
1287  if (tableNamePattern != null && !table.matches(tableNamePattern)) {
1288  continue;
1289  }
1290  List<TDBObject> db_objects = con.client.get_db_object_privs(
1291  con.session, table, TDBObjectType.TableDBObjectType);
1292 
1293  // check if the table matches the input pattern
1294  for (TDBObject db_object : db_objects) {
1295  // If the user is a super user then the objectName will be super
1296  // and needs to be changed to the table name.
1297  if (db_object.objectName.equalsIgnoreCase("super")) {
1298  db_object.objectName = table;
1299  }
1300  // A bunch of db objects come back. Any with a different name throw away
1301  if (!db_object.objectName.equalsIgnoreCase(table)) {
1302  continue;
1303  }
1304 
1305  // Create set of table permissions based ont he db_object. This seems to
1306  // be the only way - though being hardwired on the number of privs is not great.
1307  TTablePermissions tt = new TTablePermissions(db_object.privs.get(0),
1308  db_object.privs.get(1),
1309  db_object.privs.get(2),
1310  db_object.privs.get(3),
1311  db_object.privs.get(4),
1312  db_object.privs.get(5),
1313  db_object.privs.get(6),
1314  db_object.privs.get(7));
1315 
1316  int ordinal = 1;
1317  for (TTablePermissions._Fields field = tt.fieldForId(ordinal); field != null;
1318  field = tt.fieldForId(++ordinal)) {
1319  Boolean x = (Boolean) tt.getFieldValue(field);
1320  if (x == false) {
1321  continue;
1322  }
1323  // standardise the fieldName upper case and remove trailing '_'. create_ =>
1324  // CREATE
1325  dataMap.get("PRIVILEGE")
1326  .add(field.getFieldName().toUpperCase().replace("_", ""));
1327  dataMap.get("TABLE_CAT").setNull(true);
1328  dataMap.get("TABLE_SCHEM").setNull(true);
1329  dataMap.get("TABLE_NAME").add(db_object.objectName);
1330  dataMap.get("GRANTOR").setNull(true);
1331  dataMap.get("GRANTEE").add(db_object.grantee);
1332  dataMap.get("IS_GRANTABLE").add("NO");
1333  }
1334  }
1335  }
1336  }
1337 
1338  @Override
1339  public ResultSet getTablePrivileges(
1340  String catalog, String schemaPattern, String tableNamePattern)
1341  throws SQLException {
1342  MAPDLOGGER.debug("Entered");
1343 
1344  String modifiedTablePattern =
1345  (tableNamePattern == null) ? null : tableNamePattern.replaceAll("%", ".*");
1346 
1347  MAPDLOGGER.debug("TablePattern " + tableNamePattern + " modifiedTableNamePattern "
1348  + modifiedTablePattern);
1349 
1350  // declare the columns in the result set
1351  final TTypeInfo strTTI =
1352  new TTypeInfo(TDatumType.STR, TEncodingType.NONE, false, false, 0, 0, 0);
1353  final TDatumType datumType = strTTI.type;
1354 
1355  Map<String, OmniSciData> dataMap = new HashMap() {
1356  {
1357  put("TABLE_CAT", new OmniSciData(datumType));
1358  put("TABLE_SCHEM", new OmniSciData(datumType));
1359  put("TABLE_NAME", new OmniSciData(datumType));
1360  put("GRANTOR", new OmniSciData(datumType));
1361  put("GRANTEE", new OmniSciData(datumType));
1362  put("PRIVILEGE", new OmniSciData(datumType));
1363  put("IS_GRANTABLE", new OmniSciData(datumType));
1364  }
1365  };
1366 
1367  try {
1368  // Get all the tables and then pattern match them in tablePermProcess
1369  List<String> tables = con.client.get_tables(con.session);
1370  tablePermProcess(tables, dataMap, modifiedTablePattern);
1371  } catch (TException ex) {
1372  throw new SQLException("get_privileges failed " + ex.toString());
1373  }
1374 
1375  // create component to contain the meta data for the rows
1376  // and create a container to store the data and the nul indicators
1377  // List<TColumnType> rowDesc = new ArrayList(columns.length);
1378 
1379  List<TColumnType> rowDesc = new ArrayList(dataMap.size());
1380  List<TColumn> columnsList = new ArrayList(dataMap.size());
1381 
1382  for (Map.Entry<String, OmniSciData> pair : dataMap.entrySet()) {
1383  columnsList.add(pair.getValue().getTColumn());
1384  rowDesc.add(createTColumnType(pair.getKey(), new TTypeInfo(strTTI)));
1385  }
1386 
1387  // create a rowset for the result
1388  TRowSet rowSet = new TRowSet(rowDesc, null, columnsList, true);
1389 
1390  TQueryResult result = new TQueryResult(
1391  rowSet, 0, 0, null, null, true, com.omnisci.thrift.server.TQueryType.UNKNOWN);
1392 
1393  OmniSciResultSet cols = new OmniSciResultSet(result, "getPrivileges");
1394  return cols;
1395  }
1396 
1397  @Override
1398  public ResultSet getBestRowIdentifier(
1399  String catalog, String schema, String table, int scope, boolean nullable)
1400  throws SQLException {
1401  MAPDLOGGER.debug("Entered");
1402  throw new UnsupportedOperationException("Not supported yet,"
1403  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1404  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1405  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1406  }
1407 
1408  @Override
1409  public ResultSet getVersionColumns(String catalog, String schema, String table)
1410  throws SQLException {
1411  MAPDLOGGER.debug("Entered");
1412  throw new UnsupportedOperationException("Not supported yet,"
1413  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1414  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1415  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1416  }
1417 
1418  @Override
1419  public ResultSet getPrimaryKeys(String catalog, String schema, String table)
1420  throws SQLException {
1421  MAPDLOGGER.debug("Entered");
1422 
1423  TTypeInfo strTTI =
1424  new TTypeInfo(TDatumType.STR, TEncodingType.NONE, false, false, 0, 0, 0);
1425  TTypeInfo intTTI =
1426  new TTypeInfo(TDatumType.INT, TEncodingType.NONE, false, false, 0, 0, 0);
1427  TTypeInfo smallIntTTI =
1428  new TTypeInfo(TDatumType.SMALLINT, TEncodingType.NONE, false, false, 0, 0, 0);
1429  TColumnType columns[] = {createTColumnType("TABLE_CAT", new TTypeInfo(strTTI)),
1430  createTColumnType("TABLE_SCHEM", new TTypeInfo(strTTI)),
1431  createTColumnType("TABLE_NAME", new TTypeInfo(strTTI)),
1432  createTColumnType("COLUMN_NAME", new TTypeInfo(strTTI)),
1433  createTColumnType("KEY_SEQ", new TTypeInfo(smallIntTTI)),
1434  createTColumnType("PK_NAME", new TTypeInfo(strTTI))};
1435 
1436  return getEmptyResultSetWithDesc(columns);
1437  }
1438 
1439  @Override
1440  public ResultSet getImportedKeys(String catalog, String schema, String table)
1441  throws SQLException {
1442  MAPDLOGGER.debug("Entered");
1443 
1444  TTypeInfo strTTI =
1445  new TTypeInfo(TDatumType.STR, TEncodingType.NONE, false, false, 0, 0, 0);
1446  TTypeInfo intTTI =
1447  new TTypeInfo(TDatumType.INT, TEncodingType.NONE, false, false, 0, 0, 0);
1448  TTypeInfo smallIntTTI =
1449  new TTypeInfo(TDatumType.SMALLINT, TEncodingType.NONE, false, false, 0, 0, 0);
1450  TColumnType columns[] = {createTColumnType("PKTABLE_CAT", new TTypeInfo(strTTI)),
1451  createTColumnType("PKTABLE_SCHEM", new TTypeInfo(strTTI)),
1452  createTColumnType("PKTABLE_NAME", new TTypeInfo(strTTI)),
1453  createTColumnType("PKCOLUMN_NAME", new TTypeInfo(strTTI)),
1454  createTColumnType("FKTABLE_CAT", new TTypeInfo(strTTI)),
1455  createTColumnType("FKTABLE_SCHEM", new TTypeInfo(strTTI)),
1456  createTColumnType("FKTABLE_NAME", new TTypeInfo(strTTI)),
1457  createTColumnType("FKCOLUMN_NAME", new TTypeInfo(strTTI)),
1458  createTColumnType("KEY_SEQ", new TTypeInfo(smallIntTTI)),
1459  createTColumnType("UPDATE_RULE", new TTypeInfo(smallIntTTI)),
1460  createTColumnType("DELETE_RULE", new TTypeInfo(smallIntTTI)),
1461  createTColumnType("FK_NAME", new TTypeInfo(strTTI)),
1462  createTColumnType("PK_NAME", new TTypeInfo(strTTI)),
1463  createTColumnType("DEFERRABILITY", new TTypeInfo(smallIntTTI))};
1464 
1465  return getEmptyResultSetWithDesc(columns);
1466  }
1467 
1468  @Override
1469  public ResultSet getExportedKeys(String catalog, String schema, String table)
1470  throws SQLException {
1471  MAPDLOGGER.debug("Entered");
1472 
1473  TTypeInfo strTTI =
1474  new TTypeInfo(TDatumType.STR, TEncodingType.NONE, false, false, 0, 0, 0);
1475  TTypeInfo intTTI =
1476  new TTypeInfo(TDatumType.INT, TEncodingType.NONE, false, false, 0, 0, 0);
1477  TTypeInfo smallIntTTI =
1478  new TTypeInfo(TDatumType.SMALLINT, TEncodingType.NONE, false, false, 0, 0, 0);
1479  TColumnType columns[] = {createTColumnType("FKTABLE_CAT", new TTypeInfo(strTTI)),
1480  createTColumnType("FKTABLE_SCHEM", new TTypeInfo(strTTI)),
1481  createTColumnType("FKTABLE_NAME", new TTypeInfo(strTTI)),
1482  createTColumnType("FKCOLUMN_NAME", new TTypeInfo(strTTI)),
1483  createTColumnType("PKTABLE_CAT", new TTypeInfo(strTTI)),
1484  createTColumnType("PKTABLE_SCHEM", new TTypeInfo(strTTI)),
1485  createTColumnType("PKTABLE_NAME", new TTypeInfo(strTTI)),
1486  createTColumnType("PKCOLUMN_NAME", new TTypeInfo(strTTI)),
1487  createTColumnType("KEY_SEQ", new TTypeInfo(smallIntTTI)),
1488  createTColumnType("UPDATE_RULE", new TTypeInfo(smallIntTTI)),
1489  createTColumnType("DELETE_RULE", new TTypeInfo(smallIntTTI)),
1490  createTColumnType("PK_NAME", new TTypeInfo(strTTI)),
1491  createTColumnType("FK_NAME", new TTypeInfo(strTTI)),
1492  createTColumnType("DEFERRABILITY", new TTypeInfo(smallIntTTI))};
1493 
1494  return getEmptyResultSetWithDesc(columns);
1495  }
1496 
1497  @Override
1498  public ResultSet getCrossReference(String parentCatalog,
1499  String parentSchema,
1500  String parentTable,
1501  String foreignCatalog,
1502  String foreignSchema,
1503  String foreignTable) throws SQLException {
1504  MAPDLOGGER.debug("Entered");
1505  throw new UnsupportedOperationException("Not supported yet,"
1506  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1507  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1508  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1509  }
1510 
1511  /*
1512  Retrieves a description of all the data types supported by this database. They are
1513 ordered by DATA_TYPE and then by how closely the data type maps to the corresponding JDBC
1514 SQL type. If the database supports SQL distinct types, then getTypeInfo() will return a
1515 single row with a TYPE_NAME of DISTINCT and a DATA_TYPE of Types.DISTINCT. If the database
1516 supports SQL structured types, then getTypeInfo() will return a single row with a
1517 TYPE_NAME of STRUCT and a DATA_TYPE of Types.STRUCT.
1518 
1519 If SQL distinct or structured types are supported, then information on the individual
1520 types may be obtained from the getUDTs() method.
1521 
1522 Each type description has the following columns:
1523 
1524 TYPE_NAME String => Type name
1525 DATA_TYPE int => SQL data type from java.sql.Types
1526 PRECISION int => maximum precision
1527 LITERAL_PREFIX String => prefix used to quote a literal (may be null)
1528 LITERAL_SUFFIX String => suffix used to quote a literal (may be null)
1529 CREATE_PARAMS String => parameters used in creating the type (may be null)
1530 NULLABLE short => can you use NULL for this type.
1531 typeNoNulls - does not allow NULL values
1532 typeNullable - allows NULL values
1533 typeNullableUnknown - nullability unknown
1534 CASE_SENSITIVE boolean=> is it case sensitive.
1535 SEARCHABLE short => can you use "WHERE" based on this type:
1536 typePredNone - No support
1537 typePredChar - Only supported with WHERE .. LIKE
1538 typePredBasic - Supported except for WHERE .. LIKE
1539 typeSearchable - Supported for all WHERE ..
1540 UNSIGNED_ATTRIBUTE boolean => is it unsigned.
1541 FIXED_PREC_SCALE boolean => can it be a money value.
1542 AUTO_INCREMENT boolean => can it be used for an auto-increment value.
1543 LOCAL_TYPE_NAME String => localized version of type name (may be null)
1544 MINIMUM_SCALE short => minimum scale supported
1545 MAXIMUM_SCALE short => maximum scale supported
1546 SQL_DATA_TYPE int => unused
1547 SQL_DATETIME_SUB int => unused
1548 NUM_PREC_RADIX int => usually 2 or 10
1549 The PRECISION column represents the maximum column size that the server supports for the
1550 given datatype. For numeric data, this is the maximum precision. For character data, this
1551 is the length in characters. For datetime datatypes, this is the length in characters of
1552 the String representation (assuming the maximum allowed precision of the fractional
1553 seconds component). For binary data, this is the length in bytes. For the ROWID datatype,
1554 this is the length in bytes. Null is returned for data types where the column size is not
1555 applicable.
1556 
1557 Returns:
1558 a ResultSet object in which each row is an SQL type description
1559 Throws:
1560 SQLException - if a database access error occurs
1561  */
1562  @Override
1563  public ResultSet getTypeInfo() throws SQLException {
1564  MAPDLOGGER.debug("Entered");
1565 
1566  // declare the columns in the result set
1567  TTypeInfo strTTI =
1568  new TTypeInfo(TDatumType.STR, TEncodingType.NONE, false, false, 0, 0, 0);
1569  TTypeInfo intTTI =
1570  new TTypeInfo(TDatumType.INT, TEncodingType.NONE, false, false, 0, 0, 0);
1571  TTypeInfo smallIntTTI =
1572  new TTypeInfo(TDatumType.SMALLINT, TEncodingType.NONE, false, false, 0, 0, 0);
1573  TTypeInfo boolTTI =
1574  new TTypeInfo(TDatumType.BOOL, TEncodingType.NONE, false, false, 0, 0, 0);
1575  TColumnType columns[] = {createTColumnType("TYPE_NAME", new TTypeInfo(strTTI)),
1576  createTColumnType("DATA_TYPE", new TTypeInfo(intTTI)),
1577  createTColumnType("PRECISION", new TTypeInfo(intTTI)),
1578  createTColumnType("LITERAL_PREFIX", new TTypeInfo(strTTI)),
1579  createTColumnType("LITERAL_SUFFIX", new TTypeInfo(strTTI)),
1580  createTColumnType("CREATE_PARAMS", new TTypeInfo(strTTI)),
1581  createTColumnType("NULLABLE", new TTypeInfo(smallIntTTI)),
1582  createTColumnType("CASE_SENSITIVE", new TTypeInfo(boolTTI)),
1583  createTColumnType("SEARCHABLE", new TTypeInfo(smallIntTTI)),
1584  createTColumnType("UNSIGNED_ATTRIBUTE", new TTypeInfo(boolTTI)),
1585  createTColumnType("FIXED_PREC_SCALE", new TTypeInfo(boolTTI)),
1586  createTColumnType("AUTO_INCREMENT", new TTypeInfo(boolTTI)),
1587  createTColumnType("LOCAL_TYPE_NAME", new TTypeInfo(strTTI)),
1588  createTColumnType("MINIMUM_SCALE", new TTypeInfo(smallIntTTI)),
1589  createTColumnType("MAXIMUM_SCALE", new TTypeInfo(smallIntTTI)),
1590  createTColumnType("SQL_DATA_TYPE", new TTypeInfo(intTTI)),
1591  createTColumnType("SQL_DATETIME_SUB", new TTypeInfo(intTTI)),
1592  createTColumnType("NUM_PREC_RADIX", new TTypeInfo(intTTI))};
1593 
1594  Map<String, OmniSciData> dataMap = new HashMap(columns.length);
1595 
1596  // create component to contain the meta data for the rows
1597  // and create a container to store the data and the nul indicators
1598  List<TColumnType> rowDesc = new ArrayList(columns.length);
1599  for (TColumnType col : columns) {
1600  rowDesc.add(col);
1601  dataMap.put(col.col_name, new OmniSciData(col.col_type.type));
1602  }
1603  // TODO this is currently a work in progress need to add actual details here
1604  // Now add some actual details for table name
1605  dataMap.get("TYPE_NAME").setNull(true); // String => Type name
1606  dataMap.get("DATA_TYPE").setNull(true); // int => SQL data type from java.sql.Types
1607  dataMap.get("PRECISION").setNull(true); // int => maximum precision
1608  dataMap.get("LITERAL_PREFIX").setNull(true); //.setNull(true);// String => prefix used
1609  // to quote a literal (may be null)
1610  dataMap.get("LITERAL_SUFFIX").setNull(true); //.setNull(true);// String => suffix used
1611  // to quote a literal (may be null)
1612  dataMap.get("CREATE_PARAMS")
1613  .setNull(
1614  true); // String => parameters used in creating the type (may be null)
1615  dataMap.get("NULLABLE").setNull(true); // short => can you use NULL for this type.
1616  // typeNoNulls - does not allow NULL values
1617  // typeNullable - allows NULL values
1618  // typeNullableUnknown - nullability unknown
1619  dataMap.get("CASE_SENSITIVE").setNull(true); // boolean=> is it case sensitive.
1620  dataMap.get("SEARCHABLE")
1621  .setNull(true); // short => can you use "WHERE" based on this type:
1622  // typePredNone - No support
1623  // typePredChar - Only supported with WHERE .. LIKE
1624  // typePredBasic - Supported except for WHERE .. LIKE
1625  // typeSearchable - Supported for all WHERE ..
1626  dataMap.get("UNSIGNED_ATTRIBUTE").setNull(true); // boolean => is it unsigned.
1627  dataMap.get("FIXED_PREC_SCALE").setNull(true); // boolean => can it be a money value.
1628  dataMap.get("AUTO_INCREMENT")
1629  .setNull(false); // boolean => can it be used for an auto-increment value.
1630  dataMap.get("LOCAL_TYPE_NAME")
1631  .setNull(true); // String => localized version of type name (may be null)
1632  dataMap.get("MINIMUM_SCALE").setNull(true); // short => minimum scale supported
1633  dataMap.get("MAXIMUM_SCALE").setNull(true); // short => maximum scale supported
1634  dataMap.get("SQL_DATA_TYPE").setNull(true); // int => unused
1635  dataMap.get("SQL_DATETIME_SUB").setNull(true); // int => unused
1636  dataMap.get("NUM_PREC_RADIX").setNull(true); //
1637 
1638  List<TColumn> columnsList = new ArrayList(columns.length);
1639 
1640  for (TColumnType col : columns) {
1641  TColumn schemaCol = dataMap.get(col.col_name).getTColumn();
1642  // logger.info("Tcolumn is "+ schemaCol.toString());
1643  columnsList.add(schemaCol);
1644  }
1645 
1646  // create a rowset for the result
1647  TRowSet rowSet = new TRowSet(rowDesc, null, columnsList, true);
1648 
1649  TQueryResult result = new TQueryResult(
1650  rowSet, 0, 0, null, null, true, com.omnisci.thrift.server.TQueryType.UNKNOWN);
1651 
1652  OmniSciResultSet cols = new OmniSciResultSet(result, "getTypeInfo");
1653  return cols;
1654  }
1655 
1656  @Override
1657  public ResultSet getIndexInfo(String catalog,
1658  String schema,
1659  String table,
1660  boolean unique,
1661  boolean approximate) throws SQLException {
1662  MAPDLOGGER.debug("Entered");
1663  return getEmptyResultSet();
1664  }
1665 
1666  @Override
1667  public boolean supportsResultSetType(int type) throws SQLException {
1668  MAPDLOGGER.debug("Entered");
1669  return false;
1670  }
1671 
1672  @Override
1673  public boolean supportsResultSetConcurrency(int type, int concurrency)
1674  throws SQLException {
1675  MAPDLOGGER.debug("Entered");
1676  return false;
1677  }
1678 
1679  @Override
1680  public boolean ownUpdatesAreVisible(int type) throws SQLException {
1681  MAPDLOGGER.debug("Entered");
1682  return false;
1683  }
1684 
1685  @Override
1686  public boolean ownDeletesAreVisible(int type) throws SQLException {
1687  MAPDLOGGER.debug("Entered");
1688  return false;
1689  }
1690 
1691  @Override
1692  public boolean ownInsertsAreVisible(int type) throws SQLException {
1693  MAPDLOGGER.debug("Entered");
1694  return false;
1695  }
1696 
1697  @Override
1698  public boolean othersUpdatesAreVisible(int type) throws SQLException {
1699  MAPDLOGGER.debug("Entered");
1700  return false;
1701  }
1702 
1703  @Override
1704  public boolean othersDeletesAreVisible(int type) throws SQLException {
1705  MAPDLOGGER.debug("Entered");
1706  return false;
1707  }
1708 
1709  @Override
1710  public boolean othersInsertsAreVisible(int type) throws SQLException {
1711  MAPDLOGGER.debug("Entered");
1712  return false;
1713  }
1714 
1715  @Override
1716  public boolean updatesAreDetected(int type) throws SQLException {
1717  MAPDLOGGER.debug("Entered");
1718  return false;
1719  }
1720 
1721  @Override
1722  public boolean deletesAreDetected(int type) throws SQLException {
1723  MAPDLOGGER.debug("Entered");
1724  return false;
1725  }
1726 
1727  @Override
1728  public boolean insertsAreDetected(int type) throws SQLException {
1729  MAPDLOGGER.debug("Entered");
1730  return false;
1731  }
1732 
1733  @Override
1734  public boolean supportsBatchUpdates() throws SQLException {
1735  MAPDLOGGER.debug("Entered");
1736  return true;
1737  }
1738 
1739  @Override
1740  public ResultSet getUDTs(
1741  String catalog, String schemaPattern, String typeNamePattern, int[] types)
1742  throws SQLException {
1743  MAPDLOGGER.debug("Entered");
1744  throw new UnsupportedOperationException("Not supported yet,"
1745  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1746  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1747  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1748  }
1749 
1750  @Override
1751  public Connection getConnection() throws SQLException {
1752  MAPDLOGGER.debug("Entered");
1753  return con;
1754  }
1755 
1756  @Override
1757  public boolean supportsSavepoints() throws SQLException {
1758  MAPDLOGGER.debug("Entered");
1759  return false;
1760  }
1761 
1762  @Override
1763  public boolean supportsNamedParameters() throws SQLException {
1764  MAPDLOGGER.debug("Entered");
1765  return false;
1766  }
1767 
1768  @Override
1769  public boolean supportsMultipleOpenResults() throws SQLException {
1770  MAPDLOGGER.debug("Entered");
1771  return false;
1772  }
1773 
1774  @Override
1775  public boolean supportsGetGeneratedKeys() throws SQLException {
1776  MAPDLOGGER.debug("Entered");
1777  return false;
1778  }
1779 
1780  @Override
1781  public ResultSet getSuperTypes(
1782  String catalog, String schemaPattern, String typeNamePattern)
1783  throws SQLException {
1784  MAPDLOGGER.debug("Entered");
1785  throw new UnsupportedOperationException("Not supported yet,"
1786  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1787  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1788  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1789  }
1790 
1791  @Override
1792  public ResultSet getSuperTables(
1793  String catalog, String schemaPattern, String tableNamePattern)
1794  throws SQLException {
1795  MAPDLOGGER.debug("Entered");
1796  throw new UnsupportedOperationException("Not supported yet,"
1797  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1798  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1799  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1800  }
1801 
1802  @Override
1803  public ResultSet getAttributes(String catalog,
1804  String schemaPattern,
1805  String typeNamePattern,
1806  String attributeNamePattern) throws SQLException {
1807  MAPDLOGGER.debug("Entered");
1808  throw new UnsupportedOperationException("Not supported yet,"
1809  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1810  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1811  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1812  }
1813 
1814  @Override
1815  public boolean supportsResultSetHoldability(int holdability) throws SQLException {
1816  MAPDLOGGER.debug("Entered");
1817  return false;
1818  }
1819 
1820  @Override
1821  public int getResultSetHoldability() throws SQLException {
1822  MAPDLOGGER.debug("Entered");
1823  return ResultSet.CLOSE_CURSORS_AT_COMMIT;
1824  }
1825 
1826  @Override
1827  public int getDatabaseMajorVersion() throws SQLException {
1828  MAPDLOGGER.debug("Entered");
1829  return this.databaseMajorVersion;
1830  }
1831 
1832  @Override
1833  public int getDatabaseMinorVersion() throws SQLException {
1834  MAPDLOGGER.debug("Entered");
1835  return this.databaseMinorVersion;
1836  }
1837 
1838  @Override
1839  public int getJDBCMajorVersion() throws SQLException {
1840  MAPDLOGGER.debug("Entered");
1841  return 0;
1842  }
1843 
1844  @Override
1845  public int getJDBCMinorVersion() throws SQLException { // logger.debug("Entered");
1846  MAPDLOGGER.debug("Entered");
1847  return 0;
1848  }
1849 
1850  @Override
1851  public int getSQLStateType() throws SQLException {
1852  MAPDLOGGER.debug("Entered");
1853  return 0;
1854  }
1855 
1856  @Override
1857  public boolean locatorsUpdateCopy() throws SQLException {
1858  MAPDLOGGER.debug("Entered");
1859  return false;
1860  }
1861 
1862  @Override
1863  public boolean supportsStatementPooling() throws SQLException {
1864  MAPDLOGGER.debug("Entered");
1865  return false;
1866  }
1867 
1868  @Override
1869  public RowIdLifetime getRowIdLifetime() throws SQLException {
1870  MAPDLOGGER.debug("Entered");
1871  return RowIdLifetime.ROWID_VALID_OTHER;
1872  }
1873 
1874  @Override
1875  public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException {
1876  MAPDLOGGER.debug("Entered");
1877  return getSchemas();
1878  }
1879 
1880  @Override
1881  public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException {
1882  MAPDLOGGER.debug("Entered");
1883  return false;
1884  }
1885 
1886  @Override
1887  public boolean autoCommitFailureClosesAllResultSets() throws SQLException {
1888  MAPDLOGGER.debug("Entered");
1889  return false;
1890  }
1891 
1892  @Override
1893  public ResultSet getClientInfoProperties() throws SQLException {
1894  MAPDLOGGER.debug("Entered");
1895  throw new UnsupportedOperationException("Not supported yet,"
1896  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1897  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1898  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1899  }
1900 
1901  @Override
1902  public ResultSet getFunctions(
1903  String catalog, String schemaPattern, String functionNamePattern)
1904  throws SQLException {
1905  MAPDLOGGER.debug("Entered");
1906  throw new UnsupportedOperationException("Not supported yet,"
1907  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1908  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1909  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1910  }
1911 
1912  @Override
1913  public ResultSet getFunctionColumns(String catalog,
1914  String schemaPattern,
1915  String functionNamePattern,
1916  String columnNamePattern) throws SQLException {
1917  MAPDLOGGER.debug("Entered");
1918  throw new UnsupportedOperationException("Not supported yet,"
1919  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1920  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1921  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1922  }
1923 
1924  @Override
1925  public ResultSet getPseudoColumns(String catalog,
1926  String schemaPattern,
1927  String tableNamePattern,
1928  String columnNamePattern) throws SQLException {
1929  MAPDLOGGER.debug("Entered");
1930  throw new UnsupportedOperationException("Not supported yet,"
1931  + " line:" + new Throwable().getStackTrace()[0].getLineNumber()
1932  + " class:" + new Throwable().getStackTrace()[0].getClassName()
1933  + " method:" + new Throwable().getStackTrace()[0].getMethodName());
1934  }
1935 
1936  @Override
1937  public boolean generatedKeyAlwaysReturned() throws SQLException {
1938  MAPDLOGGER.debug("Entered");
1939  return false;
1940  }
1941 
1942  @Override
1943  public <T> T unwrap(Class<T> iface) throws SQLException {
1944  MAPDLOGGER.debug("Entered");
1945  return null;
1946  }
1947 
1948  @Override
1949  public boolean isWrapperFor(Class<?> iface) throws SQLException {
1950  MAPDLOGGER.debug("Entered");
1951  return false;
1952  }
1953 }
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)