Skip to content

Commit 37523ff

Browse files
touchmarinetpope
authored andcommitted
Correctly pass max argument to readfile()
Max was passed as the type argument which did nothing.
1 parent a63649c commit 37523ff

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

autoload/db.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ function! s:init() abort
407407
if empty(maparg('gq', 'n'))
408408
exe 'nnoremap <buffer><silent>' (v:version < 704 ? '' : '<nowait>') 'gq :bdelete<CR>'
409409
endif
410-
nnoremap <buffer><nowait> r :DB <C-R>=get(readfile(b:db_input, 1), 0)<CR>
410+
nnoremap <buffer><nowait> r :DB <C-R>=get(readfile(b:db_input, '', 1), 0)<CR>
411411
nnoremap <buffer><silent> R :call <SID>reload()<CR>
412412
nnoremap <buffer><silent> <C-c> :call db#cancel()<CR>
413413
endfunction
@@ -500,7 +500,7 @@ function! db#execute_command(mods, bang, line1, line2, cmd) abort
500500
let lines = split(db#adapter#call(conn, 'massage', [str], str), "\n", 1)
501501
elseif !empty(maybe_infile)
502502
let lines = repeat([''], a:line1-1) +
503-
\ readfile(expand(maybe_infile), a:line2)[(a:line1)-1 : -1]
503+
\ readfile(expand(maybe_infile), '', a:line2)[(a:line1)-1 : -1]
504504
elseif a:line1 == 1 && a:line2 == line('$') && empty(cmd) && !&modified && filereadable(expand('%'))
505505
let infile = expand('%:p')
506506
else

autoload/db/adapter/duckdb.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function! db#adapter#duckdb#test_file(file) abort
66
if getfsize(a:file) < 100
77
return
88
endif
9-
let firstline = readfile(a:file, 1)[0]
9+
let firstline = readfile(a:file, '', 1)[0]
1010
" DuckDB can also open SQLite databases
1111
if firstline[8:11] ==# 'DUCK' || firstline =~# '^SQLite format 3\n'
1212
return 1

autoload/db/adapter/sqlite.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function! db#adapter#sqlite#canonicalize(url) abort
33
endfunction
44

55
function! db#adapter#sqlite#test_file(file) abort
6-
if getfsize(a:file) >= 100 && readfile(a:file, 1)[0] =~# '^SQLite format 3\n'
6+
if getfsize(a:file) >= 100 && readfile(a:file, '', 1)[0] =~# '^SQLite format 3\n'
77
return 1
88
endif
99
endfunction

0 commit comments

Comments
 (0)