lunatic-cat / pg_exec_array_params Goto Github PK
View Code? Open in Web Editor NEW๐ PG::Connection#exec_params with arrays
License: MIT License
๐ PG::Connection#exec_params with arrays
License: MIT License
Hi @razum2um,
arm64-based machines cannot install the gem due to the dependency pg_query 1.2.0
not supporting arm.
The version 1.3.0 adds support to ARM and should solve the issue (see Changelog).
I am facing the issue on a M1 macbook and it might happen more and more as the new mac hardware transitions to ARM.
Would it be possible to upgrade the dependency to 1.3.0?
Gem processes only REXPR inside A_EXPR (e.g. right part of filter clauses or assignments), but this fails:
> PG::Connection.include(PgExecArrayParams)
=> PG::Connection
> sql = "SELECT $1"
=> "SELECT $1"
> User.connection.raw_connection.exec_array_params(sql, [[1,2]])
PG::ProtocolViolation: ERROR: bind message supplies 0 parameters, but prepared statement "" requires 1
from /lib/pg_exec_array_params/query.rb:25:in `exec_params'
AST looks like:
> PgQuery.parse sql
=> #<PgQuery:0x00007f84741fc1d8
@aliases=nil,
@cte_names=nil,
@query="SELECT $1",
@tables=nil,
@tree=[{"RawStmt"=>{"stmt"=>{"SelectStmt"=>{"targetList"=>[{"ResTarget"=>{"val"=>{"ParamRef"=>{"number"=>1, "location"=>7}}, "location"=>7}}], "op"=>0}}}}],
@warnings=[]>
p.s. reply with gem link to https://stackoverflow.com/questions/30409360/ruby-pg-gem-use-array-as-param-with-exec-params
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.