Skip to content
Permalink
Browse files

Remove references to QPyNullVariant

  • Loading branch information
m-kuhn committed May 13, 2016
1 parent 89b7a4a commit 25f2e637c0bbb71b4dd6c6a6d2caa21325f912dd
@@ -23,14 +23,13 @@
***************************************************************************/
"""

from qgis.PyQt.QtCore import QPyNullVariant
from qgis.PyQt.QtSql import QSqlDatabase

from ..connector import DBConnector
from ..plugin import ConnectionError, DbError, Table

import os
from qgis.core import QGis, QgsApplication
from qgis.core import QGis, QgsApplication, NULL
from . import QtSqlDB
import sqlite3

@@ -611,7 +610,7 @@ def getVectorTables(self, schema=None):
for i, tbl in enumerate(lst_tables):
item = list(tbl)
detectedSrid = item.pop()
if isinstance(detectedSrid, QPyNullVariant):
if detectedSrid == NULL:
detectedSrid = u"-1"
else:
detectedSrid = int(detectedSrid)
@@ -779,7 +778,7 @@ def getTableGeomTypes(self, table, geomCol):
geomtypes = []
srids = []
for row in rows:
if isinstance(row[1], QPyNullVariant):
if row[1] == NULL:
srids.append(-1)
else:
srids.append(int(row[1]))
@@ -831,7 +830,7 @@ def getTableRowEstimation(self, table):
res = self._fetchone(c)
c.close()

if not res or isinstance(res[0], QPyNullVariant):
if not res or res[0] == NULL:
return 0
else:
return int(res[0])
@@ -1113,7 +1112,7 @@ def getTableEstimatedExtent(self, table, geom):

if not res_d or len(res_d) < 2:
return None
elif isinstance(res_d[0], QPyNullVariant):
elif res_d[0] == NULL:
return None
else:
res.extend(res_d)
@@ -26,11 +26,11 @@
# this will disable the dbplugin if the connector raise an ImportError
from .connector import OracleDBConnector

from qgis.PyQt.QtCore import Qt, QSettings, QPyNullVariant
from qgis.PyQt.QtCore import Qt, QSettings
from qgis.PyQt.QtGui import QIcon, QKeySequence
from qgis.PyQt.QtWidgets import QAction, QApplication, QMessageBox

from qgis.core import QgsVectorLayer
from qgis.core import QgsVectorLayer, NULL

from ..plugin import ConnectionError, InvalidDataException, DBPlugin, \
Database, Schema, Table, VectorTable, TableField, TableConstraint, \
@@ -487,12 +487,12 @@ def __init__(self, row, table):

self.primaryKey = False
self.num = int(self.num)
if isinstance(self.charMaxLen, QPyNullVariant):
if self.charMaxLen == NULL:
self.charMaxLen = None
else:
self.charMaxLen = int(self.charMaxLen)

if isinstance(self.modifier, QPyNullVariant):
if self.modifier == NULL:
self.modifier = None
else:
self.modifier = int(self.modifier)
@@ -502,7 +502,7 @@ def __init__(self, row, table):
else:
self.notNull = True

if isinstance(self.comment, QPyNullVariant):
if self.comment == NULL:
self.comment = u""

# find out whether fields are part of primary key
@@ -571,22 +571,22 @@ def __init__(self, row, table):
else:
self.type = ORTableConstraint.TypeUnknown

if isinstance(row[6], QPyNullVariant):
if row[6] == NULL:
self.checkSource = u""
else:
self.checkSource = row[6]

if isinstance(row[8], QPyNullVariant):
if row[8] == NULL:
self.foreignTable = u""
else:
self.foreignTable = row[8]

if isinstance(row[7], QPyNullVariant):
if row[7] == NULL:
self.foreignOnDelete = u""
else:
self.foreignOnDelete = row[7]

if isinstance(row[9], QPyNullVariant):
if row[9] == NULL:
self.foreignKey = u""
else:
self.foreignKey = row[9]
@@ -27,8 +27,9 @@

import os

from qgis.PyQt.QtCore import QPyNullVariant, QCoreApplication, QSettings, QObject, pyqtSignal
from qgis.PyQt.QtCore import QCoreApplication, QSettings, QObject, pyqtSignal
from qgis.PyQt.QtGui import QIcon
from qgis.core import NULL
from processing.tools.system import defaultOutputFolder
import processing.tools.dataobjects

@@ -196,7 +197,7 @@ def getSetting(name):
if name in ProcessingConfig.settings.keys():
v = ProcessingConfig.settings[name].value
try:
if isinstance(v, QPyNullVariant):
if v == NULL:
v = None
except:
pass
@@ -29,8 +29,8 @@

from qgis.PyQt import uic
from qgis.PyQt.QtCore import (Qt,
QEvent,
QPyNullVariant)
QEvent
)
from qgis.PyQt.QtWidgets import (QFileDialog,
QDialog,
QStyle,
@@ -45,8 +45,10 @@
QStandardItemModel,
QStandardItem)

from qgis.gui import QgsDoubleSpinBox
from qgis.gui import QgsSpinBox
from qgis.gui import (QgsDoubleSpinBox,
QgsSpinBox
)
from qgis.core import NULL

from processing.core.ProcessingConfig import (ProcessingConfig,
settingsWatcher,
@@ -340,7 +342,7 @@ def eventFilter(self, editor, event):
return QStyledItemDelegate.eventFilter(self, editor, event)

def convertValue(self, value):
if value is None or isinstance(value, QPyNullVariant):
if value is None or value == NULL:
return ""
try:
return int(value)

0 comments on commit 25f2e63

Please sign in to comment.
You can’t perform that action at this time.