diff --git a/autoload/db/adapter/mysql.vim b/autoload/db/adapter/mysql.vim index 9b28190..2fe434c 100644 --- a/autoload/db/adapter/mysql.vim +++ b/autoload/db/adapter/mysql.vim @@ -49,3 +49,13 @@ endfunction function! db#adapter#mysql#tables(url) abort return db#systemlist(s:command_for_url(a:url) + ['-e', 'show tables'])[1:-1] endfunction + +function! db#adapter#mysql#procedures(url) abort + " return db#systemlist(s:command_for_url(a:url) + ['-e', 'SHOW PROCEDURE STATUS'])[1:-1] + return db#systemlist(s:command_for_url(a:url) + ['-N', '-e', 'select concat(db, ''.'', name) name from mysql.proc where db=database() and type=''PROCEDURE'''])[1:-1] +endfunction + +function! db#adapter#mysql#functions(url) abort + " return db#systemlist(s:command_for_url(a:url) + ['-e', 'SHOW FUNCTION STATUS'])[1:-1] + return db#systemlist(s:command_for_url(a:url) + ['-N', '-e', 'select concat(db, ''.'', name) name from mysql.proc where db=database() and type=''FUNCTION'''])[1:-1] +endfunction diff --git a/autoload/db/adapter/postgresql.vim b/autoload/db/adapter/postgresql.vim index a4defb6..26c6357 100644 --- a/autoload/db/adapter/postgresql.vim +++ b/autoload/db/adapter/postgresql.vim @@ -44,3 +44,13 @@ function! db#adapter#postgresql#tables(url) abort return s:parse_columns(db#systemlist( \ db#adapter#postgresql#filter(a:url) + ['--no-psqlrc', '-tA', '-c', '\dtvm']), 1) endfunction + +function! db#adapter#postgresql#procedures(url) abort + return s:parse_columns(db#systemlist( + \ db#adapter#postgresql#filter(a:url) + ['--no-psqlrc', '-tA', '-c', '\dfp']), 1) +endfunction + +function! db#adapter#postgresql#functions(url) abort + return s:parse_columns(db#systemlist( + \ db#adapter#postgresql#filter(a:url) + ['--no-psqlrc', '-tA', '-c', '\dfn']), 1) +endfunction