Esempio n. 1
0
        internal int GetNextResult(out ISQLCursor cursor, ref short resultCols)
        {
            cursor     = new FbCursor(this);
            resultCols = 0;

            return(-1);
        }
Esempio n. 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());
        }
Esempio n. 3
0
		internal int GetNextResult(out ISQLCursor cursor, ref short resultCols)
		{
			cursor = new FbCursor(this);
			resultCols = 0;

			return -1;
		}
Esempio n. 4
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();
		}