logstash-output-charrington 0.2.1 → 0.2.2
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 +4 -4
- data/README.md +1 -0
- data/lib/logstash/outputs/charrington/alter_table.rb +12 -4
- data/logstash-output-charrington.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95cf47c25df7b4666cfc94d7ca2c4b964164a0d76b57ce62993f8cd5c4d53bcd
|
4
|
+
data.tar.gz: 5a5eb5c0323f16d0b9143d6953dcf24fdf9f430e56a751412142f2f7c01dea93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f88562ff8b73f92e22750359178f301c5fef58bd1e2361c9d1d88e8b2c08bba7b69d001be8c5a87fbd2b741ff6bff70138d954a7f094c7794d2155c9103bea23
|
7
|
+
data.tar.gz: dcdd5585b34e0335693a42a04f4b0897632c7f441ad4cac419975fcca863ea6c3b8eb58154ea8f111557d2d2743c4b4b1d8659c6a5129408134961fed8bf4699
|
data/README.md
CHANGED
@@ -66,11 +66,13 @@ module Charrington
|
|
66
66
|
|
67
67
|
def current_table_columns
|
68
68
|
sql = "SELECT * FROM #{table_name} LIMIT 1;"
|
69
|
-
rs = executeQuery(sql)
|
69
|
+
stmt, rs = executeQuery(prep_sql(sql))
|
70
70
|
meta_data = rs.getMetaData()
|
71
|
+
stmt.close unless stmt.nil?
|
71
72
|
column_count = meta_data.getColumnCount()
|
72
|
-
|
73
73
|
(1..column_count).map {|i| meta_data.getColumnName(i) }
|
74
|
+
ensure
|
75
|
+
stmt.close unless stmt.nil?
|
74
76
|
end
|
75
77
|
|
76
78
|
def execute(sql)
|
@@ -84,10 +86,16 @@ module Charrington
|
|
84
86
|
|
85
87
|
def executeQuery(sql)
|
86
88
|
stmt = connection.createStatement()
|
87
|
-
|
89
|
+
# only close the statement if something goes wrong
|
90
|
+
# otherwise, the caller is responsible for closing the
|
91
|
+
# statement when they are doen with the result set
|
92
|
+
return stmt, stmt.executeQuery(prep_sql(sql))
|
88
93
|
rescue Java::OrgPostgresqlUtil::PSQLException => e
|
94
|
+
puts "PSQLException: #{e.message}"
|
95
|
+
stmt.close unless stmt.nil?
|
89
96
|
# @logger.error("#{e.message}")
|
90
|
-
|
97
|
+
rescue => e
|
98
|
+
puts "Unknown exception: #{e.message}"
|
91
99
|
stmt.close unless stmt.nil?
|
92
100
|
end
|
93
101
|
|