CVSROOT: /cvs
Module name: ports
Changes by: [email protected] 2019/01/08 12:42:45
Modified files:
databases/sqlports: Makefile
databases/sqlports/files: Inserter.pm Sql.pm Var.pm mksqlitedb
rebuild_schema
Log message:
move to using Sql for most tables and Views, no functional change.
The main benefit is that it's easier to construct the schema from several
places, with proper indentation.
Also, sql knows a bit about sql, so it's able to
- know which column is a foreign key, just reference the table
- remove table aliases when they're not needed
- leave table names out in table.column when there's no ambiguity.
For instance, view Ports now looks like:
CREATE VIEW Ports AS
SELECT
Id AS PathId,
_Paths.FullPkgPath AS FullPkgPath,
_AutoVersion.Value AS AUTOCONF_VERSION,
T0001.Value AS AUTOMAKE_VERSION,
[...]
FROM _Ports
JOIN _Paths
ON Canonical=_Ports.FullPkgPath
LEFT JOIN _AutoVersion
ON _AutoVersion.KeyRef=AUTOCONF_VERSION
LEFT JOIN _AutoVersion T0001
ON T0001.KeyRef=AUTOMAKE_VERSION
instead of:
CREATE VIEW Ports AS
SELECT
T0057.Id AS PathId,
T0057.FULLPKGPATH AS FULLPKGPATH,
T0058.VALUE AS AUTOCONF_VERSION,
T0059.VALUE AS AUTOMAKE_VERSION,
[...]
FROM _Ports
JOIN _Paths T0057
ON T0057.Canonical=_Ports.FULLPKGPATH
LEFT JOIN _AutoVersion T0058
ON T0058.KEYREF=_Ports.AUTOCONF_VERSION
LEFT JOIN _AutoVersion T0059
ON T0059.KEYREF=_Ports.AUTOMAKE_VERSION