Ejemplo n.º 1
0
 public void Query(Sql sql, Connection db, Action <List <Dictionary <string, object> > > callback)
 {
     Oxide.Core.MySql.Libraries.MySql.MySqlQuery mySqlQuery = new Oxide.Core.MySql.Libraries.MySql.MySqlQuery()
     {
         Sql        = sql,
         Connection = db,
         Callback   = callback
     };
     lock (this._syncroot)
     {
         this._queue.Enqueue(mySqlQuery);
     }
     this._workevent.Set();
 }
Ejemplo n.º 2
0
 public void ExecuteNonQuery(Sql sql, Connection db, Action <int> callback = null)
 {
     Oxide.Core.MySql.Libraries.MySql.MySqlQuery mySqlQuery = new Oxide.Core.MySql.Libraries.MySql.MySqlQuery()
     {
         Sql              = sql,
         Connection       = db,
         CallbackNonQuery = callback,
         NonQuery         = true
     };
     lock (this._syncroot)
     {
         this._queue.Enqueue(mySqlQuery);
     }
     this._workevent.Set();
 }
Ejemplo n.º 3
0
 private void Worker()
 {
     while (this._running || this._queue.Count > 0)
     {
         Oxide.Core.MySql.Libraries.MySql.MySqlQuery mySqlQuery = null;
         lock (this._syncroot)
         {
             if (this._queue.Count <= 0)
             {
                 foreach (Connection _runningConnection in this._runningConnections)
                 {
                     if (_runningConnection == null || _runningConnection.get_ConnectionPersistent())
                     {
                         continue;
                     }
                     this.CloseDb(_runningConnection);
                 }
                 this._runningConnections.Clear();
             }
             else
             {
                 mySqlQuery = this._queue.Dequeue();
             }
         }
         if (mySqlQuery == null)
         {
             if (!this._running)
             {
                 continue;
             }
             this._workevent.WaitOne();
         }
         else
         {
             mySqlQuery.Handle();
             if (mySqlQuery.Connection == null)
             {
                 continue;
             }
             this._runningConnections.Add(mySqlQuery.Connection);
         }
     }
 }