public int Execute(DBState state) { ISqlMapper sqlMap = this.GetSqlMap(); int resultRowNum = 0; try { if (state.Type == ESqlType.INSERT) { resultRowNum += sqlMap.Update(state.Name, state.Param); } else { if (state.Type == ESqlType.UPDATE) { //string sql = GetSql(state.Name, state.Param,true); resultRowNum += sqlMap.Update(state.Name, state.Param); } else { resultRowNum += sqlMap.Delete(state.Name, state.Param); } } } catch (Exception ex) { throw ex; } return(resultRowNum); }
public int BatchExecute(ISqlMapper sqlMap, DBState state) { //DateTime now = System.DateTime.Now; int resultRowNum = 0; resultRowNum = sqlMap.Update(state.Name, state.Param); return(resultRowNum); }
public int Execute(string sqlStatement) { ISqlMapper sqlMap = this.GetSqlMap(); string text = sqlStatement.ToUpper().Trim(); ESqlType eSqlType = ESqlType.INSERT; int resultRowNum = 0; if (text.StartsWith(ESqlType.INSERT.ToString())) { eSqlType = ESqlType.INSERT; } else { if (text.StartsWith(ESqlType.UPDATE.ToString())) { eSqlType = ESqlType.UPDATE; } else { if (text.StartsWith(ESqlType.DELETE.ToString())) { eSqlType = ESqlType.DELETE; } } } DBState dBState = new DBState { Name = "ExecuteNoneQuery", Param = sqlStatement, Type = eSqlType }; if (eSqlType == ESqlType.INSERT) { resultRowNum += sqlMap.Update(dBState.Name, dBState.Param); } else { if (eSqlType == ESqlType.UPDATE) { resultRowNum += sqlMap.Update(dBState.Name, dBState.Param); } else { resultRowNum += sqlMap.Delete(dBState.Name, dBState.Param); } } return(resultRowNum); }
public static int Execute(DBState state) { return(DaoBase.getInstance().Execute(state)); }
public static int ExecuteWithOutTransaction(ISqlMapper sqlMap, DBState state) { return(DaoBase.getInstance().Execute(sqlMap, state)); }