Skip to content

Commit 33405e1

Browse files
committed
Fix quote handling in JS
1 parent fe1281e commit 33405e1

File tree

6 files changed

+62
-30
lines changed

6 files changed

+62
-30
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Change log of Panorama for Oracle
22
## [Unreleased]
33

4-
## Relese 2.19.10
4+
## Relese 2.19.11
55
- 2026-03-23 Run and show optimizer trace from SQL details page for SQLs from SGA
66

77
## Relese 2.19.9

app/controllers/dba_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1868,7 +1868,7 @@ def show_trace_files
18681868
render_partial
18691869
end
18701870

1871-
# Generator a trace file of optimizer parse process
1871+
# Generate a trace file of optimizer parse process
18721872
# The SQL must be in v$SQL of the current instance
18731873
def optimizer_parse_trace
18741874
@sql_id = prepare_param :sql_id

app/helpers/application_helper.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ def get_recall_params_info_for_render_page_caption
557557
:hint => t(:addition_copy_recall_params_hint, :default=>"Copy request parameter to clipboard which allows you to reconstruct/replay this page later\nCall menu &#39Spec. additions / Execute with given parameters&#39 and paste this info to reconstruct your page at later time."),
558558
:icon_class => 'cui-copy',
559559
show_icon_in_caption: true,
560-
:action => "copy_to_clipboard('#{request.parameters.except(:update_area, :browser_tab_id).to_json.gsub("'", ''')}'); alert('#{t(:addition_copy_recall_params_answer, :default=>"Current request parameters are copied to clipboard.\nUse menu \"Spec. additions / Execute with given parameters\" to paste this parameters").gsub("\n", '\\n')}');"
560+
:action => "copy_to_clipboard('#{request.parameters.except(:update_area, :browser_tab_id).to_json.gsub("'", ''').gsub('"', """)}'); show_popup_message('#{t(:addition_copy_recall_params_answer, :default=>"Current request parameters are copied to clipboard.\nUse menu \"Spec. additions / Execute with given parameters\" to paste this parameters").gsub("\n", '\\n').gsub('"', """)}');"
561561
}
562562
end
563563

