Skip to content

Commit

Permalink
fix: Handle missing ORA_bin variable
Browse files Browse the repository at this point in the history
  • Loading branch information
kristijanhusak committed Jun 16, 2023
1 parent 92b9905 commit 200aebf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions autoload/db_ui/schemas.vim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function! s:strip_quotes(results) abort
function! s:strip_quotes(results) abort
return split(substitute(join(a:results),'"','','g'))
endfunction

Expand Down Expand Up @@ -145,7 +145,7 @@ let s:oracle = {
\ 'filetype': 'plsql',
\ }

if g:dbext_default_ORA_bin == 'sql'
if get(g:, 'dbext_default_ORA_bin') == 'sql'
let s:oracle.parse_results = {results, min_len -> s:results_parser(s:strip_quotes(results[13:-5]), ',', min_len)}
let s:oracle.parse_virtual_results = {results, min_len -> s:results_parser(s:strip_quotes(results[13:-4]), ',', min_len)}
endif
Expand Down

3 comments on commit 200aebf

@walkabout21
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm new to viml so I'm not sure I understand the difference between checking the var vs checking get(g:,var). Is this in case the global var doesn't exist? I tested with it assigned and unassigned.

@kristijanhusak
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@walkabout21 you probably have it defined somewhere by another plugin.
Difference is that get() handles the situation where variable is missing, while doing g:var expects it to be defined.

@walkabout21
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I'll keep that in mind for the future.

Please sign in to comment.