如何用ruby-on-rails的Ruby PG gem将数组作为exec_params的参数传递?

更新于
2026-10-09 18:26:21
0阅读来源:SEO教程
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计179个文字,预计阅读时间需要1分钟。

如何用ruby-on-rails的Ruby PG gem将数组作为exec_params的参数传递?

我想传递一个像这样的ruby数组值:sql=SELECT $1 FROM users WHERE id=$2User.connection.raw_connection.exec_params(sql, [[1, 2]]) 这返回了 PG::IndeterminateDatatype: ERROR: could not determine data type of parameter $1。

阅读全文

本文共计179个文字,预计阅读时间需要1分钟。

如何用ruby-on-rails的Ruby PG gem将数组作为exec_params的参数传递?

我想传递一个像这样的ruby数组值:sql=SELECT $1 FROM users WHERE id=$2User.connection.raw_connection.exec_params(sql, [[1, 2]]) 这返回了 PG::IndeterminateDatatype: ERROR: could not determine data type of parameter $1。

阅读全文