Hi Jose,
In the SQLite class, Finalize gets called during the Destructor and when a new statement is prepared. However, if the programmer calls Finalize in their code then the statement handle m_hStmt needs to be set to zero, otherwise a GPF will occur when the class subsequently tries to call Finalize because the statement will have already been freed and the m_hStmt value is no longer valid.
PRIVATE FUNCTION CSQLiteStmt.Finalize () AS LONG
DIM pProc AS PFNSQLITE3FINALIZEPROC = _
cast(PFNSQLITE3FINALIZEPROC, GetProcAddress(m_hLib, "sqlite3_finalize"))
IF pProc = 0 THEN this.SetResult(GetLastError) : EXIT FUNCTION
FUNCTION = pProc(m_hStmt)
m_hStmt = 0 ' <---- NEED TO ADD THIS LINE
IF m_pColNames THEN m_pColNames->RemoveAll
END FUNCTION
Done. Thanks for spotting it.