This commit is contained in:
j4ck 2022-06-04 00:50:51 +03:00
parent c4b9627422
commit 9e2be5bb51
2 changed files with 17 additions and 6 deletions

View File

@ -91,6 +91,22 @@ public class Database
Save();
}
public void AddToTable(AddQuery? query)
{
var table = query?.TableName;
var columns = query?.Columns;
var tableToReturn = _tables.Find(x => x.Name == table);
if (tableToReturn == null) return;
var row = new Row
{
Columns = columns
};
tableToReturn.Rows?.Append(row);
Save();
}
public static void Loop()
{
while (true)

View File

@ -58,12 +58,7 @@ public class DbClient
case QueryType.AddToTable:
{
AddQuery addQuery = JsonConvert.DeserializeObject<AddQuery>(query);
foreach (var column in addQuery?.Columns)
{
Console.WriteLine(column.Value);
}
RsndMain.Db.AddToTable(addQuery);
break;
}
case QueryType.CreateTable: