Deletes all views in the database with given postfix.
@param String $postfix The postfix for this type of view, f.i. '_joint'
340905
public static function deleteAllByPostfix($postfix) {
        $adapter    = Zend_Db_Table::getDefaultAdapter();
        $config     = Zend_Registry::get('config');
        $dbName     = $config->resources->db->params->dbname;

        $queryTpl   = "SELECT table_name FROM information_schema.views WHERE table_schema = '%s' and table_name like '%%%s';";
        $statement  = sprintf($queryTpl, $dbName, $postfix);

        $views = $adapter->fetchAll($statement);
        foreach ($views as $view) {
            $viewName = $view['table_name'];
            $dropStatement = "DROP VIEW IF EXISTS `{$viewName}`;";
            $adapter->query($dropStatement);
        }
    }
646070
public function postfix(string $value, string $postfix): string
    {
        if (substr($value, strlen($value) - strlen($postfix)) === $postfix) {
            return $value;
        }

        return $value . $postfix;
    }
781499
public void deletePost(final long postId) throws SQLException {
      clearPostMeta(postId);
      Connection conn = null;
      PreparedStatement stmt = null;
      Timer.Context ctx = metrics.deletePostTimer.time();
      try {
         conn = connectionSupplier.getConnection();
         stmt = conn.prepareStatement(deletePostIdSQL);
         stmt.setLong(1, postId);
         stmt.executeUpdate();
      } finally {
         ctx.stop();
         SQLUtil.closeQuietly(conn, stmt);
      }
   }
652449
public function deleteRecord($index)
    {
        if (isset($this->records[$index])) {
            $this->fileLength -= ($this->records[$index]->getContentLength() + 4);
            $count = count($this->records) - 1;
            for ($i = $index; $i < $count; ++$i) {
                $this->records[$i] = $this->records[$i + 1];
            }
            unset($this->records[count($this->records) - 1]);
            $this->_deleteRecordFromDBF($index);
        }
    }
116323
protected function deletePostMeta()
    {
        $WpDb = $this->s::wpDb();

        $sql = /* Delete post meta. */ '
                DELETE
                    FROM `'.esc_sql($WpDb->postmeta).'`
                WHERE
                    `meta_key` LIKE %s
                    OR `meta_key` LIKE %s
            ';
        $like1 = $WpDb->esc_like($this->App->Config->©brand['©var'].'_').'%';
        $like2 = '%'.$WpDb->esc_like('_'.$this->App->Config->©brand['©var'].'_').'%';

        $WpDb->query($WpDb->prepare($sql, $like1, $like2));
    }
260639
public function removeFromIndex($index)
    {
        $index = intval($index);
        if ($this->length() > $index) {
            for ($i = $index + 1; $i < $this->length(); ++$i) {
                if ($this->offsetExists($i)) {
                    $this->offsetUnset($i);
                }
            }
        }
    }
1000189
public function erase(string $pos): void
    {
        $keys = array_keys($this->map);

        unset($this->map[$keys[$pos]]);
    }
1320976
public function remove($index)
    {
        $this->lines = \array_diff_key($this->lines, array($index => ''));

        $this->write();
    }
1025206
public function actionDeleteAll()
    {
        if (isset($_POST['items'])) {
            foreach ($_POST['items'] as $id) {
                $this->findModel($id)->delete();
            }
        }
    }
620973
public function delete($table, $where = null)
    {
        if (isset($where)) {
            $where = " WHERE " . $where;
        }

        $this->sql = "DELETE FROM "
            . $this->prefix
            . $table
            . $where
            . ";\n";
    }
298775
public function purgeTreeMenuTransientForAncestors($postId)
    {
        // Get page ancestors
        $ancestors = get_post_ancestors($postId);
        $ancestors[] = $postId;

        // Remove front page from ancestors array
        $ancestors = array_reverse($ancestors);

        if ($ancestors[0] == get_option('page_on_front')) {
            unset($ancestors[0]);
        }

        $ancestors = array_values($ancestors);

        // Delete transient for page ancestors
        foreach ($ancestors as $postId) {
            $children = get_children(array(
                'post_parent' => $postId,
                'numberofposts' => -1,
                'post_type' => 'page',
            ));

            foreach ($children as $child) {
                delete_transient('main_menu_' . $child->ID);
                delete_transient('mobile_menu_' . $child->ID);
                delete_transient('sidebar_menu_' . $child->ID);

                delete_transient('main_menu_' . $child->ID . '_loggedin');
                delete_transient('mobile_menu_' . $child->ID . '_loggedin');
                delete_transient('sidebar_menu_' . $child->ID . '_loggedin');
            }
        }
    }
