Update runtime files.
diff --git a/runtime/autoload/sqlcomplete.vim b/runtime/autoload/sqlcomplete.vim
index 360f7e6..f830965 100644
--- a/runtime/autoload/sqlcomplete.vim
+++ b/runtime/autoload/sqlcomplete.vim
@@ -1,23 +1,43 @@
 " Vim OMNI completion script for SQL
 " Language:    SQL
 " Maintainer:  David Fishburn <dfishburn dot vim at gmail dot com>
-" Version:     12.0
-" Last Change: 2012 Feb 08
+" Version:     14.0
+" Last Change: 2012 Dec 04
+" Homepage:    http://www.vim.org/scripts/script.php?script_id=1572
 " Usage:       For detailed help
 "              ":help sql.txt"
 "              or ":help ft-sql-omni"
 "              or read $VIMRUNTIME/doc/sql.txt
 
 " History
-" Version 12.0
+"
+" Version 14.0 (Dec 2012)
+"     - BF: Added check for cpo
+"
+" Version 13.0 (Dec 2012)
+"     - NF: 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).
+"     - NF: 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).
+"     - BF: 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.
+"     - BF: When OMNI popped up, possibly the wrong word
+"           would be replaced for column and column list options.
+"
+" Version 12.0 (Feb 2012)
 "     - Partial column name completion did not work when a table
 "       name or table alias was provided (Jonas Enberg).
 "     - 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 
+"       consider the partial name to be a table or table alias for the
 "       query and attempt to match on it.
 "
-" Version 11.0
+" Version 11.0 (Jan 2012)
 "     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
@@ -40,7 +60,7 @@
 "         - Prepends error message with SQLComplete so you know who issued
 "           the error.
 "
-" Version 9.0
+" Version 9.0 (May 2010)
 "     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.
@@ -51,10 +71,10 @@
 "     Incorrectly re-executed the g:ftplugin_sql_omni_key_right and g:ftplugin_sql_omni_key_left
 "     when drilling in and out of a column list for a table.
 "
-" Version 7.0
+" Version 7.0 (Jan 2010)
 "     Better handling of object names
 "
-" Version 6.0
+" Version 6.0 (Apr 2008)
 "     Supports object names with spaces "my table name"
 "
 " Set completion with CTRL-X CTRL-O to autoloaded function.
@@ -71,7 +91,9 @@
 if exists('g:loaded_sql_completion')
     finish
 endif
-let g:loaded_sql_completion = 120
+let g:loaded_sql_completion = 130
+let s:keepcpo= &cpo
+set cpo&vim
 
 " Maintains filename of dictionary
 let s:sql_file_table        = ""
@@ -137,6 +159,13 @@
 endif
 
 " This function is used for the 'omnifunc' option.
+" It is called twice by omni and it is responsible
+" for returning the completion list of items.
+" But it must also determine context of what to complete
+" and what to "replace" with the completion.
+" The a:base, is replaced directly with what the user
+" chooses from the choices.
+" The s:prepend provides context for the completion.
 function! sqlcomplete#Complete(findstart, base)
 
     " Default to table name completion
@@ -145,6 +174,7 @@
     if exists('b:sql_compl_type')
         let compl_type = b:sql_compl_type
     endif
+    let begindot = 0
 
     " First pass through this function determines how much of the line should
     " be replaced by whatever is chosen from the completion list
@@ -153,7 +183,6 @@
         let line     = getline('.')
         let start    = col('.') - 1
         let lastword = -1
-        let begindot = 0
         " Check if the first character is a ".", for column completion
         if line[start - 1] == '.'
             let begindot = 1
@@ -179,7 +208,10 @@
                 " If lastword has already been set for column completion
                 " break from the loop, since we do not also want to pickup
                 " a table name if it was also supplied.
+                " Unless g:omni_sql_include_owner == 1, then we can
+                " include the ownername.
                 if lastword != -1 && compl_type == 'column'
+                            \ && g:omni_sql_include_owner == 0
                     break
                 endif
                 " If column completion was specified stop at the "." if
