[pgsqlclient-checkins] pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient PgDbClient.cs,1.4
Status: Inactive
Brought to you by:
carlosga_fb
From: Carlos Guzm?n ?l. <car...@us...> - 2004-05-31 17:20:03
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13825 Modified Files: PgDbClient.cs Log Message: 2004-05-31 Carlos Guzman Alvarez <car...@te...> * PostgreSql.Data.PgSqlClient/FbConnection.cs: * PostgreSql.Data.PgSqlClient/NPgClient/PgDbClient.cs: - Reworked information and notification message handling using callbacks (delegates) Index: PgDbClient.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgDbClient.cs,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** PgDbClient.cs 6 May 2004 08:17:16 -0000 1.48 --- PgDbClient.cs 31 May 2004 17:19:55 -0000 1.49 *************** *** 33,36 **** --- 33,38 ---- internal delegate void SslConnectionCallback(); + internal delegate void NotificationCallback(int processID, string condition, string aditional); + internal delegate void InfoMessageCallback(PgClientException exception); #endregion *************** *** 38,46 **** internal class PgDbClient { ! #region Events ! public event PgClientMessageEventHandler InfoMessage; ! public event PgClientNotificationEventHandler Notification; ! public event SslConnectionCallback SslConnection; #endregion --- 40,62 ---- internal class PgDbClient { ! #region Callbacks ! public SslConnectionCallback SslConnection ! { ! get { return this.sslCallback; } ! set { this.sslCallback = value; } ! } ! ! public NotificationCallback Notification ! { ! get { return this.notification; } ! set { this.notification = value; } ! } ! ! public InfoMessageCallback InfoMessage ! { ! get { return this.infoMessage; } ! set { this.infoMessage = value; } ! } #endregion *************** *** 53,72 **** #endregion - #region Fields - - private int handle; - private int secretKey; - private Hashtable parameterStatus; - private Socket socket; - private NetworkStream networkStream; - private SslClientStream sslStream; - private BinaryReader receive; - private BinaryWriter send; - private PgResponsePacket buffer; - private PgConnectionParams settings; - private char transactionStatus; - - #endregion - #region Static Properties --- 69,72 ---- *************** *** 85,88 **** --- 85,108 ---- #endregion + #region Fields + + private SslConnectionCallback sslCallback; + private NotificationCallback notification; + private InfoMessageCallback infoMessage; + + private int handle; + private int secretKey; + private Hashtable parameterStatus; + private Socket socket; + private NetworkStream networkStream; + private SslClientStream sslStream; + private BinaryReader receive; + private BinaryWriter send; + private PgResponsePacket buffer; + private PgConnectionParams settings; + private char transactionStatus; + + #endregion + #region Properties *************** *** 111,120 **** } - public SslConnectionCallback SslConnectionDelegate - { - get { return this.SslConnection; } - set { this.SslConnection = value; } - } - #endregion --- 131,134 ---- *************** *** 292,296 **** { case PgBackendCodes.ERROR_RESPONSE: - { // Read the error message and trow the exception PgClientException ex = processErrorPacket(responsePacket); --- 306,309 ---- *************** *** 299,313 **** this.Sync(); throw ex; - } case PgBackendCodes.NOTICE_RESPONSE: - { // Read the notice message and raise an InfoMessage event ! PgClientException ex = processErrorPacket(responsePacket); ! ! this.InfoMessage(this, new PgClientMessageEventArgs(ex)); ! } ! break; case PgBackendCodes.NOTIFICATION_RESPONSE: --- 312,322 ---- this.Sync(); + // Throe the PostgreSQL exception throw ex; case PgBackendCodes.NOTICE_RESPONSE: // Read the notice message and raise an InfoMessage event ! this.InfoMessage(processErrorPacket(responsePacket)); ! break; case PgBackendCodes.NOTIFICATION_RESPONSE: *************** *** 512,516 **** if (this.Notification != null) { ! this.Notification(this, new PgClientNotificationEventArgs(processID, condition, additional)); } } --- 521,525 ---- if (this.Notification != null) { ! this.Notification(processID, condition, additional); } } *************** *** 816,820 **** if (this.InfoMessage != null) { ! this.InfoMessage(this, new PgClientMessageEventArgs(exception)); } } --- 825,829 ---- if (this.InfoMessage != null) { ! this.InfoMessage(exception); } } |