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 2021/08/08 04:04:16 UTC

[GitHub] [shardingsphere] zjcnb opened a new pull request #11699: Schema name add default value

zjcnb opened a new pull request #11699:
URL: https://github.com/apache/shardingsphere/pull/11699


   For #11621 .
   
   add default value
   


-- 
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] zjcnb commented on a change in pull request #11699: Schema name add default value

Posted by GitBox <gi...@apache.org>.
zjcnb commented on a change in pull request #11699:
URL: https://github.com/apache/shardingsphere/pull/11699#discussion_r684714812



##########
File path: shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/resources/META-INF/namespace/datasource.xsd
##########
@@ -29,7 +29,7 @@
                 <xsd:element ref="beans:props" minOccurs="0" />
             </xsd:all>
             <xsd:attribute name="id" type="xsd:string" use="required" />
-            <xsd:attribute name="schema-name" type="xsd:string" />
+            <xsd:attribute name="schema-name" type="xsd:string" default="logic_db"/>

Review comment:
       ok, i will done




-- 
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 merged pull request #11699: Schema name add default value

Posted by GitBox <gi...@apache.org>.
terrymanu merged pull request #11699:
URL: https://github.com/apache/shardingsphere/pull/11699


   


-- 
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 a change in pull request #11699: Schema name add default value

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #11699:
URL: https://github.com/apache/shardingsphere/pull/11699#discussion_r684711654



