Exemple #1
0
        private async Task InsertVehicles()
        {
            Console.WriteLine("Inserting vehicle data");

            await qldbDriver.Execute(async transactionExecutor =>
            {
                await Insert(transactionExecutor, VehicleTableName, new Vehicle {
                    Vin  = "1N4AL11D75C109151", Type = "Sedan", Year = 2011,
                    Make = "Audi", Model = "A5", Color = "Silver"
                });
                await Insert(transactionExecutor, VehicleTableName, new Vehicle {
                    Vin  = "KM8SRDHF6EU074761", Type = "Sedan", Year = 2015,
                    Make = "Tesla", Model = "Model S", Color = "Blue"
                });
                await Insert(transactionExecutor, VehicleTableName, new Vehicle {
                    Vin  = "3HGGK5G53FM761765", Type = "Motorcycle", Year = 2011,
                    Make = "Ducati", Model = "Monster", Color = "Yellowr"
                });
                await Insert(transactionExecutor, VehicleTableName, new Vehicle {
                    Vin  = "1HVBBAANXWH544237", Type = "Semi", Year = 2009,
                    Make = "Ford", Model = "F 150", Color = "Black"
                });
                await Insert(transactionExecutor, VehicleTableName, new Vehicle {
                    Vin  = "1C4RJFAG0FC625797", Type = "Sedan", Year = 2019,
                    Make = "Mercedes", Model = "CLK 350", Color = "White"
                });
            });

            Console.WriteLine("Vehicle data inserted");
        }
 private async Task CreateIndexAsync(string tableName, string field)
 {
     if (!await CheckIndexExistsAsync(tableName, field))
     {
         Console.WriteLine($"Index does not exist, creating index on {tableName} for {field}.");
         await qldbDriver.Execute(async transactionExecutor => await transactionExecutor.Execute($"CREATE INDEX ON {tableName}({field})"));
     }
     else
     {
         Console.WriteLine($"Index already exists for {tableName} and {field}.");
     }
 }
Exemple #3
0
 private async Task CreateTableAsync(string tableName)
 {
     if (!await CheckTableExistsAsync(tableName))
     {
         Console.WriteLine($"Table does not exist, creating table with name {tableName}.");
         await qldbDriver.Execute(async transactionExecutor => await transactionExecutor.Execute($"CREATE TABLE {tableName}"));
     }
     else
     {
         Console.WriteLine($"Table {tableName} already exists, ignoring.");
     }
 }