Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _update(self):
"""updates the current row"""
txts = []
values = []
for k,v in self._values.items():
if k.lower() != "objectid" and \
k.lower() != 'shape':
txts.append("%s=?" % k)
values.append(v)
elif k.lower() == 'shape':
if isinstance(v, dict) and "coordinates" not in v:
v = self._header + dumps(v, False)
elif isinstance(v, dict) and "coordinates" in v:
v = self._gpheader + geometwkb.dumps(obj=v)
elif isinstance(v, str):
gj = geometwkt.loads(v)
v = self._gpheader + geometwkb.dumps(obj=gj)
elif isinstance(v, (bytes, bytearray)):
if isinstance(v, (bytearray)):
v = bytes(v)
if len(v) > 2 and \
v[:2] != b'GB':
v = self._gpheader + v
elif v is None:
v = self._gpheader + b'0x000000000000f87f'
else:
raise ValueError(("Shape column must be Esri JSON dictionary, "
"WKT, GeoJSON dictionary, or WKB (bytes)"))
txts.append("%s=?" % k)
values.append(v)
"""updates the current row"""
txts = []
values = []
for k,v in self._values.items():
if k.lower() != "objectid" and \
k.lower() != 'shape':
txts.append("%s=?" % k)
values.append(v)
elif k.lower() == 'shape':
if isinstance(v, dict) and "coordinates" not in v:
v = self._header + dumps(v, False)
elif isinstance(v, dict) and "coordinates" in v:
v = self._gpheader + geometwkb.dumps(obj=v)
elif isinstance(v, str):
gj = geometwkt.loads(v)
v = self._gpheader + geometwkb.dumps(obj=gj)
elif isinstance(v, (bytes, bytearray)):
if isinstance(v, (bytearray)):
v = bytes(v)
if len(v) > 2 and \
v[:2] != b'GB':
v = self._gpheader + v
elif v is None:
v = self._gpheader + b'0x000000000000f87f'
else:
raise ValueError(("Shape column must be Esri JSON dictionary, "
"WKT, GeoJSON dictionary, or WKB (bytes)"))
txts.append("%s=?" % k)
values.append(v)
sql = '''UPDATE {table} SET {values} WHERE OBJECTID={oid}'''.format(
table=self._table_name,
values=",".join(txts),