thecore_mssql_importer_common 0.1.0 → 0.1.1
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af42f5d519bab9f77066ee77d688787da7bc8d06
|
4
|
+
data.tar.gz: 8bd484b0623a3f5ec73dc15cdfe8c1561b167e0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f624d3f59380f72ad908c4ec28f0821507bc395d153b148344a75d1321ec082888ea15c112a97bba7caee0930f789147f3f8f656cf257d84143e252657a89809
|
7
|
+
data.tar.gz: 2d241b04bc496faa084d93f2bca2de45d998e5fec232a70ecf1a278d6c0481c2926b1c897c7cbd3884fd604a99f3520669b30ebece9d1b1d7b4538756a7afb69
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'tiny_tds'
|
2
|
+
|
3
|
+
class MSSQLImporterCommon
|
4
|
+
# "Just tests connection to the DB configured in Settings."
|
5
|
+
def self.ping_mssql_server
|
6
|
+
connect
|
7
|
+
puts 'Connecting to SQL Server'
|
8
|
+
|
9
|
+
if @client.active? == true then puts 'Done' end
|
10
|
+
|
11
|
+
@client.close
|
12
|
+
end
|
13
|
+
|
14
|
+
# "Retrieves all records from the reading table."
|
15
|
+
def self.get_all_records
|
16
|
+
connect
|
17
|
+
# Read all employees
|
18
|
+
puts "Reading data from table"
|
19
|
+
@client.execute("SELECT * FROM #{Settings.ns('mssql_connector').table_read}").each do |row|
|
20
|
+
puts row
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.connect
|
25
|
+
conn = {
|
26
|
+
username: Settings.ns('mssql_connector').username,
|
27
|
+
password: Settings.ns('mssql_connector').password,
|
28
|
+
host: Settings.ns('mssql_connector').host,
|
29
|
+
port: Settings.ns('mssql_connector').port,
|
30
|
+
database: Settings.ns('mssql_connector').database,
|
31
|
+
}
|
32
|
+
@client = TinyTds::Client.new conn
|
33
|
+
end
|
34
|
+
end
|
@@ -1,4 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
require 'tracker_importer'
|
2
|
+
|
3
|
+
namespace :mssql_importer_common do
|
4
|
+
desc "Just tests connection to the DB configured in Settings."
|
5
|
+
task ping_mssql_server: :environment do
|
6
|
+
MSSQLImporterCommon.ping_mssql_server
|
7
|
+
end
|
8
|
+
|
9
|
+
desc "Retrieves all records from the reading table."
|
10
|
+
task get_all_records: :environment do
|
11
|
+
MSSQLImporterCommon.get_all_records
|
12
|
+
end
|
13
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thecore_mssql_importer_common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriele Tassoni
|
@@ -53,6 +53,7 @@ files:
|
|
53
53
|
- config/initializers/thecore_mssql_importer_common_after_initialize.rb
|
54
54
|
- config/routes.rb
|
55
55
|
- db/migrate/20180621103713_add_sql_server_connector_params.rb
|
56
|
+
- lib/mssql_importer_common.rb
|
56
57
|
- lib/tasks/thecore_mssql_importer_common_tasks.rake
|
57
58
|
- lib/thecore_mssql_importer_common.rb
|
58
59
|
- lib/thecore_mssql_importer_common/engine.rb
|