sharding-jdbc-how2work 当当的sharding-jdbc剖析(查询)

1. 以JDBC作为出发点

1.1 重新实现了JDBC的几个接口

实现javax.sql.DataSource接口  ShardingDataSource
实现java.sql.Connection接口 ShardingConnection
实现java.sql.Statement ShardingStatement
实现java.sql.PreparedStatement ShardingPreparedStatement
实现java.sql.ResultSet AbstractShardingResultSet

重新实现的模式是adapter的模式

具体的实现分析见下面的思维导图

2016-12-01 18-36-15_XMind - D__600.self_05.code_04.java_15.sharding-jdbc-how2work_how2work-doc_shard

1.2 聚合 比较排序的处理

2016-12-01 18-44-50_XMind - D__600.self_05.code_04.java_15.sharding-jdbc-how2work_how2work-doc_shard

2. Executor

2016-12-01 18-45-39_XMind - D__600.self_05.code_04.java_15.sharding-jdbc-how2work_how2work-doc_shard

3. Route

2016-12-01 18-46-49_XMind - D__600.self_05.code_04.java_15.sharding-jdbc-how2work_how2work-doc_shard

4. Parse后visitor的处理

2016-12-01 18-48-59_XMind - D__600.self_05.code_04.java_15.sharding-jdbc-how2work_how2work-doc_shard

4.1  AbstractMySQLVisitor 处理细节

2016-12-01 18-50-39_XMind - D__600.self_05.code_04.java_15.sharding-jdbc-how2work_how2work-doc_shard

4.2 MySQLSelectVisitor 逻辑

2016-12-01 18-50-52_XMind - D__600.self_05.code_04.java_15.sharding-jdbc-how2work_how2work-doc_shard

delete insert  update的见第4节一开始的那张图。

posted @ 2017-06-01 12:06  邱明成  阅读(501)  评论(0编辑  收藏  举报