@@ -191,7 +223,7 @@
                 " If omni_sql_include_owner = 0, do not include the table
                 " name as part of the substitution, so break here
                 if lastword == -1 &&
-                            \ compl_type =~ 'table\|view\|procedure\column_csv' &&
+                            \ compl_type =~ '\<\(table\|view\|procedure\|column\|column_csv\)\>' &&
                             \ g:omni_sql_include_owner == 0
                     let lastword = start
                     break
@@ -288,6 +320,12 @@
             let table  = matchstr( base, '^\(.*\.\)\?\zs.*\ze\..*' )
             let column = matchstr( base, '.*\.\zs.*' )
 
+            if g:omni_sql_include_owner == 1 && owner == '' && table != '' && column != ''
+                let owner  = table
+                let table  = column
+                let column = ''
+            endif
+
             " It is pretty well impossible to determine if the user
             " has entered:
             "    owner.table
@@ -370,7 +408,16 @@
                 let list_type     = 'csv'
             endif
 
-            let compl_list  = s:SQLCGetColumns(table, list_type)
+            " If we are including the OWNER for the objects, then for
+            " table completion, if we have it, it should be included
+            " as there can be the same table names in a database yet
+            " with different owner names.
+            if g:omni_sql_include_owner == 1 && owner != '' && table != ''
+                let compl_list  = s:SQLCGetColumns(owner.'.'.table, list_type)
+            else
+                let compl_list  = s:SQLCGetColumns(table, list_type)
+            endif
+
             if column != ''
                 " If no column prefix has been provided and the table
                 " name was provided, append it to each of the items
@@ -393,11 +440,14 @@
         endif
     elseif compl_type == 'resetCache'
         " Reset all cached items
-        let s:tbl_name  = []
-        let s:tbl_alias = []
-        let s:tbl_cols  = []
-        let s:syn_list  = []
-        let s:syn_value = []
+        let s:tbl_name           = []
+        let s:tbl_alias          = []
+        let s:tbl_cols           = []
+        let s:syn_list           = []
+        let s:syn_value          = []
+        let s:sql_file_table     = ""
+        let s:sql_file_procedure = ""
+        let s:sql_file_view      = ""
 
         let msg = "All SQL cached items have been removed."
         call s:SQLCWarningMsg(msg)
@@ -423,12 +473,27 @@
         " let expr = 'v:val '.(g:omni_sql_ignorecase==1?'=~?':'=~#').' "\\(^'.base.'\\|\\(\\.\\)\\?'.base.'\\)"'
         " let expr = 'v:val '.(g:omni_sql_ignorecase==1?'=~?':'=~#').' "\\(^'.base.'\\|\\([^.]*\\)\\?'.base.'\\)"'
         let compl_list = filter(deepcopy(compl_list), expr)
+
+        if empty(compl_list) && compl_type == 'table' && base =~ '\.$'
+            " It is possible we could be looking for column name completion
+            " and the user simply hit C-X C-O to lets try it as well
+            " since we had no hits with the tables.
+            " If the base ends with a . it is hard to know if we are
+            " completing table names or column names.
+            let list_type = ''
+
+            let compl_list  = s:SQLCGetColumns(base, list_type)
+        endif
     endif
 
     if exists('b:sql_compl_savefunc') && b:sql_compl_savefunc != ""
         let &omnifunc = b:sql_compl_savefunc
     endif
 
+    if empty(compl_list)
+        call s:SQLCWarningMsg( 'Could not find type['.compl_type.'] using prepend[.'.s:prepended.'] base['.a:base.']' )
+    endif
+
     return compl_list
 endfunc
 
@@ -664,8 +729,26 @@
 endfunction
 
 function! s:SQLCGetColumns(table_name, list_type)
