public static void CheckResultErrors(SaveResult[] saveResults) { string errMessages = string.Empty; foreach (SaveResult sr in saveResults) { if (!sr.success) { foreach (Error err in sr.errors) errMessages += err.message + "\n"; } } if (errMessages != string.Empty) throw new Exception(errMessages); }
public new SaveResult[] update(sObject[] sObjects) { long start = DateTime.Now.Ticks; if (sObjects.Length > 1) SetAutoRequestCompressed(); else SetAutoRequestPlain(); SetAutoResponseCompressed(); try { if (sObjects.Length <= maxRowCount) return base.update(sObjects); else { SaveResult[] results = new SaveResult[sObjects.Length]; for (int startPos = 0; startPos < sObjects.Length; startPos += maxRowCount) { sObject[] buffer = new sObject[Math.Min(maxRowCount, sObjects.Length - startPos)]; Array.Copy(sObjects, startPos, buffer, 0, buffer.Length); (base.update(buffer)).CopyTo(results, startPos); } return results; } } finally { if (OnUpdateComplete != null) OnUpdateComplete(new TimeSpan(DateTime.Now.Ticks - start)); ResetCompressionModes(); } }