Configure DBext mac for SQLite

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Configure DBext mac for SQLite

Brian Libgober
Apologies if this is a repeat post, I have been trying to configure vim to work with dbext on MacOS Yosemite.  Here's the connection string I have setup in my .vimrc

And here's the command I run

select * from CIK limit 5;

The error I get back

Connection: T(SQLITE)  D(/Users/brianlibgober/Dropbox/Collaborations/CleanMake/Main.sqlite)   at 17:32
Error: near "<": syntax error
To change connection parameters:
:DBPromptForBufferParameters
Or
:DBSetOption user|passwd|dsnname|srvname|dbname|host|port|...=<value>
:DBSetOption user=tiger:passwd=scott
Last command(rc=1):
sqlite3  /Users/brianlibgober/Dropbox/Collaborations/CleanMake/Main.sqlite < /var/folders/p2/nkftf47s5vb8zr6slgc7fc940000gn/T/v5uxPIb/dbext.sql
Last SQL:
.mode column
.headers ON
select * from CIK limit 5

The bizarreness of this is that the following run on terminal:

sqlite3  /Users/brianlibgober/Dropbox/Collaborations/CleanMake/Main.sqlite < /var/folders/p2/nkftf47s5vb8zr6slgc7fc940000gn/T/v5uxPIb/dbext.sql

Yields

index       CIK         COMPANYNAME
----------  ----------  -----------
0           0001438823  !J INC
1           0001509607  #1 A LIFESA
2           0001457512  #1 ARIZONA
3           0001433777  #1 PAINTBAL
4           0001427189  $ LLC

Which is what I would expect....

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Configure DBext mac for SQLite

Brian Libgober
On Monday, July 24, 2017 at 7:28:39 AM UTC-4, Brian Libgober wrote:

> Apologies if this is a repeat post, I have been trying to configure vim to work with dbext on MacOS Yosemite.  Here's the connection string I have setup in my .vimrc
>
> And here's the command I run
>
> select * from CIK limit 5;
>
> The error I get back
>
> Connection: T(SQLITE)  D(/Users/brianlibgober/Dropbox/Collaborations/CleanMake/Main.sqlite)   at 17:32
> Error: near "<": syntax error
> To change connection parameters:
> :DBPromptForBufferParameters
> Or
> :DBSetOption user|passwd|dsnname|srvname|dbname|host|port|...=<value>
> :DBSetOption user=tiger:passwd=scott
> Last command(rc=1):
> sqlite3  /Users/brianlibgober/Dropbox/Collaborations/CleanMake/Main.sqlite < /var/folders/p2/nkftf47s5vb8zr6slgc7fc940000gn/T/v5uxPIb/dbext.sql
> Last SQL:
> .mode column
> .headers ON
> select * from CIK limit 5
>
> The bizarreness of this is that the following run on terminal:
>
> sqlite3  /Users/brianlibgober/Dropbox/Collaborations/CleanMake/Main.sqlite < /var/folders/p2/nkftf47s5vb8zr6slgc7fc940000gn/T/v5uxPIb/dbext.sql
>
> Yields
>
> index       CIK         COMPANYNAME
> ----------  ----------  -----------
> 0           0001438823  !J INC
> 1           0001509607  #1 A LIFESA
> 2           0001457512  #1 ARIZONA
> 3           0001433777  #1 PAINTBAL
> 4           0001427189  $ LLC
>
> Which is what I would expect....
Interestingly, the command :DBListTable does what it should, so the connection works...

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Configure DBext mac for SQLite

Brian Libgober
Managed to get the DBI interface to work. Had to recompile my vim against a version of perl with the necessary packaged installed, after doing that it worked immediately.

On Monday, July 24, 2017 at 1:51:27 PM UTC-4, Brian Libgober wrote:

> On Monday, July 24, 2017 at 7:28:39 AM UTC-4, Brian Libgober wrote:
> > Apologies if this is a repeat post, I have been trying to configure vim to work with dbext on MacOS Yosemite.  Here's the connection string I have setup in my .vimrc
> >
> > And here's the command I run
> >
> > select * from CIK limit 5;
> >
> > The error I get back
> >
> > Connection: T(SQLITE)  D(/Users/brianlibgober/Dropbox/Collaborations/CleanMake/Main.sqlite)   at 17:32
> > Error: near "<": syntax error
> > To change connection parameters:
> > :DBPromptForBufferParameters
> > Or
> > :DBSetOption user|passwd|dsnname|srvname|dbname|host|port|...=<value>
> > :DBSetOption user=tiger:passwd=scott
> > Last command(rc=1):
> > sqlite3  /Users/brianlibgober/Dropbox/Collaborations/CleanMake/Main.sqlite < /var/folders/p2/nkftf47s5vb8zr6slgc7fc940000gn/T/v5uxPIb/dbext.sql
> > Last SQL:
> > .mode column
> > .headers ON
> > select * from CIK limit 5
> >
> > The bizarreness of this is that the following run on terminal:
> >
> > sqlite3  /Users/brianlibgober/Dropbox/Collaborations/CleanMake/Main.sqlite < /var/folders/p2/nkftf47s5vb8zr6slgc7fc940000gn/T/v5uxPIb/dbext.sql
> >
> > Yields
> >
> > index       CIK         COMPANYNAME
> > ----------  ----------  -----------
> > 0           0001438823  !J INC
> > 1           0001509607  #1 A LIFESA
> > 2           0001457512  #1 ARIZONA
> > 3           0001433777  #1 PAINTBAL
> > 4           0001427189  $ LLC
> >
> > Which is what I would expect....
>
> Interestingly, the command :DBListTable does what it should, so the connection works...
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Configure DBext mac for SQLite

David Fishburn-2
In reply to this post by Brian Libgober
Glad you managed to get it working using DBI.

I would like to resolve this issue though Brian. 

If there are any Mac users who might have some input into this I would appreciate it.

Please read below.

On Sun, Jul 23, 2017 at 5:43 PM, Brian Libgober <[hidden email]> wrote:
...
select * from CIK limit 5;

The error I get back

Connection: T(SQLITE)  D(/Users/brianlibgober/Dropbox/Collaborations/CleanMake/Main.sqlite)   at 17:32
Error: near "<": syntax error
...
 
Last command(rc=1):
sqlite3  /Users/brianlibgober/Dropbox/Collaborations/CleanMake/Main.sqlite < /var/folders/p2/nkftf47s5vb8zr6slgc7fc940000gn/T/v5uxPIb/dbext.sql
Last SQL:
.mode column
.headers ON
select * from CIK limit 5

The bizarreness of this is that the following run on terminal:

sqlite3  /Users/brianlibgober/Dropbox/Collaborations/CleanMake/Main.sqlite < /var/folders/p2/nkftf47s5vb8zr6slgc7fc940000gn/T/v5uxPIb/dbext.sql

Yields

index       CIK         COMPANYNAME
----------  ----------  -----------
0           0001438823  !J INC
1           0001509607  #1 A LIFESA
2           0001457512  #1 ARIZONA
3           0001433777  #1 PAINTBAL
4           0001427189  $ LLC

...

Sorry, Brian I have been away.

Yes, your analysis above is definitely strange, if that command worked from the command line, then I would think it also should have worked from the system() command. 

What happens when you try these steps:

1.  Use the SQLite connection type (instead of DBI as you did before)

2. Set a couple of dbext options
:DBSetOption delete_temp_file=0
:DBSetOption display_cmd_line=1

3. Run the SQL statement
:Select * from CIK limit 5


4.  Try it in Vim, without using the dbext plugin

At this point you should have the same error.
But with those options set, the dbext.sql file should still be available and the command line executed should be shown.

Use Vim's echo statement to see the results:

:echo system('sqlite3  /Users/brianlibgober/Dropbox/Collaborations/CleanMake/Main.sqlite < /var/folders/p2/nkftf47s5vb8zr6slgc7fc940000gn/T/v5uxPIb/dbext.sql')

This should result in the same error as you initially reported.
If you do get an error (I hope you do) when using the :echo statement, if you could possibly play with these settings in Vim:

:h 'shellquote'
:h 'shellslash'
:h 'shellpipe'
:h 'shellxquote'
:h 'shellxescape'
:h 'shelltype'

Perhaps :h shellpipe, since it is really complaining about the <?


5.  Provide the output from :set and from :DBGetOption

Sorry to ask you to try stuff, but I don't use a Mac, I do test on Linux though.


David


--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Configure DBext mac for SQLite

David Fishburn-2

On Sun, Jul 23, 2017 at 5:43 PM, Brian Libgober <[hidden email]> wrote:
...
select * from CIK limit 5;

The error I get back

Connection: T(SQLITE)  D(/Users/brianlibgober/Dropbox/Collaborations/CleanMake/Main.sqlite)   at 17:32
Error: near "<": syntax error

Brian,

I was able to try this over the weekend on a MacBook.

I don't see what you are seeing.

:ver                                                                                                                                                
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Aug  4 2017 21:35:40)
MacOS X (unix) version
Included patches: 1-862
Compiled by davidfishburnlocal@YKFM00540280A
Huge version without GUI.  Features included (+) or not (-):
+acl             +comments        +extra_search    +keymap          +mouse_dec       +path_extra      +smartindent     +timers          -X11
+arabic          +conceal         +farsi           +lambda          -mouse_gpm       -perl            +startuptime     +title           -xfontset
+autocmd         +cryptv          +file_in_path    +langmap         -mouse_jsbterm   +persistent_undo +statusline      -toolbar         -xim
-balloon_eval    -cscope          +find_in_path    +libcall         +mouse_netterm   +postscript      -sun_workshop    +user_commands   -xpm
-browse          +cursorbind      +float           +linebreak       +mouse_sgr       +printer         +syntax          +vertsplit       -xsmp
++builtin_terms  +cursorshape     +folding         +lispindent      -mouse_sysmouse  +profile         +tag_binary      +virtualedit     -xterm_clipboard
+byte_offset     +dialog_con      -footer          +listcmds        +mouse_urxvt     -python          +tag_old_static  +visual          -xterm_save
+channel         +diff            +fork()          +localmap        +mouse_xterm     -python3         -tag_any_white   +visualextra
+cindent         +digraphs        -gettext         -lua             +multi_byte      +quickfix        -tcl             +viminfo
-clientserver    -dnd             -hangul_input    +menu            +multi_lang      +reltime         +termguicolors   +vreplace
+clipboard       -ebcdic          +iconv           +mksession       -mzscheme        +rightleft       -terminal        +wildignore
+cmdline_compl   +emacs_tags      +insert_expand   +modify_fname    +netbeans_intg   -ruby            +terminfo        +wildmenu
+cmdline_hist    +eval            +job             +mouse           +num64           +scrollbind      +termresponse    +windows
+cmdline_info    +ex_extra        +jumplist        -mouseshape      +packages        +signs           +textobjects     +writebackup
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc    -o vim        -lm -lncurses  -liconv -framework Cocoa




I used this .vimrc:

***
" Vim 8, prevents defaults.vim from being sourced
let skip_defaults_vim = 1
" Do not keep compatibility with Vi, use all of Vim's features
set nocompatible
set hlsearch
set selectmode=
behave xterm
set cursorline
set cursorcolumn
set laststatus=2
set shortmess=at
set whichwrap=<,>,h,l
set history=500
set nobackup
set nowritebackup
set incsearch
set showcmd
set showbreak=>>
set nostartofline
set joinspaces
set nrformats-=octal
set ignorecase smartcase
set virtualedit=
set modelines=10
set shiftwidth=4
set nodigraph
set esckeys
set hidden
set ruler
set showmatch
set visualbell
set wildmenu
set noerrorbells
set autoindent
set autochdir
set foldopen+=jump
set hidden
set expandtab
set tabstop=4
set lines=42
set columns=160
set nolist
***


I put in the following dbext configuration:

let g:dbext_default_profile_mysql_local = 'type=MYSQL:user=root:passwd=MyPass:dbname=mysql:extra=-t'
let g:dbext_default_MYSQL_bin = '/usr/local/mysql/bin/mysql'
let g:dbext_default_profile='mysql_local'
let g:dbext_default_use_jobs=0

This returned everything I was expecting when executing:
:DBListTables
:DBExecSQL show tables like '%'


Can you please also try using the .vimrc I supplied above and see if you get any different behaviour.




For the Job issue, I had different results.

let g:dbext_default_use_jobs=0

Everything works.

let g:dbext_default_use_jobs=1

I get a usage screen from the mysql client.  So even though the command works (as proven without jobs), it is very strange that somehow the command was changed when executing via a job.

Strangely enough this works on my Windows machine, but at least I am at a point where I can narrow this down.

David

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Loading...