2008-11-05 Francisco Figueiredo Jr. <francisco@npgsql.org>
[mono.git] / mcs / class / Npgsql / Npgsql / NpgsqlNotificationEventArgs.cs
1 // Npgsql.NpgsqlNotificationEventArgs.cs
2 //
3 // Author:
4 //  Wojtek Wierzbicki
5 //
6 //      Copyright (C) 2002 The Npgsql Development Team
7 //      npgsql-general@gborg.postgresql.org
8 //      http://gborg.postgresql.org/project/npgsql/projdisplay.php
9 //
10 //
11 // Permission to use, copy, modify, and distribute this software and its
12 // documentation for any purpose, without fee, and without a written
13 // agreement is hereby granted, provided that the above copyright notice
14 // and this paragraph and the following two paragraphs appear in all copies.
15 // 
16 // IN NO EVENT SHALL THE NPGSQL DEVELOPMENT TEAM BE LIABLE TO ANY PARTY
17 // FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
18 // INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
19 // DOCUMENTATION, EVEN IF THE NPGSQL DEVELOPMENT TEAM HAS BEEN ADVISED OF
20 // THE POSSIBILITY OF SUCH DAMAGE.
21 // 
22 // THE NPGSQL DEVELOPMENT TEAM SPECIFICALLY DISCLAIMS ANY WARRANTIES,
23 // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
24 // AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
25 // ON AN "AS IS" BASIS, AND THE NPGSQL DEVELOPMENT TEAM HAS NO OBLIGATIONS
26 // TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
27
28
29 using System;
30 using System.IO;
31
32 namespace Npgsql
33 {
34         /// <summary>
35         /// EventArgs class to send Notification parameters.
36         /// </summary>
37         public class NpgsqlNotificationEventArgs : EventArgs
38         {
39                 /// <summary>
40                 /// Process ID of the PostgreSQL backend that sent this notification.
41                 /// </summary>
42                 public readonly int PID;
43
44                 /// <summary>
45                 /// Condition that triggered that notification.
46                 /// </summary>
47                 public readonly string Condition;
48
49                 /// <summary>
50                 /// Additional Information From Notifiying Process (for future use, currently postgres always sets this to an empty string)
51                 /// </summary>
52                 public readonly string AdditionalInformation;
53
54                 internal NpgsqlNotificationEventArgs(Stream stream, bool readAdditional)
55                 {
56                         PID = PGUtil.ReadInt32(stream);
57                         Condition = PGUtil.ReadString(stream);
58                         AdditionalInformation = readAdditional ? PGUtil.ReadString(stream) : string.Empty;
59                 }
60         }
61 }