Merge branch 'master' into stmt

* master:
  only use wait_timeout if it's a Fixnum
  update gemspec from file updates
  no need to invalidate the FD now that we're only modifying it once, in one place
  no need to check if the FD is >= 0 now that we centralized the close/free logic. Once closed, none of that code will run again
  wording fix in readme
This commit is contained in:
Brian Lopez 2010-10-18 12:15:35 -07:00
commit f6d7e877b2
4 changed files with 19 additions and 22 deletions

View File

@ -234,7 +234,7 @@ then iterating over every row using an #each like method yielding a block:
== Special Thanks == Special Thanks
* Eric Wong - for the contribution (and informative explanations of) of some thread-safety, non-blocking I/O and cleanup patches. You rock dude * Eric Wong - for the contribution (and the informative explanations) of some thread-safety, non-blocking I/O and cleanup patches. You rock dude
* Yury Korolev (http://github.com/yury) - for TONS of help testing the ActiveRecord adapter * Yury Korolev (http://github.com/yury) - for TONS of help testing the ActiveRecord adapter
* Aaron Patterson (http://github.com/tenderlove) - tons of contributions, suggestions and general badassness * Aaron Patterson (http://github.com/tenderlove) - tons of contributions, suggestions and general badassness
* Mike Perham (http://github.com/mperham) - Async ActiveRecord adapter (uses Fibers and EventMachine) * Mike Perham (http://github.com/mperham) - Async ActiveRecord adapter (uses Fibers and EventMachine)

View File

@ -113,26 +113,21 @@ static VALUE nogvl_close(void *ptr) {
* we'll send a QUIT message to the server, but that message is more of a * we'll send a QUIT message to the server, but that message is more of a
* formality than a hard requirement since the socket is getting shutdown * formality than a hard requirement since the socket is getting shutdown
* anyways, so ensure the socket write does not block our interpreter * anyways, so ensure the socket write does not block our interpreter
*/ *
int fd = wrapper->client->net.fd; *
if (fd >= 0) {
/*
* if the socket is dead we have no chance of blocking, * if the socket is dead we have no chance of blocking,
* so ignore any potential fcntl errors since they don't matter * so ignore any potential fcntl errors since they don't matter
*/ */
#ifndef _WIN32 #ifndef _WIN32
int flags = fcntl(fd, F_GETFL); int flags = fcntl(wrapper->client->net.fd, F_GETFL);
if (flags > 0 && !(flags & O_NONBLOCK)) if (flags > 0 && !(flags & O_NONBLOCK))
fcntl(fd, F_SETFL, flags | O_NONBLOCK); fcntl(wrapper->client->net.fd, F_SETFL, flags | O_NONBLOCK);
#else #else
u_long iMode = 1; u_long iMode = 1;
ioctlsocket(fd, FIONBIO, &iMode); ioctlsocket(wrapper->client->net.fd, FIONBIO, &iMode);
#endif #endif
}
mysql_close(wrapper->client); mysql_close(wrapper->client);
wrapper->client->net.fd = -1;
free(wrapper->client); free(wrapper->client);
} }

View File

@ -622,7 +622,8 @@ module ActiveRecord
variable_assignments << "NAMES '#{encoding}'" if encoding variable_assignments << "NAMES '#{encoding}'" if encoding
# increase timeout so mysql server doesn't disconnect us # increase timeout so mysql server doesn't disconnect us
variable_assignments << "@@wait_timeout = #{@config[:wait_timeout] || 2592000}" wait_timeout = @config[:wait_timeout] || 2592000
variable_assignments << "@@wait_timeout = #{wait_timeout}" if wait_timeout.is_a?(Fixnum)
execute("SET #{variable_assignments.join(', ')}", :skip_logging) execute("SET #{variable_assignments.join(', ')}", :skip_logging)
end end

View File

@ -9,7 +9,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Brian Lopez"] s.authors = ["Brian Lopez"]
s.date = %q{2010-09-17} s.date = %q{2010-10-18}
s.email = %q{seniorlopez@gmail.com} s.email = %q{seniorlopez@gmail.com}
s.extensions = ["ext/mysql2/extconf.rb"] s.extensions = ["ext/mysql2/extconf.rb"]
s.extra_rdoc_files = [ s.extra_rdoc_files = [
@ -17,6 +17,7 @@ Gem::Specification.new do |s|
] ]
s.files = [ s.files = [
".gitignore", ".gitignore",
".rspec",
"CHANGELOG.md", "CHANGELOG.md",
"MIT-LICENSE", "MIT-LICENSE",
"README.rdoc", "README.rdoc",
@ -29,7 +30,6 @@ Gem::Specification.new do |s|
"benchmark/query_without_mysql_casting.rb", "benchmark/query_without_mysql_casting.rb",
"benchmark/sequel.rb", "benchmark/sequel.rb",
"benchmark/setup_db.rb", "benchmark/setup_db.rb",
"benchmark/thread_alone.rb",
"examples/eventmachine.rb", "examples/eventmachine.rb",
"examples/threaded.rb", "examples/threaded.rb",
"ext/mysql2/client.c", "ext/mysql2/client.c",
@ -54,10 +54,11 @@ Gem::Specification.new do |s|
"spec/mysql2/error_spec.rb", "spec/mysql2/error_spec.rb",
"spec/mysql2/result_spec.rb", "spec/mysql2/result_spec.rb",
"spec/rcov.opts", "spec/rcov.opts",
"spec/spec.opts",
"spec/spec_helper.rb", "spec/spec_helper.rb",
"tasks/benchmarks.rake", "tasks/benchmarks.rake",
"tasks/compile.rake", "tasks/compile.rake",
"tasks/jeweler.rake",
"tasks/rspec.rake",
"tasks/vendor_mysql.rake" "tasks/vendor_mysql.rake"
] ]
s.homepage = %q{http://github.com/brianmario/mysql2} s.homepage = %q{http://github.com/brianmario/mysql2}