Пример #1
0
        public void Func1()
        {
            try
            {
                SqlDataBaseConnector con1 = new SqlDataBaseConnector();
                var st1 = con1.ConnectToFile(
                    @"C:\DatabaseComparer-Asp-ASP.NET-Core-2.0-\TestDatabases\sakila.mdf");
                var l11 = con1.GetTablesList();
                l11.Sort();
                SQLiteDatabaseConnector con2 = new SQLiteDatabaseConnector();
                var st2 = con2.ConnectToFile(
                    @"C:\DatabaseComparer-Asp-ASP.NET-Core-2.0-\TestDatabases\sakila.db");
                var l21 = con2.GetTablesList();
                l21.Sort();

                List <dynamic> list = new List <dynamic>();
                for (int j = 0; j < l11.Count; j++)
                {
                    con1.SelectedColumns.Clear();
                    con2.SelectedColumns.Clear();
                    var l12 = con1.GetTableInfo(l11[j]);
                    foreach (var item in con1.TableColumns)
                    {
                        con1.SelectedColumns.Add(item);
                    }

                    con1.SelectedTable = l11[j];
                    var      l1       = con1.Read(con1.BuildSelectQuery(), con1.FullStringArraySelector);
                    string[] selected = new string[l1.Count];
                    for (int i = 0; i < l1.Count; i++)
                    {
                        selected[i] = i.ToString();
                    }

                    var l3 = String.Join("", con1.BuildInsert(l1, selected));
                    list.Add(new { Name = $"{l11[j]}", Data = l3 });
                }
                Console.WriteLine(1);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Пример #2
0
 public void SQLiteConnectionTest()
 {
     try
     {
         var db = new SQLiteDatabaseConnector();
         db.ConnectToFile(
             @"D:\GitHub\Database_Comaparer\DatabaseComparer-Asp-ASP.NET-Core-2.0-\TestApp\UnitTestProject1\bin\Debug\chinook.db");
         var list = db.GetTablesList();
         Assert.IsNotNull(list);
         var list2 = db.GetTableInfo(list[3]);
         Assert.IsNotNull(list2);
         var list3 = db.Read($"Select * from {list[3]}", db.FullStringArraySelector);
         Assert.IsNotNull(list3);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         Assert.Fail();
     }
 }