HOWTO SQL? Can't execute ... locked tables....

Author Message

Björn Dieding@xrow.de

Friday 30 June 2006 5:40:08 am

Query error: Can't execute the given command because you have active locked tables or an active transaction. Query: TRUNCATE ezcollab_group

The following code produces the error in my system.

        $db =& eZDB::instance();
        $db->begin();
	    $db->query( "UNLOCK TABLES" );
        $db->query( "TRUNCATE ezapprove_items" );
        $db->query( "TRUNCATE ezcollab_group" );
        $db->query( "TRUNCATE ezcollab_item" );
        $db->query( "TRUNCATE ezcollab_item_group_link" );
        $db->query( "TRUNCATE ezcollab_item_message_link" );
        $db->query( "TRUNCATE ezcollab_item_participant_link" );
        $db->query( "TRUNCATE ezcollab_item_status" );
        $db->query( "TRUNCATE ezcollab_profile" );
        $db->query( "TRUNCATE ezcollab_simple_message" );
        $db->query( "TRUNCATE ezworkflow_process" );
        
        $list = eZContentObjectVersion::fetchObjectList( eZContentObjectVersion::definition(), null,  array( 'status' => EZ_VERSION_STATUS_PENDING ) );

        if ( count( $list ) > 0 )
        {
            foreach( $list as $item )
            {
                $assignments = $item->nodeAssignments();
                foreach ( $assignments as $assignment )
                {
                    $assignment->remove();
                }
                $item->remove();
            }
        }

        $db->commit();

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.