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(); 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() public static void Loop()
{ {
while (true) while (true)

View File

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