• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# FirebirdClient.FbTransaction类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



FbTransaction类属于FirebirdSql.Data.FirebirdClient命名空间,在下文中一共展示了FbTransaction类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Init

        private void Init(FirebirdProcessor processor, IEnumerable<string> columnDefinitions)
        {
            Connection = (FbConnection)processor.Connection;
            Transaction = (FbTransaction)processor.Transaction;

            Create(columnDefinitions);
        }
开发者ID:SaltyDH,项目名称:fluentmigrator,代码行数:7,代码来源:FirebirdTestTable.cs


示例2: _executeNonQuery

        protected string _executeNonQuery(FbConnection conn, FbTransaction trans, string query, Dictionary<string, object> prms, bool isReturning)
        {
            string ret = "";

            using (FbCommand cmd = new FbCommand(query, conn, trans))
            {
                foreach (var prm in prms)
                    cmd.Parameters.AddWithValue(prm.Key, prm.Value);

                if (isReturning)
                {
                    FbParameter outparam = new FbParameter("@out", FbDbType.VarChar)
                    {
                        Direction = ParameterDirection.Output
                    };
                    cmd.Parameters.Add(outparam);

                    cmd.ExecuteNonQuery();
                    ret = outparam.Value as string;
                }
                else
                    cmd.ExecuteNonQuery();
            }

            return ret;
        }
开发者ID:kindprojects,项目名称:workstation,代码行数:26,代码来源:SCommand.cs


示例3: _executeReader

        protected List<Dictionary<string, string>> _executeReader(FbConnection conn, FbTransaction trans, string query, Dictionary<string, object> prms)
        {
            List<Dictionary<string, string>> ret = new List<Dictionary<string, string>>();

            using (FbCommand cmd = new FbCommand(query, conn, trans))
            {
                foreach (var prm in prms)
                    cmd.Parameters.AddWithValue(prm.Key, prm.Value);

                using (FbDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        Dictionary<string, string> row = new Dictionary<string, string>();

                        Object[] values = new Object[reader.FieldCount];
                        reader.GetValues(values);

                        for (int jj = 0; jj < reader.FieldCount; jj++)
                            row.Add(reader.GetName(jj).ToLower(), values[jj].ToString());

                        ret.Add(row);
                    }
                }
            }

            return ret;
        }
开发者ID:kindprojects,项目名称:workstation,代码行数:28,代码来源:SCommand.cs


