Return the table identifier in the best fit depending on database type

@param requestedTable Catalog and schema used
@param tableName Table without quotes
@param isH2 True if H2, false if PostGRES

@return Find table identifier
7027
public static String caseIdentifier(TableLocation requestedTable, String tableName, boolean isH2) {
        return new TableLocation(requestedTable.getCatalog(), requestedTable.getSchema(),
                TableLocation.parse(tableName, isH2).getTable()).toString();
    }
1182982
public GeometryColumns queryForTableName(String tableName)
			throws SQLException {
		GeometryColumns geometryColumns = null;
		if (tableName != null) {
			List<GeometryColumns> results = queryForEq(
					GeometryColumns.COLUMN_TABLE_NAME, tableName);
			if (!results.isEmpty()) {
				if (results.size() > 1) {
					throw new SQLException("More than one "
							+ GeometryColumns.class.getSimpleName()
							+ " returned for Table Name: " + tableName);
				}
				geometryColumns = results.get(0);
			}
		}
		return geometryColumns;
	}
804802
@Override
  public OperationHandle getTables(SessionHandle sessionHandle,
      String catalogName, String schemaName, String tableName, List<String> tableTypes)
          throws HiveSQLException {
    OperationHandle opHandle = sessionManager.getSession(sessionHandle)
        .getTables(catalogName, schemaName, tableName, tableTypes);
    LOG.debug(sessionHandle + ": getTables()");
    return opHandle;
  }
156831
public ResultSet getImportedKeysUsingInformationSchema(String catalog, String table)
      throws SQLException {
    if (table == null) {
      throw new SQLException("'table' parameter in getImportedKeys cannot be null");
    }
    String sql =
        "SELECT KCU.REFERENCED_TABLE_SCHEMA PKTABLE_CAT, NULL PKTABLE_SCHEM,  KCU.REFERENCED_TABLE_NAME PKTABLE_NAME,"
            + " KCU.REFERENCED_COLUMN_NAME PKCOLUMN_NAME, KCU.TABLE_SCHEMA FKTABLE_CAT, NULL FKTABLE_SCHEM, "
            + " KCU.TABLE_NAME FKTABLE_NAME, KCU.COLUMN_NAME FKCOLUMN_NAME, KCU.POSITION_IN_UNIQUE_CONSTRAINT KEY_SEQ,"
            + " CASE update_rule "
            + "   WHEN 'RESTRICT' THEN 1"
            + "   WHEN 'NO ACTION' THEN 3"
            + "   WHEN 'CASCADE' THEN 0"
            + "   WHEN 'SET NULL' THEN 2"
            + "   WHEN 'SET DEFAULT' THEN 4"
            + " END UPDATE_RULE,"
            + " CASE DELETE_RULE"
            + "  WHEN 'RESTRICT' THEN 1"
            + "  WHEN 'NO ACTION' THEN 3"
            + "  WHEN 'CASCADE' THEN 0"
            + "  WHEN 'SET NULL' THEN 2"
            + "  WHEN 'SET DEFAULT' THEN 4"
            + " END DELETE_RULE,"
            + " RC.CONSTRAINT_NAME FK_NAME,"
            + " NULL PK_NAME,"
            + importedKeyNotDeferrable + " DEFERRABILITY"
            + " FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU"
            + " INNER JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS RC"
            + " ON KCU.CONSTRAINT_SCHEMA = RC.CONSTRAINT_SCHEMA"
            + " AND KCU.CONSTRAINT_NAME = RC.CONSTRAINT_NAME"
            + " WHERE "
            + catalogCond("KCU.TABLE_SCHEMA", catalog)
            + " AND "
            + " KCU.TABLE_NAME = " + escapeQuote(table)
            + " ORDER BY PKTABLE_CAT, PKTABLE_SCHEM, PKTABLE_NAME, KEY_SEQ";

    return executeQuery(sql);
  }
1164138
private TableName snapshotExists(String snapshotName,
      List<SnapshotDescription> snapshotDescriptions) {
    if (snapshotDescriptions != null) {
      Optional<SnapshotDescription> descriptor =
          snapshotDescriptions.stream()
              .filter(desc -> desc.getName().equals(snapshotName))
              .findFirst();
      return descriptor.isPresent() ? descriptor.get().getTableName() : null;
    }
    return null;
  }
