101 Commits

Author SHA1 Message Date
Alessandro Pasotti
d54c3101ae Add feedback to executeSql
Fixes #38092 by adding an optional QgsFeedback argument to
the executeSql method and by implementing the PQCancel
method in the PG provider internals.

While the cancellation works well for all supported provider while
fetching results in the loop, the cancellation of a running query is now
implemented for the postgres provider connection only because the GPKG
and GDAL both rely on GDALDatasetExecuteSQL which cannot be interrupted.

This PR also introduce a few optimizations in the PG DB-Manager
code that should probably fix also other "slowness" issues that
were reported after 3.x during PG query execution.

A small UX change in th SQL dialog makes it evident to the user that
a cancellation request has been sent to the backend: the button text
is changed to "Cancellation requested, please wait..." so that for
provider connections that are not able to interrupt the running query
and must wait for the fetching loop to exit from the exeuteSql call
the user knows that something is happening and that a cancellation
request has been successfully sent.
2020-09-19 11:15:41 +02:00
Matthias Kuhn
9729a43df7
Merge pull request #36828 from m-kuhn/followup_36823
Address review comment from #36823
2020-05-30 11:25:20 +02:00
Matthias Kuhn
ffc5033976
Merge pull request #36827 from m-kuhn/win_newlines
Fix windows newlines replacement in db manager query layer
2020-05-30 11:24:40 +02:00
Matthias Kuhn
b1307d241c Address review comment from #36823 2020-05-29 16:29:46 +02:00
Matthias Kuhn
d8fa7e2df4 Fix windows newlines replacement in db manager query layer
Fixes #36825
2020-05-29 15:50:09 +02:00
Alessandro Pasotti
dc2ff12c2b DB Manager: remove semicolon from SQL window queries
Partial fix for #36205
2020-05-29 12:38:45 +02:00
Nyall Dawson
b6a7a10703 Fix some more python formatting issues, remove more flake exceptions 2020-05-11 11:41:50 +10:00
Alexander Bruy
bba874cd42 prompt before closing SQL editor tabs with unsaved changes (fix #14636) 2020-05-06 12:49:18 +03:00
Matthias Kuhn
574e0ebaa1 [db_manager] Allow opening .sql files
and not only .SQL files
also allow any file extension

Fix #33173
2019-12-02 01:43:28 +10:00
Stephen Knox
a39a413b92 Fixing db_manager so that it can run sql with inline comments
Fixes #29089
2019-09-06 10:26:34 +10:00
lbartoletti
81c4b81b3b [bugfix] Fix the whole text instead of the selected part in db_manager save SQL file. fixes #30616 2019-07-22 18:41:01 +10:00
Nyall Dawson
ef8d893393 More QgsMapLayer python fixes 2019-03-27 09:11:15 +10:00
Nyall Dawson
ac651ee0d9 Followup 8d51a693, fix broken plugins 2019-03-27 07:20:43 +10:00
Denis Rouzaud
8d51a693a1 missing changes of QgsMapLayer::Type => QgsMapLayerType 2019-03-26 14:09:19 -05:00
Alessandro Pasotti
74aa8ca16e Fix db manager sql query
Fixes #21353
2019-02-23 11:10:50 +01:00
Etienne Trimaille
f37d48f69b
keep comments when save as preset or file, remove lines starting by "--" in DBManager 2019-02-18 22:04:34 -04:00
Etienne Trimaille
427cb0b27a fix some HIG and add missing translations in dbmanager 2019-02-05 10:48:47 +11:00
Etienne Trimaille
ac9c6f1e18 some minor code cleanup in dbmanager 2019-02-05 10:48:47 +11:00
Alessandro Pasotti
3618d63ca6 Show an error message when a query yields an invalid layer
... instead of failing silently
2018-12-14 15:09:46 +01:00
Alessandro Pasotti
b5181f2c50 sqlite accept aliased queries from db manager
Fixes #20674 - DB Manager - load sql query as layer with geom column

Well, not sure it really fixes that particular issue because it
is not really well described, but for sure this fixes the general
case of "SELECT * FROM my_table AS my_alias"
2018-12-08 11:15:49 +01:00
Blottiere Paul
4e209724cf
Merge pull request #8260 from lbartoletti/dbmanager_add_save_sql_file
[FEATURE][needs-docs]Add buttons to load and save an external SQL file
2018-11-19 04:49:59 +00:00
lbartoletti
03d53fb871 missing translations; add extension at save 2018-11-13 09:22:33 +01:00
lbartoletti
ebdc932ec2 add LastDir for SQL File 2018-11-13 08:20:20 +01:00
lbartoletti
5eecbf2d4c Add translation ; add button 'load file' 2018-11-12 17:48:14 +01:00
Nyall Dawson
dc72f06e53 Bump minimum Qt version to 5.9 2018-11-06 08:45:37 +10:00
Nyall Dawson
f3e9aaf79a Fix some inefficient python dictionary iteration 2018-10-31 08:42:51 +10:00
lbartoletti
74f7cb5414 Add a button to save the query as an external sql file 2018-10-22 12:26:14 +02:00
Alessandro Pasotti
a74b6262df [dbmanager] Fix stored queries retrieve
Fixes #19802 - DB Manager saved SQL statements are saved empty
2018-09-18 18:22:58 +02:00
Nyall Dawson
9d8202b66a [dbmanager] Fix exception on older Qt builds
Fixes #19309
2018-06-30 18:35:38 +10:00
Salvatore Larosa
84d86935e4 set limit to 20 to store database query in the history 2018-04-05 22:53:04 +02:00
Salvatore Larosa
1242402a56 [FEATURE][needs-docs] DB Manager: adds SQL query history 2018-04-04 23:30:48 +02:00
Blottiere Paul
fea66f9913 Update ui and add shortcut to cancel pending query 2018-03-02 09:43:26 +00:00
Blottiere Paul
957e92c847 Add async model for virtual layers 2018-03-02 09:43:26 +00:00
Blottiere Paul
bf7df6d2e3 Add a cancel button for Postgis and Spatialite 2018-03-02 09:43:26 +00:00
Matthias Kuhn
8473df562f
More endless hourglass protection 2017-07-30 22:18:25 +02:00
Harrissou Sant-anna
6fab688298 Use SpatiaLite right spelling when needed 2017-07-07 01:26:38 +02:00
Juergen E. Fischer
f00a87cb8a update translation strings 2017-03-05 10:21:24 +01:00
Harrissou Sant-anna
ef85cdcf83 Replace "eg" by "e.g." or "for example" 2016-12-30 00:03:22 +01:00
Martin Dobias
d56a97d4fe Merge QgsMapLayerRegistry into QgsProject
All methods/signals of QgsMapLayerRegistry moved verbatim to QgsProject.
2016-12-10 15:18:12 +08:00
Juergen E. Fischer
31df84aa6b run 2to3 on source 2016-09-21 23:30:04 +02:00
Mathieu Pellerin
cd1d44be9d [db manager] python3 support (#3512) 2016-09-20 09:34:36 +02:00
Juergen E. Fischer
a6954b2771 [dbmanager] re-enable line number again (followup 5e36de7 and d9f934f) 2016-07-03 20:22:13 +02:00
Matthias Kuhn
5e36de70b0 [dbmanager] Fix error when opening SQL window 2016-07-03 14:48:17 +02:00
Juergen E. Fischer
d9f934f950 db manager: re-enable margins with line numbers in sql editor
(fixes #15110)
2016-06-22 22:41:44 +02:00
Denis Rouzaud
8071acd064 move PyQt compat folder to python/qgis 2016-04-29 14:10:26 +02:00
Juergen E. Fischer
c55f8b73f0 db_manager: cleanups 2016-03-21 17:00:24 +01:00
Juergen E. Fischer
8bda5c00a5 db_manager: migrate to new style signals 2016-03-15 23:46:54 +01:00
Juergen E. Fischer
c6d921729e python fixes:
* issues identified by pyflakes (star and unused imports)
* pyqtwrapper: add QtSvg
* some exceptions e.message => unicode(e)
* some translations tr("..." % foo) => tr("...") % foo
* TODO:
  python/console/console_sci.py:547 QsciScintillaCompat?
  python/plugins/db_manager/dlg_query_builder.py:304 pop_up_error?
2016-03-15 17:25:23 +01:00
Juergen E. Fischer
00633811c9 spelling fixes 2016-01-21 10:42:25 +01:00
Juergen E. Fischer
c2fb11c8d5 db manager: only alias subqueries on postgres (fixes #13731) 2015-12-02 09:24:25 +01:00