public void testAddFilledTableSeveralTuples2(int numTuples) { List <string> listType; List <string> listNames; listType = new List <string>() { DataType.INT.ToString(), DataType.STRING.ToString(), DataType.STRING.ToString() }; listNames = new List <string>() { "ID", "NAME", "EMAIL" }; admTest.Table newTable = new Table("PERSON", listNames.Count, listNames, listType); admTest.Database db = new admTest.Database(); string message = db.createDatabase("0", "0", "0"); newTable.addField("ID", DataType.INT); newTable.addField("NAME", DataType.STRING); newTable.addField("ADDRESS", DataType.STRING); List <string> insertTupleList; for (int i = 0; i < numTuples; i++) { insertTupleList = new List <string>(); //add Table to the Database insertTupleList = new List <string>(); insertTupleList.Add(i.ToString()); insertTupleList.Add("123456789123456789123456789123456789123456789"); insertTupleList.Add("*****@*****.**"); newTable.addTupleToTable(insertTupleList); } }
public void testAddEmptyTable() { admTest.Database db = new admTest.Database(); string message = db.createDatabase("squirrel", "basajaun", "basajaun"); db.listTable.Add(new Table()); }
public void testAddEmptyTableSeveralNum(int numTables) { admTest.Database db = new admTest.Database(); string message = db.createDatabase("0", "0", "0"); for (int i = 0; i < numTables; i++) { db.listTable.Add(new Table()); } }
public static void Main(string[] args) { Console.WriteLine("Starts the code execution"); //create database string dbName, dbNameUser, dbPassUser; string message; dbName = "db1"; dbNameUser = "******"; dbPassUser = "******"; admTest.Database myDb = new admTest.Database(); //Create database message = myDb.createDatabase(dbName, dbNameUser, dbPassUser); Console.WriteLine("Database response: " + message); //Create new Table List <string> listType = new List <string>() { DataType.INT.ToString(), DataType.STRING.ToString(), DataType.STRING.ToString() }; List <string> listNames = new List <string>() { "ID", "NAME", "EMAIL" }; admTest.Table newTable = new Table("PERSON", listNames.Count, listNames, listType); newTable.addField("ID", DataType.INT); newTable.addField("NAME", DataType.STRING); newTable.addField("ADDRESS", DataType.STRING); //add Table to the Database myDb.addTable(newTable, "db1"); //Insert tuples List <string> insertTupleList = new List <string>(); insertTupleList.Add("1"); insertTupleList.Add("JOHN"); insertTupleList.Add("*****@*****.**"); newTable.addTupleToTable(insertTupleList); insertTupleList = new List <string>(); insertTupleList.Add("2"); insertTupleList.Add("Kathy"); insertTupleList.Add("*****@*****.**"); newTable.addTupleToTable(insertTupleList); myDb.executeSQLByCommand("SELECT ID, NAME, EMAIL FROM PERSON", newTable); }
public void testCreateDatabase(string myDatabase, string username, string password) { admTest.Database db = new admTest.Database(); string message = db.createDatabase(myDatabase, username, password); }