mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-09 00:08:52 -04:00
[DB Manager] Allow lowercase field names for homogenize PostGIS Import
PostGIS provider has an option to lowercase field names. This options is available for user in QGIS algorithm ImportIntoPostGIS and not in DB Mananger. This commit fix it.
This commit is contained in:
parent
c130372730
commit
a9795ad8ea
@ -552,6 +552,9 @@ class Database(DbItemObject):
|
|||||||
def spatialIndexClause(self, src_table, src_column, dest_table, dest_table_column):
|
def spatialIndexClause(self, src_table, src_column, dest_table, dest_table_column):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def hasLowercaseFieldNamesOption(self):
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
class Schema(DbItemObject):
|
class Schema(DbItemObject):
|
||||||
|
|
||||||
|
@ -168,6 +168,9 @@ class PGDatabase(Database):
|
|||||||
|
|
||||||
item.runRefreshMaterializedView()
|
item.runRefreshMaterializedView()
|
||||||
|
|
||||||
|
def hasLowercaseFieldNamesOption(self):
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
class PGSchema(Schema):
|
class PGSchema(Schema):
|
||||||
|
|
||||||
|
@ -108,6 +108,10 @@ class DlgImportVector(QDialog, Ui_Dialog):
|
|||||||
if not self.chkSpatialIndex.isEnabled():
|
if not self.chkSpatialIndex.isEnabled():
|
||||||
self.chkSpatialIndex.setChecked(False)
|
self.chkSpatialIndex.setChecked(False)
|
||||||
|
|
||||||
|
self.chkLowercaseFieldNames.setEnabled(self.db.hasLowercaseFieldNamesOption())
|
||||||
|
if not self.chkLowercaseFieldNames.isEnabled():
|
||||||
|
self.chkLowercaseFieldNames.setChecked(False)
|
||||||
|
|
||||||
def populateLayers(self):
|
def populateLayers(self):
|
||||||
self.cboInputLayer.clear()
|
self.cboInputLayer.clear()
|
||||||
for index, layer in enumerate(iface.legendInterface().layers()):
|
for index, layer in enumerate(iface.legendInterface().layers()):
|
||||||
@ -302,13 +306,18 @@ class DlgImportVector(QDialog, Ui_Dialog):
|
|||||||
else:
|
else:
|
||||||
geom = None
|
geom = None
|
||||||
|
|
||||||
|
options = {}
|
||||||
|
if self.chkLowercaseFieldNames.isEnabled() and self.chkLowercaseFieldNames.isChecked():
|
||||||
|
pk = pk.lower()
|
||||||
|
if geom:
|
||||||
|
geom = geom.lower()
|
||||||
|
options['lowercaseFieldNames'] = True
|
||||||
|
|
||||||
# get output params, update output URI
|
# get output params, update output URI
|
||||||
self.outUri.setDataSource(schema, table, geom, "", pk)
|
self.outUri.setDataSource(schema, table, geom, "", pk)
|
||||||
uri = self.outUri.uri(False)
|
uri = self.outUri.uri(False)
|
||||||
|
|
||||||
providerName = self.db.dbplugin().providerName()
|
providerName = self.db.dbplugin().providerName()
|
||||||
|
|
||||||
options = {}
|
|
||||||
if self.chkDropTable.isChecked():
|
if self.chkDropTable.isChecked():
|
||||||
options['overwrite'] = True
|
options['overwrite'] = True
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0" colspan="2">
|
<item row="8" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="chkSpatialIndex">
|
<widget class="QCheckBox" name="chkSpatialIndex">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Create spatial index</string>
|
<string>Create spatial index</string>
|
||||||
@ -267,6 +267,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="7" column="0">
|
||||||
|
<widget class="QCheckBox" name="chkLowercaseFieldNames">
|
||||||
|
<property name="text">
|
||||||
|
<string>Convert field names to lowercase</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user