Update of /cvsroot/pgsqlclient/pgsqlclient/PostgreSql.Data.PGSqlClient/source
In directory sc8-pr-cvs1:/tmp/cvs-serv32505
Modified Files:
PGConnection.cs
Added Files:
PGInfoMessageEventArgs.cs PGNotificationEventArgs.cs
Log Message:
* Improved PostgreSQL 3.0 protocol handling.
* Added some new files:
- PGInfoMessageEventArgs.cs
- PGNotificationEventArgs.cs
- PGClientMessageEventArgs.cs
- PGClientNotificationEventArgs.cs
* Added initial revision of asynchronous notification support ( task #82889 ).
* Added implementation of PGConnection.InfoMessage event ( task #82902 ).
--- NEW FILE: PGInfoMessageEventArgs.cs ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: PGNotificationEventArgs.cs ---
(This appears to be a binary file; contents omitted.)
Index: PGConnection.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient/PostgreSql.Data.PGSqlClient/source/PGConnection.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** PGConnection.cs 31 Jul 2003 10:54:40 -0000 1.5
--- PGConnection.cs 1 Aug 2003 17:51:19 -0000 1.6
***************
*** 23,27 ****
using System.Collections;
using System.ComponentModel;
-
using PostgreSql.Data.NPGClient;
using PostgreSql.Data.PGSqlClient.DbSchema;
--- 23,26 ----
***************
*** 33,39 ****
public sealed class PGConnection : Component, IDbConnection, ICloneable
{
! #region events
! public event StateChangeEventHandler StateChange;
#endregion
--- 32,40 ----
public sealed class PGConnection : Component, IDbConnection, ICloneable
{
! #region EVENTS
! public event StateChangeEventHandler StateChange;
! public event PGInfoMessageEventHandler InfoMessage;
! public event PGNotificationEventHandler Notification;
#endregion
***************
*** 49,52 ****
--- 50,56 ----
private ArrayList activeCommands;
+ private PGClientMessageEventHandler infoMessageHandler;
+ private PGClientNotificationEventHandler notificationHandler;
+
#endregion
***************
*** 369,374 ****
}
! state = ConnectionState.Open;
!
if (StateChange != null)
{
--- 373,378 ----
}
! // Set connection state to Open
! state = ConnectionState.Open;
if (StateChange != null)
{
***************
*** 376,380 ****
--- 380,393 ----
}
+ // Initialize active commands list
activeCommands = new ArrayList();
+
+ // Add Info message event handler
+ infoMessageHandler = new PGClientMessageEventHandler(OnInfoMessage);
+ dbConnection.DB.InfoMessage += infoMessageHandler;
+
+ // Add notification event handler
+ notificationHandler = new PGClientNotificationEventHandler(OnNotification);
+ dbConnection.DB.Notification += notificationHandler;
}
catch (PGClientException ex)
***************
*** 393,396 ****
--- 406,410 ----
lock (dbConnection)
{
+ // Close DataReader
if (dataReader != null)
{
***************
*** 398,403 ****
--- 412,419 ----
}
+ // Dispose Active commands
DisposeActiveCommands();
+ // Rollback active transation
if (activeTxn != null)
{
***************
*** 406,409 ****
--- 422,433 ----
}
+ // Remove info message event handler
+ dbConnection.DB.InfoMessage -= infoMessageHandler;
+
+ // Remove notification event handler
+ dbConnection.DB.Notification -= notificationHandler;
+
+ // Close connection permanently or send it
+ // back to the pool
if (dbConnection.Pooled)
{
***************
*** 545,548 ****
--- 569,592 ----
{
throw new PGException(ex.Message, ex);
+ }
+ }
+
+ private void OnInfoMessage(object sender, PGClientMessageEventArgs e)
+ {
+ if (InfoMessage != null)
+ {
+ InfoMessage(this, new PGInfoMessageEventArgs(e.Exception));
+ }
+ }
+
+ private void OnNotification(object sender, PGClientNotificationEventArgs e)
+ {
+ if (Notification != null)
+ {
+ Notification(this,
+ new PGNotificationEventArgs(
+ e.ProcessID,
+ e.Condition,
+ e.Aditional));
}
}
|