Empire resources in XML dumps

* Added dump view for empire resources

* Added empire resource information storage class and associated row
mapper

* Integrated empire resource information into the summary generator
This commit is contained in:
Emmanuel BENOîT 2012-01-19 09:35:12 +01:00
parent ce6d86d344
commit 9b346a80c2
9 changed files with 542 additions and 15 deletions
legacyworlds-server-data/db-structure/parts/040-functions

View file

@ -1205,6 +1205,30 @@ CREATE VIEW bugs.dump_research_view
GRANT SELECT ON bugs.dump_research_view TO :dbuser;
/*
* Empire resources view
* ----------------------
*
* This view contains the details about empires' resources as they are needed
* by the XML dump generator.
*
* Columns:
* empire_id Identifier of the empire
* resource_name Text-based identifier of the resource type
* empres_possessed Amount of resources possessed by the empire
* empres_owed Amount of resources owed by the empire
*/
DROP VIEW IF EXISTS bugs.dump_emp_resources_view CASCADE;
CREATE VIEW bugs.dump_emp_resources_view
AS SELECT empire_id , name AS resource_name , empres_possessed , empres_owed
FROM emp.resources
INNER JOIN defs.strings ON id = resource_name_id;
GRANT SELECT
ON bugs.dump_emp_resources_view
TO :dbuser;
CREATE VIEW bugs.dump_planets_view
AS SELECT ep.empire_id , ep.planet_id , p.population ,
( ph.current / p.population )::REAL AS current_happiness , ph.target AS target_happiness ,
@ -1248,6 +1272,7 @@ GRANT SELECT ON bugs.dump_planets_view TO :dbuser;
* if there is no resource provider of that
* type on the planet
*/
DROP VIEW IF EXISTS bugs.dump_planet_resources_view CASCADE;
CREATE VIEW bugs.dump_planet_resources_view
AS SELECT empire_id , planet_id ,
name AS resource_name ,