@@ -588,7 +588,11 @@ def sql_select_iterator(sql, modifier: nil, query_name: 'sql_select_iterator', c
588588
PanoramaConnection.sql_select_iterator(sql, modifier: modifier, query_name: query_name, convert_tz: convert_tz)
589589
end
590590

591-
# Select genau erste Zeile
591+
# Select exactly the first line of a result
592+
# @param [String, Array] sql The sql with optional bind parameters
593+
# @param [String] query_name The name for log output
594+
# @param [Boolean] convert_tz Should the time zone of date or time values be converted to the browser client timezone
595+
# @return [Hash,nil]
592596
def sql_select_first_row(sql, query_name: 'sql_select_first_row', convert_tz: true)
593597
PanoramaConnection.sql_select_first_row(sql, query_name: query_name, convert_tz: convert_tz)
594598
end

config/application.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929

3030
module Panorama
3131
# VERSION and RELEASE_DATE should have fix syntax and positions because they are parsed from other sites
32-
VERSION = '2.19.10' if !defined? Panorama::VERSION
33-
RELEASE_DATE = Date.parse('2026-03-27') if !defined? Panorama::RELEASE_DATE
32+
VERSION = '2.19.11' if !defined? Panorama::VERSION
33+
RELEASE_DATE = Date.parse('2026-03-29') if !defined? Panorama::RELEASE_DATE
3434

3535
RELEASE_DAY = "%02d" % RELEASE_DATE.day if !defined? Panorama::RELEASE_DAY
3636
RELEASE_MONTH = "%02d" % RELEASE_DATE.month if !defined? Panorama::RELEASE_MONTH

test/controllers/dba_controller_test.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ class DbaControllerTest < ActionDispatch::IntegrationTest
99
#@routes = Engine.routes # Suppress routing error if only routes for dummy application are active
1010
set_session_test_db_context
1111

12+
if !defined? @sga_sql_id
13+
sql_row = sql_select_first_row "SELECT SQL_ID, Child_Number FROM v$sql WHERE SQL_Text LIKE '%seg$%' AND Object_Status = 'VALID' ORDER BY Executions DESC, First_Load_Time"
14+
raise "DbaControllerTest.setup: No SQL found for test" if sql_row.nil?
15+
@sga_sql_id = sql_row.sql_id
16+
@sga_child_number = sql_row.child_number
17+
end
18+
1219
initialize_min_max_snap_id_and_times
1320
@autonomous = PanoramaConnection.autonomous_database?
1421
end
@@ -274,6 +281,26 @@ class DbaControllerTest < ActionDispatch::IntegrationTest
274281
end
275282
end
276283

284+
test "optimizer_parse_trace with xhr: true" do
285+
assert_nothing_raised do
286+
# DBMS_SQLDIAG.DUMP_TRACE requires Oracle >= 12.2 and access on gv$Diag_Trace_File_Contents
287+
# Access on trace files is not possible on autonomous DBs
288+
if get_db_version >= '12.2' && !PanoramaConnection.autonomous_database?
289+
# Get a valid SQL-ID and child_number from the SGA
290+
post '/dba/optimizer_parse_trace', params: { format: :html,
291+
sql_id: @sga_sql_id,
292+
child_number: @sga_child_number,
293+
update_area: :hugo
294+
}
295+
if @response.body['ORA-01031']
296+
Rails.logger.debug('DBAControllerTest.optimizer_parse_trace') { "No access to DBMS_SQLDIAG.DUMP_TRACE, cannot test optimizer_parse_trace" }
297+
else
298+
assert_response :success
299+
end
300+
end
301+
end
302+
end
303+
277304
test "scheduler_autoruns with xhr: true" do
278305
post '/dba/list_dba_autotask_job_runs', :params => {format: :html, update_area: :hugo, client_name: 'auto optimizer stats collection' }
279306
assert_response :success

test/controllers/dba_sga_controller_test.rb

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ class DbaSgaControllerTest < ActionDispatch::IntegrationTest
1010

1111
initialize_min_max_snap_id_and_times
1212

13-
if !defined? @@hist_sql_id
13+
if !defined? @sga_sql_id
1414
sql_row = sql_select_first_row "SELECT SQL_ID, Child_Number, Parsing_Schema_Name FROM v$sql WHERE SQL_Text LIKE '%seg$%' AND Object_Status = 'VALID' ORDER BY Executions DESC, First_Load_Time"
15-
@@hist_sql_id = sql_row.sql_id
16-
@@sga_child_number = sql_row.child_number
17-
@@hist_parsing_schema_name = sql_row.parsing_schema_name
15+
raise "DbaSgaControllerTest.setup: No SQL found for test" if sql_row.nil?
16+
@sga_sql_id = sql_row.sql_id
17+
@sga_child_number = sql_row.child_number
18+
@hist_parsing_schema_name = sql_row.parsing_schema_name
1819
end
1920
@instance = PanoramaConnection.instance_number
2021
end
@@ -80,15 +81,15 @@ def string2hex(s)
8081
end
8182

8283
test "list_sql_detail_sql_id_childno with xhr: true" do
83-
get '/dba_sga/list_sql_detail_sql_id_childno', :params => {:format=>:html, :instance => @instance, :sql_id => @@hist_sql_id, child_number: @@sga_child_number, :update_area=>:hugo }
84+
get '/dba_sga/list_sql_detail_sql_id_childno', :params => {:format=>:html, :instance => @instance, :sql_id => @sga_sql_id, child_number: @sga_child_number, :update_area=>:hugo }
8485
assert_response :success
8586
end
8687

8788
test "list_sql_detail_sql_id with xhr: true" do
88-
get '/dba_sga/list_sql_detail_sql_id' , :params => {:format=>:html, :instance =>@instance, :sql_id => @@hist_sql_id, :update_area=>:hugo }
89+
get '/dba_sga/list_sql_detail_sql_id' , :params => {:format=>:html, :instance =>@instance, :sql_id => @sga_sql_id, :update_area=>:hugo }
8990
assert_response :success
9091

91-
get '/dba_sga/list_sql_detail_sql_id' , :params => {:format=>:html, :sql_id => @@hist_sql_id, :update_area=>:hugo }
92+
get '/dba_sga/list_sql_detail_sql_id' , :params => {:format=>:html, :sql_id => @sga_sql_id, :update_area=>:hugo }
9293
assert_response :success
9394

9495
post '/dba_sga/list_sql_profile_detail', :params => {:format=>:html, :profile_name=>'Hugo', :update_area=>:hugo }
@@ -97,43 +98,43 @@ def string2hex(s)
9798
end
9899

99100
test "list_sql_detail_execution_plan with xhr: true" do
100-
post '/dba_sga/list_sql_detail_execution_plan' , params: {format: :html, instance: @instance, sql_id: @@hist_sql_id, update_area: :hugo }
101+
post '/dba_sga/list_sql_detail_execution_plan' , params: {format: :html, instance: @instance, sql_id: @sga_sql_id, update_area: :hugo }
101102
assert_response :success
102-
post '/dba_sga/list_sql_detail_execution_plan' , params: {format: :html, instance: @instance, sql_id: @@hist_sql_id, child_number: 1, child_address: 'ABC', update_area: :hugo }
103+
post '/dba_sga/list_sql_detail_execution_plan' , params: {format: :html, instance: @instance, sql_id: @sga_sql_id, child_number: 1, child_address: 'ABC', update_area: :hugo }
103104
assert_response :success
104105
end
105106

106107
test "list_sql_child_cursors with xhr: true" do
107-
post '/dba_sga/list_sql_child_cursors' , params: {format: :html, instance: @instance, sql_id: @@hist_sql_id, update_area: :hugo }
108+
post '/dba_sga/list_sql_child_cursors' , params: {format: :html, instance: @instance, sql_id: @sga_sql_id, update_area: :hugo }
108109
assert_response :success
109110
end
110111

111112
test "list_bind_variables_per_sql with xhr: true" do
112-
post '/dba_sga/list_bind_variables', :params => {format: :html, instance: @instance, sql_id: @@hist_sql_id, update_area: :hugo }
113+
post '/dba_sga/list_bind_variables', :params => {format: :html, instance: @instance, sql_id: @sga_sql_id, update_area: :hugo }
113114
assert_response :success
114115

115-
post '/dba_sga/list_bind_variables', :params => {format: :html, instance: @instance, sql_id: @@hist_sql_id, child_number: 0, child_address: 'ABC', update_area: :hugo }
116+
post '/dba_sga/list_bind_variables', :params => {format: :html, instance: @instance, sql_id: @sga_sql_id, child_number: 0, child_address: 'ABC', update_area: :hugo }
116117
assert_response :success
117118
end
118119

119120

120121
test "list_open_cursor_per_sql with xhr: true" do
121-
get '/dba_sga/list_open_cursor_per_sql', :params => {:format=>:html, :instance=> @instance, :sql_id => @@hist_sql_id, :update_area=>:hugo }
122+
get '/dba_sga/list_open_cursor_per_sql', :params => {:format=>:html, :instance=> @instance, :sql_id => @sga_sql_id, :update_area=>:hugo }
122123
assert_response :success
123124
end
124125

125126
test "list_dbms_xplan_display with xhr: true" do
126-
post '/dba_sga/list_dbms_xplan_display' , params: {format: :html, instance: @instance, sql_id: @@hist_sql_id, update_area: :hugo }
127+
post '/dba_sga/list_dbms_xplan_display' , params: {format: :html, instance: @instance, sql_id: @sga_sql_id, update_area: :hugo }
127128
assert_response :success
128129
end
129130

130131
test "list_dbms_xplan_display_multiple_children with xhr: true" do
131-
post '/dba_sga/list_dbms_xplan_display_multiple_children' , params: {format: :html, instance: @instance, sql_id: @@hist_sql_id, update_area: :hugo }
132+
post '/dba_sga/list_dbms_xplan_display_multiple_children' , params: {format: :html, instance: @instance, sql_id: @sga_sql_id, update_area: :hugo }
132133
assert_response :success
133134
end
134135

135136
test "list_sql_shared_cursor with xhr: true" do
136-
post '/dba_sga/list_sql_shared_cursor' , params: {format: :html, instance: @instance, sql_id: @@hist_sql_id, update_area: :hugo }
137+
post '/dba_sga/list_sql_shared_cursor' , params: {format: :html, instance: @instance, sql_id: @sga_sql_id, update_area: :hugo }
137138
assert_response :success
138139
end
139140

@@ -142,7 +143,7 @@ def string2hex(s)
142143
{ child_number: nil, show_defaults: true},
143144
{ child_number: @child_number, show_defaults: false}
144145
].each do |v|
145-
post '/dba_sga/list_sql_optimizer_env' , params: {format: :html, instance: @instance, sql_id: @@hist_sql_id, child_number: v[:child_number], show_defaults: v[:show_defaults], update_area: :hugo }
146+
post '/dba_sga/list_sql_optimizer_env' , params: {format: :html, instance: @instance, sql_id: @sga_sql_id, child_number: v[:child_number], show_defaults: v[:show_defaults], update_area: :hugo }
146147
assert_response :success
147148
end
148149
end
@@ -193,12 +194,12 @@ def string2hex(s)
193194
end
194195