示例4: Get

        public int? Get(FbConnection conn, FbTransaction trans, int objectId, string code, bool createIfNotExist)
        {
            string query = "SELECT * FROM sp_get_collection(@objectid, @collectioncode, @createifnotexist)";

            int? ret = null;

            try
            {
                using (FbCommand cmd = new FbCommand(query, conn, trans))
                {
                    cmd.Parameters.AddWithValue("@objectid", objectId);
                    cmd.Parameters.AddWithValue("@collectioncode", code);
                    cmd.Parameters.AddWithValue("@createifnotexist", createIfNotExist);

                    using (FbDataReader reader = cmd.ExecuteReader())
                    {
                        if (reader.Read())
                        {
                            ret = !reader.IsDBNull(0) ? reader.GetInt32(0) as int? : null;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("Ошибка SQL запроса. {0}", ex.Message));
            }

            return ret;
        }
开发者ID:kindprojects,项目名称:workstation,代码行数:30,代码来源:RepCollection.cs


示例5: Find

        public List<int> Find(FbConnection conn, FbTransaction trans, int ownerObjectId, string collectionName, string attrName, string attrValue)
        {
            string query = "SELECT objectid FROM sp_find_objects(@ownerObjectId, @collectionName, @attrName, '=', @attrValue)";

            List<int> ret = new List<int>();

            try
            {

                using (FbCommand cmd = new FbCommand(query, conn, trans))
                {
                    cmd.Parameters.AddWithValue("ownerObjectId", ownerObjectId);
                    cmd.Parameters.AddWithValue("collectionName", collectionName);
                    cmd.Parameters.AddWithValue("attrName", attrName);
                    cmd.Parameters.AddWithValue("attrValue", attrValue);

                    using (FbDataReader reader = cmd.ExecuteReader())
                    {
                        if (reader.Read())
                        {
                            ret.Add(reader.GetInt32(0));
                        }
                    }
                }

            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("Ошибка SQL запроса. {0}", ex.Message));
            }

            return ret;
        }
开发者ID:kindprojects,项目名称:workstation,代码行数:33,代码来源:RepObject.cs


示例6: Select

        public IModel Select(FbConnection conn, FbTransaction trans, string code)
        {
            string query = "SELECT * FROM models WHERE modelcode = UPPER(@modelcode)";

            IModel ret = null;

            try
            {
                using (FbCommand cmd = new FbCommand(query, conn, trans))
                {
                    cmd.Parameters.AddWithValue("modelcode", code.ToUpper());
                    using (FbDataReader reader = cmd.ExecuteReader())
                    {
                        if (reader.Read())
                        {
                            ret = new Model
                            {
                                Id = reader.GetInt32(0),
                                Code = reader.GetString(1),
                                ObjectIdRoot = reader.GetInt32(2)
                            };
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("Ошибка SQL запроса. {0}", ex.Message));
            }

            return ret;
        }
开发者ID:kindprojects,项目名称:workstation,代码行数:32,代码来源:RepModel.cs


示例7: Add

        public int? Add(FbConnection conn, FbTransaction trans, int collectionId)
        {
            string query = "SELECT * FROM sp_add_object(@collectionId)";

            int? ret = null;

            try
            {

                using (FbCommand cmd = new FbCommand(query, conn, trans))
                {
                    cmd.Parameters.AddWithValue("collectionId", collectionId);
                    using (FbDataReader reader = cmd.ExecuteReader())
                    {
                        if (reader.Read())
                        {
                            ret = !reader.IsDBNull(0) ? reader.GetInt32(0) as int? : null;
                        }
                    }
                }

            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("Ошибка SQL запроса. {0}", ex.Message));
            }

            return ret;
        }
开发者ID:kindprojects,项目名称:workstation,代码行数:29,代码来源:RepObject.cs


示例8: TransactionSubstance

 /// <summary>
 /// 指定されたパラメタでインスタンスを生成します。
 /// </summary>
 /// <param name="connectionSubstance">接続実体オブジェクト</param>
 internal TransactionSubstance(ConnectionSubstance connectionSubstance)
 {
     this.count = 0;
     this.isRollback = false;
     this.connectionSubstance = connectionSubstance;
     this.transaction = this.connectionSubstance.FbConnection.BeginTransaction(Transaction.FbTransactionOption);
     this.commandList = new List<Command>();
     this.disposed = false;
 }
开发者ID:saboten02091212,项目名称:Commons,代码行数:13,代码来源:TransactionSubstance.cs


示例9: Delete

 /// <summary>
 /// Удаление пользователя
 /// </summary>
 /// <param name="user">Пользователь</param>
 /// <param name="connection">Соединение</param>
 /// <param name="transaction">Транзакция</param>
 public static void Delete(UserData user, FbConnection connection,
     FbTransaction transaction)
 {
     // создаем команду
     using (FbCommand command = new FbCommand("delete from users where id = @id",
         connection, transaction))
     {
         // параметры команды
         command.Parameters.Add("@id", user.Id);
         // выполняем команду
         command.ExecuteNonQuery();
     }
 }
开发者ID:Dennis-Petrov,项目名称:Cash,代码行数:19,代码来源:UserDataHelper.cs


示例10: Exists

 /// <summary>
 /// Проверка существования записи в базе
 /// </summary>
 /// <param name="user">Пользователь</param>
 /// <param name="connection">Соединение</param>
 /// <param name="transaction">Транзакция</param>
 public static Boolean Exists(UserData user, FbConnection connection,
     FbTransaction transaction)
 {
     // создаем команду
     using (FbCommand command = new FbCommand("select id from users where id = @id",
         connection, transaction))
     {
         // параметры команды
         command.Parameters.Add("@id", user.Id);
         // выполняем команду
         using (FbDataReader reader = command.ExecuteReader())
         {
             // возвращаем результат поиска
             return reader.Read();
         }
     }
 }
开发者ID:Dennis-Petrov,项目名称:Cash,代码行数:23,代码来源:UserDataHelper.cs


示例11: Delete

        public void Delete(FbConnection conn, FbTransaction trans, int ownerObjectId, string code)
        {
            string query = "DELETE FROM collections WHERE owner_objectid = @owner_objectid AND collectioncode = UPPER(@collectioncode)";
            try
            {
                using (FbCommand cmd = new FbCommand(query, conn, trans))
                {
                    cmd.Parameters.AddWithValue("@owner_objectid", ownerObjectId);
                    cmd.Parameters.AddWithValue("@collectioncode", code);

                    cmd.ExecuteNonQuery();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("Ошибка SQL запроса. {0}", ex.Message));
            }
        }
开发者ID:kindprojects,项目名称:workstation,代码行数:18,代码来源:RepCollection.cs


示例12: Set

        public void Set(FbConnection conn, FbTransaction trans,  int objectId, string code, string val)
        {
            string query = "EXECUTE PROCEDURE sp_set_attribute(@objectId, @attributeCode, @val)";

            try
            {
                using (FbCommand cmd = new FbCommand(query, conn, trans))
                {
                    cmd.Parameters.AddWithValue("objectId", objectId);
                    cmd.Parameters.AddWithValue("attributeCode", code);
                    cmd.Parameters.AddWithValue("val", val);

                    cmd.ExecuteNonQuery();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("Ошибка SQL запроса. {0}", ex.Message));
            }
        }
开发者ID:kindprojects,项目名称:workstation,代码行数:20,代码来源:RepAttribute.cs


示例13: Delete

        public int Delete(FbConnection conn, FbTransaction trans, int id)
        {
            string query = "EXECUTE PROCEDURE sp_delete_object(@id)";

            int ret = -1;

            try
            {
                using (FbCommand cmd = new FbCommand(query, conn, trans))
                {
                    cmd.Parameters.AddWithValue("id", id);
                    ret = cmd.ExecuteNonQuery();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("Ошибка SQL запроса. {0}", ex.Message));
            }

            return ret;
        }
开发者ID:kindprojects,项目名称:workstation,代码行数:21,代码来源:RepObject.cs


示例14: Insert

        /// <summary>
        /// Добавление пользователя
        /// </summary>
        /// <param name="user">Пользователь</param>
        /// <param name="connection">Соединение</param>
        /// <param name="transaction">Транзакция</param>
        public static void Insert(UserData user, FbConnection connection,
            FbTransaction transaction)
        {
            // текст команды
            StringBuilder commandText = new StringBuilder();
            commandText.Append("insert into users values ");
            commandText.Append("(@id, @name, @password, @group, @can_close, @cashier_mode_only)");

            // создаем команду
            using (FbCommand command = new FbCommand(commandText.ToString(), connection, transaction))
            {
                // параметры
                command.Parameters.Add("@id", user.Id);
                command.Parameters.Add("@name", user.Name);
                command.Parameters.Add("@password", user.Password);
                command.Parameters.Add("@group", (Int32)user.SecurityGroup);
                command.Parameters.Add("@can_close", user.CanClose ? 1 : 0);
                command.Parameters.Add("@cashier_mode_only", user.CashierModeOnly ? 1 : 0);

                // выполняем команду
                command.ExecuteNonQuery();
            }
        }
开发者ID:Dennis-Petrov,项目名称:Cash,代码行数:29,代码来源:UserDataHelper.cs


示例15: FbCommand

        public FbCommand(string cmdText, FbConnection connection, FbTransaction transaction)
            : base()
        {
            this.namedParameters = new List<string>();
            this.updatedRowSource = UpdateRowSource.Both;
            this.commandType = CommandType.Text;
            this.designTimeVisible = true;
            this.commandTimeout = 30;
            this.fetchSize = 200;
            this.commandText = string.Empty;

            if (connection != null)
            {
                this.fetchSize = connection.ConnectionOptions.FetchSize;
            }

            if (cmdText != null)
            {
                this.CommandText = cmdText;
            }

            this.Connection = connection;
            this.transaction = transaction;
        }
开发者ID:kingpong,项目名称:NETProvider,代码行数:24,代码来源:FbCommand.cs


示例16: setTransacao

 public static void setTransacao(FbTransaction pfbTransaction)
 {
     fbTransaction = pfbTransaction;
 }
开发者ID:chmcorbo,项目名称:App.NET,代码行数:4,代码来源:ConexaoFB.cs


示例17: Prepare

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

            FbConnectionInternal innerConn = this.connection.InnerConnection;

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

                    // Update Statement	transaction
                    if (this.statement != null)
                    {
                        this.statement.Transaction = this.transaction.Transaction;
                    }
                }
            }

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

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

                // Reformat the SQL statement if needed
                string sql = this.commandText;

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

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

                    throw;
                }

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


