aboutsummaryrefslogtreecommitdiff
path: root/captain/db.f90
diff options
context:
space:
mode:
Diffstat (limited to 'captain/db.f90')
-rw-r--r--captain/db.f9025
1 files changed, 25 insertions, 0 deletions
diff --git a/captain/db.f90 b/captain/db.f90
index b789280..315bd10 100644
--- a/captain/db.f90
+++ b/captain/db.f90
@@ -146,6 +146,31 @@ contains
end subroutine update_player_token_db
+ function player_has_token_db(name)
+ implicit none
+
+ character(*), intent(in)::name
+ logical::player_has_token_db
+ type(sqlite3_stmt)::stmt
+
+ character(128)::tk
+
+ player_has_token_db = .false.
+
+ if(stmt%prepare(db, "SELECT token FROM players WHERE name=?") == SQLITE_OK) then
+ if(stmt%bind_text(1, name) == SQLITE_OK ) then
+ if(stmt%step() == SQLITE_ROW) then
+ call stmt%column_text(0, tk)
+ player_has_token_db = (trim(tk) /= "None")
+ end if
+ end if
+ end if
+ call stmt%finalize()
+
+
+ end function player_has_token_db
+
+
subroutine remove_player_db(name)
implicit none