Class: MSSQLImporterCommon
- Inherits:
-
Object
- Object
- MSSQLImporterCommon
- Defined in:
- lib/mssql_importer_common.rb
Class Method Summary collapse
- .connect ⇒ Object
-
.get_all_records ⇒ Object
“Retrieves all records from the reading table.”.
-
.ping_mssql_server ⇒ Object
“Just tests connection to the DB configured in Settings.”.
Class Method Details
.connect ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/mssql_importer_common.rb', line 24 def self.connect conn = { username: Settings.ns('mssql_connector').username, password: Settings.ns('mssql_connector').password, host: Settings.ns('mssql_connector').host, port: Settings.ns('mssql_connector').port, database: Settings.ns('mssql_connector').database, } @client = TinyTds::Client.new conn end |
.get_all_records ⇒ Object
“Retrieves all records from the reading table.”
15 16 17 18 19 20 21 22 |
# File 'lib/mssql_importer_common.rb', line 15 def self.get_all_records connect # Read all employees puts "Reading data from table" @client.execute("SELECT * FROM #{Settings.ns('mssql_connector').table_read}").each do |row| puts row end end |
.ping_mssql_server ⇒ Object
“Just tests connection to the DB configured in Settings.”
5 6 7 8 9 10 11 12 |
# File 'lib/mssql_importer_common.rb', line 5 def self.ping_mssql_server connect puts 'Connecting to SQL Server' if @client.active? == true then puts 'Done' end @client.close end |