Skip to content
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
12 changes: 11 additions & 1 deletion autoload/db/adapter/mysql.vim
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,17 @@ endfunction

function! s:command_for_url(url) abort
let params = db#url#parse(a:url).params
let command = ['mysql']
" check the global mysql client command first
" if it's not there, try the use the global variable g:db#adapter#mysql#command
" if that's not there, use the default mysql client command

if executable('mysql')
let command = ['mysql']
elseif exists('g:db#adapter#mysql#command')
let command = [g:db#adapter#mysql#command]
else
let command = ['mysql']
endif

for i in keys(params)
let command += ['--'.i.'='.params[i]]
Expand Down
2 changes: 2 additions & 0 deletions doc/dadbod.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ t:db, b:db, $DATABASE_URL, and g:db will be used. Suggested uses:
Set a variable with |:let|, or use |:DB| to normalize the URL first:
>
:DB w:db = adapter://...

You can use g:db#adapter#mysql#command to set the binary command to use when connecting, e.g. let g:db#adapter#mysql#command = 'mycli'
<
ADAPTERS *dadbod-adapters*

Expand Down