The struct->class workaround is unworkable in this case because underlying C database clients are often pretty sensitive to out of order resource cleanup and generate errors or crash as a result. The structs are essential but I will limit the design to avoid the issue for now.