当前位置: 首页>>代码示例>>C#>>正文


C# FbTransaction.BeginTransaction方法代码示例

本文整理汇总了C#中FirebirdSql.Data.FirebirdClient.FbTransaction.BeginTransaction方法的典型用法代码示例。如果您正苦于以下问题:C# FbTransaction.BeginTransaction方法的具体用法?C# FbTransaction.BeginTransaction怎么用?C# FbTransaction.BeginTransaction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FirebirdSql.Data.FirebirdClient.FbTransaction的用法示例。


在下文中一共展示了FbTransaction.BeginTransaction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BeginTransaction

		public FbTransaction BeginTransaction(FbTransactionOptions options, string transactionName)
		{
			lock (this)
			{
				if (HasActiveTransaction)
				{
					throw new InvalidOperationException("A transaction is currently active. Parallel transactions are not supported.");
				}

				try
				{
					_activeTransaction = new FbTransaction(
						_owningConnection, IsolationLevel.Unspecified);

					_activeTransaction.BeginTransaction(options);

					if (transactionName != null)
					{
						_activeTransaction.Save(transactionName);
					}
				}
				catch (IscException ex)
				{
					throw new FbException(ex.Message, ex);
				}
			}

			return _activeTransaction;
		}
开发者ID:fishcodelib,项目名称:FirebirdSql.Data.FirebirdClient,代码行数:29,代码来源:FbConnectionInternal.cs

示例2: Prepare

		private void Prepare(bool returnsSet)
		{
			LogCommand();

			FbConnectionInternal innerConn = _connection.InnerConnection;

			// Check if	we have	a valid	transaction
			if (_transaction == null)
			{
				if (innerConn.IsEnlisted)
				{
					_transaction = innerConn.ActiveTransaction;
				}
				else
				{
					_implicitTransaction = true;
					_transaction = new FbTransaction(_connection, _connection.ConnectionOptions.IsolationLevel);
					_transaction.BeginTransaction();

					// Update Statement	transaction
					if (_statement != null)
					{
						_statement.Transaction = _transaction.Transaction;
					}
				}
			}

			// Check if	we have	a valid	statement handle
			if (_statement == null)
			{
				_statement = innerConn.Database.CreateStatement(_transaction.Transaction);
			}

			// Prepare the statement if	needed
			if (!_statement.IsPrepared)
			{
				// Close the inner DataReader if needed
				CloseReader();

				// Reformat the SQL statement if needed
				string sql = _commandText;

				if (_commandType == CommandType.StoredProcedure)
				{
					sql = BuildStoredProcedureSql(sql, returnsSet);
				}

				try
				{
					// Try to prepare the command
					_statement.Prepare(ParseNamedParameters(sql));
				}
				catch
				{
					// Release the statement and rethrow the exception
					_statement.Release();
					_statement = null;

					throw;
				}

				// Add this	command	to the active command list
				innerConn.AddPreparedCommand(this);
			}
			else
			{
				// Close statement for subsequently	executions
				Close();
			}
		}
开发者ID:nakagami,项目名称:FirebirdSql.Data.FirebirdClient,代码行数:70,代码来源:FbCommand.cs


注:本文中的FirebirdSql.Data.FirebirdClient.FbTransaction.BeginTransaction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。