GithubHelp home page GithubHelp logo

db-meta's People

Contributors

fandro avatar wukenaihe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

db-meta's Issues

How to write a Bugdojo issue template

Writing detailed, informative and structured issues means the world to testers.
Trust me on this one, I've worked with a lot of them!

The Bugdojo team has come up with a nice template that works well. I'd suggest you follow this template for all the issues that you wish to test in Bugdojo.

Start URL: http://helloworld.com

Steps:
1. Click open tab
2. Update details
3. Press save

Expected: Should save your details

Login: username / password (optional)

How to write a Bugdojo bot command

Congrats! You're all set up!

Hi, I'm bugdojobot. I'm here to help you. We can communicate through the following commands. Allow me to explain what each one does.

@bugdojobot test

Submits the issue for testing by the pool of testers. After a while, you’ll start receiving reports. Look for passed or failed labelled issues.

@bugdojobot retest

When you’ve done some fixes or changes based on the report and want to re-submit the issue for testing, use this command.

@bugdojobot reject

Use the reject command when you’re not happy with the report and want to re-test the issue.

@bugdojobot support

Whenever you find yourself unsure or stuck, you can contact the Bugodojo team by using this command. They’ll receive your comment and reply ASAP.

Sql Server扫描出多余的表的问题

【trace_xe_event_map】
【trace_xe_action_map】
我用的是Sql Server 2014 版本,在获取表的时候,会多获取这两个,暂时没有一个较合适的办法解决,希望大佬能不能解决一下

解决Mysql、Oracle、Sql Server中,表备注、字段备注不显示的问题

【解决Sql server表备注、列备注问题】:
通过我对源码的研究,发现作者并未提供Sql Server对表备注和列备注的实现,因此,在阅读源码后,我对以下的一个方法进行修改,就可以解决这个问题了,并且同时支持sqljdbc4、jtds这两个数据源连接。
修改文件位置:db-meta/src/main/java/com/cgs/db/meta/core/MetaLoaderImpl.java
修改方法位置:100行处,public Table getTable(String tableName, SchemaInfoLevel schemaLevel,SchemaInfo schemaInfo) 方法
修改以后内容:直接复制这块代码,占到对应的方法中即可,注意是将该方法中代码全部替换
QQ截图20200727013851
全部代码内容:
Connection con = JDBCUtils.getConnection(dataSource); MetaCrawler metaCrawler=null; try{ metaCrawler=factory.newInstance(con); Table table = metaCrawler.getTable(tableName, schemaLevel,schemaInfo); // 获取数据源,然后获取驱动名称 Connection connection = dataSource.getConnection(); DatabaseMetaData metaData = connection.getMetaData(); String driverName = metaData.getDriverName(); // Microsoft JDBC Driver 4.0 for SQL Server // jTDS Type 4 JDBC Driver for MS SQL Server and Sybase // 判断是否是sql server驱动,解决表备注和列备注失效的问题 if (driverName != null && driverName.indexOf("SQL Server") != -1) { // 通过查找sql server独有的约束表,将之前所缺少的字段补充上 String sql = "SELECT\r\n" + " CONVERT (NVARCHAR (100),isnull(A.name, '')) AS TABLE_NAME,\r\n" + " CONVERT (NVARCHAR (100),isnull(D.value, '')) AS TABLE_REMARK,\r\n" + " CONVERT (NVARCHAR (100),isnull(B.name, '')) AS COLUMN_NAME,\r\n" + " CONVERT (NVARCHAR (100),isnull(C.value, '')) AS COLUMN_REMARK\r\n" + "FROM sys.tables A\r\n" + "LEFT JOIN sys.columns B ON A.object_id = B.object_id\r\n" + "LEFT JOIN sys.extended_properties C ON A.object_id = C.major_id AND B.column_id = C.minor_id\r\n" + "LEFT JOIN sys.extended_properties D ON A.object_id = D.major_id AND D.minor_id = 0\r\n" + "WHERE A.name = '"+tableName+"'"; PreparedStatement preparedStatement = connection.prepareStatement(sql); ResultSet resultSet = preparedStatement.executeQuery(); // 循环每一个字段,将列备注重新设置 while (resultSet.next()) { // String TABLE_NAME = resultSet.getString("TABLE_NAME"); // 表名 String TABLE_REMARK = resultSet.getString("TABLE_REMARK") ; // 表备注 String COLUMN_NAME = resultSet.getString("COLUMN_NAME") ; // 列名 String COLUMN_REMARK = resultSet.getString("COLUMN_REMARK") ; // 列备注 table.setComment(TABLE_REMARK); table.getColumns().get(COLUMN_NAME).setComment(COLUMN_REMARK); } } return table; }catch(DataAccessException | SQLException e){ logger.debug(e.getMessage(),e); throw new DatabaseMetaGetMetaException("Get tables error!", e); }finally{ JDBCUtils.closeConnection(con); }

【解决Mysql、Oracle表备注、列备注问题】:
我发现数据源最好使用druid,而不是DBCP和C3P0,因为druid可以设置参数的形式,开启mysql、oracle的表备注和列备注
这样就不需要修改这个开源项目的源码了,就像下边这样,接下来,下一个我将介绍统一请求格式
11

【统一mysql、oracle、sql server的初始化格式,使用单元测试演示】:
直接使用了url一条解决,其实是可以设置端口、账户、密码、数据库名啥的,但是我觉得太麻烦了,为什么我要统一格式呢,主要是,我想做一个代码生成器,支持这三个数据库,所以我就把最上层的创建这里也给统一了,如下图,这里只是创建数据源
mysql:
222

oracle:
333

sql server:sqljdbc4
444

sql server:jtds
555

异常抛错了

MetaLoaderImpl.java类中的getFunctions、getFunction、getFunctionNames异常抛错了

SqlServerMetaCrawler抛出无效异常

db-meta/src/main/java/com/cgs/db/meta/retriever/SqlServerMetaCrawler.java

代码第98行,应该是sql server,而源码是Oracle,这里是不是错了
// throw new DatabaseMetaGetMetaException("Get database(Oracle) schema information error!", e);
throw new DatabaseMetaGetMetaException("Get database(sql server) schema information error!", e);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.