Plugin-ul DB Manager

Managerul DB Plugin este oficial parte a nucleului QGIS, fiind destinat să fie principalul instrument pentru integrarea și gestionarea formatelor de baze de date spațiale acceptate de QGIS (PostGIS, SpatiaLite, Geopackage, Oracle Spatial, Straturi virtuale) într-o interfață unică. Pluginul dbManager DB Manager oferă mai multe funcționalități. Aveți posibilitatea de a glisa straturile din browser-ul QGIS în Managerul DB, și de a importa stratul în baza de date spațială. Este suficient să glisați tabele între bazele de date spațiale, iar acestea vor fi importate.

Figure DB Manager 1:

../../../_images/db_manager.png

Dialogul DB Manager

Meniul Bazei de Date vă permite să vă conectați la o bază de date existentă, pentru a lansa fereastra SQL și pentru a ieși din Plugin-ul DB Manager. O dată ce vă conectați la o bază de date existentă, apar meniurile adiționale Schemă și Tabelă.

Meniul Schema include instrumente pentru a crea și a șterge scheme (vide) și, în cazul în care topologia este disponibilă, (de exemplu, PostGIS 2), pentru a începe o TopoVizualizare.

The Table menu allows you to create and edit tables and to delete tables and views. It is also possible to empty tables and to move tables from one schema to another. As further functionality, you can perform a VACUUM and then an ANALYZE for each selected table. Plain VACUUM simply reclaims space and makes it available for reuse. ANALYZE updates statistics to determine the most efficient way to execute a query. Finally, you can import layers/files, if they are loaded in QGIS or exist in the file system. And you can export database tables to shape with the Export File feature.

The Tree window lists all existing databases supported by QGIS. With a double-click, you can connect to the database. With the right mouse button, you can rename and delete existing schemas and tables. Tables can also be added to the QGIS canvas with the context menu.

If connected to a database, the main window of the DB Manager offers three tabs. The Info tab provides information about the table and its geometry, as well as about existing fields, constraints and indexes. It also allows you to run Vacuum Analyze and to create a spatial index on a selected table, if not already done. The Table tab shows all attributes, and the Preview tab renders the geometries as preview.

Lucrul cu fereastra SQL

You can also use the DB Manager to execute SQL queries against your spatial database and then view the spatial output for queries by adding the results to QGIS as a query layer. It is possible to highlight a portion of the SQL and only that portion will be executed when you press F5 or click the Execute (F5) button.

Figure DB Manager 2:

../../../_images/db_manager_sql.png

Executarea interogărilor SQL în fereastra SQL DB Manager