我的请求中有一个来自产品的transactionReceipt变量,即product.gettransactionReceipt(),如何将此值发送到请求中的transactionReceipt? transactionReceipt是作为用户字段的json之一
// TODO check another users bought
if (!purchased.contains(product.getProductId())) {
Statement st = conn.createStatement();
String transactionReceipt = product.getTransactionReceipt();
ResultSet rs = st.executeQuery("DECLARE transactionReceipt ; Select username from user WHERE info -> 'purshasedProducts' ->> 'transactionReceipt' = 'transactionReceipt");
答案 0 :(得分:0)
您可以改用PreparedStatement
,并将transactionReceipt
作为参数传递给它。喜欢:
PreparedStatement st = conn.prepareStatement("Select username from user WHERE info -> 'purshasedProducts' ->> 'transactionReceipt' = ?");
String transactionReceipt = product.getTransactionReceipt();
st.setString(1, transactionReceipt);
ResultSet execute = st.executeQuery();