On Tue, 25 Mar 2014 07:46:49 +1100 Lex Trotman elextr@gmail.com wrote:
On 25 March 2014 03:12, Steven Blatnick steve8track@yahoo.com wrote:
I wrote an sql plugin for gedit a while back which was based on my experience with Microsoft's SQL client. Basically the approach I took, and I think this would work for geany as well, was:
Manage various connections to databases and allow switching between the connections - the connection is global to geany (Actually, I think my first plugin only allowed one connection, and later when I tried to remake the plugin for gedit3, I allowed multiple connections to be managed) Run queries from any open document by highlighting them and using some keyboard shortcut and/or button
IMO it would be better if the query was copied to an editable (pane/entry) since whenever I have sql in code it usually has part of the query generated by code and this would need interpolating for the query to make sense at edit time.
Well... in my mind I had also something more, Steven suggested. Mark a query and execute it. The reason why I want such a support is, that I don't want to copy queries e.g. to pgadmin
Display the results in a scrollable gtk table in the bottom pane. This was especially beneficial as the ASCII presentation from the command line is hard to see when it starts wrapping.
Or a separate editor buffer??
Well... also possible. Do you need some editor features on that buffer?
That would be a reasonable minimum. We could extend it from there to:
Show tables in the current database on the side panel, expandable to show the columns
Editable if supported by the underlying database, what about creating tables as well?
CREATE TABLE "foo"; should be not too complicated for everyone in first step IMHO.
Allow editing of the cells in the table output
Which is where outputting to the edit buffer helps, save means commit changes?
Well... This is something, I was thinking of not having -- at least on versions. I just don't think it's needed to often by a developer. And everyone else could use pgadmin/phpmyadmin/*
Some further thoughts:
I used SQLAlchemy for my gedit plugin (it was in python) because it allowed connecting to various SQL databases such as MySQL, PostgreSQL, etc If there is a way to make the output in a table on a separate thread to not lock the UI, that would be good for larger result sets. We could at least create some optional built in limit of how many results. A way to kill the query in progress would be good
In current Geany thats best handled as a subprocess, which is also a good way of handling multi-database configurability, just run the command for the particular database.
I second that there should be a blocking UI when running a query -- by using the geany api it should be not often the issue anymore.
Cheers, Frank