Ejemplo n.º 1
0
        private void BuildInsert(IMultiQuery query, ISmartScriptLine[] serializedScript, IConditionLine[] serializedConditions)
        {
            if (serializedScript.Length == 0)
            {
                return;
            }

            var lines = serializedScript.Select(s => GenerateSingleSai(query, s));

            query.Table(SmartScriptTableName).BulkInsert(lines);

            query.BlankLine();

            query.Add(conditionQueryGenerator.BuildDeleteQuery(new IDatabaseProvider.ConditionKey(
                                                                   SmartConstants.ConditionSourceSmartScript,
                                                                   null,
                                                                   script.EntryOrGuid,
                                                                   (int)script.SourceType)));
            query.Add(conditionQueryGenerator.BuildInsertQuery(serializedConditions));
        }
        private void BuildInsert(IMultiQuery query)
        {
            var(serializedScript, serializedConditions) = scriptExporter.ToDatabaseCompatibleSmartScript(script);

            if (serializedScript.Length == 0)
            {
                return;
            }

            var lines = serializedScript.Select(s => GenerateSingleSai(query, s));

            query.Table("smart_scripts").BulkInsert(lines);

            query.BlankLine();

            query.Add(conditionQueryGenerator.BuildDeleteQuery(new IDatabaseProvider.ConditionKey(
                                                                   SmartConstants.ConditionSourceSmartScript,
                                                                   null,
                                                                   script.EntryOrGuid,
                                                                   (int)script.SourceType)));
            query.Add(conditionQueryGenerator.BuildInsertQuery(serializedConditions));
        }