Class: FluentQuery::Drivers::SQLite3

Inherits:
DBI
  • Object
show all
Defined in:
lib/fluent-query/drivers/sqlite3.rb

Overview

SQLite3 database driver.

Constant Summary collapse

@@__known_tokens =

Known tokens index. (internal cache)

Hash::new do |hash, key| 
    hash[key] = { }
end

Instance Method Summary collapse

Instance Method Details

#authentificationObject



88
89
90
# File 'lib/fluent-query/drivers/sqlite3.rb', line 88

def authentification
    @_nconnection_settings.take_values(:username, :password)
end

#connection_stringObject



67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/fluent-query/drivers/sqlite3.rb', line 67

def connection_string
    if @_nconnection_settings.nil?
        raise FluentQuery::Drivers::Exception::new('Connection settings hasn\'t been assigned yet.')
    end
    
    # Gets settings                        
    file = @_nconnection_settings[:file]
    
    # Builds connection string and other parameters
    connection_string = "DBI:SQLite3:" << file.to_s
    
    # Returns
    return connection_string
end

#driver_nameObject



41
42
43
# File 'lib/fluent-query/drivers/sqlite3.rb', line 41

def driver_name
    "SQLite3"
end

#known_token?(group, token_name) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/fluent-query/drivers/sqlite3.rb', line 28

def known_token?(group, token_name)
    super(group, token_name, @@__known_tokens)
end

#open_connection(settings) ⇒ Object



53
54
55
56
57
58
59
# File 'lib/fluent-query/drivers/sqlite3.rb', line 53

def open_connection(settings)
    if not settings[:file]
        raise FluentQuery::Drivers::Exception::new("Database file name is required for connection.")
    end
    
    super(settings)
end