Skip to content

Commit

Permalink
Revert "Correction of issues #311, #310, #164, #163"
Browse files Browse the repository at this point in the history
This reverts commit 7783490.
  • Loading branch information
cdessanti committed Feb 25, 2019
1 parent 7783490 commit e819507
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 114 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ public OmniSciConnection(String url, Properties info)
(String) this.cP.get(Connection_enums.user_passwd),
(String) this.cP.get(Connection_enums.db_name));

catalog = (String) this.cP.get(Connection_enums.db_name);
logger.debug("Connected session is " + session);

} catch (TTransportException ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ void add(int value) {
}

void setNull(boolean b) {
if (colType == TDatumType.STR) tcolumn.data.addToStr_col(null); else tcolumn.data.addToInt_col(0);
tcolumn.addToNulls(b);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -865,14 +865,6 @@ public ResultSet getTables(
throw new SQLException("get_tables failed " + ex.toString());
}

List<String> views;
try {
views = con.client.get_views(con.session);
} catch (TException ex) {
throw new SQLException("get_views failed " + ex.toString());
}


TTypeInfo strTTI =
new TTypeInfo(TDatumType.STR, TEncodingType.NONE, false, false, 0, 0, 0);
TColumnType columns[] = {createTColumnType("TABLE_CAT", new TTypeInfo(strTTI)),
Expand All @@ -897,31 +889,23 @@ public ResultSet getTables(
dataMap.put(col.col_name, new ArrayList());
nullMap.put(col.col_name, new ArrayList());
}
if (schemaPattern == null || schemaPattern.toLowerCase().equals(con.getCatalog().toLowerCase()))
{
// Now add some actual details for table name
for (String x : tables) {
dataMap.get("TABLE_NAME").add(x);
nullMap.get("TABLE_NAME").add(false);
nullMap.get("TABLE_SCHEM").add(true);
nullMap.get("TABLE_CAT").add(true);
if ( views.contains(x) == true )
{
dataMap.get("TABLE_TYPE").add("VIEW");
}
else
{
dataMap.get("TABLE_TYPE").add("TABLE");
}
nullMap.get("TABLE_TYPE").add(false);
nullMap.get("REMARKS").add(true);
nullMap.get("TYPE_CAT").add(true);
nullMap.get("TYPE_SCHEM").add(true);
nullMap.get("TYPE_NAME").add(true);
nullMap.get("SELF_REFERENCING_COL_NAME").add(true);
nullMap.get("REF_GENERATION").add(true);
}

// Now add some actual details for table name
for (String x : tables) {
dataMap.get("TABLE_NAME").add(x);
nullMap.get("TABLE_NAME").add(false);
nullMap.get("TABLE_SCHEM").add(true);
nullMap.get("TABLE_CAT").add(true);
dataMap.get("TABLE_TYPE").add("TABLE");
nullMap.get("TABLE_TYPE").add(false);
nullMap.get("REMARKS").add(true);
nullMap.get("TYPE_CAT").add(true);
nullMap.get("TYPE_SCHEM").add(true);
nullMap.get("TYPE_NAME").add(true);
nullMap.get("SELF_REFERENCING_COL_NAME").add(true);
nullMap.get("REF_GENERATION").add(true);
}

List<TColumn> columnsList = new ArrayList(columns.length);

for (TColumnType col : columns) {
Expand Down Expand Up @@ -1028,7 +1012,6 @@ public ResultSet getTableTypes() throws SQLException {

// Now add some actual details for table name
dataMap.get("TABLE_TYPE").add("TABLE");
dataMap.get("TABLE_TYPE").add("VIEW");

List<TColumn> columnsList = new ArrayList(columns.length);

Expand Down Expand Up @@ -1256,26 +1239,6 @@ public ResultSet getEmptyResultSet() {
return new OmniSciResultSet();
}

// this method is needed to build an empty resultset with columns names and datatypes
public ResultSet getEmptyResultSetWithDesc(TColumnType columns[] ) throws SQLException { // for compatibility and future
Map<String, OmniSciData> dataMap = new HashMap(columns.length);
List<TColumnType> rowDesc = new ArrayList(columns.length);
for (TColumnType col : columns) {
rowDesc.add(col);
dataMap.put(col.col_name, new OmniSciData(col.col_type.type));
}
List<TColumn> columnsList = new ArrayList(columns.length);
for (TColumnType col : columns) {
TColumn schemaCol = dataMap.get(col.col_name).getTColumn();
columnsList.add(schemaCol);
}
TRowSet rowSet = new TRowSet(rowDesc, null, columnsList, true);
TQueryResult result = new TQueryResult(rowSet, 0, 0, null);
OmniSciResultSet cols = new OmniSciResultSet(result, "getColumns");
return cols;
}


private void tablePermProcess(
List<String> tables, Map<String, OmniSciData> dataMap, String tableNamePattern)
throws TException {
Expand Down Expand Up @@ -1414,76 +1377,27 @@ public ResultSet getVersionColumns(String catalog, String schema, String table)
public ResultSet getPrimaryKeys(String catalog, String schema, String table)
throws SQLException {
MAPDLOGGER.debug("Entered");

TTypeInfo strTTI = new TTypeInfo(TDatumType.STR, TEncodingType.NONE, false, false, 0, 0, 0);
TTypeInfo intTTI = new TTypeInfo(TDatumType.INT, TEncodingType.NONE, false, false, 0, 0, 0);
TTypeInfo smallIntTTI = new TTypeInfo(TDatumType.SMALLINT, TEncodingType.NONE, false, false, 0, 0, 0);
TColumnType columns[] = {
createTColumnType("TABLE_CAT", new TTypeInfo(strTTI)),
createTColumnType("TABLE_SCHEM", new TTypeInfo(strTTI)),
createTColumnType("TABLE_NAME", new TTypeInfo(strTTI)),
createTColumnType("COLUMN_NAME", new TTypeInfo(strTTI)),
createTColumnType("KEY_SEQ", new TTypeInfo(smallIntTTI)),
createTColumnType("PK_NAME", new TTypeInfo(strTTI))
};

return getEmptyResultSetWithDesc(columns);
return getEmptyResultSet();
}

@Override
public ResultSet getImportedKeys(String catalog, String schema, String table)
throws SQLException {
MAPDLOGGER.debug("Entered");

TTypeInfo strTTI = new TTypeInfo(TDatumType.STR, TEncodingType.NONE, false, false, 0, 0, 0);
TTypeInfo intTTI = new TTypeInfo(TDatumType.INT, TEncodingType.NONE, false, false, 0, 0, 0);
TTypeInfo smallIntTTI = new TTypeInfo(TDatumType.SMALLINT, TEncodingType.NONE, false, false, 0, 0, 0);
TColumnType columns[] = {
createTColumnType("PKTABLE_CAT", new TTypeInfo(strTTI)),
createTColumnType("PKTABLE_SCHEM", new TTypeInfo(strTTI)),
createTColumnType("PKTABLE_NAME", new TTypeInfo(strTTI)),
createTColumnType("PKCOLUMN_NAME", new TTypeInfo(strTTI)),
createTColumnType("FKTABLE_CAT", new TTypeInfo(strTTI)),
createTColumnType("FKTABLE_SCHEM", new TTypeInfo(strTTI)),
createTColumnType("FKTABLE_NAME", new TTypeInfo(strTTI)),
createTColumnType("FKCOLUMN_NAME", new TTypeInfo(strTTI)),
createTColumnType("KEY_SEQ", new TTypeInfo(smallIntTTI)),
createTColumnType("UPDATE_RULE", new TTypeInfo(smallIntTTI)),
createTColumnType("DELETE_RULE", new TTypeInfo(smallIntTTI)),
createTColumnType("FK_NAME", new TTypeInfo(strTTI)),
createTColumnType("PK_NAME", new TTypeInfo(strTTI)),
createTColumnType("DEFERRABILITY", new TTypeInfo(smallIntTTI))
};

return getEmptyResultSetWithDesc(columns);
MAPDLOGGER.debug("Entered");
throw new UnsupportedOperationException("Not supported yet,"
+ " line:" + new Throwable().getStackTrace()[0].getLineNumber()
+ " class:" + new Throwable().getStackTrace()[0].getClassName()
+ " method:" + new Throwable().getStackTrace()[0].getMethodName());
}

@Override
public ResultSet getExportedKeys(String catalog, String schema, String table)
throws SQLException {
MAPDLOGGER.debug("Entered");

TTypeInfo strTTI = new TTypeInfo(TDatumType.STR, TEncodingType.NONE, false, false, 0, 0, 0);
TTypeInfo intTTI = new TTypeInfo(TDatumType.INT, TEncodingType.NONE, false, false, 0, 0, 0);
TTypeInfo smallIntTTI = new TTypeInfo(TDatumType.SMALLINT, TEncodingType.NONE, false, false, 0, 0, 0);
TColumnType columns[] = {
createTColumnType("FKTABLE_CAT", new TTypeInfo(strTTI)),
createTColumnType("FKTABLE_SCHEM", new TTypeInfo(strTTI)),
createTColumnType("FKTABLE_NAME", new TTypeInfo(strTTI)),
createTColumnType("FKCOLUMN_NAME", new TTypeInfo(strTTI)),
createTColumnType("PKTABLE_CAT", new TTypeInfo(strTTI)),
createTColumnType("PKTABLE_SCHEM", new TTypeInfo(strTTI)),
createTColumnType("PKTABLE_NAME", new TTypeInfo(strTTI)),
createTColumnType("PKCOLUMN_NAME", new TTypeInfo(strTTI)),
createTColumnType("KEY_SEQ", new TTypeInfo(smallIntTTI)),
createTColumnType("UPDATE_RULE", new TTypeInfo(smallIntTTI)),
createTColumnType("DELETE_RULE", new TTypeInfo(smallIntTTI)),
createTColumnType("PK_NAME", new TTypeInfo(strTTI)),
createTColumnType("FK_NAME", new TTypeInfo(strTTI)),
createTColumnType("DEFERRABILITY", new TTypeInfo(smallIntTTI))
};

return getEmptyResultSetWithDesc(columns);
throw new UnsupportedOperationException("Not supported yet,"
+ " line:" + new Throwable().getStackTrace()[0].getLineNumber()
+ " class:" + new Throwable().getStackTrace()[0].getClassName()
+ " method:" + new Throwable().getStackTrace()[0].getMethodName());
}

@Override
Expand Down

0 comments on commit e819507

Please sign in to comment.