Update of /cvsroot/pgsqlclient/pgsqlclient_10/source/PostgreSql/Data/Protocol In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5092/Data/Protocol Modified Files: PgClientNotificationEventArgs.cs PgCodes.cs PgDbClient.cs PgOutputPacket.cs PgResponsePacket.cs PgStatement.cs Log Message: Started the reorganization of the CVS module Index: PgResponsePacket.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/source/PostgreSql/Data/Protocol/PgResponsePacket.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PgResponsePacket.cs 8 Sep 2005 18:41:55 -0000 1.1 --- PgResponsePacket.cs 9 Sep 2005 21:35:00 -0000 1.2 *************** *** 28,37 **** namespace PostgreSql.Data.Protocol { ! internal class PgResponsePacket : BinaryReader { #region · Fields · ! private char message; ! private Encoding encoding; #endregion --- 28,39 ---- namespace PostgreSql.Data.Protocol { ! internal class PgResponsePacket { #region · Fields · ! private char message; ! private Stream stream; ! private BinaryReader packet; ! private Encoding encoding; #endregion *************** *** 45,62 **** } ! public Encoding Encoding ! { ! get { return this.encoding; } ! set { this.encoding = value; } ! } ! ! public long Length { ! get { return ((MemoryStream)this.BaseStream).Length; } } ! public long Position { ! get { return ((MemoryStream)this.BaseStream).Position; } } --- 47,58 ---- } ! public int Length { ! get { return (int)this.stream.Length; } } ! public int Position { ! get { return (int)this.stream.Position; } } *************** *** 76,114 **** } ! public long Pending { ! get { return this.Length - this.Position; } } ! #endregion ! #region · Constructors · ! public PgResponsePacket() : base(new MemoryStream()) { } ! public PgResponsePacket(byte[] contents) : base(new MemoryStream(contents)) { } ! public PgResponsePacket(char message, byte[] contents) : base(new MemoryStream(contents)) { ! this.message = message; } #endregion ! #region · Stream Methods · ! public void Reset() { ! ((MemoryStream)this.BaseStream).SetLength(0); ! ((MemoryStream)this.BaseStream).Position = 0; } ! public byte[] ToArray() { ! return ((MemoryStream)this.BaseStream).ToArray(); } --- 72,123 ---- } ! public bool IsReadyForQuery { ! get { return (this.Message == PgBackendCodes.READY_FOR_QUERY); } } ! public bool IsCommandComplete ! { ! get { return (this.Message == PgBackendCodes.COMMAND_COMPLETE); } ! } ! public bool IsPortalSuspended ! { ! get { return (this.Message == PgBackendCodes.PORTAL_SUSPENDED); } ! } ! public bool IsNoData { + get { return (this.Message == PgBackendCodes.NODATA); } } ! public bool IsCloseComplete { + get { return (this.Message == PgBackendCodes.CLOSE_COMPLETE); } } ! public bool IsRowDescription { ! get { return (this.Message == PgBackendCodes.ROW_DESCRIPTION); } } #endregion ! #region · Constructors · ! public PgResponsePacket(char message, Encoding encoding, byte[] contents) { ! this.packet = new BinaryReader(new MemoryStream(contents)); ! this.encoding = encoding; ! this.message = message; } ! #endregion ! ! #region · Binary Types · ! ! public byte[] ReadBytes(int count) { ! return this.packet.ReadBytes(count); } *************** *** 117,126 **** #region · String Types · public string ReadNullString() { StringBuilder cString = new StringBuilder(); char c; ! ! while ((c = ReadChar()) != PgCodes.NULL_TERMINATOR ) { cString.Append(c); --- 126,145 ---- #region · String Types · + public char ReadChar() + { + return this.packet.ReadChar(); + } + + public char[] ReadChars(int count) + { + return this.packet.ReadChars(count); + } + public string ReadNullString() { StringBuilder cString = new StringBuilder(); char c; ! ! while ((c = this.packet.ReadChar()) != PgCodes.NULL_TERMINATOR) { cString.Append(c); *************** *** 134,148 **** byte[] buffer = new byte[length]; ! this.Read(buffer, 0, length); return this.encoding.GetString(buffer); } ! public new string ReadString() { ! int length = this.ReadInt(); byte[] buffer = new byte[length]; ! this.Read(buffer, 0, length); return this.encoding.GetString(buffer); --- 153,167 ---- byte[] buffer = new byte[length]; ! this.packet.Read(buffer, 0, length); return this.encoding.GetString(buffer); } ! public string ReadString() { ! int length = this.ReadInt32(); byte[] buffer = new byte[length]; ! this.packet.Read(buffer, 0, length); return this.encoding.GetString(buffer); *************** *** 151,192 **** #endregion ! #region · Numeric Types · ! public short ReadShort() { ! short val = base.ReadInt16(); ! return IPAddress.HostToNetworkOrder(val); } ! public int ReadInt() { ! int val = base.ReadInt32(); ! return IPAddress.HostToNetworkOrder(val); } ! public long ReadLong() { ! return IPAddress.HostToNetworkOrder(base.ReadInt64()); } ! public override float ReadSingle() { ! return BitConverter.ToSingle(BitConverter.GetBytes(this.ReadInt()), 0); } public float ReadCurrency() { ! float val = (float)this.ReadInt(); ! return val/100; } ! public override double ReadDouble() { ! byte[] buffer = BitConverter.GetBytes(this.ReadLong()); ! ! return BitConverter.ToDouble(buffer, 0); } --- 170,219 ---- #endregion ! #region · Boolean Types · ! public bool ReadBoolean() { ! return this.packet.ReadBoolean(); ! } ! #endregion ! ! #region · Numeric Types · ! ! public byte ReadByte() ! { ! return this.packet.ReadByte(); } ! public short ReadInt16() { ! return IPAddress.HostToNetworkOrder(this.packet.ReadInt16()); ! } ! public int ReadInt32() ! { ! return IPAddress.HostToNetworkOrder(this.packet.ReadInt32()); } ! public long ReadInt64() { ! return IPAddress.HostToNetworkOrder(this.packet.ReadInt64()); } ! public float ReadSingle() { ! return BitConverter.ToSingle(BitConverter.GetBytes(this.ReadInt32()), 0); } public float ReadCurrency() { ! float value = (float)this.ReadInt32(); ! return (value / 100); } ! public double ReadDouble() { ! return BitConverter.ToDouble(BitConverter.GetBytes(this.ReadInt64()), 0); } *************** *** 197,205 **** public DateTime ReadDate() { ! int days = this.ReadInt(); ! ! DateTime date = new DateTime(days); ! ! return PgCodes.BASE_DATE.AddDays(days); } --- 224,228 ---- public DateTime ReadDate() { ! return PgCodes.BASE_DATE.AddDays(this.ReadInt32()); } *************** *** 207,215 **** { double intervalTime = this.ReadDouble(); ! int intervalMonth = this.ReadInt(); TimeSpan interval = TimeSpan.FromSeconds(intervalTime); ! return interval.Add(TimeSpan.FromDays(intervalMonth*30)); } --- 230,238 ---- { double intervalTime = this.ReadDouble(); ! int intervalMonth = this.ReadInt32(); TimeSpan interval = TimeSpan.FromSeconds(intervalTime); ! return interval.Add(TimeSpan.FromDays(intervalMonth * 30)); } *************** *** 246,261 **** else { - int[] lengths; - int[] lowerBounds; - // Read number of dimensions ! int dimensions = this.ReadInt(); ! ! // Initialize arrays for lengths and lower bounds ! lengths = new int[dimensions]; ! lowerBounds = new int[dimensions]; // Read flags value ! int flags = this.ReadInt(); if (flags != 0) { --- 269,281 ---- else { // Read number of dimensions ! int dimensions = this.ReadInt32(); + // Create arrays for the lengths and lower bounds + int[] lengths = new int[dimensions]; + int[] lowerBounds = new int[dimensions]; + // Read flags value ! int flags = this.ReadInt32(); if (flags != 0) { *************** *** 264,274 **** // Read array element type ! PgType elementType = PgDbClient.Types[this.ReadInt()]; // Read array lengths and lower bounds for (int i = 0; i < dimensions; i++) { ! lengths[i] = this.ReadInt(); ! lowerBounds[i] = this.ReadInt(); } --- 284,294 ---- // Read array element type ! PgType elementType = PgDbClient.Types[this.ReadInt32()]; // Read array lengths and lower bounds for (int i = 0; i < dimensions; i++) { ! lengths[i] = this.ReadInt32(); ! lowerBounds[i] = this.ReadInt32(); } *************** *** 276,286 **** if (type.SystemType.IsPrimitive) { ! return this.ReadPrimitiveArray(elementType, length, ! dimensions, flags, lengths, lowerBounds); } else { ! return this.ReadNonPrimitiveArray(elementType, length, ! dimensions, flags, lengths, lowerBounds); } } --- 296,304 ---- if (type.SystemType.IsPrimitive) { ! return this.ReadPrimitiveArray(elementType, length, dimensions, flags, lengths, lowerBounds); } else { ! return this.ReadNonPrimitiveArray(elementType, length, dimensions, flags, lengths, lowerBounds); } } *************** *** 296,301 **** for (int i = 0; i < data.Length; i++ ) { ! object elementValue = ReadValue(elementType, elementType.Size); ! data.SetValue(elementValue, i); } --- 314,318 ---- for (int i = 0; i < data.Length; i++ ) { ! data.SetValue(this.ReadValue(elementType, elementType.Size), i); } *************** *** 309,316 **** public PgPoint ReadPoint() { ! double x = this.ReadDouble(); ! double y = this.ReadDouble(); ! ! return new PgPoint(x, y); } --- 326,330 ---- public PgPoint ReadPoint() { ! return new PgPoint(this.ReadDouble(), this.ReadDouble()); } *************** *** 340,344 **** public PgPolygon ReadPolygon() { ! PgPoint[] points = new PgPoint[this.ReadInt()]; for (int i = 0; i < points.Length; i++) --- 354,358 ---- public PgPolygon ReadPolygon() { ! PgPoint[] points = new PgPoint[this.ReadInt32()]; for (int i = 0; i < points.Length; i++) *************** *** 353,357 **** { bool isClosedPath = this.ReadBoolean(); ! PgPoint[] points = new PgPoint[this.ReadInt()]; for (int i = 0; i < points.Length; i++) --- 367,371 ---- { bool isClosedPath = this.ReadBoolean(); ! PgPoint[] points = new PgPoint[this.ReadInt32()]; for (int i = 0; i < points.Length; i++) *************** *** 391,397 **** case PgDataType.Decimal: ! return Decimal.Parse( ! this.ReadString(length), ! NumberFormatInfo.InvariantInfo); case PgDataType.Currency: --- 405,409 ---- case PgDataType.Decimal: ! return Decimal.Parse(this.ReadString(length), NumberFormatInfo.InvariantInfo); case PgDataType.Currency: *************** *** 405,415 **** case PgDataType.Int2: ! return this.ReadShort(); case PgDataType.Int4: ! return this.ReadInt(); case PgDataType.Int8: ! return this.ReadLong(); case PgDataType.Interval: --- 417,427 ---- case PgDataType.Int2: ! return this.ReadInt16(); case PgDataType.Int4: ! return this.ReadInt32(); case PgDataType.Int8: ! return this.ReadInt64(); case PgDataType.Interval: *************** *** 494,526 **** case PgDataType.Decimal: ! return Decimal.Parse( ! stringValue, ! NumberFormatInfo.InvariantInfo); case PgDataType.Currency: case PgDataType.Float: ! return Single.Parse( ! stringValue, ! NumberFormatInfo.InvariantInfo); case PgDataType.Double: ! return Double.Parse( ! stringValue, ! NumberFormatInfo.InvariantInfo); case PgDataType.Int2: ! return Int16.Parse( ! stringValue, ! NumberFormatInfo.InvariantInfo); case PgDataType.Int4: ! return Int32.Parse( ! stringValue, ! NumberFormatInfo.InvariantInfo); case PgDataType.Int8: ! return Int64.Parse( ! stringValue, ! NumberFormatInfo.InvariantInfo); case PgDataType.Interval: --- 506,526 ---- case PgDataType.Decimal: ! return Decimal.Parse(stringValue, NumberFormatInfo.InvariantInfo); case PgDataType.Currency: case PgDataType.Float: ! return Single.Parse(stringValue, NumberFormatInfo.InvariantInfo); case PgDataType.Double: ! return Double.Parse(stringValue, NumberFormatInfo.InvariantInfo); case PgDataType.Int2: ! return Int16.Parse(stringValue, NumberFormatInfo.InvariantInfo); case PgDataType.Int4: ! return Int32.Parse(stringValue, NumberFormatInfo.InvariantInfo); case PgDataType.Int8: ! return Int64.Parse(stringValue, NumberFormatInfo.InvariantInfo); case PgDataType.Interval: *************** *** 556,560 **** default: ! return ReadBytes(length); } } --- 556,560 ---- default: ! return this.packet.ReadBytes(length); } } *************** *** 584,588 **** for (int i = data.GetLowerBound(0); i <= data.GetUpperBound(0); i++) { ! int elementLen = this.ReadInt(); data.SetValue(this.ReadValue(elementType, elementType.Size), i); } --- 584,588 ---- for (int i = data.GetLowerBound(0); i <= data.GetUpperBound(0); i++) { ! int elementLen = this.ReadInt32(); data.SetValue(this.ReadValue(elementType, elementType.Size), i); } *************** *** 620,624 **** { byte[] elementData = null; ! int elementLen = this.ReadInt(); switch (type.DataType) --- 620,624 ---- { byte[] elementData = null; ! int elementLen = this.ReadInt32(); switch (type.DataType) *************** *** 637,649 **** case PgDataType.Int2: ! elementData = BitConverter.GetBytes(this.ReadShort()); break; case PgDataType.Int4: ! elementData = BitConverter.GetBytes(this.ReadInt()); break; case PgDataType.Int8: ! elementData = BitConverter.GetBytes(this.ReadLong()); break; } --- 637,649 ---- case PgDataType.Int2: ! elementData = BitConverter.GetBytes(this.ReadInt16()); break; case PgDataType.Int4: ! elementData = BitConverter.GetBytes(this.ReadInt32()); break; case PgDataType.Int8: ! elementData = BitConverter.GetBytes(this.ReadInt64()); break; } Index: PgDbClient.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/source/PostgreSql/Data/Protocol/PgDbClient.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PgDbClient.cs 8 Sep 2005 18:41:55 -0000 1.1 --- PgDbClient.cs 9 Sep 2005 21:35:00 -0000 1.2 *************** *** 24,30 **** using System.Net; using System.Net.Sockets; ! ! using Mono.Security.Cryptography; ! using Mono.Security.Protocol.Tls; namespace PostgreSql.Data.Protocol --- 24,28 ---- using System.Net; using System.Net.Sockets; ! using System.Net.Security; namespace PostgreSql.Data.Protocol *************** *** 32,57 **** 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 - #region · Static Fields · --- 30,33 ---- *************** *** 193,196 **** --- 169,194 ---- #endregion + #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 + #region · Fields · *************** *** 204,211 **** private Socket socket; private NetworkStream networkStream; ! private SslClientStream sslStream; private BinaryReader receive; private BinaryWriter send; - private PgResponsePacket buffer; private PgConnectionParams settings; private char transactionStatus; --- 202,208 ---- private Socket socket; private NetworkStream networkStream; ! private SslStream secureStream; private BinaryReader receive; private BinaryWriter send; private PgConnectionParams settings; private char transactionStatus; *************** *** 243,249 **** #region · Internal Properties · ! internal SslClientStream SslClientStream { ! get { return this.sslStream; } } --- 240,246 ---- #region · Internal Properties · ! internal SslStream SecureStream { ! get { return this.secureStream; } } *************** *** 262,266 **** #region · Constructors · ! public PgDbClient() : this(null) { } --- 259,264 ---- #region · Constructors · ! public PgDbClient() ! : this(null) { } *************** *** 269,273 **** { this.parameterStatus = new Hashtable(); - this.buffer = new PgResponsePacket(); this.settings = settings; --- 267,270 ---- *************** *** 297,309 **** if (this.settings.SSL) { ! this.sslStream = new SslClientStream( ! this.networkStream, ! this.settings.ServerName, ! false, ! Mono.Security.Protocol.Tls.SecurityProtocolType.Tls| ! Mono.Security.Protocol.Tls.SecurityProtocolType.Ssl3); ! this.receive = new BinaryReader(this.sslStream); ! this.send = new BinaryWriter(this.sslStream); if (this.SslConnection != null) --- 294,303 ---- if (this.settings.SSL) { ! this.secureStream = new SslStream(this.networkStream, false); ! this.SecureStream.AuthenticateAsClient(this.settings.ServerName); ! ! this.receive = new BinaryReader(this.SecureStream); ! this.send = new BinaryWriter(this.SecureStream); if (this.SslConnection != null) *************** *** 317,323 **** PgOutputPacket packet = new PgOutputPacket(this.settings.Encoding); ! packet.WriteInt(PgCodes.PROTOCOL_VERSION3); packet.WriteNullString("user"); ! packet.WriteNullString(this.settings.UserName); if (settings.Database != null && this.settings.Database.Length > 0) { --- 311,318 ---- PgOutputPacket packet = new PgOutputPacket(this.settings.Encoding); ! packet.Write(PgCodes.PROTOCOL_VERSION3); packet.WriteNullString("user"); ! packet.WriteNullString(this.settings.UserName); ! if (settings.Database != null && this.settings.Database.Length > 0) { *************** *** 325,328 **** --- 320,324 ---- packet.WriteNullString(this.settings.Database); } + packet.WriteNullString("DateStyle"); packet.WriteNullString(PgCodes.DATE_STYLE); *************** *** 332,343 **** this.SendSimplePacket(packet); ! PgResponsePacket response = new PgResponsePacket(); ! // Check if the is ready for Query ! while (response.Message != PgBackendCodes.READY_FOR_QUERY) { response = this.ReceiveResponsePacket(); this.ProcessResponsePacket(response); } } } --- 328,339 ---- this.SendSimplePacket(packet); ! PgResponsePacket response = null; ! do { response = this.ReceiveResponsePacket(); this.ProcessResponsePacket(response); } + while (!response.IsReadyForQuery); } } *************** *** 462,467 **** } ! responsePacket = new PgResponsePacket(type, buffer); ! responsePacket.Encoding = Settings.Encoding; } catch (IOException) --- 458,462 ---- } ! responsePacket = new PgResponsePacket(type, Settings.Encoding, buffer); } catch (IOException) *************** *** 491,496 **** case PgBackendCodes.BACKEND_KEY_DATA: // BackendKeyData ! this.Handle = packet.ReadInt(); ! this.SecretKey = packet.ReadInt(); break; } --- 486,491 ---- case PgBackendCodes.BACKEND_KEY_DATA: // BackendKeyData ! this.Handle = packet.ReadInt32(); ! this.SecretKey = packet.ReadInt32(); break; } *************** *** 515,519 **** { // Authentication response ! int authType = packet.ReadInt(); PgOutputPacket outPacket = new PgOutputPacket(settings.Encoding); --- 510,514 ---- { // Authentication response ! int authType = packet.ReadInt32(); PgOutputPacket outPacket = new PgOutputPacket(settings.Encoding); *************** *** 550,555 **** // Second calculate md5 of password + user string userHash = MD5Authentication.GetMD5Hash( ! settings.Encoding.GetBytes(settings.UserName), ! settings.UserPassword); // Third calculate real MD5 hash --- 545,549 ---- // Second calculate md5 of password + user string userHash = MD5Authentication.GetMD5Hash( ! settings.Encoding.GetBytes(settings.UserName), settings.UserPassword); // Third calculate real MD5 hash *************** *** 630,634 **** private void ProcessNotificationResponse(PgResponsePacket packet) { ! int processID = packet.ReadInt(); string condition = packet.ReadNullString(); string additional = packet.ReadNullString(); --- 624,628 ---- private void ProcessNotificationResponse(PgResponsePacket packet) { ! int processID = packet.ReadInt32(); string condition = packet.ReadNullString(); string additional = packet.ReadNullString(); *************** *** 736,754 **** // Receive response ! PgResponsePacket response = new PgResponsePacket(); ! while (response.Message != PgBackendCodes.READY_FOR_QUERY) { response = this.ReceiveResponsePacket(); this.ProcessResponsePacket(response); } } ! catch (Exception ex) { ! PgResponsePacket response = new PgResponsePacket(); ! while (response.Message != PgBackendCodes.READY_FOR_QUERY) { response = this.ReceiveResponsePacket(); this.ProcessResponsePacket(response); } throw; --- 730,752 ---- // Receive response ! PgResponsePacket response = null; ! ! do { response = this.ReceiveResponsePacket(); this.ProcessResponsePacket(response); } + while (!response.IsReadyForQuery); } ! catch { ! PgResponsePacket response = null; ! ! do { response = this.ReceiveResponsePacket(); this.ProcessResponsePacket(response); } + while (!response.IsReadyForQuery); throw; *************** *** 765,772 **** PgOutputPacket packet = new PgOutputPacket(); ! packet.WriteInt(16); ! packet.WriteInt(PgCodes.CANCEL_REQUEST); ! packet.WriteInt(Handle); ! packet.WriteInt(SecretKey); // Send packet to the server --- 763,770 ---- PgOutputPacket packet = new PgOutputPacket(); ! packet.Write((int)16); ! packet.Write(PgCodes.CANCEL_REQUEST); ! packet.Write(this.Handle); ! packet.Write(this.SecretKey); // Send packet to the server *************** *** 790,794 **** PgOutputPacket packet = new PgOutputPacket(); ! packet.WriteInt(PgCodes.SSL_REQUEST); // Send packet to the server --- 788,792 ---- PgOutputPacket packet = new PgOutputPacket(); ! packet.Write(PgCodes.SSL_REQUEST); // Send packet to the server *************** *** 854,882 **** private void InitializeSocket() { ! IPAddress hostadd = Dns.Resolve(settings.ServerName).AddressList[0]; ! IPEndPoint EPhost = new IPEndPoint(hostadd, settings.ServerPort); ! this.socket = new Socket( ! AddressFamily.InterNetwork, ! SocketType.Stream, ! ProtocolType.Tcp); // Set Receive Buffer size. ! this.socket.SetSocketOption(SocketOptionLevel.Socket, ! SocketOptionName.ReceiveBuffer, settings.PacketSize); // Set Send Buffer size. ! this.socket.SetSocketOption(SocketOptionLevel.Socket, ! SocketOptionName.SendBuffer, settings.PacketSize); ! // Disables the Nagle algorithm for send coalescing. ! this.socket.SetSocketOption( ! SocketOptionLevel.Tcp, ! SocketOptionName.NoDelay, ! 1); // Make the socket to connect to the Server ! this.socket.Connect(EPhost); this.networkStream = new NetworkStream(socket, true); --- 852,870 ---- private void InitializeSocket() { ! IPAddress hostadd = Dns.GetHostEntry(settings.ServerName).AddressList[0]; ! this.socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); // Set Receive Buffer size. ! this.socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveBuffer, settings.PacketSize); // Set Send Buffer size. ! this.socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendBuffer, settings.PacketSize); // Disables the Nagle algorithm for send coalescing. ! this.socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, 1); // Make the socket to connect to the Server ! this.socket.Connect(new IPEndPoint(hostadd, settings.ServerPort)); this.networkStream = new NetworkStream(socket, true); *************** *** 895,903 **** { // Close streams ! if (this.sslStream != null) { try { ! this.sslStream.Close(); } catch --- 883,891 ---- { // Close streams ! if (this.secureStream != null) { try { ! this.secureStream.Close(); } catch Index: PgStatement.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/source/PostgreSql/Data/Protocol/PgStatement.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PgStatement.cs 8 Sep 2005 18:41:55 -0000 1.1 --- PgStatement.cs 9 Sep 2005 21:35:00 -0000 1.2 *************** *** 183,187 **** packet.WriteNullString(this.ParseName); packet.WriteNullString(this.stmtText); ! packet.WriteShort(0); // Send packet to the server --- 183,187 ---- packet.WriteNullString(this.ParseName); packet.WriteNullString(this.stmtText); ! packet.Write((short)0); // Send packet to the server *************** *** 231,241 **** // Receive Describe response ! PgResponsePacket response = new PgResponsePacket(); ! while ((response.Message != PgBackendCodes.ROW_DESCRIPTION && ! response.Message != PgBackendCodes.NODATA)) { response = this.db.ReceiveResponsePacket(); this.ProcessSqlPacket(response); ! } // Update status --- 231,241 ---- // Receive Describe response ! PgResponsePacket response = null; ! do { response = this.db.ReceiveResponsePacket(); this.ProcessSqlPacket(response); ! } ! while (response.IsRowDescription || response.IsNoData); // Update status *************** *** 267,288 **** // Send parameters format code. ! packet.WriteShort((short)parameters.Length); for (int i = 0; i < parameters.Length; i++) { ! packet.WriteShort((short)this.parameters[i].DataType.FormatCode); } // Send parameter values ! packet.WriteShort((short)parameters.Length); for (int i = 0; i < parameters.Length; i++) { ! packet.WriteParameter(this.parameters[i]); } // Send column information ! packet.WriteShort((short)this.rowDescriptor.Fields.Length); for (int i = 0; i < this.rowDescriptor.Fields.Length; i++) { ! packet.WriteShort((short)this.rowDescriptor.Fields[i].DataType.FormatCode); } --- 267,288 ---- // Send parameters format code. ! packet.Write((short)parameters.Length); for (int i = 0; i < parameters.Length; i++) { ! packet.Write((short)this.parameters[i].DataType.FormatCode); } // Send parameter values ! packet.Write((short)parameters.Length); for (int i = 0; i < parameters.Length; i++) { ! packet.Write(this.parameters[i]); } // Send column information ! packet.Write((short)this.rowDescriptor.Fields.Length); for (int i = 0; i < this.rowDescriptor.Fields.Length; i++) { ! packet.Write((short)this.rowDescriptor.Fields[i].DataType.FormatCode); } *************** *** 312,316 **** packet.WriteNullString(this.PortalName); ! packet.WriteInt(this.fetchSize); // Rows to retrieve ( 0 = nolimit ) // Send packet to the server --- 312,316 ---- packet.WriteNullString(this.PortalName); ! packet.Write(this.fetchSize); // Rows to retrieve ( 0 = nolimit ) // Send packet to the server *************** *** 321,332 **** // Receive response ! PgResponsePacket response = new PgResponsePacket(); ! while (response.Message != PgBackendCodes.READY_FOR_QUERY && ! response.Message != PgBackendCodes.PORTAL_SUSPENDED && ! response.Message != PgBackendCodes.COMMAND_COMPLETE) { response = this.db.ReceiveResponsePacket(); this.ProcessSqlPacket(response); ! } // reset rowIndex --- 321,332 ---- // Receive response ! PgResponsePacket response = null; ! ! do { response = this.db.ReceiveResponsePacket(); this.ProcessSqlPacket(response); ! } ! while (!response.IsReadyForQuery); // reset rowIndex *************** *** 335,341 **** // If the command is finished and has returned rows // set all rows are received ! if ((response.Message == PgBackendCodes.READY_FOR_QUERY || ! response.Message == PgBackendCodes.COMMAND_COMPLETE) && ! this.hasRows) { this.allRowsFetched = true; --- 335,339 ---- // If the command is finished and has returned rows // set all rows are received ! if ((response.IsReadyForQuery || response.IsCommandComplete) && this.HasRows) { this.allRowsFetched = true; *************** *** 344,348 **** // If all rows are received or the command doesn't return // rows perform a Sync. ! if (!this.hasRows || this.allRowsFetched) { this.db.Sync(); --- 342,346 ---- // If all rows are received or the command doesn't return // rows perform a Sync. ! if (!this.HasRows || this.allRowsFetched) { this.db.Sync(); *************** *** 352,360 **** this.status = PgStatementStatus.Executed; } ! catch (Exception) { - // Update status this.status = PgStatementStatus.Error; - // Throw exception throw; } --- 350,356 ---- this.status = PgStatementStatus.Executed; } ! catch { this.status = PgStatementStatus.Error; throw; } *************** *** 371,392 **** // Function id ! packet.WriteInt(id); // Send parameters format code. ! packet.WriteShort((short)this.parameters.Length); for (int i = 0; i < this.parameters.Length; i++) { ! packet.WriteShort((short)this.parameters[i].DataType.FormatCode); } // Send parameter values ! packet.WriteShort((short)this.parameters.Length); for (int i = 0; i < this.parameters.Length; i++) { ! packet.WriteParameter(this.parameters[i]); } // Send the format code for the function result ! packet.WriteShort(PgCodes.BINARY_FORMAT); // Send packet to the server --- 367,388 ---- // Function id ! packet.Write(id); // Send parameters format code. ! packet.Write((short)this.parameters.Length); for (int i = 0; i < this.parameters.Length; i++) { ! packet.Write((short)this.parameters[i].DataType.FormatCode); } // Send parameter values ! packet.Write((short)this.parameters.Length); for (int i = 0; i < this.parameters.Length; i++) { ! packet.Write(this.parameters[i]); } // Send the format code for the function result ! packet.Write(PgCodes.BINARY_FORMAT); // Send packet to the server *************** *** 394,403 **** // Receive response ! PgResponsePacket response = new PgResponsePacket(); ! while (response.Message != PgBackendCodes.READY_FOR_QUERY) { response = this.db.ReceiveResponsePacket(); this.ProcessSqlPacket(response); } // Update status --- 390,400 ---- // Receive response ! PgResponsePacket response = null; ! do { response = this.db.ReceiveResponsePacket(); this.ProcessSqlPacket(response); } + while (!response.IsReadyForQuery); // Update status *************** *** 436,441 **** // Receive response ! PgResponsePacket response = new PgResponsePacket(); ! while (response.Message != PgBackendCodes.READY_FOR_QUERY) { response = this.db.ReceiveResponsePacket(); --- 433,439 ---- // Receive response ! PgResponsePacket response = null; ! ! do { response = this.db.ReceiveResponsePacket(); *************** *** 449,452 **** --- 447,451 ---- } } + while (!response.IsReadyForQuery); if (this.hasRows) *************** *** 542,551 **** // Read until CLOSE COMPLETE message is received ! PgResponsePacket response = new PgResponsePacket(); ! while (response.Message != PgBackendCodes.CLOSE_COMPLETE) { response = this.db.ReceiveResponsePacket(); this.ProcessSqlPacket(response); } // Clear rows --- 541,552 ---- // Read until CLOSE COMPLETE message is received ! PgResponsePacket response = null; ! ! do { response = this.db.ReceiveResponsePacket(); this.ProcessSqlPacket(response); } + while (response.IsCloseComplete); // Clear rows *************** *** 683,687 **** private void ProcessFunctionResult(PgResponsePacket packet) { ! int length = packet.ReadInt(); outParameter.Value = packet.ReadValue(outParameter.DataType, length); --- 684,688 ---- private void ProcessFunctionResult(PgResponsePacket packet) { ! int length = packet.ReadInt32(); outParameter.Value = packet.ReadValue(outParameter.DataType, length); *************** *** 690,694 **** private void ProcessRowDescription(PgResponsePacket packet) { ! this.rowDescriptor = new PgRowDescriptor(packet.ReadShort()); for (int i = 0; i < rowDescriptor.Fields.Length; i++) --- 691,695 ---- private void ProcessRowDescription(PgResponsePacket packet) { ! this.rowDescriptor = new PgRowDescriptor(packet.ReadInt16()); for (int i = 0; i < rowDescriptor.Fields.Length; i++) *************** *** 697,706 **** this.rowDescriptor.Fields[i].FieldName = packet.ReadNullString(); ! this.rowDescriptor.Fields[i].OidTable = packet.ReadInt(); ! this.rowDescriptor.Fields[i].OidNumber = packet.ReadShort(); ! this.rowDescriptor.Fields[i].DataType = PgDbClient.Types[packet.ReadInt()]; ! this.rowDescriptor.Fields[i].DataTypeSize = packet.ReadShort(); ! this.rowDescriptor.Fields[i].TypeModifier = packet.ReadInt(); ! this.rowDescriptor.Fields[i].FormatCode = (PgTypeFormat)packet.ReadShort(); } } --- 698,707 ---- this.rowDescriptor.Fields[i].FieldName = packet.ReadNullString(); ! this.rowDescriptor.Fields[i].OidTable = packet.ReadInt32(); ! this.rowDescriptor.Fields[i].OidNumber = packet.ReadInt16(); ! this.rowDescriptor.Fields[i].DataType = PgDbClient.Types[packet.ReadInt32()]; ! this.rowDescriptor.Fields[i].DataTypeSize = packet.ReadInt16(); ! this.rowDescriptor.Fields[i].TypeModifier = packet.ReadInt32(); ! this.rowDescriptor.Fields[i].FormatCode = (PgTypeFormat)packet.ReadInt16(); } } *************** *** 708,716 **** private void ProcessParameterDescription(PgResponsePacket packet) { ! this.parameters = new PgParameter[packet.ReadShort()]; for (int i = 0; i < parameters.Length; i++) { ! this.parameters[i] = new PgParameter(packet.ReadInt()); } } --- 709,717 ---- private void ProcessParameterDescription(PgResponsePacket packet) { ! this.parameters = new PgParameter[packet.ReadInt16()]; for (int i = 0; i < parameters.Length; i++) { ! this.parameters[i] = new PgParameter(packet.ReadInt32()); } } *************** *** 718,722 **** private void ProcessDataRow(PgResponsePacket packet) { ! int fieldCount = packet.ReadShort(); object[] values = new object[fieldCount]; --- 719,723 ---- private void ProcessDataRow(PgResponsePacket packet) { ! int fieldCount = packet.ReadInt16(); object[] values = new object[fieldCount]; *************** *** 729,733 **** for (int i = 0; i < values.Length; i++) { ! int length = packet.ReadInt(); switch (length) --- 730,734 ---- for (int i = 0; i < values.Length; i++) { ! int length = packet.ReadInt32(); switch (length) Index: PgOutputPacket.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/source/PostgreSql/Data/Protocol/PgOutputPacket.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PgOutputPacket.cs 8 Sep 2005 18:41:55 -0000 1.1 --- PgOutputPacket.cs 9 Sep 2005 21:35:00 -0000 1.2 *************** *** 28,36 **** namespace PostgreSql.Data.Protocol { ! internal class PgOutputPacket : BinaryWriter { #region · Fields · ! private Encoding encoding; #endregion --- 28,38 ---- namespace PostgreSql.Data.Protocol { ! internal class PgOutputPacket { #region · Fields · ! private MemoryStream stream; ! private BinaryWriter packet; ! private Encoding encoding; #endregion *************** *** 38,49 **** #region · Properties · ! public long Position { ! get { return ((MemoryStream)this.BaseStream).Position; } } ! public long Length { ! get { return ((MemoryStream)this.BaseStream).Length; } } --- 40,51 ---- #region · Properties · ! public int Position { ! get { return (int)this.stream.Position; } } ! public int Length { ! get { return (int)this.stream.Length; } } *************** *** 52,64 **** #region · Constructors · ! public PgOutputPacket() : base(new MemoryStream()) { - this.encoding = Encoding.Default; - this.Write(new byte[0]); } ! public PgOutputPacket(Encoding encoding) : base(new MemoryStream(), encoding) { ! this.encoding = encoding; this.Write(new byte[0]); } --- 54,69 ---- #region · Constructors · ! public PgOutputPacket() ! : this(Encoding.Default) { } ! public PgOutputPacket(Encoding encoding) ! : this() { ! this.stream = new MemoryStream(); ! this.packet = new BinaryWriter(this.stream); ! this.encoding = encoding; ! this.Write(new byte[0]); } *************** *** 68,85 **** #region · Stream Methods · - public int GetByteCount() - { - return (int)((MemoryStream)this.BaseStream).Length; - } - public byte[] ToArray() { ! return ((MemoryStream)this.BaseStream).ToArray(); } public void Reset() { ! ((MemoryStream)this.BaseStream).SetLength(0); ! ((MemoryStream)this.BaseStream).Position = 0; } --- 73,85 ---- #region · Stream Methods · public byte[] ToArray() { ! return this.stream.ToArray(); } public void Reset() { ! this.stream.SetLength(0); ! this.stream.Position = 0; } *************** *** 88,106 **** #region · String Types · ! public void WriteNullString(string data) { ! if (!data.EndsWith(PgCodes.NULL_TERMINATOR.ToString())) { ! data += PgCodes.NULL_TERMINATOR; } ! this.Write(this.encoding.GetBytes(data)); } ! public void WriteString(string data) { ! byte[] buffer = this.encoding.GetBytes(data); ! this.WriteInt(buffer.Length); this.Write(buffer); } --- 88,116 ---- #region · String Types · ! public void Write(char ch) { ! this.packet.Write(ch); ! } ! ! public void Write(char[] chars) ! { ! this.packet.Write(chars); ! } ! ! public void WriteNullString(string value) ! { ! if (!value.EndsWith(PgCodes.NULL_TERMINATOR.ToString())) { ! value += PgCodes.NULL_TERMINATOR; } ! this.Write(this.encoding.GetBytes(value)); } ! public void WriteString(string value) { ! byte[] buffer = this.encoding.GetBytes(value); ! this.Write(buffer.Length); this.Write(buffer); } *************** *** 110,140 **** #region · Numeric Types · ! public void WriteShort(short val) { ! this.Write((short)IPAddress.HostToNetworkOrder(val)); } ! public void WriteInt(int val) { ! this.Write((int)IPAddress.HostToNetworkOrder(val)); } ! public void WriteLong(long val) { ! this.Write((long)IPAddress.HostToNetworkOrder(val)); } ! public void WriteFloat(float val) { ! byte[] buffer = BitConverter.GetBytes(val); ! this.Write(BitConverter.ToInt32(buffer, 0)); } ! public void WriteDouble(double val) { ! byte[] buffer = BitConverter.GetBytes(val); ! this.WriteLong(BitConverter.ToInt64(buffer, 0)); } --- 120,160 ---- #region · Numeric Types · ! public void Write(byte value) { ! this.packet.Write(value); } ! public void Write(short value) { ! this.packet.Write((short)IPAddress.HostToNetworkOrder(value)); } ! public void Write(int value) { ! this.packet.Write((int)IPAddress.HostToNetworkOrder(value)); } ! public void Write(long value) { ! this.packet.Write((long)IPAddress.HostToNetworkOrder(value)); ! } ! public void Write(float value) ! { ! this.packet.Write(BitConverter.ToInt32(BitConverter.GetBytes(value), 0)); } ! public void Write(double value) { ! this.Write(BitConverter.ToInt64(BitConverter.GetBytes(value), 0)); ! } ! #endregion ! ! #region · Boolean Types · ! ! public void Write(bool value) ! { ! this.packet.Write(value); } *************** *** 145,151 **** public void WriteDate(DateTime date) { ! TimeSpan days = date.Subtract(PgCodes.BASE_DATE); ! ! this.WriteInt(days.Days); } --- 165,169 ---- public void WriteDate(DateTime date) { ! this.Write(date.Subtract(PgCodes.BASE_DATE).Days); } *************** *** 155,160 **** int days = (interval.Days % 30); ! this.WriteDouble(interval.Subtract(TimeSpan.FromDays(months * 30)).TotalSeconds); ! this.WriteInt(months); } --- 173,178 ---- int days = (interval.Days % 30); ! this.Write(interval.Subtract(TimeSpan.FromDays(months * 30)).TotalSeconds); ! this.Write(months); } *************** *** 183,234 **** #region · Geometric Types · ! public void WritePoint(PgPoint point) { ! this.WriteDouble(point.X); ! this.WriteDouble(point.Y); } ! public void WriteCircle(PgCircle circle) { ! this.WritePoint(circle.Center); ! this.WriteDouble(circle.Radius); } ! public void WriteLine(PgLine line) { ! this.WritePoint(line.StartPoint); ! this.WritePoint(line.EndPoint); } ! public void WriteLSeg(PgLSeg lseg) { ! this.WritePoint(lseg.StartPoint); ! this.WritePoint(lseg.EndPoint); } ! public void WriteBox(PgBox box) { ! this.WritePoint(box.UpperRight); ! this.WritePoint(box.LowerLeft); } ! public void WritePolygon(PgPolygon polygon) { ! this.WriteInt(polygon.Points.Length); for (int i = 0; i < polygon.Points.Length; i++) { ! this.WritePoint(polygon.Points[i]); } } ! public void WritePath(PgPath path) { this.Write(path.IsClosedPath); ! this.WriteInt(path.Points.Length); for (int i = 0; i < path.Points.Length; i++) { ! this.WritePoint(path.Points[i]); } } --- 201,252 ---- #region · Geometric Types · ! public void Write(PgPoint point) { ! this.Write(point.X); ! this.Write(point.Y); } ! public void Write(PgCircle circle) { ! this.Write(circle.Center); ! this.Write(circle.Radius); } ! public void Write(PgLine line) { ! this.Write(line.StartPoint); ! this.Write(line.EndPoint); } ! public void Write(PgLSeg lseg) { ! this.Write(lseg.StartPoint); ! this.Write(lseg.EndPoint); } ! public void Write(PgBox box) { ! this.Write(box.UpperRight); ! this.Write(box.LowerLeft); } ! public void Write(PgPolygon polygon) { ! this.Write(polygon.Points.Length); for (int i = 0; i < polygon.Points.Length; i++) { ! this.Write(polygon.Points[i]); } } ! public void Write(PgPath path) { this.Write(path.IsClosedPath); ! this.Write(path.Points.Length); for (int i = 0; i < path.Points.Length; i++) { ! this.Write(path.Points[i]); } } *************** *** 238,250 **** #region · Parameters · ! public void WriteParameter(PgParameter parameter) { int size = parameter.DataType.Size; ! if (parameter.Value == System.DBNull.Value || ! parameter.Value == null) { // -1 indicates a NULL argument value ! this.WriteInt(-1); } else --- 256,267 ---- #region · Parameters · ! public void Write(PgParameter parameter) { int size = parameter.DataType.Size; ! if (parameter.Value == System.DBNull.Value || parameter.Value == null) { // -1 indicates a NULL argument value ! this.Write((int)-1); } else *************** *** 264,280 **** // Write the number of dimensions ! packet.WriteInt(array.Rank); // Write flags (always 0) ! packet.WriteInt(0); // Write base type of the array elements ! packet.WriteInt(parameter.DataType.ElementType); // Write lengths and lower bounds for (int i = 0; i < array.Rank; i ++) { ! packet.WriteInt(array.GetLength(i)); ! packet.WriteInt(array.GetLowerBound(i) + 1); } --- 281,297 ---- // Write the number of dimensions ! packet.Write(array.Rank); // Write flags (always 0) ! packet.Write((int)0); // Write base type of the array elements ! packet.Write(parameter.DataType.ElementType); // Write lengths and lower bounds for (int i = 0; i < array.Rank; i ++) { ! packet.Write(array.GetLength(i)); ! packet.Write(array.GetLowerBound(i) + 1); } *************** *** 286,290 **** // Write parameter size ! this.WriteInt(packet.GetByteCount()); // Write parameter data this.Write(packet.ToArray()); --- 303,308 ---- // Write parameter size ! this.Write(packet.Length); ! // Write parameter data this.Write(packet.ToArray()); *************** *** 306,311 **** // Write packet contents ! packet.WriteInt(GetByteCount() + 4); ! packet.Write(ToArray()); return packet.ToArray(); --- 324,329 ---- // Write packet contents ! packet.Write((int)(this.Length + 4)); ! packet.Write(this.ToArray()); return packet.ToArray(); *************** *** 317,322 **** packet.Write((byte)format); ! packet.WriteInt(GetByteCount() + 4); ! packet.Write(ToArray()); return packet.ToArray(); --- 335,340 ---- packet.Write((byte)format); ! packet.Write((int)(this.Length + 4)); ! packet.Write(this.ToArray()); return packet.ToArray(); *************** *** 325,346 **** #endregion ! #region · Private Methods · ! private void WriteParameter(PgOutputPacket packet, PgDataType dataType, int size, object value) { switch (dataType) { case PgDataType.Binary: ! packet.WriteInt(((byte[])value).Length); packet.Write((byte[])value); break; case PgDataType.Byte: ! packet.WriteInt(size); packet.Write((byte)value); break; case PgDataType.Boolean: ! packet.WriteInt(size); packet.Write(Convert.ToByte((bool)value)); break; --- 343,378 ---- #endregion ! #region · Methods · ! public void Write(byte[] buffer) ! { ! this.Write(buffer, 0, buffer.Length); ! } ! ! public void Write(byte[]buffer, int index, int count) ! { ! this.packet.Write(buffer, index, count); ! } ! ! #endregion ! ! #region · Private Methods · ! ! private void WriteParameter(PgOutputPacket packet, PgDataType dataType, int size, object value) { switch (dataType) { case PgDataType.Binary: ! packet.Write(((byte[])value).Length); packet.Write((byte[])value); break; case PgDataType.Byte: ! packet.Write(size); packet.Write((byte)value); break; case PgDataType.Boolean: ! packet.Write(size); packet.Write(Convert.ToByte((bool)value)); break; *************** *** 355,374 **** case PgDataType.Int2: ! packet.WriteInt(size); ! packet.WriteShort(Convert.ToInt16(value)); break; case PgDataType.Int4: ! packet.WriteInt(size); ! packet.WriteInt(Convert.ToInt32(value)); break; case PgDataType.Int8: ! packet.WriteInt(size); ! packet.WriteLong(Convert.ToInt64(value)); break; case PgDataType.Interval: ! packet.WriteInt(size); packet.WriteInterval(TimeSpan.Parse(value.ToString())); break; --- 387,406 ---- case PgDataType.Int2: ! packet.Write(size); ! packet.Write(Convert.ToInt16(value)); break; case PgDataType.Int4: ! packet.Write(size); ! packet.Write(Convert.ToInt32(value)); break; case PgDataType.Int8: ! packet.Write(size); ! packet.Write(Convert.ToInt64(value)); break; case PgDataType.Interval: ! packet.Write(size); packet.WriteInterval(TimeSpan.Parse(value.ToString())); break; *************** *** 377,381 **** { string paramValue = value.ToString(); ! packet.WriteInt(encoding.GetByteCount(paramValue)); packet.Write(paramValue.ToCharArray()); } --- 409,413 ---- { string paramValue = value.ToString(); ! packet.Write(encoding.GetByteCount(paramValue)); packet.Write(paramValue.ToCharArray()); } *************** *** 383,402 **** case PgDataType.Double: ! packet.WriteInt(size); ! packet.WriteDouble(Convert.ToDouble(value)); break; case PgDataType.Float: ! packet.WriteInt(size); ! packet.WriteFloat(Convert.ToSingle(value)); break; case PgDataType.Currency: ! packet.WriteInt(size); ! packet.WriteInt(Convert.ToInt32(Convert.ToSingle(value) * 100)); break; case PgDataType.Date: ! packet.WriteInt(size); packet.WriteDate(Convert.ToDateTime(value)); break; --- 415,434 ---- case PgDataType.Double: ! packet.Write(size); ! packet.Write(Convert.ToDouble(value)); break; case PgDataType.Float: ! packet.Write(size); ! packet.Write(Convert.ToSingle(value)); break; case PgDataType.Currency: ! packet.Write(size); ! packet.Write(Convert.ToInt32(Convert.ToSingle(value) * 100)); break; case PgDataType.Date: ! packet.Write(size); packet.WriteDate(Convert.ToDateTime(value)); break; *************** *** 419,444 **** case PgDataType.Point: ! packet.WriteInt(size); ! packet.WritePoint((PgPoint)value); break; case PgDataType.Circle: ! packet.WriteInt(size); ! packet.WriteCircle((PgCircle)value); break; case PgDataType.Line: ! packet.WriteInt(size); ! packet.WriteLine((PgLine)value); break; case PgDataType.LSeg: ! packet.WriteInt(size); ! packet.WriteLSeg((PgLSeg)value); break; case PgDataType.Box: ! packet.WriteInt(size); ! packet.WriteBox((PgBox)value); break; --- 451,476 ---- case PgDataType.Point: ! packet.Write(size); ! packet.Write((PgPoint)value); break; case PgDataType.Circle: ! packet.Write(size); ! packet.Write((PgCircle)value); break; case PgDataType.Line: ! packet.Write(size); ! packet.Write((PgLine)value); break; case PgDataType.LSeg: ! packet.Write(size); ! packet.Write((PgLSeg)value); break; case PgDataType.Box: ! packet.Write(size); ! packet.Write((PgBox)value); break; *************** *** 446,451 **** PgPolygon polygon = (PgPolygon)value; ! packet.WriteInt((size * polygon.Points.Length) + 4); ! packet.WritePolygon(polygon); break; --- 478,483 ---- PgPolygon polygon = (PgPolygon)value; ! packet.Write((int)((size * polygon.Points.Length) + 4)); ! packet.Write(polygon); break; *************** *** 453,458 **** PgPath path = (PgPath)value; ! packet.WriteInt((size * path.Points.Length) + 5); ! packet.WritePath(path); break; } --- 485,490 ---- PgPath path = (PgPath)value; ! packet.Write((int)((size * path.Points.Length) + 5)); ! packet.Write(path); break; } Index: PgCodes.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/source/PostgreSql/Data/Protocol/PgCodes.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PgCodes.cs 8 Sep 2005 18:41:55 -0000 1.1 --- PgCodes.cs 9 Sep 2005 21:35:00 -0000 1.2 *************** *** 69,74 **** // Format codes ! public const int TEXT_FORMAT = 0; ! public const int BINARY_FORMAT = 1; // Date & Time codes --- 69,74 ---- // Format codes ! public const short TEXT_FORMAT = 0; ! public const short BINARY_FORMAT = 1; // Date & Time codes Index: PgClientNotificationEventArgs.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/source/PostgreSql/Data/Protocol/PgClientNotificationEventArgs.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PgClientNotificationEventArgs.cs 8 Sep 2005 18:41:55 -0000 1.1 --- PgClientNotificationEventArgs.cs 9 Sep 2005 21:35:00 -0000 1.2 *************** *** 54,65 **** #region · Constructors · ! public PgClientNotificationEventArgs( ! int processID, ! string condition, ! string addtional) { this.processID = processID; this.condition = condition; ! this.aditional = aditional; } --- 54,62 ---- #region · Constructors · ! public PgClientNotificationEventArgs(int processID, string condition, string addtional) { this.processID = processID; this.condition = condition; ! this.aditional = addtional; } |