diff options
Diffstat (limited to 'db.c')
-rw-r--r-- | db.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -186,6 +186,17 @@ bool db_add_member(i64 roomid,i64 userid){ return success; } +bool db_remove_member(i64 roomid,i64 userid){ + assert(roomid!=-1&&userid!=-1); + static sqlite3_stmt *stmt = NULL; + if (!stmt) SQLITE(prepare_v2,database,"delete from Members where room = ? and user = ?",-1,&stmt,NULL); + SQLITE(bind_int64,stmt,1,roomid); + SQLITE(bind_int64,stmt,2,userid); + bool success=sqlite3_step(stmt)==SQLITE_DONE; + reset_stmt(stmt); + return success; +} + bool db_is_member(i64 roomid,i64 userid){ static sqlite3_stmt *stmt = NULL; if (!stmt) SQLITE(prepare_v2,database,"select 1 from Members where room = ? and user = ?",-1,&stmt,NULL); |