public string ConvertToSql(string sqlUpdate, CriteriaOperator criteria) { var sqlWhere = CriteriaToWhereClauseHelper.GetMsSqlWhere(XpoCriteriaFixer.Fix(criteria)); var sqlTemplate = sqlUpdate.Replace("{criteria}", (string.IsNullOrEmpty(sqlWhere) ? "" : " AND " + sqlWhere)); return(sqlTemplate); }
private void ShowFilterSql() { CriteriaOperator criteria = ActiveFilterCriteria; var sqlCriteria = CriteriaToWhereClauseHelper.GetMsSqlWhere(XpoCriteriaFixer.Fix(criteria)); new GenericMessageBox(sqlCriteria, "Filter Criteria SQL Text"); }
public void CriteriaToSqlTest() { string xpoCriteriaText = "[Activity] Is Not Null Or [ActionOwner.Name] Like 'UNDEFINED'"; var criteria = CriteriaEditorHelper.GetCriteriaOperator( xpoCriteriaText, typeof(BankStmt), ObjectSpace); var sqlCriteriaText = CriteriaToWhereClauseHelper.GetOracleWhere(XpoCriteriaFixer.Fix(criteria)); Console.WriteLine(sqlCriteriaText); }
private void BuildCriteriaExpression_Execute(object sender, SimpleActionExecuteEventArgs e) { var obj = (IMappingCriteriaGenerator)View.CurrentObject; var xpoCriteriaText = obj.Criteria; var criteria = CriteriaEditorHelper.GetCriteriaOperator( xpoCriteriaText, obj.CriteriaObjectType, ObjectSpace); obj.CriteriaExpression = CriteriaToWhereClauseHelper.GetOracleWhere(XpoCriteriaFixer.Fix(criteria)); }
// Note that this does not delete child objects public void Delete(XPClassInfo classInfo, CriteriaOperator criteria) { var session = ((XPObjectSpace)objectSpace).Session; var gcRecordIDGenerator = new Random(); var randomNumber = gcRecordIDGenerator.Next(1, 2147483647); var sqlWhere = CriteriaToWhereClauseHelper.GetMsSqlWhere(XpoCriteriaFixer.Fix(criteria)); sqlWhere = string.IsNullOrEmpty(sqlWhere) ? "" : " WHERE " + sqlWhere; var sqlNonQuery = "UPDATE " + classInfo.TableName + " SET GCRecord = " + randomNumber + sqlWhere; session.ExecuteNonQuery(sqlNonQuery); objectSpace.CommitChanges(); }
public void Process(IEnumerable objs) { Type objType = null; foreach (var obj in objs) { objType = obj.GetType(); } if (objType == null) { return; } var criteria = new InOperator(objSpace.GetKeyPropertyName(objType), objs); var sqlWhere = CriteriaToWhereClauseHelper.GetMsSqlWhere(XpoCriteriaFixer.Fix(criteria)); string processCommandText = CreateProcessCommandText(sqlWhere); using (var cmd = ((SqlConnection)objSpace.Session.Connection).CreateCommand()) { cmd.CommandText = parameterCommandText + "\n\n" + processCommandText; cmd.ExecuteNonQuery(); } }