shijie-328931589 commented on issue #32280:
URL: 
https://github.com/apache/shardingsphere/issues/32280#issuecomment-2260215121

   Have the same problem when use ShardingSphereDataSource. the code:
   
           String sql = " INSERT INTO user_little_secretary_read ( user_id, 
read_time, type )  VALUES ( ?, now(),  ? ) ON CONFLICT ( user_id, type ) DO 
UPDATE " +
                   " set read_time = now() WHERE 
user_little_secretary_read.user_id = ? AND user_little_secretary_read.type = ? 
";
           ShardingSphereDataSource dataSource = 
(ShardingSphereDataSource)RoutingDataSourceUtils.getCurrentShardingInfo().getRealDataSource();
           try {
               try(Connection connection = dataSource.getConnection()){
                   PreparedStatement statement = 
connection.prepareStatement(sql);
                   statement.setLong(1, userId);
                   statement.setLong(2, type);
                   statement.setLong(3, userId);
                   statement.setLong(4, type);
                   statement.execute();
               }
           }catch (Exception e){
               throw new RuntimeException(e);
           }


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to