On Mon, Oct 11, 2010 at 04:43:06PM +0200, Sebastian Detert wrote:
> Why don't you write a small function checking for invalid IDs and
> delete them and referenced subIDs? If you guess it's to hard/slow to
> find out all referenced subIDs you could change your Session array
> to an multi-dimensional array, with all referenced IDs on lower
> levels
> 
> array ( sector_id => array ( company_id => array (location_id) ) );
> 
> like
> 
> array ( 1 => array (17,4 => array(2)) would mean that loction 2
> inside company 4 inside section 1 was selected. This way you only
> need to delete an old entry, and all referenced IDs dissapear
> 
> Sebastian

Hi Sebastian,

My explanation might've been unclear.

The problem isn't deleting a row and its dependencies. The problem is that i
can't delete both the reference from the database search trough all the
sessions for references (using the file mechanism). And even if i could, it
wouldn't be done atomically so it would be useless because a race could happen.

I would like to have a function which either deletes a row, or if it is
referenced by a session, fails.

And if the session would be stored in the database MySQL could take care of
this. However, the $_SESSION abstraction doesn't allow this to be implemented
properly. I think an implementation is possible, it would however be very ugly.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to