update the RB_UBF_DL for more recent versions of Ruby 1.9, which doesn't have it
This commit is contained in:
parent
16d9c043c2
commit
02e265072c
@ -31,8 +31,9 @@ else
|
||||
exit 1
|
||||
end
|
||||
|
||||
if have_func('rb_thread_blocking_region') and have_macro('RB_UBF_DFL', 'ruby.h')
|
||||
flags << "-DHAVE_TBR"
|
||||
# check for 1.9
|
||||
if have_func('rb_thread_blocking_region') and have_macro('RUBY_UBF_IO', 'ruby.h')
|
||||
$CFLAGS += " -DHAVE_TBR "
|
||||
end
|
||||
|
||||
# make mysql constant
|
||||
@ -71,9 +72,4 @@ File.open('error_const.h', 'w') do |f|
|
||||
end
|
||||
end
|
||||
|
||||
# check for 1.9
|
||||
if have_func('rb_thread_blocking_region') and have_macro('RB_UBF_DFL', 'ruby.h')
|
||||
$CFLAGS += " -DHAVE_TBR"
|
||||
end
|
||||
|
||||
create_makefile("mysql")
|
||||
|
@ -711,17 +711,16 @@ static VALUE store_result(VALUE obj)
|
||||
MYSQL_RES* res = NULL;
|
||||
#ifndef HAVE_TBR
|
||||
res = mysql_store_result(m);
|
||||
//store_result_to_location(m, &res);
|
||||
#else
|
||||
mysql_result_to_here_t linker;
|
||||
linker.mysql_instance = m;
|
||||
linker.store_it_here = &res;
|
||||
//store_result_to_location((void *) &linker);
|
||||
rb_thread_blocking_region(store_result_to_location, (void *) &linker, RB_UBF_DFL, 0);
|
||||
rb_thread_blocking_region(store_result_to_location, (void *) &linker, RUBY_UBF_IO, 0); /* not sure if this should be RUBY_UBF_IO or RUBY_UBF_PROCESS here -- see Ruby 1.9 ChangeLog */
|
||||
#endif
|
||||
|
||||
if (res == NULL)
|
||||
mysql_raise(m);
|
||||
|
||||
return mysqlres2obj(res);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
# shows the effect of using .all_hashes instead of looping on each hash
|
||||
# run it by substiting in a 'long' [many row] query for the query variable and toggling use_all_hashes here at the top
|
||||
# note that we load all the rows first, then run .all_hashes on the result [to see more easily the effect of all hashes]
|
||||
# on my machine and a 200_000 row table, it took 3.38s versus 3.65s
|
||||
# on my machine and a 200_000 row table, it took 3.38s versus 3.65s for the old .each_hash way [note also that .each_hash is
|
||||
# almost as fast, now, as .all_hashes--they've both been optimized]
|
||||
require 'mysqlplus'
|
||||
|
||||
use_the_all_hashes_method = true
|
||||
|
Loading…
Reference in New Issue
Block a user