public void addToShadowTable (SqlConnection conn, RingoIndex index, int id, int storage_id) { lock (_sync_object) { if (shadow_datatable == null) _createDataTable(); if (shadow_datatable.Rows.Count >= 10000) _flushShadowTable(conn); DataRow shadow_row = shadow_datatable.NewRow(); shadow_row["id"] = id; shadow_row["storage_id"] = storage_id; shadow_row["crf"] = index.crf; shadow_row["hash"] = index.hash; shadow_datatable.Rows.Add(shadow_row); } }
public void addToShadowTable(SqlConnection conn, RingoIndex index, int id, int storage_id) { lock (_sync_object) { if (shadow_datatable == null) { _createDataTable(); } if (shadow_datatable.Rows.Count >= 10000) { _flushShadowTable(conn); } DataRow shadow_row = shadow_datatable.NewRow(); shadow_row["id"] = id; shadow_row["storage_id"] = storage_id; shadow_row["crf"] = index.crf; shadow_row["hash"] = index.hash; shadow_datatable.Rows.Add(shadow_row); } }
private static bool _AddReactionToIndex (SqlConnection conn, BingoIndexData bingo_data) { RingoIndexData data = (RingoIndexData)bingo_data; int id; RingoIndex index = new RingoIndex(); if (!index.readPrepared(out id)) { string message = String.Format("Reaction with ID={0} wasn't added to the index: {1}", id, BingoCore.lib.bingoGetWarning()); SqlContext.Pipe.Send(message); BingoLog.logMessage(message); return false; } byte[] new_data = new byte[index.crf.Length + 4]; index.crf.CopyTo(new_data, 4); MemoryStream stream = new MemoryStream(new_data, 0, 4, true); BinaryWriter writer = new BinaryWriter(stream); writer.Write(id); int storage_id = data.storage.add(new_data, conn); data.fingerprints.addFingerprint(conn, index.fingerprint, storage_id); data.addToShadowTable(conn, index, id, storage_id); return false; }