From: <cin...@us...> - 2010-02-07 15:49:54
|
Revision: 1081 http://firebird.svn.sourceforge.net/firebird/?rev=1081&view=rev Author: cincura_net Date: 2010-02-07 15:49:47 +0000 (Sun, 07 Feb 2010) Log Message: ----------- * Work on op_cancel packet (work-in-progress). * Small code cleanup. Modified Paths: -------------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsDatabase.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsStatement.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version11/GdsDatabase.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version11/GdsStatement.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsDatabase.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscCodes.cs NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj Added Paths: ----------- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsStatement.cs Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsDatabase.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsDatabase.cs 2010-01-30 17:39:02 UTC (rev 1080) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsDatabase.cs 2010-02-07 15:49:47 UTC (rev 1081) @@ -353,7 +353,7 @@ this.WriteBuffer(dpb.ToArray()); } - protected virtual void ProcessCreateResponse(GenericResponse response) + protected void ProcessCreateResponse(GenericResponse response) { this.handle = response.ObjectHandle; } @@ -561,6 +561,15 @@ #endregion + #region \xB7 Cancel Methods \xB7 + + public virtual void CancelOperation(int kind) + { + throw new NotSupportedException("Cancel Operation isn't supported on protocol 10."); + } + + #endregion + #region \xB7 Statement Creation Methods \xB7 public virtual StatementBase CreateStatement() @@ -834,10 +843,8 @@ } protected void ProcessReleaseObjectResponse(IResponse response) - { + { } - } - #endregion #region \xB7 Read Members \xB7 Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsStatement.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsStatement.cs 2010-01-30 17:39:02 UTC (rev 1080) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version10/GdsStatement.cs 2010-02-07 15:49:47 UTC (rev 1081) @@ -40,7 +40,6 @@ protected bool allRowsFetched; private Queue<DbValue[]> rows; private Queue<DbValue[]> outputParams; - private int recordsAffected; private int fetchSize; private bool returnRecordsAffected; @@ -91,11 +90,7 @@ get { return this.fields; } } - public override int RecordsAffected - { - get { return this.recordsAffected; } - protected set { this.recordsAffected = value; } - } + public override int RecordsAffected { get; protected set; } public override bool IsPrepared { @@ -157,7 +152,7 @@ } this.handle = IscCodes.INVALID_OBJECT; - this.recordsAffected = -1; + this.RecordsAffected = -1; this.fetchSize = 200; this.rows = new Queue<DbValue[]>(); this.outputParams = new Queue<DbValue[]>(); @@ -208,7 +203,7 @@ this.statementType = DbStatementType.None; this.handle = 0; this.fetchSize = 0; - this.recordsAffected = 0; + this.RecordsAffected = 0; } base.Dispose(disposing); @@ -307,7 +302,7 @@ { try { - this.recordsAffected = -1; + this.RecordsAffected = -1; this.SendExecuteToBuffer(); Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version11/GdsDatabase.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version11/GdsDatabase.cs 2010-01-30 17:39:02 UTC (rev 1080) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version11/GdsDatabase.cs 2010-02-07 15:49:47 UTC (rev 1081) @@ -111,7 +111,7 @@ dpb.Append(IscCodes.isc_dpb_trusted_auth, authData); } - protected virtual void ProcessTrustedAuthResponse(SSPIHelper sspiHelper, ref IResponse response) + protected void ProcessTrustedAuthResponse(SSPIHelper sspiHelper, ref IResponse response) { while (response is AuthResponse) { Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version11/GdsStatement.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version11/GdsStatement.cs 2010-01-30 17:39:02 UTC (rev 1080) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version11/GdsStatement.cs 2010-02-07 15:49:47 UTC (rev 1081) @@ -24,7 +24,6 @@ using System.IO; using FirebirdSql.Data.Common; -using FirebirdSql.Data.Client.Managed.Version10; namespace FirebirdSql.Data.Client.Managed.Version11 { @@ -146,8 +145,8 @@ if (this.StatementType == DbStatementType.StoredProcedure) { numberOfResponses--; - sqlStoredProcedureResponse = this.database.ReadSqlResponse(); - this.ProcessStoredProcedureExecuteResponse(sqlStoredProcedureResponse); + sqlStoredProcedureResponse = this.database.ReadSqlResponse(); + this.ProcessStoredProcedureExecuteResponse(sqlStoredProcedureResponse); } numberOfResponses--; @@ -161,7 +160,7 @@ } this.ProcessExecuteResponse(executeResponse); - if (rowsAffectedResponse != null) + if (readRowsAffectedResponse) this.RecordsAffected = this.ProcessRecordsAffectedBuffer(this.ProcessInfoSqlResponse(rowsAffectedResponse)); } finally @@ -181,25 +180,21 @@ #endregion - #region \xB7 Private Methods \xB7 + #region Protected methods + protected void SafeFinishFetching(ref int numberOfResponses) + { + while (numberOfResponses > 0) + { + numberOfResponses--; + try + { + this.database.ReadResponse(); + } + catch (IscException) + { } + } + } - private void SafeFinishFetching(ref int numberOfResponses) - { - while (numberOfResponses > 0) - { - numberOfResponses--; - try - { - this.database.ReadResponse(); - } - catch (IscException) - { } - } - } - - #endregion - - #region Protected methods protected override void Free(int option) { if (FreeNotNeeded(option)) Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsDatabase.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsDatabase.cs 2010-01-30 17:39:02 UTC (rev 1080) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsDatabase.cs 2010-02-07 15:49:47 UTC (rev 1081) @@ -56,6 +56,44 @@ this.WriteBuffer(Encoding.UTF8.GetBytes(database)); this.WriteBuffer(dpb.ToArray()); } + + #region \xB7 Override Statement Creation Methods \xB7 + + public override StatementBase CreateStatement() + { + return new GdsStatement(this); + } + + public override StatementBase CreateStatement(ITransaction transaction) + { + return new GdsStatement(this, transaction); + } + + #endregion + + #region \xB7 Cancel Methods \xB7 + + public override void CancelOperation(int kind) + { + try + { + SendCancelOperationToBuffer(kind); + this.Flush(); + // no response, this is async + } + catch (IOException) + { + throw new IscException(IscCodes.isc_network_error); + } + } + + protected void SendCancelOperationToBuffer(int kind) + { + this.Write(IscCodes.op_cancel); + this.Write(kind); + } + + #endregion } } Added: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsStatement.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsStatement.cs (rev 0) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Client/Managed/Version12/GdsStatement.cs 2010-02-07 15:49:47 UTC (rev 1081) @@ -0,0 +1,43 @@ +/* + * Firebird ADO.NET Data provider for .NET and Mono + * + * The contents of this file are subject to the Initial + * Developer's Public License Version 1.0 (the "License"); + * you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * http://www.firebirdsql.org/index.php?op=doc&id=idpl + * + * Software distributed under the License is distributed on + * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * Copyright (c) 2010 Jiri Cincura (ji...@ci...) + * All Rights Reserved. + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.IO; + +using FirebirdSql.Data.Common; + +namespace FirebirdSql.Data.Client.Managed.Version12 +{ + internal class GdsStatement : Version11.GdsStatement + { + #region \xB7 Constructors \xB7 + + public GdsStatement(IDatabase db) + : base(db) + { } + + public GdsStatement(IDatabase db, ITransaction transaction) + : base(db, transaction) + { } + + #endregion + } +} Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscCodes.cs =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscCodes.cs 2010-01-30 17:39:02 UTC (rev 1080) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/Common/IscCodes.cs 2010-02-07 15:49:47 UTC (rev 1081) @@ -247,6 +247,7 @@ public const int op_partial = 89; // packet is not complete - delay processing public const int op_trusted_auth = 90; + public const int op_cancel = 91; #endregion @@ -895,5 +896,12 @@ public const int DTYPE_TYPE_MAX = 20; #endregion - } + + #region Cancel types + public const int fb_cancel_disable = 1; + public const int fb_cancel_enable = 2; + public const int fb_cancel_raise = 3; + public const int fb_cancel_abort = 4; + #endregion + } } Modified: NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj =================================================================== --- NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj 2010-01-30 17:39:02 UTC (rev 1080) +++ NETProvider/trunk/NETProvider/source/FirebirdSql/Data/FirebirdSql.Data.FirebirdClient.csproj 2010-02-07 15:49:47 UTC (rev 1081) @@ -81,6 +81,7 @@ <Compile Include="Client\Managed\Version11\AuthResponse.cs" /> <Compile Include="Client\Managed\Version11\SSPIHelper.cs" /> <Compile Include="Client\Managed\Version12\GdsDatabase.cs" /> + <Compile Include="Client\Managed\Version12\GdsStatement.cs" /> <Compile Include="Entity\DmlSqlGenerator.cs" /> <Compile Include="Entity\ExpressionTranslator.cs" /> <Compile Include="Entity\FirstClause.cs" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |