0

有一个具有以下函数存根的 Postgresql 数据库

CREATE OR REPLACE FUNCTION net_train(terms text[], perceptron_id integer)
  RETURNS void AS
$BODY$begin
-- stub
end;$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;
ALTER FUNCTION net_train(text[], integer)
  OWNER TO postgres;

如何通过在java中调用程序将一组术语(也希望知道如何传递第二个参数)传递给这个函数?输入项数组写成

ArrayList<String> ProcessedTherms = new ArrayList<String>();
4

1 回答 1

1

我们用ibatis做映射,不过应该是差不多的:

Connection conn = ps.getConnection(); //ps is prepared statement
ArrayList arr = (ArrayList) param;
final Array sqlArray = conn.createArrayOf("integer", arr.toArray()); // we had integers, should be similar for String
ps.setArray(i, sqlArray);// i is position of parameter
于 2013-05-24T14:50:45.470 回答