コード例 #1
0
        internal int GetNextResult(out ISQLCursor cursor, ref short resultCols)
        {
            cursor     = new FbCursor(this);
            resultCols = 0;

            return(-1);
        }
コード例 #2
0
        public int Execute(out ISQLCursor cursor, ref short resultCols)
        {
            cursor     = null;
            resultCols = 0;

            try
            {
                if (this.statement == null)
                {
                    throw new InvalidOperationException("Command needs to be prepared before execution.");
                }

                if (this.transactionId == 0)
                {
                    this.transactionId = this.connection.GetTransactionId();
                    if (this.transactionId < 0)
                    {
                        this.connection.BeginTransaction(this.transactionId, (int)(IsolationLevel.ReadCommitted));
                    }
                }

                ITransaction transaction = (ITransaction)this.connection.Transactions[this.transactionId];

                if (this.statement.IsPrepared)
                {
                    this.Close();
                }

                this.statement.Execute();

                cursor = new FbCursor(this);

                if (this.statement.StatementType != DbStatementType.Select &&
                    this.statement.StatementType != DbStatementType.SelectForUpdate &&
                    this.statement.StatementType != DbStatementType.StoredProcedure)
                {
                    this.CommitImplicitTransaction();
                }
                else
                {
                    resultCols = this.statement.Fields.Count;
                }
            }
            catch (IscException e)
            {
                this.lastError = e;
                this.RollbackImplicitTransaction();
            }

            return(this.GetErrorCode());
        }
コード例 #3
0
ファイル: FbCommand.cs プロジェクト: cafee/NETProvider
		internal int GetNextResult(out ISQLCursor cursor, ref short resultCols)
		{
			cursor = new FbCursor(this);
			resultCols = 0;

			return -1;
		}
コード例 #4
0
ファイル: FbCommand.cs プロジェクト: cafee/NETProvider
		public int Execute(out ISQLCursor cursor, ref short resultCols)
		{
			cursor		= null;
			resultCols	= 0;

			try
			{
				if (this.statement == null)
				{
					throw new InvalidOperationException("Command needs to be prepared before execution.");
				}

				if (this.transactionId == 0)
				{
					this.transactionId = this.connection.GetTransactionId();
					if (this.transactionId < 0)
					{
						this.connection.BeginTransaction(this.transactionId, (int)(IsolationLevel.ReadCommitted));
					}
				}

				ITransaction transaction = (ITransaction)this.connection.Transactions[this.transactionId];
				
				if (this.statement.IsPrepared)
				{
					this.Close();
				}

				this.statement.Execute();

				cursor = new FbCursor(this);

				if (this.statement.StatementType != DbStatementType.Select &&
					this.statement.StatementType != DbStatementType.SelectForUpdate &&
					this.statement.StatementType != DbStatementType.StoredProcedure)
				{
					this.CommitImplicitTransaction();
				}
				else
				{
					resultCols = this.statement.Fields.Count;
				}
			}
			catch (IscException e)
			{
				this.lastError = e;
				this.RollbackImplicitTransaction();
			}
			
			return this.GetErrorCode();
		}