public BaseTableScanner(OHMConnection connection, byte[] tableName) { //Store the params this.connection = connection; this.tableName = tableName; }
protected String generateNewKey(OHMConnection connection, byte[] tableName, Random rand) { String key = null; OHMRow result = null; bool found = false; while(!found) { //Generate throw random 5 digit numbers int no1 = rand.Next(10000, 99999); int no2 = rand.Next(10000, 99999); int no3 = rand.Next(10000, 99999); key = no1.ToString() + no2.ToString() + no3.ToString(); Console.WriteLine("New Key: " + key); try { result = connection.getRow(tableName, fromString(key)); } catch(Exception exp) { } if(result == null || result.Columns.Count == 0) { //The key is not already in use found = true; } } return key; }