On Sat, 8 Jan 2005, John Richard Moser wrote:
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>What can be in an SQL table?
>
>Can tables contain tables? I want to be able to search for a given
>package and find what files are in it, search for a file and find what
>packages supply it. . . what's the best way to do this?
We did a package management tool using SQLite. We used a schema similar to
the following:
create table packages (
package text primary key,
version text
);
create table files (
file text primary key,
package text,
md5 text
);
create table dependencies (
package text,
depends text,
details text -- Optional minimum version
);
This schema is sufficient to implement packages with files and
dependencies. The set of files in all installed packages must be disjoint,
a desirable property.
You can then get the owner of a file using:
SELECT file, package FROM files
WHERE file = '<some file>';
Christian
--
/"\
\ / ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
X - AGAINST MS ATTACHMENTS
/ \