/*!
\static
Removes all wishlists from the database.
\note Transaction unsafe. If you call several transaction unsafe methods you must enclose
the calls within a db transaction; thus within db->begin and db->commit.
359769
static function cleanup()
    {
        $db = eZDB::instance();
        $db->begin();
        $rows = $db->arrayQuery( "SELECT productcollection_id FROM ezwishlist" );
        if ( count( $rows ) > 0 )
        {
            $productCollectionIDList = array();
            foreach ( $rows as $row )
            {
                $productCollectionIDList[] = $row['productcollection_id'];
            }
            eZProductCollection::cleanupList( $productCollectionIDList );
        }
        $db->query( "DELETE FROM ezwishlist" );
        $db->commit();
    }
20190
public function cleanup()
	{
		$conn = $this->_dbm->acquire( $this->_dbname );

		try
		{
			$date = date( 'Y-m-d H:i:00' );
			$search = new MW_Common_Criteria_SQL( $conn );
			$search->setConditions( $search->compare( '<', $this->_searchConfig['cache.expire']['code'], $date ) );

			$types = $this->_getSearchTypes( $this->_searchConfig );
			$translations = $this->_getSearchTranslations( $this->_searchConfig );
			$conditions = $search->getConditionString( $types, $translations );

			$stmt = $conn->create( str_replace( ':cond', $conditions, $this->_sql['delete'] ) );
			$stmt->bind( 1, $this->_siteid, MW_DB_Statement_Abstract::PARAM_INT );
			$stmt->execute()->finish();

			$this->_dbm->release( $conn, $this->_dbname );
		}
		catch( Exception $e )
		{
			$this->_dbm->release( $conn, $this->_dbname );
			throw $e;
		}
	}
1315845
static function cleanupList( $productCollectionIDList )
    {
        $db = eZDB::instance();
        $db->begin();
        $inText = $db->generateSQLINStatement( $productCollectionIDList, 'productcollection_id', false, false, 'int' );
        $rows = $db->arrayQuery( "SELECT id FROM ezproductcollection_item WHERE $inText" );
        if ( count( $rows ) > 0 )
        {
            $itemIDList = array();
            foreach ( $rows as $row )
            {
                $itemIDList[] = $row['id'];
            }
            eZProductCollectionItemOption::cleanupList( $itemIDList );
        }
        $db->query( "DELETE FROM ezproductcollection_item WHERE $inText" );
        $db->commit();
    }
1154960
public function clear()
    {
        $this->wheres  = array();
        $this->sets    = array();
        $this->havings = array();
        $this->orders  = array();
        $this->binds   = array();
        $this->limit   = null;
        $this->offset  = null;

        return $this;
    }
851165
function begin() {
		$this->dbh or $this->setup();

		if ($this->savepoint == 0) {
			\mysqli_autocommit($this->dbh, false);
			\mysqli_begin_transaction($this->dbh);
		}
		else { // already in a transaction
			\mysqli_query($this->dbh, 'SAVEPOINT save'.$this->savepoint);
		}

		$this->savepoint++;
		return $this;
	}
795267
function removeThis( $remove_childs = false )
    {
        $db = eZDB::instance();
        $db->begin();
        if ( is_array( $remove_childs ) )
        {
            foreach( $remove_childs as $event )
            {
                $event->remove();
            }
        }
        else if ( $remove_childs )
        {
            eZPersistentObject::removeObject( eZWorkflowEvent::definition(),
                                              array( "workflow_id" => $this->ID,
                                                     "version" => $this->Version ) );
        }

        $this->remove();
        $db->commit();
    }
92840
static function cleanupList( $productCollectionIDList )
    {
        $db = eZDB::instance();
        $db->begin();

        // Purge shipping information associated with product collections being removed.
        foreach ( $productCollectionIDList as $productCollectionID )
            eZShippingManager::purgeShippingInfo( $productCollectionID );

        eZProductCollectionItem::cleanupList( $productCollectionIDList );
        $where = $db->generateSQLINStatement( $productCollectionIDList, 'id', false, false, 'int' );
        $db->query( "DELETE FROM ezproductcollection WHERE {$where}" );
        $db->commit();
    }
958093
function clearDatabase() {
        var promises = [];

        _.each(resources, function (resource) {
            var service = pancakes.getService(resource.name);
            if (service.removePermanently) {
                log.info('purging ' + resource.name);
                promises.push(service.removePermanently({ where: {}, multi: true }));
            }
        });

        return Q.all(promises);
    }
1215654
function clear(dbid) {
  return new Promise((resolve, reject) => {
    return instance[dbid].then(db => {
      const req = db.transaction(db.name, 'readwrite')
          .objectStore(db.name).clear();
        req.onsuccess = () => resolve();
        req.onerror = event => reject(event);
    });
  });
}
924368
public static function cleanupDatabase()
    {
        // Grab any extensions sitting in the database
        $rows = Symphony::Database()->fetch("SELECT `name` FROM `tbl_extensions`");

        // Iterate over each row
        if (is_array($rows) && !empty($rows)) {
            foreach ($rows as $r) {
                $name = $r['name'];
                $status = isset($r['status']) ? $r['status'] : null;

                // Grab the install location
                $path = self::__getClassPath($name);
                $existing_id = self::fetchExtensionID($name);

                // If it doesnt exist, remove the DB rows
                if (!@is_dir($path)) {
                    Symphony::Database()->delete("tbl_extensions_delegates", sprintf(" `extension_id` = %d ", $existing_id));
                    Symphony::Database()->delete('tbl_extensions', sprintf(" `id` = %d LIMIT 1", $existing_id));
                } elseif ($status == 'disabled') {
                    Symphony::Database()->delete("tbl_extensions_delegates", sprintf(" `extension_id` = %d ", $existing_id));
                }
            }
        }
    }
992745
function removeThis()
    {
        if ( ($this->objectCount() > 0) or ($this->classCount() > 0) )
        {
            return false;
        }

        $this->remove();

        eZContentCacheManager::clearAllContentCache();

        eZContentLanguage::fetchList( true );

        return true;
    }
1270619
function removeThis()
    {
        $workflowParameters = $this->attribute( 'parameter_list' );
        $cleanupList = array();

        $db = eZDB::instance();
        $db->begin();
        if ( isset( $workflowParameters['cleanup_list'] ) && is_array( $workflowParameters['cleanup_list'] ) )
        {
            $cleanupList = $workflowParameters['cleanup_list'];
            foreach ( $cleanupList as $workflowEventID )
            {
                $workflowEvent = eZWorkflowEvent::fetch( $workflowEventID );
                $workflowType = $workflowEvent->eventType();
                $workflowType->cleanup( $this, eZWorkflowEvent::fetch( $workflowEventID ) );
            }
        }
        eZPersistentObject::removeObject( eZWorkflowProcess::definition(), array( 'id' => $this->attribute( 'id' ) ) );
        $db->commit();
    }
879951
public static function unUsingAll(IDb $db)
    {
        foreach(static::$statements[$db->hashCode()] as &$item)
        {
            $item['using'] = false;
        }
    }
363621
function clean()
    {
        try {

            $sql = "DELETE FROM `KVStore` WHERE 1;";
            $this->pdo->exec($sql);

        } catch (\Exception $e) {
            throw new exWriteError($e->getMessage(), $e->getCode(), $e);
        }
    }
1105823
public function deleteAll()
    {
        $delete = $this->dsql();
        $delete->owner->beginTransaction();
        $this->hook('beforeDeleteAll', array($delete));
        $delete->delete();
        $this->hook('afterDeleteAll');
        $delete->owner->commit();
        $this->reset();

        return $this;
    }
310139
private function removeEntities()
    {
        //Keep track of the relations you have already deleted, so you don't try to delete them twice
        $deletedRelations = array();

        //Begin the database batch
        $this->beginBatch();

        foreach($this->nodeEntitiesToRemove as $node)
        {

            //Get the primary key
            $meta = $this->getMeta($node);
            $id = $meta->getPrimaryKey()->getValue($node);

            if($id)
            {
                //Grab the node from the database
                $entity = $this->client->getNode($id);

                //Delete all the nodes relations
                $relationships = $entity->getRelationships();

                foreach ($relationships as $relationship)
                {
                    //Don't delete it if it's already been deleted in this batch!
                    if(!in_array($relationship->getId(), $deletedRelations))
                    {
                        $deletedRelations[] = $relationship->getId();
                        $relationship->delete();
                    }
                }

                //Delete index information
                $class = $meta->getName();
                $index = $this->getRepository($class)->getIndex();
                $index->remove($entity);

                //Delete the node
                $entity->delete();
            }
        }

        foreach($this->relationEntitiesToRemove as $relation)
        {
            //Get the primary key
            $meta = $this->getMeta($relation);
            $id = $meta->getPrimaryKey()->getValue($relation);

            //If the relation has an id, and hasn't been deleted already in this batch, delete it!
            if($id && !in_array($id, $deletedRelations))
            {
                //Grab everyman relationship
                $entity = $this->client->getRelationship($id);

                //Delete index information
                $class = $meta->getName();
                $index = $this->getRepository($class)->getIndex();
                $index->remove($entity);

                //Delete the entity
                $entity->delete();
            }
        }

        //Commit the database batch
        $this->commitBatch();
    }
1321959
protected function deleteLinked($store_id)
    {
        $this->db->delete('triggers', array('store_id' => $store_id));
        $this->db->delete('wishlist', array('store_id' => $store_id));
        $this->db->delete('collection', array('store_id' => $store_id));
        $this->db->delete('product_sku', array('store_id' => $store_id));
    }