The Photo DB is not created automatically when setting up a form with a MultiPhoto widget. This could be overcome by creationg the table at runtime if it does not already exist.
The code also opens the database with the spatialite module, but that is not strictly necessary for a photo db.
def DB(self):
dbconfig = self.config['dboptions']
dbpath = dbconfig['dbpath']
dbpath = os.path.join(self.config['context']['project'].datafolder(), dbpath)
table = dbconfig['table']
db = sqlite3.connect(dbpath)
db.enable_load_extension(True)
db.load_extension("spatialite4.dll")
sql = "CREATE TABLE IF NOT EXISTS '{0}' (linkid, photo, photo_id, timestamp, photo_number, linkname);".format(table)
db.execute(sql)
return db
The Photo DB is not created automatically when setting up a form with a MultiPhoto widget. This could be overcome by creationg the table at runtime if it does not already exist.
The code also opens the database with the spatialite module, but that is not strictly necessary for a photo db.