@@ -1157,6 +1157,11 @@ function! s:DB_resetGlobalParameters()
1157
1157
silent ! let g:
1158
1158
redir END
1159
1159
1160
+ " ans 2022-04-09: prevent dbext barking on us because FuzzyFinder
1161
+ " remembers something in his global variable FuzzyFinderMode about db_ext!!! (something
1162
+ " of my recent searches apparently)
1163
+ let @a = substitute (@a , " \n FuzzyFin.*\n " ," \n " ,' ' )
1164
+
1160
1165
if @a = ~ ' db_ext'
1161
1166
call s: DB_warningMsg (" You have used a previous version of db_ext. " )
1162
1167
call s: DB_warningMsg (" The configuration parameters have changed. " )
@@ -5015,6 +5020,42 @@ function! s:DB_DBI_getListTable(table_prefix)
5015
5020
return result
5016
5021
endfunction
5017
5022
5023
+ function ! s: DB_DBI_extractDdl (object_name_like)
5024
+ " let owner = s:DB_getObjectOwner(a:object_name_like)
5025
+ " let table_name = s:DB_getObjectName(a:object_name_like)
5026
+
5027
+ if s: DB_DBI_Autoload () == -1
5028
+ return -1
5029
+ endif
5030
+
5031
+ if dbext#DB_connect (" extract ddl " . a: object_name_like ) == -1
5032
+ return -1
5033
+ endif
5034
+
5035
+ " If empty, use undef, if not, place single quotes around it and add a %
5036
+ " let owner = (owner == ''?'undef':"'".owner."%'")
5037
+ " let table_name = (table_name == ''?'undef':"'".table_name."%'")
5038
+ " let driver = s:DB_get('driver')
5039
+ " let table_type = s:DB_getDefault('DBI_table_type_'.driver)
5040
+ " if table_type == ""
5041
+ " let table_type = s:DB_getDefault('DBI_table_type')
5042
+ " endif
5043
+ " let table_type = "'".table_type."'"
5044
+
5045
+ let cmd = " perl db_ora_extract_ddl('" .a: object_name_like ." ')"
5046
+ exec cmd
5047
+ if g: dbext_dbi_result == -1
5048
+ " call s:DB_errorMsg(g:dbext_dbi_msg)
5049
+ call s: DB_runCmd (" perl DBI" , cmd, g: dbext_dbi_msg )
5050
+ return -1
5051
+ endif
5052
+
5053
+ let result = g: dbext_dbi_result
5054
+ call s: DB_runCmd (" perl DBI" , cmd, result)
5055
+
5056
+ return result
5057
+ endfunction
5058
+
5018
5059
function ! s: DB_DBI_getListProcedure (proc_prefix)
5019
5060
let owner = s: DB_getObjectOwner (a: proc_prefix )
5020
5061
let object = s: DB_getObjectName (a: proc_prefix )
@@ -6177,9 +6218,37 @@ function! s:DB_getLoginScript(filename)
6177
6218
endif
6178
6219
endif
6179
6220
6221
+ " ans: debug the login_script
6222
+ " echomsg "login_script:"
6223
+ " echomsg sql
6180
6224
return sql
6181
6225
endfunction
6182
6226
6227
+ function ! dbext#DB_enableSrvOut (... )
6228
+
6229
+ let cmd = " perl db_enable_srv_out('dummy')"
6230
+ exec cmd
6231
+ if g: dbext_dbi_result == -1
6232
+ " call s:DB_errorMsg(g:dbext_dbi_msg)
6233
+ call s: DB_runCmd (" perl DBI" , cmd, g: dbext_dbi_msg )
6234
+ return -1
6235
+ endif
6236
+
6237
+ endfunction
6238
+
6239
+ function ! dbext#DB_disableSrvOut (... )
6240
+
6241
+
6242
+ let cmd = " perl db_disable_srv_out('dummy')"
6243
+ exec cmd
6244
+ if g: dbext_dbi_result == -1
6245
+ " call s:DB_errorMsg(g:dbext_dbi_msg)
6246
+ call s: DB_runCmd (" perl DBI" , cmd, g: dbext_dbi_msg )
6247
+ return -1
6248
+ endif
6249
+
6250
+ endfunction
6251
+
6183
6252
function ! dbext#DB_describeTable (... )
6184
6253
if (a: 0 > 0 )
6185
6254
let table_name = s: DB_getObjectAndQuote (a: 1 )
@@ -6299,6 +6368,25 @@ function! dbext#DB_getListTable(...)
6299
6368
return dbext#DB_execFuncTypeWCheck (' getListTable' , table_prefix)
6300
6369
endfunction
6301
6370
6371
+ function ! dbext#DB_extractDdl (... )
6372
+ if (a: 0 > 0 )
6373
+ " Strip any leading or trailing spaces
6374
+ let object_name_like = substitute (a: 1 ,' \s*\(\w*\)\s*' ,' \1' ,' ' )
6375
+ else
6376
+ let object_name_like = s: DB_getInput (
6377
+ \ " Enter object_name_like: " ,
6378
+ \ ' ' ,
6379
+ \ " dbext_cancel"
6380
+ \ )
6381
+ if object_name_like == " dbext_cancel"
6382
+ return " "
6383
+ endif
6384
+ endif
6385
+ " it is only oracle and DBI specific, but we need generic handling fro
6386
+ " winnr() etc to assign s:dbext_prev_winnr and friends properly...
6387
+ return dbext#DB_execFuncTypeWCheck (' extractDdl' , object_name_like)
6388
+ endfunction
6389
+
6302
6390
function ! dbext#DB_getListProcedure (... )
6303
6391
if (a: 0 > 0 )
6304
6392
" Strip any leading or trailing spaces
@@ -7840,6 +7928,7 @@ function! s:DB_addToResultBuffer(output, do_clear)
7840
7928
" silent! exec "put = data"
7841
7929
let cmd = " perl db_print_results('" .dbi_orient." ')"
7842
7930
exec cmd
7931
+ " norm Goans was here(2).
7843
7932
else
7844
7933
let g: dbext_rows_affected = 0
7845
7934
let l: start_of_output = line (' $' )
@@ -7854,11 +7943,13 @@ function! s:DB_addToResultBuffer(output, do_clear)
7854
7943
endif
7855
7944
7856
7945
" Since this is a small window, remove any blanks lines
7857
- silent % g /^\s*$/ d
7946
+ " ans: this squashes my DDL output - because empty lines will be removed
7947
+ " silent %g/^\s*$/d
7858
7948
" Fix the ^M characters, if any
7859
7949
silent execute " %s/\<C-M> \\ +$//e"
7860
7950
" Dont allow modifications, and do not wrap the text, since
7861
7951
" the data may be lined up for columns
7952
+ " norm Goans was here.
7862
7953
setlocal nomodified
7863
7954
setlocal nowrap
7864
7955
setlocal noswapfile
0 commit comments