When I try the example (step 3, add an item) on p. 152, I don't get the exception saying the foreign key constraint failed. The database just happily adds the item.
In Ch. 3 p. 151, the text says: "Notice, too, that you set the Foreign_Keys pragma in the initDB() function to ensure that all transactions are checked for referential integrity."
However, the code for initDB() looks like this:
Code:
def initDB(filename=None):
global db, cursor
if not filename:
filename = 'lendy.db'
try:
db = sql.connect(filename)
cursor = db.cursor()
except:
print("Error connecting to ", filname)
cursor = None
raise
I don't see anything invoking the Foreign_Keys pragma... is something missing?