spo_database: reimplement reference insertion

Insert references, reference systems, sig_reference by synchorizing the
various tables only when a new signature is inserted (assumption: any
signature that is already in the database has reference information
present)