ParameterValue[] ModifyXPObjectTypeDataCore(SimpleDataLayer dataLayer, InsertStatement insertStatement) {
     if (TypeExists(dataLayer, insertStatement)) return null;
     if (!IsMainLayer(dataLayer.Connection)) {
         _xpoObjectHacker.CreateObjectTypeIndetifier(insertStatement,_dataStoreManager.SimpleDataLayers[DataStoreManager.STR_Default]);
     }
     return dataLayer.ModifyData(insertStatement).Identities;
 }
        /// <summary>
        /// Updates data in a data store using the specified modification statements.
        /// </summary>
        /// <param name="dmlStatements">An array of data modification statements.</param>
        /// <returns>
        /// The result of the data modifications.
        /// </returns>
        public ModificationResult ModifyData(params ModificationStatement[] dmlStatements)
        {
            var appChanges = new List <ModificationStatement>(dmlStatements.Length);
            var ssChanges  = new List <ModificationStatement>(dmlStatements.Length);

            foreach (var stm in dmlStatements)
            {
                if (isSecondStorageTable(stm.TableName))
                {
                    ssChanges.Add(stm);
                }
                else
                {
                    appChanges.Add(stm);
                }
            }

            var resultSet = new List <ParameterValue>();

            if (appChanges.Count > 0)
            {
                resultSet.AddRange(appDataLayer.ModifyData(appChanges.ToArray()).Identities);
            }

            if (ssChanges.Count > 0)
            {
                openSecondStorage();
                resultSet.AddRange(secondStorageDataLayer.ModifyData(ssChanges.ToArray()).Identities);
            }

            return(new ModificationResult(resultSet));
        }
Exemple #3
0
        public ModificationResult ModifyData(params ModificationStatement[] dmlStatements)
        {
            List <ModificationStatement> legacyChanges = new List <ModificationStatement>(dmlStatements.Length);
            List <ModificationStatement> tempChanges   = new List <ModificationStatement>(dmlStatements.Length);

            foreach (ModificationStatement stm in dmlStatements)
            {
                if (IsTempDatabaseTable(stm.Table.Name))
                {
                    tempChanges.Add(stm);
                }
                else
                {
                    legacyChanges.Add(stm);
                }
            }

            List <ParameterValue> resultSet = new List <ParameterValue>();

            if (legacyChanges.Count > 0)
            {
                resultSet.AddRange(legacyDataLayer.ModifyData(legacyChanges.ToArray()).Identities);
            }
            if (tempChanges.Count > 0)
            {
                resultSet.AddRange(tempDataLayer.ModifyData(tempChanges.ToArray()).Identities);
            }
            return(new ModificationResult(resultSet));
        }