public bool MoveMessageToSubqueue(DbConnection conn, string queueTable, string messageId, Subqueue toSubqueue, Subqueue? fromSubqueue)
 {
     using (DbCommand cmd = _sql.CreateCommand(conn))
     {
         cmd.CommandText = string.Format(GetSqlFormatString("MoveMessageToSubqueue"), queueTable);
         if (fromSubqueue.HasValue)
         {
             _sql.AddParameter(cmd, "sq_from", fromSubqueue.Value.ToString());
             cmd.CommandText += " and  subqueue=@sq_from";
         }
         _sql.AddParameter(cmd, "id", Convert.ToInt64(messageId));
         _sql.AddParameter(cmd, "sq_to", toSubqueue.ToString());
         int rows = cmd.ExecuteNonQuery();
         log.Info("{0} messages returned to queue {1}", rows, queueTable);
         return rows > 0;
     }
 }
예제 #2
0
 public bool MoveMessageToSubqueue(DbConnection conn, string queueTable, string messageId, Subqueue toSubqueue, Subqueue?fromSubqueue)
 {
     using (DbCommand cmd = _sql.CreateCommand(conn))
     {
         cmd.CommandText = string.Format(GetSqlFormatString("MoveMessageToSubqueue"), queueTable);
         if (fromSubqueue.HasValue)
         {
             _sql.AddParameter(cmd, "sq_from", fromSubqueue.Value.ToString());
             cmd.CommandText += " and  subqueue=@sq_from";
         }
         _sql.AddParameter(cmd, "id", Convert.ToInt64(messageId));
         _sql.AddParameter(cmd, "sq_to", toSubqueue.ToString());
         int rows = cmd.ExecuteNonQuery();
         log.Info("{0} messages returned to queue {1}", rows, queueTable);
         return(rows > 0);
     }
 }