195196
test "list_cursor_memory with xhr: true" do
196-
get '/dba_sga/list_cursor_memory', :params => {:format=>:html, :instance=> @instance, :sql_id=>@@hist_sql_id, :update_area=>:hugo }
197+
get '/dba_sga/list_cursor_memory', :params => {:format=>:html, :instance=> @instance, :sql_id=>@sga_sql_id, :update_area=>:hugo }
197198
assert_response :success
198199
end
199200

200201
test "compare_execution_plans with xhr: true" do
201-
post '/dba_sga/list_compare_execution_plans', :params => {:format=>:html, :instance_1=> @instance, :sql_id_1=>@@hist_sql_id, :child_number_1 =>@@sga_child_number, :instance_2=> @instance, :sql_id_2=>@@hist_sql_id, :child_number_2 =>@@sga_child_number, :update_area=>:hugo }
202+
post '/dba_sga/list_compare_execution_plans', :params => {:format=>:html, :instance_1=> @instance, :sql_id_1=>@sga_sql_id, :child_number_1 =>@sga_child_number, :instance_2=> @instance, :sql_id_2=>@sga_sql_id, :child_number_2 =>@sga_child_number, :update_area=>:hugo }
202203
assert_response :success
203204
end
204205

@@ -253,7 +254,7 @@ def string2hex(s)
253254
assert_response :success
254255

