Hello, just tried accessing repository and local package information today and got excited!
Enter the SQLite3 SQL shell:
Find how many packages are currently installed:
Find how many packages are available at the local copy of the remote repository:
Query for the packages schema:
Find all tables:
Fantastic. The power is just there to search/do whatever you want.
Enter the SQLite3 SQL shell:
Code:
[cmd=root@smadev:~#] sqlite3 /var/db/pkg/local.sqlite[/cmd]
SQLite version 3.7.16.1 2013-03-29 13:44:34
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>
Code:
sqlite> [cmd]select count(*) from packages;[/cmd]
756
sqlite>
Code:
[cmd=root@smadev:~#]sqlite3 /var/db/pkg/repo.sqlite[/cmd]
SQLite version 3.7.16.1 2013-03-29 13:44:34
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> [cmd]select count(*) from packages;[/cmd]
23117
sqlite>
Code:
sqlite> [cmd].schema packages[/cmd]
CREATE TABLE packages (id INTEGER PRIMARY KEY,origin TEXT UNIQUE NOT NULL,name TEXT NOT NULL,version TEXT NOT NULL,comment TEXT NOT NULL,desc TEXT NOT NULL,mtree_id INTEGER REFERENCES mtree(id) ON DELETE RESTRICT ON UPDATE CASCADE,message TEXT,arch TEXT NOT NULL,maintainer TEXT NOT NULL, www TEXT,prefix TEXT NOT NULL,flatsize INTEGER NOT NULL,automatic INTEGER NOT NULL,licenselogic INTEGER NOT NULL,infos TEXT, time INTEGER, pkg_format_version INTEGER);
sqlite>
Code:
sqlite> [cmd].tables[/cmd]
categories licenses pkg_directories scripts
deps mtree pkg_groups shlibs
directories options pkg_licenses users
files packages pkg_shlibs
groups pkg_categories pkg_users
sqlite>
Fantastic. The power is just there to search/do whatever you want.
