Class: ThinkingSphinx::Connection::Client
- Inherits:
-
Object
- Object
- ThinkingSphinx::Connection::Client
- Defined in:
- lib/thinking_sphinx/connection/client.rb
Instance Method Summary collapse
- #close ⇒ Object
- #close! ⇒ Object
- #execute(statement) ⇒ Object
-
#initialize(options) ⇒ Client
constructor
A new instance of Client.
- #query_all(*statements) ⇒ Object
Constructor Details
#initialize(options) ⇒ Client
Returns a new instance of Client.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/thinking_sphinx/connection/client.rb', line 4 def initialize() if [:socket].present? [:socket] = [:socket].remove /:mysql41$/ .delete :host .delete :port else .delete :socket # If you use localhost, MySQL insists on a socket connection, but in this # situation we want a TCP connection. Using 127.0.0.1 fixes that. if [:host].nil? || [:host] == "localhost" [:host] = "127.0.0.1" end end @options = end |
Instance Method Details
#close ⇒ Object
23 24 25 |
# File 'lib/thinking_sphinx/connection/client.rb', line 23 def close close! unless ThinkingSphinx::Connection.persistent? end |
#close! ⇒ Object
27 28 29 |
# File 'lib/thinking_sphinx/connection/client.rb', line 27 def close! client.close end |
#execute(statement) ⇒ Object
31 32 33 |
# File 'lib/thinking_sphinx/connection/client.rb', line 31 def execute(statement) check_and_perform(statement).first end |
#query_all(*statements) ⇒ Object
35 36 37 |
# File 'lib/thinking_sphinx/connection/client.rb', line 35 def query_all(*statements) check_and_perform statements.join('; ') end |