示例18: Commit

		public void Commit(Enlistment enlistment)
		{
			if (_transaction != null && !_transaction.IsUpdated)
			{
				_transaction.Commit();
				_transaction = null;

				if (Completed != null)
				{
					Completed(this, new EventArgs());
				}

				if (_connection != null)
				{
					if (!_connection.Options.Pooling && (_connection.OwningConnection == null || _connection.OwningConnection.IsClosed))
					{
						_connection.Disconnect();
					}
				}
				_connection = null;
				_systemTransaction = null;

				// Declare done on the enlistment
				enlistment.Done();
			}
		}
开发者ID:nakagami,项目名称:FirebirdSql.Data.FirebirdClient,代码行数:26,代码来源:FbEnlistmentNotification.cs


示例19: abrir

 public static bool abrir()
 {
     conexao = new FbConnection(stringConexao);
     conexao.Open();
     transacao = conexao.BeginTransaction();
     return true;
 }
开发者ID:Artenes,项目名称:frogi-os,代码行数:7,代码来源:Conexao.cs


示例20: Commit

        public void Commit(Enlistment enlistment)
        {
            if (this.transaction != null && !this.transaction.IsUpdated)
            {
                this.transaction.Commit();
                this.transaction = null;

                if (this.Completed != null)
                {
                    this.Completed(this, new EventArgs());
                }

                if (this.connection != null)
                {
                    if (!this.connection.Pooled && (this.connection.OwningConnection == null || this.connection.OwningConnection.IsClosed))
                    {
                        this.connection.Disconnect();
                    }
                }
                this.connection         = null;
                this.systemTransaction  = null;

                // Declare done on the enlistment
                enlistment.Done();
            }
        }
开发者ID:antgraf,项目名称:Embedded-DB-.Net-Performance-Test,代码行数:26,代码来源:FbEnlistmentNotification.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Models.Device类代码示例发布时间:2022-05-24
下一篇:
C# FirebirdClient.FbParameter类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap