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

source_changes at macosforge.org source_changes at macosforge.org
Wed Oct 4 01:48:36 PDT 2006

Revision: 125
Author:   ssen
Date:     2006-10-04 01:48:36 -0700 (Wed, 04 Oct 2006)

Log Message:
For properties that are exactly arrays like "fooprop" = ("bar", "baz"),
have the SQL insert statements add an dummy index key:
INSERT (property, key, value) ("fooprop", 0, "bar")
INSERT (property, key, value) ("fooprop", 1, "baz")
So that during retrieval in _DBCopyPropArray(), the output array
is sorted the same way as the plist (since it does an
"ORDER BY key"). Properties that have an array nested in a dictionary
don't get this treatment, so they may be retrieved in a different
and non-deterministic order than they were inserted.

This solves the specific problem where you want "source_sites" to contain
multiple mirrors in a specified priority order, or where one source
site might have overriding content and must be accessed first.

As above, "dependencies" > "build" don't preserve sort order, but for
the current usage, that's OK.

Modified Paths:

Modified: trunk/darwinxref/DBDataStore.c
--- trunk/darwinxref/DBDataStore.c	2005-07-30 06:24:27 UTC (rev 124)
+++ trunk/darwinxref/DBDataStore.c	2006-10-04 08:48:36 UTC (rev 125)
@@ -461,9 +461,9 @@
 	for (i = 0; i < count; ++i) {
 		char* cvalu = strdup_cfstr(CFArrayGetValueAtIndex(value, i));
 		if (project) {
-			SQL("INSERT INTO properties (build,project,property,value) VALUES (%Q, %Q, %Q, %Q)", cbuild, cproj, cprop, cvalu);
+			SQL("INSERT INTO properties (build,project,property,key,value) VALUES (%Q, %Q, %Q, %Q)", cbuild, cproj, cprop, i, cvalu);
 		} else {
-			SQL("INSERT INTO properties (build,property,value) VALUES (%Q, %Q, %Q)", cbuild, cprop, cvalu);
+			SQL("INSERT INTO properties (build,property,key,value) VALUES (%Q, %Q, %d, %Q)", cbuild, cprop, i, cvalu);

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

More information about the darwinbuild-changes mailing list