mysql2 0.3.11-x86-mingw32 → 0.3.18-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +15 -0
  2. data/README.md +280 -75
  3. data/ext/mysql2/client.c +721 -206
  4. data/ext/mysql2/client.h +26 -12
  5. data/ext/mysql2/extconf.rb +120 -16
  6. data/ext/mysql2/infile.c +122 -0
  7. data/ext/mysql2/infile.h +1 -0
  8. data/ext/mysql2/mysql2_ext.h +7 -4
  9. data/ext/mysql2/mysql_enc_name_to_ruby.h +168 -0
  10. data/ext/mysql2/mysql_enc_to_ruby.h +246 -0
  11. data/ext/mysql2/result.c +230 -112
  12. data/ext/mysql2/result.h +4 -1
  13. data/lib/mysql2.rb +46 -3
  14. data/lib/mysql2/1.8/mysql2.so +0 -0
  15. data/lib/mysql2/1.9/mysql2.so +0 -0
  16. data/lib/mysql2/2.0/mysql2.so +0 -0
  17. data/lib/mysql2/2.1/mysql2.so +0 -0
  18. data/lib/mysql2/client.rb +48 -200
  19. data/lib/mysql2/console.rb +5 -0
  20. data/lib/mysql2/em.rb +22 -3
  21. data/lib/mysql2/error.rb +71 -6
  22. data/lib/mysql2/mysql2.rb +2 -0
  23. data/lib/mysql2/version.rb +1 -1
  24. data/spec/configuration.yml.example +17 -0
  25. data/spec/em/em_spec.rb +90 -5
  26. data/spec/my.cnf.example +9 -0
  27. data/spec/mysql2/client_spec.rb +501 -69
  28. data/spec/mysql2/error_spec.rb +58 -44
  29. data/spec/mysql2/result_spec.rb +191 -74
  30. data/spec/spec_helper.rb +23 -3
  31. data/spec/test_data +1 -0
  32. data/support/libmysql.def +219 -0
  33. data/support/mysql_enc_to_ruby.rb +82 -0
  34. data/support/ruby_enc_to_mysql.rb +61 -0
  35. data/vendor/README +654 -0
  36. data/vendor/libmysql.dll +0 -0
  37. metadata +86 -221
  38. data/.gitignore +0 -12
  39. data/.rspec +0 -3
  40. data/.rvmrc +0 -1
  41. data/.travis.yml +0 -7
  42. data/CHANGELOG.md +0 -244
  43. data/Gemfile +0 -3
  44. data/MIT-LICENSE +0 -20
  45. data/Rakefile +0 -5
  46. data/benchmark/active_record.rb +0 -51
  47. data/benchmark/active_record_threaded.rb +0 -42
  48. data/benchmark/allocations.rb +0 -33
  49. data/benchmark/escape.rb +0 -36
  50. data/benchmark/query_with_mysql_casting.rb +0 -80
  51. data/benchmark/query_without_mysql_casting.rb +0 -56
  52. data/benchmark/sequel.rb +0 -37
  53. data/benchmark/setup_db.rb +0 -119
  54. data/benchmark/threaded.rb +0 -44
  55. data/mysql2.gemspec +0 -29
  56. data/tasks/benchmarks.rake +0 -20
  57. data/tasks/compile.rake +0 -71
  58. data/tasks/rspec.rake +0 -16
  59. data/tasks/vendor_mysql.rake +0 -40
