Next: , Previous: , Up: Epkg User Manual   [Contents][Index]

7 Querying the Database

If you are more interested in information about all or a subset of mirrored packages, as opposed to individual packages, then you should query the database directly instead of using the functions epkg and epkgs.

This is usually much more efficient, but requires that you know a bit about SQL, specifically SQLite 4, and that you make yourself familiar with the syntax used by EmacSQL 5 to express SQL statements.

The statistics about the Emacsmirror and related package archives 6 for the most part use epkg-sql, you might find the tools 7 used to create those statistics useful when getting started with that function.

Function: epkg-db

This function returns the connection to the Epkg database.

If the epkg-repository, which contains the SQLite database file, does not exist yet, then this function first asks the user whether they want to clone the repository.

Function: epkg-sql sql &rest args

This function sends the SQL S-expression to the Epkg database and returns the result. This is a wrapper around emacsql that lacks the CONNECTION argument. Instead it uses the connection returned by epkg-db.