|
@@ -1,7 +1,6 @@
|
|
|
def create_ifnot_onrecord(self, table, name):
|
|
def create_ifnot_onrecord(self, table, name):
|
|
|
record = self.db.one("SELECT name, network FROM " + table + " WHERE LOWER(name)=LOWER(%s) AND LOWER(network)=LOWER(%s)", (name, self.network, ))
|
|
record = self.db.one("SELECT name, network FROM " + table + " WHERE LOWER(name)=LOWER(%s) AND LOWER(network)=LOWER(%s)", (name, self.network, ))
|
|
|
|
|
|
|
|
-
|
|
|
|
|
if record: # On record.
|
|
if record: # On record.
|
|
|
# Correct capitalisation of network name, if needed.
|
|
# Correct capitalisation of network name, if needed.
|
|
|
if not self.network == record[1]:
|
|
if not self.network == record[1]:
|
|
@@ -12,5 +11,5 @@ def create_ifnot_onrecord(self, table, name):
|
|
|
self.db.run("UPDATE " + table + " SET name=%s WHERE LOWER(name)=LOWER(%s) AND network=%s", (name, name, self.network, ))
|
|
self.db.run("UPDATE " + table + " SET name=%s WHERE LOWER(name)=LOWER(%s) AND network=%s", (name, name, self.network, ))
|
|
|
|
|
|
|
|
# Create record.
|
|
# Create record.
|
|
|
- else:
|
|
|
|
|
|
|
+ else: # Not on record.
|
|
|
self.db.run("INSERT INTO " + table + " (name, network) VALUES (%s, %s)", (name, self.network, ))
|
|
self.db.run("INSERT INTO " + table + " (name, network) VALUES (%s, %s)", (name, self.network, ))
|