@@ -1,44 +0,0 @@
1
- # encoding: UTF-8
2
- $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
3
-
4
- require 'rubygems'
5
- require 'benchmark'
6
- require 'active_record'
7
-
8
- mysql2_opts = {
9
- :adapter => 'mysql2',
10
- :database => 'test',
11
- :pool => 25
12
- }
13
- ActiveRecord::Base.establish_connection(mysql2_opts)
14
- x = Benchmark.realtime do
15
- threads = []
16
- 25.times do
17
- threads << Thread.new { ActiveRecord::Base.connection.execute("select sleep(1)") }
18
- end
19
- threads.each {|t| t.join }
20
- end
21
- puts x
22
-
23
- mysql2_opts = {
24
- :adapter => 'mysql',
25
- :database => 'test',
26
- :pool => 25
27
- }
28
- ActiveRecord::Base.establish_connection(mysql2_opts)
29
- x = Benchmark.realtime do
30
- threads = []
31
- 25.times do
32
- threads << Thread.new { ActiveRecord::Base.connection.execute("select sleep(1)") }
33
- end
34
- threads.each {|t| t.join }
35
- end
36
- puts x
37
-
38
- # these results are similar on 1.8.7, 1.9.2 and rbx-head
39
- #
40
- # $ bundle exec ruby benchmarks/threaded.rb
41
- # 1.0774750709533691
42
- #
43
- # and using the mysql gem
44
- # 25.099437952041626
data/mysql2.gemspec DELETED
@@ -1,29 +0,0 @@
1
- require File.expand_path('../lib/mysql2/version', __FILE__)
2
-
3
- Gem::Specification.new do |s|
4
- s.name = %q{mysql2}
5
- s.version = Mysql2::VERSION
6
- s.authors = ["Brian Lopez"]
7
- s.date = Time.now.utc.strftime("%Y-%m-%d")
8
- s.email = %q{seniorlopez@gmail.com}
9
- s.extensions = ["ext/mysql2/extconf.rb"]
10
- s.files = `git ls-files`.split("\n")
11
- s.homepage = %q{http://github.com/brianmario/mysql2}
12
- s.rdoc_options = ["--charset=UTF-8"]
13
- s.require_paths = ["lib"]
14
- s.rubygems_version = %q{1.4.2}
15
- s.summary = %q{A simple, fast Mysql library for Ruby, binding to libmysql}
16
- s.test_files = `git ls-files spec examples`.split("\n")
17
-
18
- # tests
19
- s.add_development_dependency 'eventmachine'
20
- s.add_development_dependency 'rake-compiler', "~> 0.7.7"
21
- s.add_development_dependency 'rake', '0.8.7' # NB: 0.8.7 required by rake-compiler 0.7.9
22
- s.add_development_dependency 'rspec'
23
- # benchmarks
24
- s.add_development_dependency 'activerecord'
25
- s.add_development_dependency 'mysql'
26
- s.add_development_dependency 'do_mysql'
27
- s.add_development_dependency 'sequel'
28
- s.add_development_dependency 'faker'
29
- end
@@ -1,20 +0,0 @@
1
- BENCHMARKS = Dir["#{File.dirname(__FILE__)}/../benchmark/*.rb"].map do |path|
2
- File.basename(path, '.rb')
3
- end.select { |x| x != 'setup_db' }
4
-
5
- namespace :bench do
6
- BENCHMARKS.each do |feature|
7
- desc "Run #{feature} benchmarks"
8
- task(feature){ ruby "benchmark/#{feature}.rb" }
9
- end
10
-
11
- task :all do
12
- BENCHMARKS.each do |feature|
13
- ruby "benchmark/#{feature}.rb"
14
- end
15
- end
16
-
17
- task :setup do
18
- ruby 'benchmark/setup_db'
19
- end
20
- end
data/tasks/compile.rake DELETED
@@ -1,71 +0,0 @@
1
- require "rake/extensiontask"
2
-
3
- CONNECTOR_VERSION = "6.0.2" #"mysql-connector-c-noinstall-6.0.2-win32.zip"
4
- CONNECTOR_MIRROR = ENV['CONNECTOR_MIRROR'] || ENV['MYSQL_MIRROR'] || "http://mysql.he.net/"
5
-
6
- def gemspec
7
- @clean_gemspec ||= eval(File.read(File.expand_path('../../mysql2.gemspec', __FILE__)))
8
- end
9
-
10
- Rake::ExtensionTask.new("mysql2", gemspec) do |ext|
11
- # reference where the vendored MySQL got extracted
12
- connector_lib = File.expand_path(File.join(File.dirname(__FILE__), '..', 'vendor', "mysql-connector-c-noinstall-#{CONNECTOR_VERSION}-win32"))
13
-
14
- # DRY options feed into compile or cross-compile process
15
- windows_options = [
16
- "--with-mysql-include=#{connector_lib}/include",
17
- "--with-mysql-lib=#{connector_lib}/lib"
18
- ]
19
-
20
- # automatically add build options to avoid need of manual input
21
- if RUBY_PLATFORM =~ /mswin|mingw/ then
22
- ext.config_options = windows_options
23
- else
24
- ext.cross_compile = true
25
- ext.cross_platform = ['x86-mingw32', 'x86-mswin32-60']
26
- ext.cross_config_options = windows_options
27
-
28
- # inject 1.8/1.9 pure-ruby entry point when cross compiling only
29
- ext.cross_compiling do |spec|
30
- spec.files << 'lib/mysql2/mysql2.rb'
31
- spec.post_install_message = <<-POST_INSTALL_MESSAGE
32
-
33
- ======================================================================================================
34
-
35
- You've installed the binary version of #{spec.name}.
36
- It was built using MySQL Connector/C version #{CONNECTOR_VERSION}.
37
- It's recommended to use the exact same version to avoid potential issues.
38
-
39
- At the time of building this gem, the necessary DLL files where available
40
- in the following download:
41
-
42
- http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-noinstall-#{CONNECTOR_VERSION}-win32.zip/from/pick
43
-
44
- And put lib\\libmysql.dll file in your Ruby bin directory, for example C:\\Ruby\\bin
45
-
46
- ======================================================================================================
47
-
48
- POST_INSTALL_MESSAGE
49
- end
50
- end
51
-
52
- ext.lib_dir = File.join 'lib', 'mysql2'
53
-
54
- # clean compiled extension
55
- CLEAN.include "#{ext.lib_dir}/*.#{RbConfig::CONFIG['DLEXT']}"
56
- end
57
- Rake::Task[:spec].prerequisites << :compile
58
-
59
- file 'lib/mysql2/mysql2.rb' do |t|
60
- name = gemspec.name
61
- File.open(t.name, 'wb') do |f|
62
- f.write <<-eoruby
63
- RUBY_VERSION =~ /(\\d+.\\d+)/
64
- require "#{name}/\#{$1}/#{name}"
65
- eoruby
66
- end
67
- end
68
-
69
- if Rake::Task.task_defined?(:cross)
70
- Rake::Task[:cross].prerequisites << "lib/mysql2/mysql2.rb"
71
- end
data/tasks/rspec.rake DELETED
@@ -1,16 +0,0 @@
1
- begin
2
- require 'rspec'
3
- require 'rspec/core/rake_task'
4
-
5
- desc "Run all examples with RCov"
6
- RSpec::Core::RakeTask.new('spec:rcov') do |t|
7
- t.rcov = true
8
- end
9
- RSpec::Core::RakeTask.new('spec') do |t|
10
- t.verbose = true
11
- end
12
-
13
- task :default => :spec
14
- rescue LoadError
15
- puts "rspec, or one of its dependencies, is not available. Install it with: sudo gem install rspec"
16
- end
@@ -1,40 +0,0 @@
1
- require 'rake/clean'
2
- require 'rake/extensioncompiler'
3
-
4
- # download mysql library and headers
5
- directory "vendor"
6
-
7
- file "vendor/mysql-connector-c-noinstall-#{CONNECTOR_VERSION}-win32.zip" => ["vendor"] do |t|
8
- url = "http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-noinstall-#{CONNECTOR_VERSION}-win32.zip/from/#{CONNECTOR_MIRROR}/"
9
- when_writing "downloading #{t.name}" do
10
- cd File.dirname(t.name) do
11
- sh "wget -c #{url} || curl -C - -O #{url}"
12
- end
13
- end
14
- end
15
-
16
- file "vendor/mysql-connector-c-noinstall-#{CONNECTOR_VERSION}-win32/include/mysql.h" => ["vendor/mysql-connector-c-noinstall-#{CONNECTOR_VERSION}-win32.zip"] do |t|
17
- full_file = File.expand_path(t.prerequisites.last)
18
- when_writing "creating #{t.name}" do
19
- cd "vendor" do
20
- sh "unzip #{full_file} mysql-connector-c-noinstall-#{CONNECTOR_VERSION}-win32/bin/** mysql-connector-c-noinstall-#{CONNECTOR_VERSION}-win32/include/** mysql-connector-c-noinstall-#{CONNECTOR_VERSION}-win32/lib/**"
21
- end
22
- # update file timestamp to avoid Rake perform this extraction again.
23
- touch t.name
24
- end
25
- end
26
-
27
- # clobber expanded packages
28
- CLOBBER.include("vendor/mysql-connector-c-noinstall-#{CONNECTOR_VERSION}-win32")
29
-
30
- # vendor:mysql
31
- task 'vendor:mysql' => ["vendor/mysql-connector-c-noinstall-#{CONNECTOR_VERSION}-win32/include/mysql.h"]
32
-
33
- # hook into cross compilation vendored mysql dependency
34
- if RUBY_PLATFORM =~ /mingw|mswin/ then
35
- Rake::Task['compile'].prerequisites.unshift 'vendor:mysql'
36
- else
37
- if Rake::Task.tasks.map {|t| t.name }.include? 'cross'
38
- Rake::Task['cross'].prerequisites.unshift 'vendor:mysql'
39
- end
40
- end