public virtual int ExecuteReturnIdentity() { if (this.InsertObjs.Count() == 1 && this.InsertObjs.First() == null) { return(0); } string sql = _ExecuteReturnIdentity(); var result = 0; if (InsertBuilder.IsOleDb) { var isAuto = false; if (this.Context.CurrentConnectionConfig.IsAutoCloseConnection) { isAuto = true; this.Context.CurrentConnectionConfig.IsAutoCloseConnection = false; } result = Ado.GetInt(sql.Split(';').First(), InsertBuilder.Parameters == null ? null : InsertBuilder.Parameters.ToArray()); result = Ado.GetInt(sql.Split(';').Last(), InsertBuilder.Parameters == null ? null : InsertBuilder.Parameters.ToArray()); if (isAuto) { this.Ado.Close(); this.Context.CurrentConnectionConfig.IsAutoCloseConnection = isAuto; } } else { result = Ado.GetInt(sql, InsertBuilder.Parameters == null ? null : InsertBuilder.Parameters.ToArray()); } After(sql, result); return(result); }
public int ExecuteReturnIdentity() { InsertBuilder.IsReturnIdentity = true; PreToSql(); string sql = InsertBuilder.ToSqlString(); return(Ado.GetInt(sql, InsertBuilder.Parameters == null ? null : InsertBuilder.Parameters.ToArray())); }
public virtual int ExecuteReturnIdentity() { InsertBuilder.IsReturnIdentity = true; PreToSql(); AutoRemoveDataCache(); string sql = InsertBuilder.ToSqlString(); RestoreMapping(); return(Ado.GetInt(sql, InsertBuilder.Parameters == null ? null : InsertBuilder.Parameters.ToArray())); }
public virtual int ExecuteReturnIdentity() { if (this.InsertObjs.Count() == 1 && this.InsertObjs.First() == null) { return(0); } string sql = _ExecuteReturnIdentity(); var result = Ado.GetInt(sql, InsertBuilder.Parameters == null ? null : InsertBuilder.Parameters.ToArray()); After(sql, result); return(result); }
public virtual int ExecuteReturnIdentity() { if (this.InsertObjs.Count() == 1 && this.InsertObjs.First() == null) { return(0); } InsertBuilder.IsReturnIdentity = true; PreToSql(); AutoRemoveDataCache(); string sql = InsertBuilder.ToSqlString(); RestoreMapping(); Before(sql); var result = Ado.GetInt(sql, InsertBuilder.Parameters == null ? null : InsertBuilder.Parameters.ToArray()); After(sql, result); return(result); }
private int GetSeqValue(string seqName) { return(Ado.GetInt(" SELECT " + seqName + ".currval FROM DUAL")); }