HBaseIntrospector
package x;import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map; /**
* @author muzhi
* @author <a href="mailto:maming.zhong2526@nvxclouds.com">Muzhi Zhang</a>
* @version 1.0.0
* @date 2023-12-12 00:59
*/
public class HBaseIntrospector extends DatabaseIntrospector {
public HBaseIntrospector(DBMetadataUtils dbMetadataUtils) {
super(dbMetadataUtils);
} public HBaseIntrospector(DBMetadataUtils dbMetadataUtils, boolean forceBigDecimals, boolean useCamelCase) {
super(dbMetadataUtils, forceBigDecimals, useCamelCase);
} @Override
public List<String> getCatalogs() throws SQLException {
return super.getCatalogs();
} @Override
public List<String> getSchemas() throws SQLException {
return super.getSchemas();
} @Override
protected Map<IntrospectedTable, List<IntrospectedColumn>> getColumns(DatabaseConfig config) throws SQLException {
DatabaseMetaData metaData = dbMetadataUtils.getDatabaseMetaData();
String[] types = {"TABLE"}; //"SYSTEM TABLE"
ResultSet resultSet = metaData.getTables(config.getCatalog(), config.getSchemaPattern(), config.getTableNamePattern(), types);
List<String> tables = new ArrayList<>();
while (resultSet.next()) {
tables.add(resultSet.getString("TABLE_NAME"));
}
return super.getColumns(config);
} @Override
public List<IntrospectedTable> introspectTables(DatabaseConfig config) throws SQLException {
DatabaseMetaData metaData = dbMetadataUtils.getDatabaseMetaData();
String[] types = {"TABLE"}; //"SYSTEM TABLE"
ResultSet resultSet = metaData.getTables(config.getCatalog(), config.getSchemaPattern(), config.getTableNamePattern(), types);
ResultSet columnsSet = metaData.getColumns(config.getCatalog(), config.getSchemaPattern(), config.getTableNamePattern(), "%");
List<IntrospectedTable> result = new ArrayList<>();
while (resultSet.next()) {
String tableName = resultSet.getString("TABLE_NAME");
IntrospectedTable table = new IntrospectedTable();
table.setName(tableName);
table.setCatalog(config.getCatalog());
result.add(table);
}
while (columnsSet.next()) {
String tableName = resultSet.getString("TABLE_NAME");
IntrospectedTable table = new IntrospectedTable();
table.setName(tableName);
table.setCatalog(config.getCatalog());
result.add(table);
}
return result;
}
}
HBaseIntrospector的更多相关文章
- 002医疗项目-主工程模块yycgproject三层构建(三大框架的整合)
先给出项目结构图:
随机推荐
- cf2009 Codeforces Round 971 (Div. 4)
A. Minimize! 签到题.计算\((c-a)+(b-c)\)的最小值,其实值固定的,等于\(b-a\). int a, b; void solve() { cin >> a > ...
- iOS中在导航条设置搜索框使用小结
最近在项目开发中用到了搜索框,一般是设置在列表顶部或者导航条上.下面说一下在导航条上使用搜索框的思路,刚开始是直接将CCSearchBar添加到导航条,在viewWillDisappear设置隐藏,在 ...
- 什么是变量污染? let、const、var的区别?
变量污染就是全局变量滥用,造成报错,覆盖等问题:简单讲就是使用了相同的标识符声明了全局变量,var关键字声明相同的变量名会覆盖,let.const重复声明相同的变量名会直接报错: var 可以声明提升 ...
- KubeSphere 3.1.1 发布,可以接入集群已有的 Prometheus
KubeSphere 作为一款面向应用的开源容器平台,经过 3 年的发展和 10 个版本的迭代,收获了两百多位开源贡献者,超过十万次下载,并有数千名社区用户用 KubeSphere 作为企业容器平台. ...
- C++容器概览
容器 容器是用来存储数据的序列,它们提供了不同的存储方式和访问模式. STL 中的容器可以分为三类: 1.序列容器:存储元素的序列,允许双向遍历. vector:动态数组,支持快速随机访问. dequ ...
- Rust的Reborrow机制
最近,在使用Rust时遇到了Reborrow的概念,记录下来以备以后参考. 1. 起因 起因准备对数据进行Min-Max标准化处理,也就是将一系列数据映射到一个新的范围. 首先,需要遍历数据,找出其中 ...
- linux 排查项目问题常用命令
查看日志 头部开始查询文件file.log前100中包含'测试'的记录前后一行,并形成文件为new.loghead -n 100 file.log|grep -1 '测试' > new.log ...
- normal matrix 正规矩阵
资料来源 In mathematics, a complex square matrix A is normal if 满足此条件也意味着A可对角化. 所以,厄米矩阵和幺正矩阵都是正规矩阵.
- Abp源码分析之Abp本地化
aspnetcore mvc 实现本地化 新建mvc项目 修改Program.cs using Microsoft.AspNetCore.Localization; using Microsoft.A ...
- 接口自动化AES对称加密为什么密钥key是16位的?
对称加密AES,加密和解密的密钥是同一个 AES是一个分组加密算法,AES有三种密钥长度(128.192.256)比特,常用的是128比特,也就是16位 AES常用的加密模式有:ECB,ECB是将明文 ...