400275
@Override
    public <E> List<E> getColumnsById(String schemaName, String tableName, String pKeyColumnName, String columnName,
        Object pKeyColumnValue, Class columnJavaType) {
        // select columnName from tableName where pKeyColumnName =
        // pKeyColumnValue
        List results = new ArrayList();
        CQLTranslator translator = new CQLTranslator();
        String selectQuery = translator.SELECT_QUERY;
        selectQuery = StringUtils.replace(selectQuery, CQLTranslator.COLUMN_FAMILY,
            translator.ensureCase(new StringBuilder(), tableName, false).toString());
        selectQuery = StringUtils.replace(selectQuery, CQLTranslator.COLUMNS,
            translator.ensureCase(new StringBuilder(), columnName, false).toString());

        StringBuilder selectQueryBuilder = new StringBuilder(selectQuery);

        selectQueryBuilder.append(CQLTranslator.ADD_WHERE_CLAUSE);

        translator.buildWhereClause(selectQueryBuilder, columnJavaType, pKeyColumnName, pKeyColumnValue,
            CQLTranslator.EQ_CLAUSE, false);
        selectQueryBuilder.delete(selectQueryBuilder.lastIndexOf(CQLTranslator.AND_CLAUSE),
            selectQueryBuilder.length());

        ResultSet rSet = execute(selectQueryBuilder.toString(), null);

        Iterator<Row> rowIter = rSet.iterator();
        while (rowIter.hasNext()) {
            Row row = rowIter.next();
            DataType dataType = row.getColumnDefinitions().getType(columnName);
            Object columnValue =
                DSClientUtilities.assign(row, null, null, dataType.getName(), null, columnName, null, null);
            results.add(columnValue);
        }
        return results;
    }
718148
private String getDbTableName(String schemaName) {
    Preconditions.checkArgument(schemaName.matches(".+_.+_.+"));
    return schemaName.replaceFirst("_", ".").substring(0, schemaName.lastIndexOf('_'));
  }
458387
public ContentsId get(String tableName) {
		ContentsId contentsId = null;
		try {
			if (contentsIdDao.isTableExists()) {
				contentsId = contentsIdDao.queryForTableName(tableName);
			}
		} catch (SQLException e) {
			throw new GeoPackageException(
					"Failed to query contents id for GeoPackage: "
							+ geoPackage.getName() + ", Table Name: "
							+ tableName, e);
		}
		return contentsId;
	}
158043
public String getTable(T bean) {
        if (tableStrategy == null) return table;
        String t = tableStrategy.getTable(table, bean);
        return t == null || t.isEmpty() ? table : t;
    }
1197071
function findColumns (pgColumns, schemaName, tableName) {
  return pgColumns
    .filter(o => o.table_schema === schemaName && o.table_name === tableName)
    .reduce((columns, col) => {
      const columnInfo = {
        columnDefault: col.column_default,
        isNullable: col.is_nullable,
        dataType: col.data_type,
        characterMaximumLength: col.character_maximum_length,
        numericScale: col.numeric_scale,
        comment: col.column_comment
      }
      if (columnInfo.dataType === 'ARRAY') {
        columnInfo.array = true
        columnInfo.dataType = col.array_element_type.slice(1)
      } else {
        columnInfo.array = false
      }
      columns[col.column_name] = columnInfo
      return columns
    },
    {}
    )
}
1270629
public String getQueryNamesPrepareSQL(T bean) {
        if (this.tableStrategy == null) return queryNamesPrepareSQL;
        return queryNamesPrepareSQL.replace("${newtable}", getTable(bean));
    }
267126
public Table findUserTable(Session session, String name,
                               String schemaName) {

        Schema schema = (Schema) schemaMap.get(schemaName);

        if (schema == null) {
            return null;
        }

        if (session != null) {
            Table table = session.getLocalTable(name);
            if (table != null) {
                return table;
            }
        }

        int i = schema.tableList.getIndex(name);

        if (i == -1) {
            return null;
        }

        return (Table) schema.tableList.get(i);
    }
