Please tell me how to return values after execution of a query to SQLite database. I have 3-4 hours does not work here is my code..
Code:int GetEndDate(string SteamId, string Service) { var sql = Sql.Builder.Append($"SELECT `Days` FROM Base WHERE UserID = {SteamId} AND `ServiceName` = '{Service}'"); int result = 0; _sqLite.Query(sql, _sqLiteConnection, list => { if (list.Count == 0) { result = 0; } else { result = Convert.ToInt32(list[0]["Days"]); } }); return result; }
SQLite return value problems
Discussion in 'Rust Development' started by TRJfl@sh, Oct 11, 2016.
-
you can't do that.
sqlite has his own thread so it does block the server while it querries.
You would need to totally work another way.
Code:void GetEndDate(string SteamId, string Service) { var sql = Sql.Builder.Append($"SELECT `Days` FROM Base WHERE UserID = {SteamId} AND `ServiceName` = '{Service}'"); int result = 0; _sqLite.Query(sql, _sqLiteConnection, list => { if (list.Count == 0) { result = 0; } else { result = Convert.ToInt32(list[0]["Days"]); } SendReply(player, result); }); } -
Cheers... ( sorry I didn't realize how to work with data files. More precisely, did not happen. According to this, I chose the usual way for me to store data from PHP. OK I will torment date files. Thank you
