DB/SAI: The Final Code

By @dr-j fixes #3640