Skip to content

Commit

Permalink
Merge pull request tpope#38 from sitedyno/sqlite
Browse files Browse the repository at this point in the history
Column completion for sqlite
  • Loading branch information
kristijanhusak authored Jun 19, 2022
2 parents 1c60988 + f5dac42 commit 0a4cc5f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions autoload/vim_dadbod_completion/schemas.vim
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ let s:schemas = {
\ 'count_parser': function('s:count_parser', [1])
\ },
\ 'oracle': s:oracle,
\ 'sqlite': {
\ 'args': ['-list'],
\ 'column_query': "SELECT m.name AS table_name, ii.name AS column_name FROM sqlite_schema AS m, pragma_table_list(m.name) AS il, pragma_table_info(il.name) AS ii WHERE m.type='table' ORDER BY column_name ASC;",
\ 'count_column_query': "SELECT count(*) AS total FROM sqlite_schema AS m, pragma_table_list(m.name) AS il, pragma_table_info(il.name) AS ii WHERE m.type='table';",
\ 'table_column_query': {table -> substitute("SELECT m.name AS table_name, ii.name AS column_name FROM sqlite_schema AS m, pragma_table_list(m.name) AS il, pragma_table_info(il.name) AS ii WHERE m.type='table' AND table_name={db_tbl_name};", '{db_tbl_name}', "'".table."'", '')},
\ 'quote': ['"', '"'],
\ 'should_quote': function('s:should_quote', [['reserved_word', 'space']]),
\ 'column_parser': function('s:map_and_filter', ['|']),
\ 'count_parser': function('s:count_parser', [1]),
\ },
\ 'sqlserver': {
\ 'args': ['-h-1', '-W', '-s', '|', '-Q'],
\ 'column_query': s:query,
Expand Down

0 comments on commit 0a4cc5f

Please sign in to comment.