Technology dependencies caching and integrity checks

* Added table that will contain the cached technology dependencies.

* Implemented trigger functions that update the cache and make sure
there are no cycles or redundancies in the technology graph.

* The following SQL files need to be (re-)executed:
  -> 030-data/080-techs.sql (for the defs.techdep_cache table)
  -> 040-functions/026-technology-dependencies.sql (new file)
This commit is contained in:
Emmanuel BENOîT 2012-02-16 18:30:58 +01:00
parent b90491ca73
commit 4f083830f2
11 changed files with 749 additions and 0 deletions
legacyworlds-server-data/db-structure/tests/user/040-functions/026-technology-dependencies

View file

@ -0,0 +1,14 @@
/*
* Test privileges on defs.tdcache_copy_tree( )
*/
BEGIN;
SELECT plan( 1 );
SELECT diag_test_name( 'defs.tdcache_copy_tree( ) - No EXECUTE privilege' );
SELECT throws_ok( $$
SELECT defs.tdcache_copy_tree( FALSE , 1 , 2 , 3 , 4 , 5 );
$$ , 42501 );
SELECT * FROM finish( );
ROLLBACK;

View file

@ -0,0 +1,14 @@
/*
* Test privileges on defs.tdcache_set_child( )
*/
BEGIN;
SELECT plan( 1 );
SELECT diag_test_name( 'defs.tdcache_set_child( ) - No EXECUTE privilege' );
SELECT throws_ok( $$
SELECT defs.tdcache_set_child( FALSE , 1 , 2 , 3 );
$$ , 42501 );
SELECT * FROM finish( );
ROLLBACK;

View file

@ -0,0 +1,14 @@
/*
* Test privileges on defs.tgf_technologies_ai( )
*/
BEGIN;
SELECT plan( 1 );
SELECT diag_test_name( 'defs.tgf_technologies_ai( ) - No EXECUTE privilege' );
SELECT throws_ok( $$
SELECT defs.tgf_technologies_ai( );
$$ , 42501 );
SELECT * FROM finish( );
ROLLBACK;

View file

@ -0,0 +1,14 @@
/*
* Test privileges on defs.tgf_techdeps_bi( )
*/
BEGIN;
SELECT plan( 1 );
SELECT diag_test_name( 'defs.tgf_techdeps_bi( ) - No EXECUTE privilege' );
SELECT throws_ok( $$
SELECT defs.tgf_techdeps_bi( );
$$ , 42501 );
SELECT * FROM finish( );
ROLLBACK;

View file

@ -0,0 +1,14 @@
/*
* Test privileges on defs.tgf_techdeps_ai( )
*/
BEGIN;
SELECT plan( 1 );
SELECT diag_test_name( 'defs.tgf_techdeps_ai( ) - No EXECUTE privilege' );
SELECT throws_ok( $$
SELECT defs.tgf_techdeps_ai( );
$$ , 42501 );
SELECT * FROM finish( );
ROLLBACK;