public static BingoIndexData CreateIndexData(int spid, SqlConnection conn, string bingo_schema, string table, string id_column, string data_column, bool reaction) { lock (index_data_list_lock) { BingoIndexID id = new BingoIndexID(conn, table); _DropIndexData(conn, bingo_schema, id, false); BingoIndexData data; if (reaction) { data = new RingoIndexData(id, id_column, data_column, bingo_schema); } else { data = new MangoIndexData(id, id_column, data_column, bingo_schema); } BingoSqlUtils.ExecNonQuery(conn, "INSERT INTO {0} VALUES({1}, {2}, '{3}', '{4}', '{5}', '{6}')", _contextTable(bingo_schema), id.table_id, id.database_id, id.FullTableName(conn), id_column, data_column, reaction ? "reaction" : "molecule"); data.CreateTables(conn); _AddIndexDataToList(spid, data); BingoLog.logMessage("Bingo index for table {0} has been initialized", id.FullTableName(conn)); return(data); } }
private static BingoIndexData _extractIndexData(SqlConnection conn, string bingo_schema, BingoIndexID id, bool throw_if_not_exists) { BingoIndexData data = null; using (SqlCommand cmd = new SqlCommand(String.Format( "SELECT id_column, data_column, type FROM {0} WHERE obj_id = '{1}'", _contextTable(bingo_schema), id.table_id), conn)) { using (SqlDataReader reader = cmd.ExecuteReader()) { if (!reader.Read()) { if (throw_if_not_exists) { throw new Exception("Cannot find Bingo index for table with id=" + id.table_id); } else { return(null); } } string id_column = Convert.ToString(reader[0]); string data_column = Convert.ToString(reader[1]); string type = Convert.ToString(reader[2]); if (type.ToLower().Equals("molecule")) { data = new MangoIndexData(id, id_column, data_column, bingo_schema); } if (type.ToLower().Equals("reaction")) { data = new RingoIndexData(id, id_column, data_column, bingo_schema); } if (data == null) { throw new Exception("unknown type: " + type); } } } data.keep_cache = (BingoConfig.getInt(conn, bingo_schema, "KEEP_CACHE", id.table_id) != 0); return(data); }
private static BingoIndexData _extractIndexData (SqlConnection conn, string bingo_schema, BingoIndexID id, bool throw_if_not_exists) { BingoIndexData data = null; using (SqlCommand cmd = new SqlCommand(String.Format( "SELECT id_column, data_column, type FROM {0} WHERE obj_id = '{1}'", _contextTable(bingo_schema), id.table_id), conn)) { using (SqlDataReader reader = cmd.ExecuteReader()) { if (!reader.Read()) { if (throw_if_not_exists) throw new Exception("Cannot find Bingo index for table with id=" + id.table_id); else return null; } string id_column = Convert.ToString(reader[0]); string data_column = Convert.ToString(reader[1]); string type = Convert.ToString(reader[2]); if (type.ToLower().Equals("molecule")) data = new MangoIndexData(id, id_column, data_column, bingo_schema); if (type.ToLower().Equals("reaction")) data = new RingoIndexData(id, id_column, data_column, bingo_schema); if (data == null) throw new Exception("unknown type: " + type); } } data.keep_cache = (BingoConfig.getInt(conn, bingo_schema, "KEEP_CACHE", id.table_id) != 0); return data; }
private static IEnumerable CheckChemicalTable (SqlString table, SqlString id_column, SqlString data_column, SqlString bingo_schema, bool is_reaction) { BingoLog.logMessage("Checking chemical table {0}", table.Value); using (BingoSession session = new BingoSession()) { using (SqlConnection conn = new SqlConnection("context connection=true")) { conn.Open(); prepareContext(conn, bingo_schema.Value, 0, ContextFlags.NTHREADS | ContextFlags.FINGERPRINTS); BingoIndexID id = new BingoIndexID(conn, table.Value); BingoIndexData dummy_data; if (is_reaction) dummy_data = new RingoIndexData(id, id_column.Value, data_column.Value, bingo_schema.Value); else dummy_data = new MangoIndexData(id, id_column.Value, data_column.Value, bingo_schema.Value); ArrayList errors = new ArrayList(); bingoOperationDelegate check_insert_op = getInsertRecordsDelegate(table.Value, false, false, false, errors); if (BingoCore.lib.bingoIndexBegin() != 1) throw new Exception(BingoCore.lib.bingoGetError()); BingoCore.lib.bingoIndexSetSkipFP(true); check_insert_op(conn, conn, dummy_data); BingoCore.lib.bingoIndexEnd(); return errors; } } }
public RingoShadowFetch(RingoIndexData index_data) { _index_data = index_data; }
public RingoFastIndexFetch(RingoIndexData index_data) { _index_data = index_data; }
public RingoFastIndexFetch (RingoIndexData index_data) { _index_data = index_data; }
public static BingoIndexData CreateIndexData (int spid, SqlConnection conn, string bingo_schema, string table, string id_column, string data_column, bool reaction) { lock (index_data_list_lock) { BingoIndexID id = new BingoIndexID(conn, table); _DropIndexData(conn, bingo_schema, id, false); BingoIndexData data; if (reaction) data = new RingoIndexData(id, id_column, data_column, bingo_schema); else data = new MangoIndexData(id, id_column, data_column, bingo_schema); BingoSqlUtils.ExecNonQuery(conn, "INSERT INTO {0} VALUES({1}, {2}, '{3}', '{4}', '{5}', '{6}')", _contextTable(bingo_schema), id.table_id, id.database_id, id.FullTableName(conn), id_column, data_column, reaction ? "reaction" : "molecule"); data.CreateTables(conn); _AddIndexDataToList(spid, data); BingoLog.logMessage("Bingo index for table {0} has been initialized", id.FullTableName(conn)); return data; } }
public RingoShadowFetch (RingoIndexData index_data) { _index_data = index_data; }