929219
public function delete(Post $post)
    {
        $this->authorize(PostsPolicy::PERMISSION_DELETE);

        try {
            $post->trashed() ? $post->forceDelete() : $post->delete();

            return $this->jsonResponseSuccess([
                'message' => $this->transNotification('deleted', ['title' => $post->title], $post->toArray())
            ]);
        }
        catch(\Exception $e) {
            return $this->jsonResponseError(['message' => $e->getMessage()], 500);
        }
    }
1134050
public void clearPostTerms(final long postId, final String taxonomy) throws SQLException {
      List<TaxonomyTerm> terms = selectPostTerms(postId, taxonomy);
      for(TaxonomyTerm term : terms) {
         clearPostTerm(postId, term.id);
      }
   }
283644
public function delete($lang, $postType, $id)
    {
        $deleteResult = $this->deletePost($id, $postType);
        if(gettype($deleteResult) == "boolean") {
            if($deleteResult) {
                return $this->response('Post is deleted successfully');
            }
            return $this->response('Post could not be deleted. Please try again later or contact administrator', 500);
        }
        return $deleteResult;
    }
191861
public function removeCellStyleXfByIndex($pIndex = 0)
    {
        if ($pIndex > count($this->_cellStyleXfCollection) - 1) {
            throw new PHPExcel_Exception("CellStyleXf index is out of bounds.");
        } else {
            array_splice($this->_cellStyleXfCollection, $pIndex, 1);
        }
    }
1002352
private function delete_all( $network ) {
		global $wpdb;

		// To ensure proper count values we first delete all transients with a timeout
		// and then the remaining transients without a timeout.
		$count = 0;

		if ( ! $network ) {
			$deleted = $wpdb->query(
				$wpdb->prepare(
					"DELETE a, b FROM {$wpdb->options} a, {$wpdb->options} b
						WHERE a.option_name LIKE %s
						AND a.option_name NOT LIKE %s
						AND b.option_name = CONCAT( '_transient_timeout_', SUBSTRING( a.option_name, 12 ) )",
					Utils\esc_like( '_transient_' ) . '%',
					Utils\esc_like( '_transient_timeout_' ) . '%'
				)
			);

			$count += $deleted / 2; // Ignore affected rows for timeouts.

			$count += $wpdb->query(
				$wpdb->prepare(
					"DELETE FROM $wpdb->options WHERE option_name LIKE %s",
					Utils\esc_like( '_transient_' ) . '%'
				)
			);
		} else {
			if ( ! is_multisite() ) {
				// Non-Multisite stores site transients in the options table.
				$deleted = $wpdb->query(
					$wpdb->prepare(
						"DELETE a, b FROM {$wpdb->options} a, {$wpdb->options} b
							WHERE a.option_name LIKE %s
							AND a.option_name NOT LIKE %s
							AND b.option_name = CONCAT( '_site_transient_timeout_', SUBSTRING( a.option_name, 17 ) )",
						Utils\esc_like( '_site_transient_' ) . '%',
						Utils\esc_like( '_site_transient_timeout_' ) . '%'
					)
				);

				$count += $deleted / 2; // Ignore affected rows for timeouts.

				$count += $wpdb->query(
					$wpdb->prepare(
						"DELETE FROM $wpdb->options WHERE option_name LIKE %s",
						Utils\esc_like( '_site_transient_' ) . '%'
					)
				);
			} else {
				// Multisite stores site transients in the sitemeta table.
				$deleted = $wpdb->query(
					$wpdb->prepare(
						"DELETE a, b FROM {$wpdb->sitemeta} a, {$wpdb->sitemeta} b
							WHERE a.meta_key LIKE %s
							AND a.meta_key NOT LIKE %s
							AND b.meta_key = CONCAT( '_site_transient_timeout_', SUBSTRING( a.meta_key, 17 ) )",
						Utils\esc_like( '_site_transient_' ) . '%',
						Utils\esc_like( '_site_transient_timeout_' ) . '%'
					)
				);

				$count += $deleted / 2; // Ignore affected rows for timeouts.

				$count += $wpdb->query(
					$wpdb->prepare(
						"DELETE FROM $wpdb->sitemeta WHERE meta_key LIKE %s",
						Utils\esc_like( '_site_transient_' ) . '%'
					)
				);
			}
		}

		if ( $count > 0 ) {
			WP_CLI::success(
				sprintf(
					'%d %s deleted from the database.',
					$count,
					Utils\pluralize( 'transient', $count )
				)
			);
		} else {
			WP_CLI::success( 'No transients found.' );
		}

		if ( wp_using_ext_object_cache() ) {
			WP_CLI::warning( 'Transients are stored in an external object cache, and this command only deletes those stored in the database. You must flush the cache to delete all transients.' );
		}
	}
1283777
public function clear($prefix = null) {
        $prefix = !is_null($prefix) ? $prefix : $this->prefix;
        if ($prefix) {
            unset($_SESSION[$prefix]);
        }
        else {
            $_SESSION = [];
        }
    }