Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add capabilities for listing procedures and functions in Postgresql and MySQL adapters #178

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions autoload/db/adapter/mysql.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 10 additions & 0 deletions autoload/db/adapter/postgresql.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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