/**
* call-seq:
* finalize( vm ) -> nil
*
* Destroys the given virtual machine and releases any associated memory. Once
* finalized, the VM should not be used.
*/
static VALUE
static_api_finalize( VALUE module, VALUE vm )
{
sqlite_vm *vm_ptr;
int result;
char *errmsg;
/* FIXME: should this be executed atomically? */
GetVM( vm_ptr, vm );
result = sqlite_finalize( vm_ptr, &errmsg );
if( result != SQLITE_OK )
{
static_raise_db_error2( result, &errmsg );
/* "raise" does not return */
}
/* don't need to free the handle anymore */
RDATA(vm)->dfree = NULL;
RDATA(vm)->data = NULL;
return Qnil;
}