dbviewer 0.9.0 → 0.9.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
  SHA256:
3
- metadata.gz: da5b1e52cd18bd48043589666bfca92019afbf065b2b327d415aa2bacf85658b
4
- data.tar.gz: d5061713ee1b8726289202bd77972c95cc1383ab9b30b859020ca76a8a8e186b
3
+ metadata.gz: 897715943af7ce5d339aebb00b03bc13e1abc728c5e09d9615ec7189555cf014
4
+ data.tar.gz: 3ee632c6e1a6cc9fe5e5df08277520a0ea6a705e20a84bcab1756acd27a0f031
5
5
  SHA512:
6
- metadata.gz: 8e75e627915d175150dc88030b11ea6ea961f832f24c7ab2144d90939b6ed76676db7994e2741acaec5e06a6541bbcd0eca8dd5752c0e21bac1f7288f0479234
7
- data.tar.gz: d04158eaedb765a5b22af6e9ceec3b6817f5e11a6980affd47a1ace976c8f20d4a868dd93031cf463ae8f73462e6b79dd562356087090cbcc17c3b46092ca34d
6
+ metadata.gz: 010a246eb09d2a6841c01bb3b87553b89ed4050a8781572a5b016894b208688d495744a1539636e8655c6ea7778449a2d0b9c0e204b0be5d7b68c2ee6ac883e3
7
+ data.tar.gz: e4142876a0867ebc55655469e8b85f240cc5a48b9b45ffb1d5bec89ab38939b95e996dcba1fa9b2555658cd1276415d24d14ae57ad98554b4f1a852beb8e0632
@@ -75,14 +75,6 @@ module Dbviewer
75
75
  "Access denied: Table access is restricted"
76
76
  end
77
77
  end
78
-
79
- private
80
-
81
- # For backwards compatibility, we keep this method but delegate to SqlParser
82
- # @deprecated Use SqlParser.extract_table_names directly
83
- def extract_table_names_from_sql(sql)
84
- @sql_parser.extract_table_names(sql)
85
- end
86
78
  end
87
79
  end
88
80
  end
@@ -1,3 +1,3 @@
1
1
  module Dbviewer
2
- VERSION = "0.9.0"
2
+ VERSION = "0.9.1"
3
3
  end
data/lib/dbviewer.rb CHANGED
@@ -84,26 +84,6 @@ module Dbviewer
84
84
  @configuration = Configuration.new
85
85
  end
86
86
 
87
- # This class method will be called by the engine when it's appropriate
88
- def setup
89
- configure_query_logger
90
- # Database connections will be validated when first accessed
91
- Rails.logger.info "DBViewer: Initialized successfully (database connections will be validated on first access)"
92
- end
93
-
94
- # Validate database connections on-demand (called when first accessing DBViewer)
95
- def validate_connections!
96
- connection_errors = configuration.database_connections.filter_map do |key, config|
97
- validate_single_connection(key, config)
98
- end
99
-
100
- if connection_errors.length == configuration.database_connections.length
101
- raise "DBViewer could not connect to any configured database. Please check your database configuration."
102
- end
103
-
104
- connection_errors
105
- end
106
-
107
87
  # Configure PII masking rules using a block
108
88
  #
109
89
  # @example
@@ -120,62 +100,14 @@ module Dbviewer
120
100
  yield(PiiConfigurator.new(configuration)) if block_given?
121
101
  end
122
102
 
123
- private
124
-
125
- # Configure the query logger with current configuration settings
126
- def configure_query_logger
103
+ # This class method will be called by the engine when it's appropriate
104
+ def setup
127
105
  Dbviewer::Query::Logger.configure(
128
106
  enable_query_logging: configuration.enable_query_logging,
129
107
  query_logging_mode: configuration.query_logging_mode
130
108
  )
131
- end
132
-
133
- # Validate a single database connection
134
- # @param key [Symbol] The connection key
135
- # @param config [Hash] The connection configuration
136
- # @return [Hash, nil] Error hash if validation failed, nil if successful
137
- def validate_single_connection(key, config)
138
- connection_class = resolve_connection_class(config)
139
- return { key: key, error: "No valid connection configuration found for #{key}" } unless connection_class
140
-
141
- test_connection(connection_class, config, key)
142
- store_resolved_connection(config, connection_class)
143
- nil
144
- rescue => e
145
- Rails.logger.error "DBViewer could not connect to #{config[:name] || key.to_s} database: #{e.message}"
146
- { key: key, error: e.message }
147
- end
148
-
149
- # Resolve the connection class from configuration
150
- # @param config [Hash] The connection configuration
151
- # @return [Class, nil] The resolved connection class or nil
152
- def resolve_connection_class(config)
153
- return config[:connection] if config[:connection]
154
- return nil unless config[:connection_class].is_a?(String)
155
-
156
- begin
157
- config[:connection_class].constantize
158
- rescue NameError => e
159
- Rails.logger.warn "DBViewer could not load connection class #{config[:connection_class]}: #{e.message}"
160
- nil
161
- end
162
- end
163
-
164
- # Test the database connection
165
- # @param connection_class [Class] The connection class
166
- # @param config [Hash] The connection configuration
167
- # @param key [Symbol] The connection key
168
- def test_connection(connection_class, config, key)
169
- connection = connection_class.connection
170
- adapter_name = connection.adapter_name
171
- Rails.logger.info "DBViewer successfully connected to #{config[:name] || key.to_s} database (#{adapter_name})"
172
- end
173
109
 
174
- # Store the resolved connection class back in the config
175
- # @param config [Hash] The connection configuration
176
- # @param connection_class [Class] The resolved connection class
177
- def store_resolved_connection(config, connection_class)
178
- config[:connection] = connection_class
110
+ Rails.logger.info "DBViewer: Initialized successfully"
179
111
  end
180
112
  end
181
113
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dbviewer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wailan Tirajoh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-06-27 00:00:00.000000000 Z
11
+ date: 2025-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails