Example #1
0
        public IEnumerable<Row> GetRows(Table table,
		                                 ColumnSet columnSet, int matchColumnSetID,
		                                 Column[] columns, object[] match)
        {
            int[] columnIndices = new int[columns.Length];
            for (int n = 0; n != columns.Length; n++) {
                columnIndices [n] = columnSet.IndexOf (columns [n]);
            }
            foreach (Row r in GetRows (table)) {
                object[] fields = r.GetValues (matchColumnSetID, columnSet);
                bool isMatch = true;
                for (int n = 0; n != columns.Length; n++) {
                    if (fields [columnIndices [n]] != match [n]) {
                        isMatch = false;
                        continue;
                    }
                }
                if (isMatch)
                    yield return r;
            }
        }
Example #2
0
 public IEnumerable<Row> GetRows(Table table)
 {
     Log.WriteLine ("DataContext-{0}.GetRows(table={1})", id.ToHexadecimal (), table);
     if (!perTableRows.ContainsKey (table))
         perTableRows.Add (table, new SortedDictionary<byte[], Row> (ByteSequenceComparer.Shared));
     foreach (var r in perTableRows [table].Values) {
         if (references.ContainsKey (r.ID)) {
             Log.WriteLine ("Ommiting object {0}", r.ID.ToHexadecimal ());
             continue;
         }
         yield return r;
     }
 }
Example #3
0
        public Row CreateRow(Table table, IDictionary<int, ColumnSet> columnSets, IDictionary<int, object[]> objects, byte[][] replacingIDs)
        {
            Log.WriteLine ("DataContext-{0}.CreateRow()", id.ToHexadecimal ());
            Log.WriteLine ("Stack trace:{0}", new System.Diagnostics.StackTrace ());

            foreach (var o in objects) {
                Log.WriteLine ("ColumnSet {0}: ", o.Key);
                int i = 0;
                foreach (var v in o.Value) {
                    Log.WriteLine ("field {0}: {1}", i, v);
                    i++;
                }
            }
            Log.WriteLine ("Replacing IDs:{0}", replacingIDs.Length);
            foreach (var rl in replacingIDs) {
                Log.WriteLine ("ID:{0}", rl.ToHexadecimal ());
            }
            byte[] rowID = new byte[32];
            System.Security.Cryptography.RandomNumberGenerator.Create ().GetBytes (rowID);
            Row r = new Row (rowID, null, replacingIDs, table, columnSets, objects);
            //			rows.Add (r.ID, r);
            //			perTableRows [table].Add (r.ID, r);
            Log.WriteLine ("Row created with ID:{0}", rowID.ToHexadecimal ());
            return r;
        }