Re: Query tool: Autocompletion
Re: Query tool: Autocompletion
От:
"Dave Page" <dpage@vale-housing.co.uk>
Дата:
> -----Original Message----- > From: pgadmin-hackers-owner@postgresql.org > [mailto:pgadmin-hackers-owner@postgresql.org] On Behalf Of > Magnus Hagander > Sent: 08 January 2006 15:05 > To: pgadmin-hackers@postgresql.org > Subject: Re: [pgadmin-hackers] Query tool: Autocompletion > > > Attached is a first attempt at autocompletion for the SQL > > Query tool. It probably needs some more work, but it's a start :-) > > > > It's based on the tab completion in psql. The idea is to pull > > the latest and greatest tab-complete.c from psql, then run it > > through a perlscript that picks out the tasty parts. > > > > > > Anyway. Attached is the patch. I've also included a > > tab-complete.inc from the current Due to a bug in the Visual > > C++ compiler, it *has* to be compiled as "C" not as "C++". > > Thus, a bit if ugly glue is required between those two worlds > > :-)psql - to make it build directly (without adding a build > > dependency on perl), this one is what should probably go in > > svn, and then be manually sycned onw and then from psql. > > "tabcomplete.c" needs to be added to the build project (I'm > > devving in Visual Studio 2003, so I can't modify the .dsw > > from there easily). > > > > I've only tested this on Windows so far. Wouldn't surprise me > > if some minor work is needed to build on *nix. > > > > I'm also unsure if I can get away with the easy way I pass > > strings in and out of wx (encoding issues?). It works in my > > testcases, but I'm not familiar enough to be sure if it > always does. > > > > Finally, I've added a screenshot for those who don't want to > > rebuild :) > > > > So. Thoughts, and comments? Nice, it works quite well. Some thoughts: - My main concern is that I do use tab, which this prevents - as per your comment in the source I think we need an option to turn the feature off for those that don't want it. - A space should be added after an item has been inserted form the auto-complete list, per psql. - Schema-prefixed table names can't have columns in the WHERE clause auto-completed. Actually on further investigation this seems to apply to psql as well. - SELECT * FROM foo WHERE bar = 'FOO' AND doesn't work. Also as per psql? I'd like Andreas to look at this before applying - particularly the encoding bits which are still largely a mystery to me as well. Regards, Dave.
Re: Query tool: Autocompletion
От:
Andreas Pflug <pgadmin@pse-consulting.de>
Дата:
Dave Page wrote: > > > >>-----Original Message----- >>From: pgadmin-hackers-owner@postgresql.org >>[mailto:pgadmin-hackers-owner@postgresql.org] On Behalf Of >>Magnus Hagander >>Sent: 08 January 2006 15:05 >>To: pgadmin-hackers@postgresql.org >>Subject: Re: [pgadmin-hackers] Query tool: Autocompletion >> >> >>>Attached is a first attempt at autocompletion for the SQL >>>Query tool. It probably needs some more work, but it's a start :-) >>> >>>It's based on the tab completion in psql. The idea is to pull >>>the latest and greatest tab-complete.c from psql, then run it >>>through a perlscript that picks out the tasty parts. >>> >>> >>>Anyway. Attached is the patch. I've also included a >>>tab-complete.inc from the current Due to a bug in the Visual >>>C++ compiler, it *has* to be compiled as "C" not as "C++". >>>Thus, a bit if ugly glue is required between those two worlds >>>:-)psql - to make it build directly (without adding a build >>>dependency on perl), this one is what should probably go in >>>svn, and then be manually sycned onw and then from psql. >>>"tabcomplete.c" needs to be added to the build project (I'm >>>devving in Visual Studio 2003, so I can't modify the .dsw >>>from there easily). >>> >>>I've only tested this on Windows so far. Wouldn't surprise me >>>if some minor work is needed to build on *nix. >>> >>>I'm also unsure if I can get away with the easy way I pass >>>strings in and out of wx (encoding issues?). It works in my >>>testcases, but I'm not familiar enough to be sure if it >> >>always does. >> >>>Finally, I've added a screenshot for those who don't want to >>>rebuild :) >>> >>>So. Thoughts, and comments? > > > Nice, it works quite well. Some thoughts: > > - My main concern is that I do use tab, which this prevents - as per > your comment in the source I think we need an option to turn the feature > off for those that don't want it. > > - A space should be added after an item has been inserted form the > auto-complete list, per psql. > > - Schema-prefixed table names can't have columns in the WHERE clause > auto-completed. Actually on further investigation this seems to apply to > psql as well. > > - SELECT * FROM foo WHERE bar = 'FOO' AND doesn't work. Also as > per psql? > > I'd like Andreas to look at this before applying - particularly the > encoding bits which are still largely a mystery to me as well. Um, nicely spoken :-) I'll have a tight look at it, esp. the disable option. I'd be positively surprised if the feature can cope with my less than straight forward editing habits. Regards, Andreas