You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "susongyan (via GitHub)" <gi...@apache.org> on 2023/05/22 12:04:40 UTC

[GitHub] [shardingsphere] susongyan commented on issue #25838: proxy update pg json field failed

susongyan commented on issue #25838:
URL: https://github.com/apache/shardingsphere/issues/25838#issuecomment-1557099930

   code: 
   
   using jdbc to update    json field 'alert_persons'
   
   String sql = "UPDATE t_alert_rule SET alert_persons = ?, update_time = CURRENT_TIMESTAMP WHERE id IN (?) RETURNING update_time";
           try (Connection conn = dataSource.getConnection()) {
               PreparedStatement preparedStatement = conn.prepareStatement(sql);
               PGobject jsonObject = new PGobject();
               jsonObject.setType("json");
               jsonObject.setValue(JSON.toJSONString(Collections.singletonList("test)")));
               preparedStatement.setObject(1, jsonObject);
               preparedStatement.setLong(2, 130);
               preparedStatement.execute();
           }


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