methodmissing-mysqlplus_adapter 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.textile
CHANGED
@@ -91,7 +91,11 @@ This concept is quite useful in an MVC context, allowing the controller to fetch
|
|
91
91
|
def index
|
92
92
|
# No blocking, executes in the background, yields a deferrable result.
|
93
93
|
#
|
94
|
-
@posts = Posts.published.find(:all, :defer => true )
|
94
|
+
@posts = Posts.published.find(:all, :defer => true ) # Slow, push to the background
|
95
|
+
@visitors = Site.visitors.recent # Snappy
|
96
|
+
# You don't want to do this. Try to not invoke methods on deferred results right away
|
97
|
+
# to minimize potential blocking.
|
98
|
+
@posts.any?
|
95
99
|
end
|
96
100
|
|
97
101
|
end
|
data/VERSION.yml
CHANGED
@@ -32,6 +32,24 @@ module ActiveRecord
|
|
32
32
|
@connection.socket
|
33
33
|
end
|
34
34
|
|
35
|
+
# Send a query in an async non-blocking manner
|
36
|
+
#
|
37
|
+
def send_query( sql, name = nil, skip_logging = false )
|
38
|
+
if skip_logging
|
39
|
+
@connection.send_query( sql )
|
40
|
+
else
|
41
|
+
log("(Socket #{socket.to_s}, Thread #{Thread.current.object_id.to_s}) #{sql}",name) do
|
42
|
+
@connection.send_query( sql )
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# Retrieve a #send_query result set
|
48
|
+
#
|
49
|
+
def get_result
|
50
|
+
@connection.get_result
|
51
|
+
end
|
52
|
+
|
35
53
|
def execute(sql, name = nil, skip_logging = false) #:nodoc:
|
36
54
|
if skip_logging
|
37
55
|
@connection.c_async_query( sql )
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require "#{File.dirname(__FILE__)}/helper"
|
2
|
+
|
3
|
+
Mysqlplus::Test.prepare!
|
4
|
+
|
5
|
+
class MysqlPlusAdapterTest < ActiveSupport::TestCase
|
6
|
+
|
7
|
+
test "should be able to execute queries in an async manner" do
|
8
|
+
MysqlUser.connection.send_query( "SELECT * FROM mysql.user WHERE User = 'root'" )
|
9
|
+
assert_instance_of Mysql::Result, MysqlUser.connection.get_result
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: methodmissing-mysqlplus_adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Lourens Naud\xC3\xA9"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-02-
|
12
|
+
date: 2009-02-17 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -43,6 +43,7 @@ files:
|
|
43
43
|
- test/models
|
44
44
|
- test/models/mysql_user.rb
|
45
45
|
- test/models/mysql_user_info.rb
|
46
|
+
- test/mysqlplus_adapter_test.rb
|
46
47
|
has_rdoc: true
|
47
48
|
homepage: http://github.com/methodmissing/mysqplus_adapter
|
48
49
|
post_install_message:
|