mysql_incremental_query 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +11 -0
- data/LICENSE +20 -0
- data/Rakefile +45 -0
- data/VERSION +1 -0
- data/lib/mysql_incremental_query.rb +15 -0
- metadata +68 -0
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Burke Libbey, Thorkelson Consulting Ltd.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "mysql_incremental_query"
|
8
|
+
gem.summary = "Query massive datasets without initial query delay"
|
9
|
+
gem.description = "Skips the initial phase where mysql sends the entire result set to ruby, instead loading records as they're consumed."
|
10
|
+
gem.email = "burke@burkelibbey.org"
|
11
|
+
gem.homepage = "http://github.com/burke/mysql_incremental_query"
|
12
|
+
gem.authors = ["Burke Libbey"]
|
13
|
+
gem.files.include '{spec,lib}/**/*'
|
14
|
+
gem.add_dependency "mysql"
|
15
|
+
end
|
16
|
+
rescue LoadError
|
17
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
18
|
+
end
|
19
|
+
|
20
|
+
begin
|
21
|
+
require 'rcov/rcovtask'
|
22
|
+
Rcov::RcovTask.new do |test|
|
23
|
+
test.libs << 'spec'
|
24
|
+
test.pattern = 'spec/**/*_spec.rb'
|
25
|
+
test.verbose = true
|
26
|
+
end
|
27
|
+
rescue LoadError
|
28
|
+
task :rcov do
|
29
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
require 'rake/rdoctask'
|
34
|
+
Rake::RDocTask.new do |rdoc|
|
35
|
+
if File.exist?('VERSION')
|
36
|
+
version = File.read('VERSION')
|
37
|
+
else
|
38
|
+
version = ""
|
39
|
+
end
|
40
|
+
|
41
|
+
rdoc.rdoc_dir = 'rdoc'
|
42
|
+
rdoc.title = "multilogger #{version}"
|
43
|
+
rdoc.rdoc_files.include('README*')
|
44
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
45
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class Mysql
|
2
|
+
def incremental_query(query, &block)
|
3
|
+
result = nil;
|
4
|
+
def result.free;end
|
5
|
+
begin
|
6
|
+
qwr = self.query_with_result
|
7
|
+
self.query_with_result = false
|
8
|
+
result = self.query(query).use_result
|
9
|
+
result.each { |row| yield(row) }
|
10
|
+
self.query_with_result = qwr
|
11
|
+
ensure
|
12
|
+
result.free
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mysql_incremental_query
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Burke Libbey
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-01-14 00:00:00 -06:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: mysql
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
description: Skips the initial phase where mysql sends the entire result set to ruby, instead loading records as they're consumed.
|
26
|
+
email: burke@burkelibbey.org
|
27
|
+
executables: []
|
28
|
+
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files:
|
32
|
+
- LICENSE
|
33
|
+
files:
|
34
|
+
- .gitignore
|
35
|
+
- LICENSE
|
36
|
+
- Rakefile
|
37
|
+
- VERSION
|
38
|
+
- lib/mysql_incremental_query.rb
|
39
|
+
has_rdoc: true
|
40
|
+
homepage: http://github.com/burke/mysql_incremental_query
|
41
|
+
licenses: []
|
42
|
+
|
43
|
+
post_install_message:
|
44
|
+
rdoc_options:
|
45
|
+
- --charset=UTF-8
|
46
|
+
require_paths:
|
47
|
+
- lib
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: "0"
|
53
|
+
version:
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: "0"
|
59
|
+
version:
|
60
|
+
requirements: []
|
61
|
+
|
62
|
+
rubyforge_project:
|
63
|
+
rubygems_version: 1.3.5
|
64
|
+
signing_key:
|
65
|
+
specification_version: 3
|
66
|
+
summary: Query massive datasets without initial query delay
|
67
|
+
test_files: []
|
68
|
+
|