diff --git a/RSND/Core/Database.cs b/RSND/Core/Database.cs index 773768a..1f77111 100644 --- a/RSND/Core/Database.cs +++ b/RSND/Core/Database.cs @@ -62,14 +62,10 @@ public class Database public string GetValue(GetQuery? query) { - Console.WriteLine(_tables.Count.ToString().Pastel("#ff0000")); var table = query?.TableName; - var where = query?.Where; - var split = where?.Split("|"); - var colName = split?[0]; - var condition = split?[1]; - var value = split?[2]; + var colName = query?.Key; + var value = query?.Value; if (query?.Select != "*") return ""; @@ -87,15 +83,12 @@ public class Database var value = query?.Value; var newValue = query?.NewValue; - Console.WriteLine(table); var tableToReturn = _tables.Find(x => x.Name == table); - Console.WriteLine(tableToReturn == null ? "shits null" : "shits not null"); - Console.WriteLine(key); var row = tableToReturn?.Rows?.FirstOrDefault(x => x.Columns?.FirstOrDefault(y => y.Name == key)?.Value == value); var column = row?.Columns?.FirstOrDefault(x => x.Name == key); column.Value = newValue; - Console.WriteLine(column.Value); + Save(); } public static void Loop() diff --git a/RSND/Core/DbClient.cs b/RSND/Core/DbClient.cs index 88de225..1b3e888 100644 --- a/RSND/Core/DbClient.cs +++ b/RSND/Core/DbClient.cs @@ -47,7 +47,6 @@ public class DbClient GetQuery getQuery = JsonConvert.DeserializeObject(query); var queryResult = RsndMain.Db.GetValue(getQuery); _socket.Send(queryResult); - Console.WriteLine($"Sent: {queryResult}".Pastel("#71C562")); break; } case QueryType.SetValue: diff --git a/RSND/Core/Querying/Queries/GetQuery.cs b/RSND/Core/Querying/Queries/GetQuery.cs index d00042e..c91444d 100644 --- a/RSND/Core/Querying/Queries/GetQuery.cs +++ b/RSND/Core/Querying/Queries/GetQuery.cs @@ -2,14 +2,16 @@ public class GetQuery : Query { - public GetQuery(string tableName, string select, string where) + public GetQuery(string tableName, string select, string key, string value) { TableName = tableName; Select = select; - Where = where; + Key = key; + Value = value; } public string TableName { get; set; } public string Select { get; set; } - public string Where { get; set; } + public string Key { get; set; } + public string Value { get; set; } } \ No newline at end of file diff --git a/RSND/RsndMain.cs b/RSND/RsndMain.cs index 88d5ebd..8eb1c01 100644 --- a/RSND/RsndMain.cs +++ b/RSND/RsndMain.cs @@ -13,7 +13,7 @@ public static class RsndMain Db.Save(); WebSocketServer server = new WebSocketServer("ws://0.0.0.0:7878"); - + Console.WriteLine("Server started"); FleckLog.Level = LogLevel.Error; server.Start(socket =>