[darwinbuild-changes] [311] trunk/darwinxref/DBDataStore.c

source_changes at macosforge.org source_changes at macosforge.org
Wed Oct 4 02:02:33 PDT 2006


Revision: 311
          http://trac.macosforge.org/projects/darwinbuild/changeset/311
Author:   kevin
Date:     2006-10-04 02:02:33 -0700 (Wed, 04 Oct 2006)

Log Message:
-----------
- Delete the entire dictionary prior to inserting; removes obsolete keys.

Modified Paths:
--------------
    trunk/darwinxref/DBDataStore.c

Modified: trunk/darwinxref/DBDataStore.c
===================================================================
--- trunk/darwinxref/DBDataStore.c	2005-12-01 01:08:50 UTC (rev 310)
+++ trunk/darwinxref/DBDataStore.c	2006-10-04 09:02:33 UTC (rev 311)
@@ -664,6 +664,13 @@
 	char* cproj = strdup_cfstr(project);
 	char* cprop = strdup_cfstr(property);
 
+	// Delete all keys from the dictionary prior to insertion.
+	if (project) {
+		SQL("DELETE FROM properties WHERE build=%Q AND project=%Q AND property=%Q", cbuild, cproj, cprop);
+	} else {
+		SQL("DELETE FROM properties WHERE build=%Q AND project IS NULL AND property=%Q", cbuild, cprop);
+	}
+
 	CFArrayRef keys = dictionaryGetSortedKeys(value);
 	CFIndex i, count = CFArrayGetCount(keys);
 	for (i = 0; i < count; ++i) {
@@ -671,12 +678,6 @@
 		char* ckey = strdup_cfstr(key);
 		CFTypeRef cf = CFDictionaryGetValue(value, key);
 
-		if (project) {
-			SQL("DELETE FROM properties WHERE build=%Q AND project=%Q AND property=%Q AND key=%Q", cbuild, cproj, cprop, ckey);
-		} else {
-			SQL("DELETE FROM properties WHERE build=%Q AND project IS NULL AND property=%Q AND key=%Q", cbuild, cprop, ckey);
-		}
-
 		if (CFGetTypeID(cf) == CFStringGetTypeID()) {
 			char* cvalu = strdup_cfstr(cf);
 			if (project) {

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20061004/698e2d6c/attachment-0001.html


More information about the darwinbuild-changes mailing list