+    if a:table_name =~ '\.'
+        " Check if the owner/creator has been specified
+        let owner  = matchstr( a:table_name, '^\zs.*\ze\..*\..*' )
+        let table  = matchstr( a:table_name, '^\(.*\.\)\?\zs.*\ze\..*' )
+        let column = matchstr( a:table_name, '.*\.\zs.*' )
+
+        if g:omni_sql_include_owner == 1 && owner == '' && table != '' && column != ''
+            let owner  = table
+            let table  = column
+            let column = ''
+        endif
+    else
+        let owner  = ''
+        let table  = matchstr(a:table_name, '^["\[\]a-zA-Z0-9_ ]\+\ze\.\?')
+        let column = ''
+    endif
+
     " Check if the table name was provided as part of the column name
-    let table_name   = matchstr(a:table_name, '^["\[\]a-zA-Z0-9_ ]\+\ze\.\?')
+    " let table_name   = matchstr(a:table_name, '^["\[\]a-zA-Z0-9_ ]\+\ze\.\?')
+    let table_name   = table
     let table_cols   = []
     let table_alias  = ''
     let move_to_top  = 1
@@ -786,7 +869,12 @@
 
              if table_name_new != ''
                  let table_alias = table_name
-                 let table_name  = matchstr( table_name_new, '^\(.*\.\)\?\zs.*\ze' )
+                 if g:omni_sql_include_owner == 1
+                    let table_name  = matchstr( table_name_new, '^\zs\(.\{-}\.\)\?\(.\{-}\.\)\?.*\ze' )
+                 else
+                     " let table_name  = matchstr( table_name_new, '^\(.*\.\)\?\zs.*\ze' )
+                    let table_name  = matchstr( table_name_new, '^\(.\{-}\.\)\?\zs\(.\{-}\.\)\?.*\ze' )
+                 endif
 
                  let list_idx = index(s:tbl_name, table_name, 0, &ignorecase)
                  if list_idx > -1
@@ -828,7 +916,8 @@
     if empty(table_cols)
         " Specify silent mode, no messages to the user (tbl, 1)
         " Specify do not comma separate (tbl, 1, 1)
-        let table_cols_str = DB_getListColumn(table_name, 1, 1)
+        " let table_cols_str = DB_getListColumn(table_name, 1, 1)
+        let table_cols_str = DB_getListColumn((owner!=''?owner.'.':'').table_name, 1, 1)
 
         if table_cols_str != ""
             let s:tbl_name  = add( s:tbl_name,  table_name )
@@ -854,3 +943,7 @@
 
     return table_cols
 endfunction
+"  Restore:
+let &cpo= s:keepcpo
+unlet s:keepcpo
+" vim: ts=4 fdm=marker
diff --git a/runtime/autoload/syntaxcomplete.vim b/runtime/autoload/syntaxcomplete.vim
index 9a1474f..e3ea0e2 100644
--- a/runtime/autoload/syntaxcomplete.vim
+++ b/runtime/autoload/syntaxcomplete.vim
@@ -1,22 +1,26 @@
 " Vim completion script
 " Language:    All languages, uses existing syntax highlighting rules
 " Maintainer:  David Fishburn <dfishburn dot vim at gmail dot com>
-" Version:     10.0
-" Last Change: 2012 Oct 20
-" Usage:       For detailed help, ":help ft-syntax-omni" 
+" Version:     11.0
+" Last Change: 2012 Dec 04
+" Usage:       For detailed help, ":help ft-syntax-omni"
 
 " History
 "
+" Version 11.0
+"     Corrected which characters required escaping during
+"     substitution calls.
+"
 " Version 10.0
 "     Cycle through all the character ranges specified in the
 "     iskeyword option and build a list of valid word separators.
-"     Prior to this change, only actual characters were used, 
-"     where for example ASCII "45" == "-".  If "45" were used 
-"     in iskeyword the hyphen would not be picked up.  
+"     Prior to this change, only actual characters were used,
+"     where for example ASCII "45" == "-".  If "45" were used
+"     in iskeyword the hyphen would not be picked up.
 "     This introduces a new option, since the character ranges
 "     specified could be multibyte:
 "         let g:omni_syntax_use_single_byte = 1
-"     This by default will only allow single byte ASCII 
+"     This by default will only allow single byte ASCII
 "     characters to be added and an additional check to ensure
 "     the charater is printable (see documentation for isprint).
 "
