aboutsummaryrefslogtreecommitdiff
path: root/captain
diff options
context:
space:
mode:
Diffstat (limited to 'captain')
-rw-r--r--captain/sqlite.f9023
1 files changed, 21 insertions, 2 deletions
diff --git a/captain/sqlite.f90 b/captain/sqlite.f90
index f9bc5b4..8a7d672 100644
--- a/captain/sqlite.f90
+++ b/captain/sqlite.f90
@@ -152,6 +152,12 @@ implicit none
integer(c_int)::sqlite3_column_type
end function sqlite3_column_type
+ function sqlite3_sleep(ms) bind(c, name='sqlite3_sleep')
+ use iso_c_binding
+ integer(kind=c_int), value::ms
+ integer(kind=c_int)::sqlite3_sleep
+ end function sqlite3_sleep
+
end interface
type :: sqlite3_stmt
@@ -327,8 +333,21 @@ contains
class(sqlite3_stmt), intent(inout)::self
integer::ignored
-
- ignored = sqlite3_step(self%stmt)
+ integer::passes
+
+ ignored = SQLITE_BUSY
+ passes = 0
+ do while(ignored == SQLITE_BUSY .and. passes <= 20)
+
+ passes = passes + 1
+
+ ! Sleep while busy...
+ if(passes > 1) then
+ ignored = sqlite3_sleep(100)
+ end if
+
+ ignored = sqlite3_step(self%stmt)
+ end do
end subroutine stmt_step_ignore