You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Maybe I'm doing something wrong here (or misunderstanding things) but this returns true:
puts "Prepared: #{db.prepared_statements?}"
I then ran this:
db.transaction do |trx|
e1 = Time.measure do
stmt = trx.connection.build("insert into junk(c1, c2, c3) values ($1, $2, $3)")
10.times do |i|
stmt.exec(i, ">" + i.to_s + "<", i & 2 == 0)
end
end
puts "e1 = #{e1}"
e2 = Time.measure do
10.times do |i|
trx.connection.exec("insert into junk(c1, c2, c3) values ($1, $2, $3)", i, ">" + i.to_s + "<", i & 2 == 0)
end
end
puts "e2 = #{e2}"
trx.rollback
end
I tailed the database log file and expected to see 1 parse followed by 10 sets of bind and execute with the first block, and 10 sets of parse, bind and execute with the second block. However, in both cases I see 10 sets of parse, bind and execute, so I'm wondering if I've misunderstood the purpose of Connection#build.
I noticed #97 so I'm wondering why the pg driver returns true for Connection#prepared_statements? ?
Thanks,
Steve
The text was updated successfully, but these errors were encountered:
Maybe. It depends on the underlying implementation or protocol. In mysql the binary and text protocol that are used for prepared or unprepared statements is very different. In sqlite all the statements are prepared. I don’t know about the internals of pg protocol.
Maybe I'm doing something wrong here (or misunderstanding things) but this returns
true
:I then ran this:
I tailed the database log file and expected to see 1 parse followed by 10 sets of bind and execute with the first block, and 10 sets of parse, bind and execute with the second block. However, in both cases I see 10 sets of parse, bind and execute, so I'm wondering if I've misunderstood the purpose of
Connection#build
.I noticed #97 so I'm wondering why the pg driver returns
true
forConnection#prepared_statements?
?Thanks,
Steve
The text was updated successfully, but these errors were encountered: