dbext: sql not executed

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

dbext: sql not executed

wietse
Hello,

I'm having trouble getting `dbext` to work. I installed dbext_2500 from https://vim.sourceforge.io/scripts/script.php?script_id=356.

My vim version:
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Oct  5 2017 04:42:50)
MacOS X (unix) version
Included patches: 1-1175
Compiled by [hidden email]
Huge version with MacVim GUI.

I have Mariadb (MySQL) running in a docker container. I can connect to, and work with this database with Sequel Pro (https://sequelpro.com/). I can do the same with my local mysql command line client.

In my vimrc I've put the following line:
let g:dbext_default_profile_mariadb_local='type=MYSQL:user=root:passwd=therealpassword:dbname=mydbname:host=127.0.0.1:port=3306'

I've done `:DBSetOption display_cmd_line=1`. When I execute SQL script in vim with this profile, e.g. by doing <leader>slt, I always get:

Connection: T(MYSQL)  H(127.0.0.1)  P(3306)  D(mvne_local)  U(root)   at 11:49
Last command:
mysql  -u root -ptherealpassword -h 127.0.0.1 -P 3306 -D mydbname -t < /var/folders/1p/wx9146md1_l6d204b6bhv_rm0000gn/T/vrGam1h/dbext.sql
Last SQL:
show tables like '%';
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql  Ver 14.14 Distrib 5.7.19, for osx10.11 (x86_64) using  EditLine wrapper
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Usage: mysql [OPTIONS] [database]
  -?, --help          Display this help and exit.
  -I, --help          Synonym for -?
[and the rest of the usage message from mysql...]

When I copy the cmd and execute it in bash I get the correct result:

>> mysql  -u root -ptherealpassword -h 127.0.0.1 -P 3306 -D mydbname -t < /var/folders/1p/wx9146md1_l6d204b6bhv_rm0000gn/T/vrGam1h/dbext.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
+--------------------------+
| Tables_in_mydbname (%) |
+--------------------------+
| contact                  |
| customer                 |
+--------------------------+

(You notice I've done this copy/paste thing a few times doing the tutorial).

So: everything "looks" fine, but it's just not coming through to the database...
Can anybody help?

Best regards,
Wietse

--
--
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
|

Re: dbext: sql not executed

David Fishburn-2
Hello Wietse.

Thanks for reaching out.

On Fri, Nov 17, 2017 at 8:16 AM, wietse <[hidden email]> wrote:

I'm having trouble getting `dbext` to work. I installed dbext_2500 from https://vim.sourceforge.io/scripts/script.php?script_id=356.

My vim version:
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Oct  5 2017 04:42:50)
MacOS X (unix) version
Included patches: 1-1175
Compiled by [hidden email]
Huge version with MacVim GUI.


 
let g:dbext_default_profile_mariadb_local='type=MYSQL:user=root:passwd=therealpassword:dbname=mydbname:host=127.0.0.1:port=3306'

I've done `:DBSetOption display_cmd_line=1`. When I execute SQL script in vim with this profile, e.g. by doing <leader>slt, I always get:

Connection: T(MYSQL)  H(127.0.0.1)  P(3306)  D(mvne_local)  U(root)   at 11:49
Last command:
mysql  -u root -ptherealpassword -h 127.0.0.1 -P 3306 -D mydbname -t < /var/folders/1p/wx9146md1_l6d204b6bhv_rm0000gn/T/vrGam1h/dbext.sql
Last SQL:
show tables like '%';
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql  Ver 14.14 Distrib 5.7.19, for osx10.11 (x86_64) using  EditLine wrapper
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Usage: mysql [OPTIONS] [database]
  -?, --help          Display this help and exit.
  -I, --help          Synonym for -?
[and the rest of the usage message from mysql...]

When I copy the cmd and execute it in bash I get the correct result:

>> mysql  -u root -ptherealpassword -h 127.0.0.1 -P 3306 -D mydbname -t < /var/folders/1p/wx9146md1_l6d204b6bhv_rm0000gn/T/vrGam1h/dbext.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
+--------------------------+
| Tables_in_mydbname (%) |
+--------------------------+


Looks like you have done an excellent job debugging through this.

I am hoping 26.00 will correct the issue, since I believe it is related to how the plugin uses Vim's job / channel support that has lead to the problem.

You can test this by trying your usual <Leader>slt, getting the error, then running:
:let b:dbext_job_enable=0
<Leader>slt

Which tells this buffer not to use the job / channel feature of Vim and execute it directly (as it did before Vim 8.0).

So try this first, then please upgrade to 26.00 and see if the whole issue is resolved.


Thanks,
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
|

Re: dbext: sql not executed

wietse
Hello David,

On Fri, Nov 17, 2017 at 7:41 PM David Fishburn <[hidden email]> wrote:
Hello Wietse.

Thanks for reaching out.

Thanks for answering.
 
On Fri, Nov 17, 2017 at 8:16 AM, wietse <[hidden email]> wrote:

I'm having trouble getting `dbext` to work. I installed dbext_2500 from https://vim.sourceforge.io/scripts/script.php?script_id=356.
 [snip: long explanation translating to "it don't work"]... 
 
I am hoping 26.00 will correct the issue, since I believe it is related to how the plugin uses Vim's job / channel support that has lead to the problem.

You can test this by trying your usual <Leader>slt, getting the error, then running:
:let b:dbext_job_enable=0
<Leader>slt

This didn't really change anything.

Which tells this buffer not to use the job / channel feature of Vim and execute it directly (as it did before Vim 8.0).

So try this first, then please upgrade to 26.00 and see if the whole issue is resolved.

But the upgrade did change the result! My first test was successful so this problem seems fixed! I'll give it a more thorough spin later today.

Thanks!
Wietse

--
--
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.