384139
@Override
    public Object getTable(final String tableName)
    {
        logger.debug("TEPHRA Begin of getTable for " + tableName);
        final TransactionAwareHTable table = tableNameHandleMap.get(tableName);
        if (table == null) {
            // TODO propagate exceptions
            logger.error("TEPHRA error: unebale to find cached table " + tableName);
            return table;
        } else {
            logger.debug("TEPHRA Found a cached handle for table " + tableName);
            return table;
        }
    }
849787
private Table findTable(String alias) {
		List<String> names = null;
		if (tableScope == null) {
			// no tables to find
			return null;
		}

		for (ScopeChild child : tableScope.children) {
			if (catalogReader.nameMatcher().matches(child.name, alias)) {
				names = ((SqlIdentifier) child.namespace.getNode()).names;
				break;
			}
		}
		if (names == null || names.size() == 0) {
			return null;
		} else if (names.size() == 1) {
			return findTable(catalogReader.getRootSchema(), names.get(0),
				catalogReader.nameMatcher().isCaseSensitive());
		}

		CalciteSchema.TableEntry entry =
			SqlValidatorUtil.getTableEntry(catalogReader, names);

		return entry == null ? null : entry.getTable();
	}
543369
@Override
    public <E> List<E> getColumnsById(String schemaName, String tableName, String pKeyColumnName, String columnName,
            Object pKeyColumnValue, Class columnJavaType)
    {
        // search using index on pkey column
        List<E> foreignKeys = new ArrayList<E>();

        Table schemaTable = tableAPI.getTable(tableName);
        Index index = schemaTable.getIndex(pKeyColumnName);
        IndexKey indexKey = index.createIndexKey();

        // StringBuilder indexNamebuilder = new StringBuilder();
        NoSqlDBUtils.add(schemaTable.getField(pKeyColumnName), indexKey, pKeyColumnValue, pKeyColumnName);
        KunderaCoreUtils.printQuery(
                "Get columns by id from:" + tableName + " for column:" + columnName + " where value:" + pKeyColumnValue,
                showQuery);
        Iterator<Row> rowsIter = tableAPI.tableIterator(indexKey, null, null);

        while (rowsIter.hasNext())
        {
            Row row = rowsIter.next();
            FieldDef fieldMetadata = schemaTable.getField(columnName);
            FieldValue value = row.get(columnName);
            foreignKeys.add((E) NoSqlDBUtils.get(fieldMetadata, value, null));
        }

        return foreignKeys;

    }
534945
@Override
    public Object[] findIdsByColumn(String schemaName, String tableName, String pKeyName, String columnName,
        Object columnValue, Class entityClazz) {
        EntityMetadata metadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entityClazz);

        return getColumnsById(schemaName, tableName, columnName,
            ((AbstractAttribute) metadata.getIdAttribute()).getJPAColumnName(), columnValue,
            metadata.getIdAttribute().getBindableJavaType()).toArray();
    }
35034
private HTableDescriptor getTableDescriptor(Class<?> clazz, EntityType<?> entityType, String tableName)
    {
        try
        {
            AbstractManagedType<?> ent = (AbstractManagedType<?>) entityType;
            HTableDescriptor tableDescriptor = null;
            String hTableName = HBaseUtils.getHTableName(databaseName, tableName);
            tableDescriptor = !admin.tableExists(TableName.valueOf(hTableName)) ? new HTableDescriptor(
                    TableName.valueOf(hTableName)) : admin.getTableDescriptor(TableName.valueOf(hTableName));
            addColumnFamilyAndSetProperties(tableDescriptor, tableName);

            // Add column families for @SecondaryTable
            List<String> secondaryTables = ((DefaultEntityAnnotationProcessor) ent.getEntityAnnotation())
                    .getSecondaryTablesName();
            for (String secTable : secondaryTables)
            {
                addColumnFamilyAndSetProperties(tableDescriptor, secTable);
            }

            // handle @JoinTable for @ManyToMany
            List<Relation> relations = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, clazz).getRelations();
            addJoinTable(relations);

            // @CollectionTable is not handled.
            return tableDescriptor;
        }
        catch (IOException ex)
        {
            logger.error("Either table isn't in enabled state or some network problem, Caused by: ", ex);
            throw new SchemaGenerationException(ex, "Hbase");
        }
    }