@@ -169,6 +169,7 @@ module sqlite
169169 public :: sqlite3_exec
170170 public :: sqlite3_exec_
171171 public :: sqlite3_finalize
172+ public :: sqlite3_finalize_
172173 public :: sqlite3_free
173174 public :: sqlite3_initialize
174175 public :: sqlite3_last_insert_rowid
@@ -398,12 +399,12 @@ function sqlite3_exec_(db, sql, callback, client_data, errmsg) bind(c, name='sql
398399 end function sqlite3_exec_
399400
400401 ! int sqlite3_finalize(sqlite3_stmt *stmt)
401- function sqlite3_finalize (stmt ) bind(c, name= ' sqlite3_finalize' )
402+ function sqlite3_finalize_ (stmt ) bind(c, name= ' sqlite3_finalize' )
402403 import :: c_int, c_ptr
403404 implicit none
404405 type (c_ptr), intent (in ), value :: stmt
405- integer (kind= c_int) :: sqlite3_finalize
406- end function sqlite3_finalize
406+ integer (kind= c_int) :: sqlite3_finalize_
407+ end function sqlite3_finalize_
407408
408409 ! int sqlite3_initialize(void)
409410 function sqlite3_initialize () bind(c, name= ' sqlite3_initialize' )
@@ -723,6 +724,14 @@ function sqlite3_exec(db, sql, callback, client_data, errmsg)
723724 if (present (errmsg)) call c_f_str_ptr(ptr, errmsg)
724725 end function sqlite3_exec
725726
727+ function sqlite3_finalize (stmt )
728+ type (c_ptr), intent (inout ) :: stmt
729+ integer :: sqlite3_finalize
730+
731+ sqlite3_finalize = sqlite3_finalize_(stmt)
732+ if (sqlite3_finalize == SQLITE_OK) stmt = c_null_ptr
733+ end function sqlite3_finalize
734+
726735 function sqlite3_libversion ()
727736 type (c_ptr) :: ptr
728737 character (len= :), allocatable :: sqlite3_libversion
0 commit comments