Ejemplo n.º 1
0
        // 쿼리 실행
        public DBQueryBase[] ProcessExecuteQueries()
        {
            if (IsConnected == false)
            {
                return(new DBQueryBase[0]);
            }

            List <DBQueryBase> queries = new List <DBQueryBase>();
            uint maxProcess            = MaxExecuteQueryPerFrame;

            lock (WaitingQueries)
            {
                for (uint numProcess = 0; numProcess < maxProcess; ++numProcess)
                {
                    if (WaitingQueries.Count == 0)
                    {
                        break;
                    }

                    queries.Add(WaitingQueries.Dequeue());
                    --NumWaitingQuery;
                }
            }

            var queryArray = queries.ToArray();

            if (queryArray.Length > 0)
            {
                bool result = DBQueryBase.Execute(Connection, queryArray);

                Utility.InvokeSafe(OnExecuted, this, queryArray, result);
            }
            return(queryArray);
        }
Ejemplo n.º 2
0
 // 쿼리 실행 요청
 public void RequestExecuteQuery(DBQueryBase query)
 {
     lock (WaitingQueries)
     {
         ++NumWaitingQuery;
         WaitingQueries.Enqueue(query);
     }
 }