255256
if get_db_version >= '12.1'
256-
[nil, @@hist_sql_id].each do |translation_sql_id|
257+
[nil, @sga_sql_id].each do |translation_sql_id|
257258
post '/dba_sga/show_sql_translations', :params => {:format=>:html, :translation_sql_id=>translation_sql_id, :update_area=>:hugo }
258259
assert_response :success
259260
end
@@ -267,7 +268,7 @@ def string2hex(s)
267268
end
268269

269270
test "influence_sql_plan with xhr: true" do
270-
post '/dba_sga/influence_sql_plan', :params => {:format=>:html, sql_id: @@hist_sql_id, :update_area=>:hugo }
271+
post '/dba_sga/influence_sql_plan', :params => {:format=>:html, sql_id: @sga_sql_id, :update_area=>:hugo }
271272
assert_response :success
272273
end
273274

@@ -278,8 +279,8 @@ def string2hex(s)
278279
[nil, true].each do |fixed_user|
279280
post '/dba_sga/show_sql_translations', :params => {:format => :html,
280281
:location => location,
281-
:sql_id => @@hist_sql_id,
282-
:user_name => @@hist_parsing_schema_name,
282+
:sql_id => @sga_sql_id,
283+
:user_name => @hist_parsing_schema_name,
283284
:fixed_user => fixed_user,
284285
:update_area => :hugo
285286
}
@@ -293,7 +294,7 @@ def string2hex(s)
293294
test "generate_sql_patch with xhr: true" do
294295
assert_nothing_raised do
295296
if get_db_version >= '12.1'
296-
post '/dba_sga/generate_sql_patch', :params => {format: :html, sql_id: @@hist_sql_id, update_area: :hugo }
297+
post '/dba_sga/generate_sql_patch', :params => {format: :html, sql_id: @sga_sql_id, update_area: :hugo }
297298
assert_response :success
298299
end
299300
end

0 commit comments

Comments
 (0)