Bdzim apply sql

Fix for #18 in conjunction with storage_vm_builder updates.