Hi Jean-Christophe
thanks for your help.
> Instead of trying to compare the hashes of DB files themselves, you
> appear to want a strict comparison of sets in the contents of the DBs.
No, I physically need the end resulting file to hash to the same value.
The file becomes a new identity in itself which is then treated as just
another file
and can be included in someone else's db as a file, verifiable by it's
hash value like any other file.
> For instance, changing the schema of the DBs in different ways will
> make schema_version differ, just as many internal values (none of which
> preclude the actual (user-visible and meaningful) content to be exactly
> the same.
But the same SQLite version, using the same schema, setup with the same
PRAGMA's, creating a db with the same data and in the same order, and
despite hardware / HDD / OS, should still produce the same file byte-for
byte ?
> What would be a more robust way to compare DBs X and Y is to perform a
> (select * from X.T except select * from Y.T) union (select * from Y.T
> except select * from X.T)
> for each and every user table T in the resultset of
> select name from sqlite_master where type like 'table'
>
> (Note that I don't know off-hand what the exact distinction is between
> column name and tbl_name in this master table).
>
> You get rid of row order, order of schema creation, internal encoding,
> history of row life (insert, update, delete) and many details that will
> stop you from comparing row DB files.
>
> That may require some adjustment to work in practice, but the main idea
> is there: comparing sets and SQL is the right tool to do that.
>
> As a sidenote, understand that the query above will silently ignore
> duplicates, but it's my understanding that it shouldn't be a problem in
> your context.
Your SQL comparison technique is pretty cool though, will have to keep
this piece of code.
Thanks again for your thoughts and ideas,
David
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users