Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed a transactions issue

  • Loading branch information...
commit 8f75dffd0445b3487090ee828e851a40055bf5d8 1 parent 62e9317
@oldmoe oldmoe authored
Showing with 5 additions and 6 deletions.
  1. +5 −6 lib/never_block/db/pooled_fibered_mysql_connection.rb
View
11 lib/never_block/db/pooled_fibered_mysql_connection.rb
@@ -14,29 +14,28 @@ def initialize(size=4, &block)
end
end
- # A proxy for the connection's exec method
+ # A proxy for the connection's query method
# quries the pool to get a connection first
- def exec(query)
+ def query(query)
@pool.hold do |conn|
conn.query(query)
end
end
- alias :query :exec
# This method must be called for transactions to work correctly.
# One cannot just send "begin" as you never know which connection
# will be available next. This method ensures you get the same connection
# while in a transaction.
def begin_db_transaction
@pool.hold(true) do |conn|
- conn.exec("begin")
+ conn.query("begin")
end
end
# see =begin_db_transaction
def rollback_db_transaction
@pool.hold do |conn|
- conn.exec("rollback")
+ conn.query("rollback")
@pool.release(Fiber.current,conn)
end
end
@@ -44,7 +43,7 @@ def rollback_db_transaction
# see =begin_db_transaction
def commit_db_transaction
@pool.hold do |conn|
- conn.exec("commit")
+ conn.query("commit")
@pool.release(Fiber.current,conn)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.