You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/06/12 13:57:12 UTC

[GitHub] [shardingsphere] gavenpeng opened a new pull request, #18317: 支持根据Hint context动态指定路由的库和表

gavenpeng opened a new pull request, #18317:
URL: https://github.com/apache/shardingsphere/pull/18317

   Increment feature:
   
   Changes proposed in this pull request:
   - 1 对强制路由做了增强,不需要规则配置为Hint模式,只要线程上下文带有强制路由的标志,就可以路由到指定的库和表,
   不受分表规则的影响.
   - 2 使用demo:
   ```
   public void demoFunc() {
       // 实例化HintManager
       HintManager hintManager = HintManager.getInstance();
       // 强制路由到哪个分库,具体的分库名见paas平台上的分片配置,一般是:ds_0,ds_1这种
       hintManager.addDatabaseShardingValue("logic_database_name(请填写你的逻辑库名)", "databaseName_name(请填写你的真实库名)");
       // 强制路由到哪个真实表
       hintManager.addTableShardingValue("logic_table_name(请填写你的逻辑表名)", "real_table_name(请填写你的真实表名)");
       try {     // java7之后,也可以使用try-with-resource写法!!
           xxxxxxx   // 业务逻辑
       } catch (Throwable e) {
           xxxxxxx   // 业务逻辑
       } finally {
           // 必须要写,不能少,切记,切记!!!!否则后面都会出错
           hintManager.close();   
       }
   }
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] terrymanu closed pull request #18317: 支持根据Hint context动态指定路由的库和表

Posted by GitBox <gi...@apache.org>.
terrymanu closed pull request #18317: 支持根据Hint context动态指定路由的库和表
URL: https://github.com/apache/shardingsphere/pull/18317


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] terrymanu commented on pull request #18317: 支持根据Hint context动态指定路由的库和表

Posted by GitBox <gi...@apache.org>.
terrymanu commented on PR #18317:
URL: https://github.com/apache/shardingsphere/pull/18317#issuecomment-1153187715

   **For English only**, other languages will not accept.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org