@@ -32,7 +36,7 @@
 " Version 7.0
 "     Updated syntaxcomplete#OmniSyntaxList()
 "         - Looking up the syntax groups defined from a syntax file
-"           looked for only 1 format of {filetype}GroupName, but some 
+"           looked for only 1 format of {filetype}GroupName, but some
 "           syntax writers use this format as well:
 "               {b:current_syntax}GroupName
 "           OmniSyntaxList() will now check for both if the first
@@ -40,11 +44,11 @@
 "
 " Version 6.0
 "     Added syntaxcomplete#OmniSyntaxList()
-"         - Allows other plugins to use this for their own 
+"         - Allows other plugins to use this for their own
 "           purposes.
 "         - It will return a List of all syntax items for the
-"           syntax group name passed in.  
-"         - XPTemplate for SQL will use this function via the 
+"           syntax group name passed in.
+"         - XPTemplate for SQL will use this function via the
 "           sqlcomplete plugin to populate a Choose box.
 "
 " Version 5.0
@@ -54,7 +58,7 @@
 "
 " Set completion with CTRL-X CTRL-O to autoloaded function.
 " This check is in place in case this script is
-" sourced directly instead of using the autoload feature. 
+" sourced directly instead of using the autoload feature.
 if exists('+omnifunc')
     " Do not set the option if already set since this
     " results in an E117 warning.
@@ -64,9 +68,9 @@
 endif
 
 if exists('g:loaded_syntax_completion')
-    finish 
+    finish
 endif
-let g:loaded_syntax_completion = 100
+let g:loaded_syntax_completion = 110
 
 " Turn on support for line continuations when creating the script
 let s:cpo_save = &cpo
@@ -190,7 +194,7 @@
 function! syntaxcomplete#OmniSyntaxList(...)
     if a:0 > 0
         let parms = []
-        if 3 == type(a:1) 
+        if 3 == type(a:1)
             let parms = a:1
         elseif 1 == type(a:1)
             let parms = split(a:1, ',')
@@ -204,7 +208,7 @@
 function! OmniSyntaxList(...)
     let list_parms = []
     if a:0 > 0
-        if 3 == type(a:1) 
+        if 3 == type(a:1)
             let list_parms = a:1
         elseif 1 == type(a:1)
             let list_parms = split(a:1, ',')
@@ -240,18 +244,18 @@
 
     let saveL = @l
     let filetype = substitute(&filetype, '\.', '_', 'g')
-    
+
     if empty(list_parms)
         " Default the include group to include the requested syntax group
         let syntax_group_include_{filetype} = ''
         " Check if there are any overrides specified for this filetype
         if exists('g:omni_syntax_group_include_'.filetype)
             let syntax_group_include_{filetype} =
-                        \ substitute( g:omni_syntax_group_include_{filetype},'\s\+','','g') 
+                        \ substitute( g:omni_syntax_group_include_{filetype},'\s\+','','g')
             let list_parms = split(g:omni_syntax_group_include_{filetype}, ',')
             if syntax_group_include_{filetype} =~ '\w'
