104 lines
4.2 KiB
MySQL
104 lines
4.2 KiB
MySQL
|
/*
|
||
|
* Test the locks set by sys.gu_pmc_get_data( )
|
||
|
*/
|
||
|
BEGIN;
|
||
|
SELECT * FROM sys.gu_pmc_get_data( 0 );
|
||
|
SELECT plan( 7 );
|
||
|
|
||
|
SELECT diag_test_name( 'sys.gu_pmc_get_data() - Locks on planets' );
|
||
|
SELECT set_eq ( $$
|
||
|
SELECT name_id , shared , exclusive
|
||
|
FROM verse.planets pl
|
||
|
INNER JOIN ( SELECT * FROM _get_locks_on( 'verse.planets' ) ) p
|
||
|
ON p.ctid = pl.ctid;
|
||
|
$$ , $$
|
||
|
VALUES ( _get_map_name( 'planet2' ) , TRUE , FALSE ) ,
|
||
|
( _get_map_name( 'planet3' ) , TRUE , FALSE ) ,
|
||
|
( _get_map_name( 'planet4' ) , TRUE , FALSE );
|
||
|
$$
|
||
|
);
|
||
|
|
||
|
SELECT diag_test_name( 'sys.gu_pmc_get_data() - Locks on resource providers' );
|
||
|
SELECT set_eq ( $$
|
||
|
SELECT planet_id , resource_name_id , shared , exclusive
|
||
|
FROM verse.resource_providers rp
|
||
|
INNER JOIN ( SELECT * FROM _get_locks_on( 'verse.resource_providers' ) ) p
|
||
|
ON p.ctid = rp.ctid;
|
||
|
$$ , $$
|
||
|
VALUES ( _get_map_name( 'planet2' ) , _get_string('resource1') , FALSE , TRUE ) ,
|
||
|
( _get_map_name( 'planet2' ) , _get_string('resource2') , FALSE , TRUE ) ,
|
||
|
( _get_map_name( 'planet3' ) , _get_string('resource1') , FALSE , TRUE ) ,
|
||
|
( _get_map_name( 'planet3' ) , _get_string('resource2') , FALSE , TRUE ) ,
|
||
|
( _get_map_name( 'planet4' ) , _get_string('resource1') , FALSE , TRUE ) ,
|
||
|
( _get_map_name( 'planet4' ) , _get_string('resource2') , FALSE , TRUE );
|
||
|
$$
|
||
|
);
|
||
|
|
||
|
SELECT diag_test_name( 'sys.gu_pmc_get_data() - Locks on planet resources' );
|
||
|
SELECT set_eq ( $$
|
||
|
SELECT planet_id , resource_name_id , shared , exclusive
|
||
|
FROM verse.planet_resources pr
|
||
|
INNER JOIN ( SELECT * FROM _get_locks_on( 'verse.planet_resources' ) ) p
|
||
|
ON p.ctid = pr.ctid;
|
||
|
$$ , $$
|
||
|
VALUES ( _get_map_name( 'planet2' ) , _get_string('resource1') , FALSE , TRUE ) ,
|
||
|
( _get_map_name( 'planet2' ) , _get_string('resource2') , FALSE , TRUE ) ,
|
||
|
( _get_map_name( 'planet3' ) , _get_string('resource1') , FALSE , TRUE ) ,
|
||
|
( _get_map_name( 'planet3' ) , _get_string('resource2') , FALSE , TRUE ) ,
|
||
|
( _get_map_name( 'planet4' ) , _get_string('resource1') , FALSE , TRUE ) ,
|
||
|
( _get_map_name( 'planet4' ) , _get_string('resource2') , FALSE , TRUE );
|
||
|
$$
|
||
|
);
|
||
|
|
||
|
SELECT diag_test_name( 'sys.gu_pmc_get_data() - Locks on empire planets' );
|
||
|
SELECT set_eq ( $$
|
||
|
SELECT planet_id , empire_id , shared , exclusive
|
||
|
FROM emp.planets ep
|
||
|
INNER JOIN ( SELECT * FROM _get_locks_on( 'emp.planets' ) ) p
|
||
|
ON p.ctid = ep.ctid;
|
||
|
$$ , $$
|
||
|
VALUES ( _get_map_name( 'planet3' ) , _get_emp_name('empire1' ) , TRUE , FALSE ) ,
|
||
|
( _get_map_name( 'planet4' ) , _get_emp_name('empire2' ) , TRUE , FALSE );
|
||
|
$$
|
||
|
);
|
||
|
|
||
|
SELECT diag_test_name( 'sys.gu_pmc_get_data() - Locks on mining settings' );
|
||
|
SELECT set_eq ( $$
|
||
|
SELECT empire_id , resource_name_id , shared , exclusive
|
||
|
FROM emp.mining_settings ms
|
||
|
INNER JOIN ( SELECT * FROM _get_locks_on( 'emp.mining_settings' ) ) p
|
||
|
ON p.ctid = ms.ctid;
|
||
|
$$ , $$
|
||
|
VALUES ( _get_emp_name('empire1' ) , _get_string( 'resource1' ) , TRUE , FALSE ) ,
|
||
|
( _get_emp_name('empire1' ) , _get_string( 'resource2' ) , TRUE , FALSE ) ,
|
||
|
( _get_emp_name('empire2' ) , _get_string( 'resource1' ) , TRUE , FALSE ) ,
|
||
|
( _get_emp_name('empire2' ) , _get_string( 'resource2' ) , TRUE , FALSE );
|
||
|
$$
|
||
|
);
|
||
|
|
||
|
SELECT diag_test_name( 'sys.gu_pmc_get_data() - Locks on planet mining settings' );
|
||
|
SELECT set_eq ( $$
|
||
|
SELECT empire_id , planet_id , resource_name_id , shared , exclusive
|
||
|
FROM emp.planet_mining_settings ms
|
||
|
INNER JOIN ( SELECT * FROM _get_locks_on( 'emp.planet_mining_settings' ) ) p
|
||
|
ON p.ctid = ms.ctid;
|
||
|
$$ , $$
|
||
|
VALUES ( _get_emp_name('empire2' ) , _get_map_name( 'planet4' ) , _get_string( 'resource1' ) , TRUE , FALSE ) ,
|
||
|
( _get_emp_name('empire2' ) , _get_map_name( 'planet4' ) , _get_string( 'resource2' ) , TRUE , FALSE );
|
||
|
$$
|
||
|
);
|
||
|
|
||
|
SELECT diag_test_name( 'sys.gu_pmc_get_data() - Locks on planet happiness records' );
|
||
|
SELECT set_eq ( $$
|
||
|
SELECT planet_id , shared , exclusive
|
||
|
FROM verse.planet_happiness pl
|
||
|
INNER JOIN ( SELECT * FROM _get_locks_on( 'verse.planet_happiness' ) ) p
|
||
|
ON p.ctid = pl.ctid;
|
||
|
$$ , $$
|
||
|
VALUES ( _get_map_name( 'planet3' ) , TRUE , FALSE ) ,
|
||
|
( _get_map_name( 'planet4' ) , TRUE , FALSE );
|
||
|
$$
|
||
|
);
|
||
|
|
||
|
SELECT * FROM finish( );
|
||
|
ROLLBACK;
|