Beispiel #1
0
        public void syncContextParameters(SqlConnection conn, string bingo_schema)
        {
            fingerprints.syncContextParameters(getIndexType() == IndexType.Reaction);

            keep_cache =
                (BingoConfig.getInt(conn, bingo_schema, "KEEP_CACHE", id.table_id) != 0);
        }
Beispiel #2
0
        public void setKeepCache(SqlConnection conn, string bingo_schema, bool keep)
        {
            if (keep_cache != keep)
            {
                keep_cache = keep;
                BingoConfig.setInt(conn, bingo_schema, "KEEP_CACHE", id.table_id, keep ? 1 : 0);

                BingoLog.logMessage("SetKeepCache has changed for {0} table. New value is {1}",
                                    id.FullTableName(conn), keep);
            }
        }
Beispiel #3
0
        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);
        }