Forgot that NULL values are actually always seen as distinct values in SQL. Why does SQLite even allow NULL in PRIMARY KEY?
This commit is contained in:
parent
07740b880b
commit
25f82e40f8
2 changed files with 6 additions and 6 deletions
|
@ -75,12 +75,12 @@ class dbObject:
|
||||||
return setuptools.getDate(str(self.getNext()["%s(SUBSTR(timestamp,0,11))" % mode]))
|
return setuptools.getDate(str(self.getNext()["%s(SUBSTR(timestamp,0,11))" % mode]))
|
||||||
|
|
||||||
def getFollowers(db):
|
def getFollowers(db):
|
||||||
db.executeQuery("SELECT id FROM followers WHERE `until` IS NULL;")
|
db.executeQuery("SELECT id FROM followers WHERE `until` = 0;")
|
||||||
for i in db.getAll():
|
for i in db.getAll():
|
||||||
yield i[0]
|
yield i[0]
|
||||||
|
|
||||||
def getFollowing(db):
|
def getFollowing(db):
|
||||||
db.executeQuery("SELECT id FROM following WHERE `until` IS NULL;")
|
db.executeQuery("SELECT id FROM following WHERE `until` = 0;")
|
||||||
for i in db.getAll():
|
for i in db.getAll():
|
||||||
yield i[0]
|
yield i[0]
|
||||||
|
|
||||||
|
|
|
@ -62,13 +62,13 @@ def getFollowers(db=dbtools.dbHelper(), two=twitools.twObject(), firstrun=False)
|
||||||
|
|
||||||
for follower in new:
|
for follower in new:
|
||||||
if follower not in current:
|
if follower not in current:
|
||||||
db.executeQuery("INSERT INTO followers VALUES('%s', %i, NULL)" % (follower, int(time.time())))
|
db.executeQuery("INSERT INTO followers VALUES('%s', %i, 0)" % (follower, int(time.time())))
|
||||||
print("New follower: %s" % follower)
|
print("New follower: %s" % follower)
|
||||||
gained += 1
|
gained += 1
|
||||||
|
|
||||||
for follower in current:
|
for follower in current:
|
||||||
if follower not in new:
|
if follower not in new:
|
||||||
db.executeQuery("UPDATE followers SET `until` = %i WHERE `id` = '%s' AND `until` IS NULL" % (int(time.time()), follower))
|
db.executeQuery("UPDATE followers SET `until` = %i WHERE `id` = '%s' AND `until` = 0" % (int(time.time()), follower))
|
||||||
print("Lost follower: %s" % follower)
|
print("Lost follower: %s" % follower)
|
||||||
lost += 1
|
lost += 1
|
||||||
|
|
||||||
|
@ -88,13 +88,13 @@ def getFollowing(db=dbtools.dbHelper(), two=twitools.twObject(), firstrun=False)
|
||||||
|
|
||||||
for following in new:
|
for following in new:
|
||||||
if following not in current:
|
if following not in current:
|
||||||
db.executeQuery("INSERT INTO following VALUES('%s', %i, NULL)" % (following, int(time.time())))
|
db.executeQuery("INSERT INTO following VALUES('%s', %i, 0)" % (following, int(time.time())))
|
||||||
print("You started following: %s" % following)
|
print("You started following: %s" % following)
|
||||||
gained += 1
|
gained += 1
|
||||||
|
|
||||||
for following in current:
|
for following in current:
|
||||||
if following not in new:
|
if following not in new:
|
||||||
db.executeQuery("UPDATE following SET `until` = %i WHERE `id` = '%s' AND `until` IS NULL" % (int(time.time()), following))
|
db.executeQuery("UPDATE following SET `until` = %i WHERE `id` = '%s' AND `until` = 0" % (int(time.time()), following))
|
||||||
print("You no longer follow: %s" % following)
|
print("You no longer follow: %s" % following)
|
||||||
lost += 1
|
lost += 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue