Class: FluentQuery::Drivers::MySQL
- Inherits:
-
DBI
- Object
- DBI
- FluentQuery::Drivers::MySQL
- Defined in:
- lib/fluent-query/drivers/mysql.rb
Overview
MySQL database driver.
Constant Summary collapse
- @@__known_tokens =
Known tokens index. (internal cache)
Hash::new do |hash, key| hash[key] = { } end
Instance Method Summary collapse
- #driver_name ⇒ Object
- #known_token?(group, token_name) ⇒ Boolean
- #native_connection ⇒ Object
- #open_connection(settings) ⇒ Object
- #quote_identifier(field) ⇒ Object
Instance Method Details
#driver_name ⇒ Object
42 43 44 |
# File 'lib/fluent-query/drivers/mysql.rb', line 42 def driver_name "Mysql" end |
#known_token?(group, token_name) ⇒ Boolean
29 30 31 |
# File 'lib/fluent-query/drivers/mysql.rb', line 29 def known_token?(group, token_name) super(group, token_name, @@__known_tokens) end |
#native_connection ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/fluent-query/drivers/mysql.rb', line 67 def native_connection super() # Gets settings encoding = @_nconnection_settings[:encoding] if encoding.nil? encoding = "utf8" end # Sets encoding and default schema @_nconnection.do("SET NAMES " + self.quote_string(encoding) + ";") return @_nconnection end |
#open_connection(settings) ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/fluent-query/drivers/mysql.rb', line 54 def open_connection(settings) if not settings[:database] or not settings[:username] raise FluentQuery::Drivers::Exception::new("Database name and username is required for connection.") end super(settings) end |
#quote_identifier(field) ⇒ Object
90 91 92 |
# File 'lib/fluent-query/drivers/mysql.rb', line 90 def quote_identifier(field) '`' + field.to_s.gsub(".", '`.`') + '`' end |