Example #1
0
        private static void _DropIndexData(SqlConnection conn, string bingo_schema,
                                           BingoIndexID id, bool throw_if_not_exists)
        {
            BingoIndexData data = _extractIndexData(conn, bingo_schema, id, throw_if_not_exists);

            if (data != null)
            {
                data.DropTables(conn);
                data.DropTriggers(conn);
            }

            BingoSqlUtils.ExecNonQueryNoThrow(conn, "DELETE FROM {0} WHERE obj_id = '{1}'",
                                              _contextTable(bingo_schema), id.table_id);

            for (int i = index_data_list.Count - 1; i >= 0; i--)
            {
                BingoIndexDataRefs refs = (BingoIndexDataRefs)index_data_list[i];
                if (refs.index_data.id.Equals(id))
                {
                    index_data_list.RemoveAt(i);
                    BingoLog.logMessage("Sessions for table {0} have been released", id.InformationName(conn));
                }
            }
            if (data != null)
            {
                BingoLog.logMessage("Bingo index for table {0} has been dropped", id.InformationName(conn));
            }
        }
Example #2
0
        private static void _AddIndexDataToList(int spid, BingoIndexData data)
        {
            BingoIndexDataRefs new_refs = new BingoIndexDataRefs();

            new_refs.index_data  = data;
            new_refs.session_ids = new List <int>();
            new_refs.session_ids.Add(spid);

            index_data_list.Add(new_refs);
        }
Example #3
0
        public static void OnSessionClose(int spid)
        {
            FlushInAllSessions(spid, true);
            lock (index_data_list_lock)
            {
                for (int i = index_data_list.Count - 1; i >= 0; i--)
                {
                    BingoIndexDataRefs refs = (BingoIndexDataRefs)index_data_list[i];

                    refs.session_ids.Remove(spid);
                    if (refs.session_ids.Count < 1 && !refs.index_data.keep_cache)
                    {
                        index_data_list.RemoveAt(i);
                        BingoLog.logMessage("Session for table {0} has been released",
                                            refs.index_data.id.InformationName());
                    }
                }
            }
        }
Example #4
0
        public static void FlushInAllSessions(int spid, bool check_spid)
        {
            lock (index_data_list_lock)
            {
                SqlConnection ctx_conn = null;
                try
                {
                    for (int i = index_data_list.Count - 1; i >= 0; i--)
                    {
                        BingoIndexDataRefs refs = (BingoIndexDataRefs)index_data_list[i];

                        if (check_spid && !refs.session_ids.Contains(spid))
                        {
                            continue;
                        }

                        if (!refs.index_data.needFlush())
                        {
                            continue;
                        }

                        if (ctx_conn == null)
                        {
                            ctx_conn = new SqlConnection("context connection=true");
                            ctx_conn.Open();
                        }
                        refs.index_data.flush(ctx_conn);
                    }
                }
                finally
                {
                    if (ctx_conn != null)
                    {
                        ctx_conn.Close();
                    }
                }
            }
        }
Example #5
0
      private static void _AddIndexDataToList (int spid, BingoIndexData data)
      {
         BingoIndexDataRefs new_refs = new BingoIndexDataRefs();

         new_refs.index_data = data;
         new_refs.session_ids = new List<int>();
         new_refs.session_ids.Add(spid);

         index_data_list.Add(new_refs);
      }