This is an automated email from the ASF dual-hosted git repository.
menghaoran pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 3e350c1 update wrong of examples of shardingsphere official documents
(#8572)
3e350c1 is described below
commit 3e350c1265bbc08b062bb8853b547ceafddf99d3
Author: CrazyFz <[email protected]>
AuthorDate: Fri Dec 11 10:12:29 2020 +0800
update wrong of examples of shardingsphere official documents (#8572)
---
.../user-manual/shardingsphere-jdbc/usage/sharding/java-api.cn.md | 6 +++---
.../user-manual/shardingsphere-jdbc/usage/sharding/java-api.en.md | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/usage/sharding/java-api.cn.md
b/docs/document/content/user-manual/shardingsphere-jdbc/usage/sharding/java-api.cn.md
index 5b17ef3..7f2b467 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/usage/sharding/java-api.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/usage/sharding/java-api.cn.md
@@ -66,7 +66,7 @@
tableShardingAlgorithmrProps.setProperty("algorithm-expression", "t_order${order
shardingRuleConfig.getShardingAlgorithms().put("tableShardingAlgorithm", new
ShardingSphereAlgorithmConfiguration("INLINE", tableShardingAlgorithmrProps));
// 创建 ShardingSphereDataSource
-DataSource dataSource =
ShardingSphereDataSourceFactory.createDataSource(dataSourceMap,
Collections.singleton((shardingRuleConfig), new Properties());
+DataSource dataSource =
ShardingSphereDataSourceFactory.createDataSource(dataSourceMap,
Collections.singleton(shardingRuleConfig), new Properties());
```
## 使用 ShardingSphereDataSource
@@ -77,14 +77,14 @@ DataSource dataSource =
ShardingSphereDataSourceFactory.createDataSource(dataSou
以原生 JDBC 使用方式为例:
```java
-DataSource dataSource =
ShardingSphereDataSourceFactory.createDataSource(dataSourceMap,
Collections.singleton((shardingRuleConfig), new Properties());
+DataSource dataSource =
ShardingSphereDataSourceFactory.createDataSource(dataSourceMap,
Collections.singleton(shardingRuleConfig), new Properties());
String sql = "SELECT i.* FROM t_order o JOIN t_order_item i ON
o.order_id=i.order_id WHERE o.user_id=? AND o.order_id=?";
try (
Connection conn = dataSource.getConnection();
PreparedStatement ps = conn.prepareStatement(sql)) {
ps.setInt(1, 10);
ps.setInt(2, 1000);
- try (ResultSet rs = preparedStatement.executeQuery()) {
+ try (ResultSet rs = ps.executeQuery()) {
while(rs.next()) {
// ...
}
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/usage/sharding/java-api.en.md
b/docs/document/content/user-manual/shardingsphere-jdbc/usage/sharding/java-api.en.md
index 2275aa7..951d369 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/usage/sharding/java-api.en.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/usage/sharding/java-api.en.md
@@ -67,7 +67,7 @@
tableShardingAlgorithmrProps.setProperty("algorithm-expression", "t_order${order
shardingRuleConfig.getShardingAlgorithms().put("tableShardingAlgorithm", new
ShardingSphereAlgorithmConfiguration("INLINE", tableShardingAlgorithmrProps));
// Create ShardingSphereDataSource
-DataSource dataSource =
ShardingSphereDataSourceFactory.createDataSource(dataSourceMap,
Collections.singleton((shardingRuleConfig), new Properties());
+DataSource dataSource =
ShardingSphereDataSourceFactory.createDataSource(dataSourceMap,
Collections.singleton(shardingRuleConfig), new Properties());
```
## Use ShardingSphereDataSource
@@ -78,14 +78,14 @@ Developer can choose to use native JDBC or ORM frameworks
such as JPA or MyBatis
Take native JDBC usage as an example:
```java
-DataSource dataSource =
ShardingSphereDataSourceFactory.createDataSource(dataSourceMap,
Collections.singleton((shardingRuleConfig), new Properties());
+DataSource dataSource =
ShardingSphereDataSourceFactory.createDataSource(dataSourceMap,
Collections.singleton(shardingRuleConfig), new Properties());
String sql = "SELECT i.* FROM t_order o JOIN t_order_item i ON
o.order_id=i.order_id WHERE o.user_id=? AND o.order_id=?";
try (
Connection conn = dataSource.getConnection();
PreparedStatement ps = conn.prepareStatement(sql)) {
ps.setInt(1, 10);
ps.setInt(2, 1000);
- try (ResultSet rs = preparedStatement.executeQuery()) {
+ try (ResultSet rs = ps.executeQuery()) {
while(rs.next()) {
// ...
}