Skip to content
Permalink
Browse files

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.

git-svn-id: https://svn.macosforge.org/repository/darwinbuild/trunk@125 10a61168-4876-4dac-953b-31e694342555
  • Loading branch information
shantonusen committed Jul 30, 2005
1 parent f0619e4 commit c58297eb3e718e825a7084b2b0cb625c3f9fa8a1
Showing with 2 additions and 2 deletions.
  1. +2 −2 darwinxref/DBDataStore.c
@@ -461,9 +461,9 @@ int DBSetPropArray(CFStringRef build, CFStringRef project, CFStringRef property,
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);
}
free(cvalu);
}

0 comments on commit c58297e

Please sign in to comment.