sponsor Vim development Vim logo Vim Book Ad

SQLComplete.vim : SQLComplete is a SQL code completion system using the omnifunc framework

 script karma  Rating 88/31, Downloaded by 9428  Comments, bugs, improvements  Vim wiki

created by
David Fishburn
 
script type
utility
 
description
SQLComplete.vim is a plugin which uses the new Vim7 OMNI completion features (intellisense code completion).

SQLComplete.vim version  4.0 is included in the Vim 7.0 release.
SQLComplete.vim version  5.0 is included in the Vim 7.1 release.
SQLComplete.vim version  6.0 is included in the Vim 7.2 release.
SQLComplete.vim version  9.0 is included in the Vim 7.3 release.
SQLComplete.vim version 10.0 is included in the Vim 7.3 release.
SQLComplete.vim version 11.0 is included in the Vim 7.3 release.
SQLComplete.vim version 12.0 is included in the Vim 7.3 release.
SQLComplete.vim version 13.0 is included in the Vim 7.3 release.
SQLComplete.vim version 14.0 is included in the Vim 7.3 release.
SQLComplete.vim version 15.0 is included in the Vim 7.3 release.

What does it do:
-----------------------
Completion for the SQL language includes statements, functions, keywords, operators and database options which it draws from the current SQL syntax file in use.  Vim ships with 9 different SQL syntax files (Oracle, Informix, MySQL, SQL Anywhere, ...).  You can choose different SQL dialects using the command  (see :h sql-dialects):
:SQLSetType sqlanywhere
:SQLSetType <Tab> will cycle through the installed dialects.

It will also dynamically complete tables, procedures, views and column lists with data pulled directly from a database.  It does this in conjunction with the dbext.vim "vimscript #356".  For detailed instructions and a tutorial see :h omni-sql-completion.

Existing instructions can be found within Vim7 using
:h sql.txt
:h sql-completion

This plugin is new to Vim7.  Improvements to the script will be uploaded here, and supplied to Bram for inclusion into future versions of Vim7.
 
install details
Copy sqlcomplete.vim to:
.vim/autoload/sqlcomplete.vim (Unix)
vimfiles\autoload\sqlcomplete.vim (Windows)

For documentation:
:h sql.txt
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
sqlcomplete.vim 15.0 2013-06-02 7.0 David Fishburn New Features
-------------------
Changed the SQL precached syntax items, omni_sql_precache_syntax_groups, to use regular expressions to pick up extended syntax group names.  This requires an updated SyntaxComplete plugin version 13.0 (uploaded separately).

If the required versions have not been installed, previous behaviour will not be impacted.
                                                                              
Bug Fixes
--------------
- Added check for cpoptions (cpo).
sqlcomplete.vim 13.0 2012-10-18 7.0 David Fishburn New Features
-------------------
- When completing column lists or drilling into a table and g:omni_sql_include_owner is enabled, the only the table name would be replaced with the column list instead of the table name and owner (if specified).

- When completing column lists using table aliases and g:omni_sql_include_owner is enabled, account for the owner name when looking up the table list instead of the table name and owner (if specified).

Bug Fixes
-------------
- When completing column lists or drilling into a table and g:omni_sql_include_owner is enabled, the column list could often not be found for the table.

- When OMNI popped up, possibly the wrong word would be replaced for column and column list options.

sqlcomplete.vim 12.0 2012-02-21 7.0 David Fishburn New Features
-------------------
- Improved the handling of column completion.  First we match any columns from a previous completion.  If not matches are found, we consider the partial name to be a table or table alias for the query and attempt to match on it.

Bug Fixes
--------------
- Partial column name completion did not work when a table name or table alias was provided (Jonas Enberg).
sqlcomplete.vim 11.0 2012-01-28 7.0 David Fishburn Version 11.0
    Added g:omni_sql_default_compl_type variable
        - You can specify which type of completion to default to
          when pressing <C-X><C-O>.  The entire list of available
          choices can be found in the calls to sqlcomplete#Map in:
              ftplugin/sql.vim
                                                                            
Version 10.0
    Updated PreCacheSyntax()
        - Now returns a List of the syntax items it finds.
          This allows other plugins / scripts to use this list for their own
          purposes.  In this case XPTemplate can use them for a Choose list.
        - Verifies the parameters are the correct type and displays a
          warning if not.
        - Verifies the parameters are the correct type and displays a
          warning if not.
    Updated SQLCWarningMsg()
        - Prepends warning message with SQLComplete so you know who issued
          the warning.
    Updated SQLCErrorMsg()
        - Prepends error message with SQLComplete so you know who issued
          the error.
sqlcomplete.vim 9.0 2010-05-13 7.0 David Fishburn Version 9.0
- This change removes some of the support for tables with spaces in their names in order to simplify the regexes used to pull out query table aliases for more robust table name and column name code completion.
- Full support for "table names with spaces" can be added in again after 7.3.

Version 8.0
- Incorrectly re-executed the g:ftplugin_sql_omni_key_right and :ftplugin_sql_omni_key_left  when drilling in and out of a column list for a table.
sqlcomplete.vim 7.0 2010-01-25 7.0 David Fishburn Version 6.0 added support for table names which had "spaces in them".  Unforunately, this broke a few things in the parsing of statements to determine which table to retrieve column names.  This version corrects those mistakes and makes the object names a bit more robust.
sqlcomplete.vim 6.0 2008-04-28 6.0 David Fishburn This release is in conjunction with the dbext.vim 6.0 release.  It adds SQL completion support of objects which contain spaces "my table".
sqlcomplete.vim 5.0 2006-06-09 7.0 David Fishburn Initial upload
ip used for rating: 18.217.67.16

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github