-                let syntax_group_include_{filetype} = 
-                            \ substitute( syntax_group_include_{filetype}, 
+                let syntax_group_include_{filetype} =
+                            \ substitute( syntax_group_include_{filetype},
                             \ '\s*,\s*', '\\|', 'g'
                             \ )
             endif
@@ -261,11 +265,11 @@
     endif
 
     " Loop through all the syntax groupnames, and build a
-    " syntax file which contains these names.  This can 
+    " syntax file which contains these names.  This can
     " work generically for any filetype that does not already
     " have a plugin defined.
     " This ASSUMES the syntax groupname BEGINS with the name
-    " of the filetype.  From my casual viewing of the vim7\syntax 
+    " of the filetype.  From my casual viewing of the vim7\syntax
     " directory this is true for almost all syntax definitions.
     " As an example, the SQL syntax groups have this pattern:
     "     sqlType
@@ -278,7 +282,7 @@
     let syntax_full = "\n".@l
     let @l = saveL
 
-    if syntax_full =~ 'E28' 
+    if syntax_full =~ 'E28'
                 \ || syntax_full =~ 'E411'
                 \ || syntax_full =~ 'E415'
                 \ || syntax_full =~ 'No Syntax items'
@@ -288,7 +292,7 @@
     let filetype = substitute(&filetype, '\.', '_', 'g')
 
     let list_exclude_groups = []
-    if a:0 > 0 
+    if a:0 > 0
         " Do nothing since we have specific a specific list of groups
     else
         " Default the exclude group to nothing
@@ -296,11 +300,11 @@
         " Check if there are any overrides specified for this filetype
         if exists('g:omni_syntax_group_exclude_'.filetype)
             let syntax_group_exclude_{filetype} =
-                        \ substitute( g:omni_syntax_group_exclude_{filetype},'\s\+','','g') 
+                        \ substitute( g:omni_syntax_group_exclude_{filetype},'\s\+','','g')
             let list_exclude_groups = split(g:omni_syntax_group_exclude_{filetype}, ',')
-            if syntax_group_exclude_{filetype} =~ '\w' 
-                let syntax_group_exclude_{filetype} = 
-                            \ substitute( syntax_group_exclude_{filetype}, 
+            if syntax_group_exclude_{filetype} =~ '\w'
+                let syntax_group_exclude_{filetype} =
+                            \ substitute( syntax_group_exclude_{filetype},
                             \ '\s*,\s*', '\\|', 'g'
                             \ )
             endif
@@ -317,14 +321,14 @@
     while ftindex > -1
         let ft_part_name = matchstr( &filetype, '\w\+', ftindex )
 
-        " Syntax rules can contain items for more than just the current 
+        " Syntax rules can contain items for more than just the current
         " filetype.  They can contain additional items added by the user
         " via autocmds or their vimrc.
         " Some syntax files can be combined (html, php, jsp).
         " We want only items that begin with the filetype we are interested in.
         let next_group_regex = '\n' .
                     \ '\zs'.ft_part_name.'\w\+\ze'.
-                    \ '\s\+xxx\s\+' 
+                    \ '\s\+xxx\s\+'
         let index    = 0
         let index    = match(syntax_full, next_group_regex, index)
 
@@ -338,11 +342,11 @@
             "     syn keyword {syntax_filename}Keyword  values ...
             "     let b:current_syntax = "mysql"
             " So, we will make the format of finding the syntax group names
-            " a bit more flexible and look for both if the first fails to 
+            " a bit more flexible and look for both if the first fails to
             " find a match.
             let next_group_regex = '\n' .
                         \ '\zs'.b:current_syntax.'\w\+\ze'.
-                        \ '\s\+xxx\s\+' 
+                        \ '\s\+xxx\s\+'
             let index    = 0
             let index    = match(syntax_full, next_group_regex, index)
         endif
@@ -356,9 +360,9 @@
                     let get_syn_list = 0
                 endif
             endfor
-        
+
             " This code is no longer needed in version 6.0 since we have
-            " augmented the syntax list command to only retrieve the syntax 
+            " augmented the syntax list command to only retrieve the syntax
             " groups we are interested in.
             "
             " if get_syn_list == 1
@@ -370,7 +374,7 @@
             " endif
 
             if get_syn_list == 1
-                " Pass in the full syntax listing, plus the group name we 
+                " Pass in the full syntax listing, plus the group name we
                 " are interested in.
                 let extra_syn_list = s:SyntaxCSyntaxGroupItems(group_name, syntax_full)
                 let syn_list = syn_list . extra_syn_list . "\n"
@@ -424,7 +428,7 @@
     "     \|           - 2nd potential match
     "     \%$          - matches end of the file or string
     "     \)           - end a group
-    let syntax_group = matchstr(a:syntax_full, 
+    let syntax_group = matchstr(a:syntax_full,
                 \ "\n".a:group_name.'\s\+xxx\s\+\zs.\{-}\ze\(\n\w\|\%$\)'
                 \ )
 
@@ -434,42 +438,42 @@
 
         " We only want the words for the lines begining with
         " containedin, but there could be other items.
-        
+
         " Tried to remove all lines that do not begin with contained
         " but this does not work in all cases since you can have
         "    contained nextgroup=...
         " So this will strip off the ending of lines with known
         " keywords.
-        let syn_list = substitute( 
+        let syn_list = substitute(
                     \    syntax_group, '\<\('.
                     \    substitute(
                     \      escape(s:syn_remove_words, '\\/.*$^~[]')
                     \      , ',', '\\|', 'g'
                     \    ).
                     \    '\).\{-}\%($\|'."\n".'\)'
-                    \    , "\n", 'g' 
+                    \    , "\n", 'g'
                     \  )
 
         " Now strip off the newline + blank space + contained.
         " Also include lines with nextgroup=@someName skip_key_words syntax_element
-        let syn_list = substitute( 
+        let syn_list = substitute(
                     \    syn_list, '\%(^\|\n\)\@<=\s*\<\(contained\|nextgroup=\)'
-                    \    , "", 'g' 
+                    \    , "", 'g'
                     \ )
 
         " This can leave lines like this
         "     =@vimMenuList  skipwhite onoremenu
         " Strip the special option keywords first
         "     :h :syn-skipwhite*
-        let syn_list = substitute( 
+        let syn_list = substitute(
                     \    syn_list, '\<\(skipwhite\|skipnl\|skipempty\)\>'
-                    \    , "", 'g' 
+                    \    , "", 'g'
                     \ )
 
         " Now remove the remainder of the nextgroup=@someName lines
-        let syn_list = substitute( 
+        let syn_list = substitute(
                     \    syn_list, '\%(^\|\n\)\@<=\s*\(@\w\+\)'
-                    \    , "", 'g' 
+                    \    , "", 'g'
                     \ )
 
         if b:omni_syntax_use_iskeyword == 0
@@ -484,17 +488,17 @@
                 " Numeric values convert to their ASCII equivalent using the
                 " nr2char() function.
                 "     &       38
-                "     *       42 
+                "     *       42
                 "     +       43
-                "     -       45 
+                "     -       45
                 "     ^       94
-                " Iterate through all numeric specifications and convert those 
+                " Iterate through all numeric specifications and convert those
                 " to their ascii equivalent ensuring the character is printable.
                 " If so, add it to the list.
                 let accepted_chars = ''
                 for item in split(&iskeyword, ',')
                     if item =~ '-'
-                        " This is a character range (ie 47-58), 
+                        " This is a character range (ie 47-58),
                         " cycle through each character within the range
                         let [b:start, b:end] = split(item, '-')
                         for range_item in range( b:start, b:end )
@@ -520,7 +524,11 @@
                     endif
                 endfor
                 " Escape special regex characters
-                let accepted_chars = escape(accepted_chars, '\\/.*$^~[]' )
+                " Looks like the wrong chars are escaped.  In a collection,
+                "      :h /[]
+                "      only `]', `\', `-' and `^' are special:
+                " let accepted_chars = escape(accepted_chars, '\\/.*$^~[]' )
+                let accepted_chars = escape(accepted_chars, ']\-^' )
                 " Remove all characters that are not acceptable
                 let syn_list = substitute( syn_list, '[^A-Za-z'.accepted_chars.']', ' ', 'g' )
             else
@@ -534,7 +542,11 @@
                 " Remove all commas
                 let accept_chars = substitute(accept_chars, ',', '', 'g')
                 " Escape special regex characters
-                let accept_chars = escape(accept_chars, '\\/.*$^~[]' )
+                " Looks like the wrong chars are escaped.  In a collection,
+                "      :h /[]
+                "      only `]', `\', `-' and `^' are special:
+                " let accept_chars = escape(accept_chars, '\\/.*$^~[]' )
+                let accept_chars = escape(accept_chars, ']\-^' )
                 " Remove all characters that are not acceptable
                 let syn_list = substitute( syn_list, '[^0-9A-Za-z_'.accept_chars.']', ' ', 'g' )
             endif