##########
File path: shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-spring-infra/shardingsphere-jdbc-spring-boot-starter-infra/src/main/java/org/apache/shardingsphere/spring/boot/schema/SchemaNameSetter.java
##########
@@ -40,6 +42,10 @@
      */
     public static String getSchemaName(final Environment environment) {
         StandardEnvironment standardEnv = (StandardEnvironment) environment;
-        return standardEnv.getProperty(PREFIX + SCHEMA_NAME);
+        String schemaName = standardEnv.getProperty(PREFIX + SCHEMA_NAME);
+        if (StringUtils.isEmpty(schemaName)) {

Review comment:
       Is it passable to use ternary operator?
   

##########
File path: shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-spring-infra/shardingsphere-jdbc-spring-boot-starter-infra/src/main/java/org/apache/shardingsphere/spring/boot/schema/SchemaNameSetter.java
##########
@@ -40,6 +42,10 @@
      */
     public static String getSchemaName(final Environment environment) {
         StandardEnvironment standardEnv = (StandardEnvironment) environment;
-        return standardEnv.getProperty(PREFIX + SCHEMA_NAME);
+        String schemaName = standardEnv.getProperty(PREFIX + SCHEMA_NAME);
+        if (StringUtils.isEmpty(schemaName)) {

Review comment:
       Please use `Strings`, just keep consist with other usage




-- 
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] zjcnb commented on a change in pull request #11699: Schema name add default value

Posted by GitBox <gi...@apache.org>.
zjcnb commented on a change in pull request #11699:
URL: https://github.com/apache/shardingsphere/pull/11699#discussion_r684714156



##########
File path: shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/api/ShardingSphereDataSourceFactory.java
##########
@@ -76,7 +76,7 @@ public static DataSource createDataSource(final Map<String, DataSource> dataSour
      * @throws SQLException SQL exception
      */
     public static DataSource createDataSource(final String schemaName, final DataSource dataSource, final Collection<RuleConfiguration> configs, final Properties props) throws SQLException {
-        return createDataSource(schemaName, Collections.singletonMap(schemaName, dataSource), configs, props);
+        return createDataSource(schemaName, Collections.singletonMap(Strings.isNullOrEmpty(schemaName) ? DefaultSchema.LOGIC_NAME : schemaName, dataSource), configs, props);

Review comment:
       it 's only check schemaName, but not check datasourceMap key




-- 
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] zjcnb commented on a change in pull request #11699: Schema name add default value

Posted by GitBox <gi...@apache.org>.
zjcnb commented on a change in pull request #11699:
URL: https://github.com/apache/shardingsphere/pull/11699#discussion_r684714824



##########
File path: shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-spring-infra/shardingsphere-jdbc-spring-boot-starter-infra/src/main/java/org/apache/shardingsphere/spring/boot/schema/SchemaNameSetter.java
##########
@@ -40,6 +42,10 @@
      */
     public static String getSchemaName(final Environment environment) {
         StandardEnvironment standardEnv = (StandardEnvironment) environment;
-        return standardEnv.getProperty(PREFIX + SCHEMA_NAME);
+        String schemaName = standardEnv.getProperty(PREFIX + SCHEMA_NAME);
+        if (StringUtils.isEmpty(schemaName)) {

Review comment:
       > Is it passable to use ternary operator?
   
   yes




-- 
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 a change in pull request #11699: Schema name add default value

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #11699:
URL: https://github.com/apache/shardingsphere/pull/11699#discussion_r684711248



##########
File path: shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/java/org/apache/shardingsphere/driver/api/ShardingSphereDataSourceFactory.java
##########
@@ -76,7 +76,7 @@ public static DataSource createDataSource(final Map<String, DataSource> dataSour
      * @throws SQLException SQL exception
      */
     public static DataSource createDataSource(final String schemaName, final DataSource dataSource, final Collection<RuleConfiguration> configs, final Properties props) throws SQLException {
-        return createDataSource(schemaName, Collections.singletonMap(schemaName, dataSource), configs, props);
+        return createDataSource(schemaName, Collections.singletonMap(Strings.isNullOrEmpty(schemaName) ? DefaultSchema.LOGIC_NAME : schemaName, dataSource), configs, props);

Review comment:
       The inline method `createDataSource` has already check null of schemaName, is it necessary to add check again?

##########
File path: shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-namespace/src/main/resources/META-INF/namespace/datasource.xsd
##########
@@ -29,7 +29,7 @@
                 <xsd:element ref="beans:props" minOccurs="0" />
             </xsd:all>
             <xsd:attribute name="id" type="xsd:string" use="required" />
-            <xsd:attribute name="schema-name" type="xsd:string" />
+            <xsd:attribute name="schema-name" type="xsd:string" default="logic_db"/>

Review comment:
       Please keep one space between `"logic_db"` and `/>`, just keep consist with others

##########
File path: shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-spring-infra/shardingsphere-jdbc-spring-boot-starter-infra/src/main/java/org/apache/shardingsphere/spring/boot/schema/SchemaNameSetter.java
##########
@@ -40,6 +42,10 @@
      */
     public static String getSchemaName(final Environment environment) {
         StandardEnvironment standardEnv = (StandardEnvironment) environment;
-        return standardEnv.getProperty(PREFIX + SCHEMA_NAME);
+        String schemaName = standardEnv.getProperty(PREFIX + SCHEMA_NAME);
+        if (StringUtils.isEmpty(schemaName)) {
+            return DefaultSchema.LOGIC_NAME;
+        }
+        return schemaName;

Review comment:
       The return value should name as `result`




-- 
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] codecov-commenter commented on pull request #11699: Schema name add default value

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #11699:
URL: https://github.com/apache/shardingsphere/pull/11699#issuecomment-894742216


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/11699?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#11699](https://codecov.io/gh/apache/shardingsphere/pull/11699?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ddaee86) into [master](https://codecov.io/gh/apache/shardingsphere/commit/c948749c1cf34abdaa53a91a039be2100707ed64?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c948749) will **decrease** coverage by `0.01%`.
   > The diff coverage is `40.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/11699/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/shardingsphere/pull/11699?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #11699      +/-   ##
   ============================================
   - Coverage     63.70%   63.69%   -0.02%     
     Complexity     1122     1122              
   ============================================
     Files          2267     2267              
     Lines         34603    34607       +4     
     Branches       6023     6029       +6     
   ============================================
   - Hits          22044    22043       -1     
   - Misses        10800    10801       +1     
   - Partials       1759     1763       +4     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/11699?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...re/driver/api/ShardingSphereDataSourceFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/11699/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtamRiYy9zaGFyZGluZ3NwaGVyZS1qZGJjLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2RyaXZlci9hcGkvU2hhcmRpbmdTcGhlcmVEYXRhU291cmNlRmFjdG9yeS5qYXZh) | `50.00% <0.00%> (-25.00%)` | :arrow_down: |
   | [.../api/yaml/YamlShardingSphereDataSourceFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/11699/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtamRiYy9zaGFyZGluZ3NwaGVyZS1qZGJjLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2RyaXZlci9hcGkveWFtbC9ZYW1sU2hhcmRpbmdTcGhlcmVEYXRhU291cmNlRmFjdG9yeS5qYXZh) | `35.00% <0.00%> (-5.00%)` | :arrow_down: |
   | [...ingsphere/spring/boot/schema/SchemaNameSetter.java](https://codecov.io/gh/apache/shardingsphere/pull/11699/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtamRiYy9zaGFyZGluZ3NwaGVyZS1qZGJjLXNwcmluZy9zaGFyZGluZ3NwaGVyZS1qZGJjLXNwcmluZy1pbmZyYS9zaGFyZGluZ3NwaGVyZS1qZGJjLXNwcmluZy1ib290LXN0YXJ0ZXItaW5mcmEvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NwcmluZy9ib290L3NjaGVtYS9TY2hlbWFOYW1lU2V0dGVyLmphdmE=) | `60.00% <50.00%> (-40.00%)` | :arrow_down: |
   | [...YamlGovernanceShardingSphereDataSourceFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/11699/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtamRiYy9zaGFyZGluZ3NwaGVyZS1qZGJjLWdvdmVybmFuY2Uvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2RyaXZlci9nb3Zlcm5hbmNlL2FwaS95YW1sL1lhbWxHb3Zlcm5hbmNlU2hhcmRpbmdTcGhlcmVEYXRhU291cmNlRmFjdG9yeS5qYXZh) | `81.25% <66.66%> (-5.42%)` | :arrow_down: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/11699?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/11699?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [c948749...ddaee86](https://codecov.io/gh/apache/shardingsphere/pull/11699?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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