wordpress/wp-content/plugins/sqlite-integration/query.class.php
/**
	 * Method to avoid DELETE with JOIN statement.
	 *
	 * wp-admin/includes/upgrade.php contains 'DELETE ... JOIN' statement.
	 * This query can't be replaced with regular expression or udf, so we
	 * replace all the statement with another. But this query was used in
	 * the very old version of WordPress when it was upgraded. So we won't
	 * have no chance that this method should be used.
	 *
	 * @access private
	 */
Method to avoid DELETE with JOIN statement.

@access private
Method to avoid DELETE with JOIN statement . @access private
private function delete_workaround() {
		global $wpdb;
		$pattern   = "DELETE o1 FROM $wpdb->options AS o1 JOIN $wpdb->options AS o2";
		$pattern2  = "DELETE a, b FROM $wpdb->sitemeta AS a, $wpdb->sitemeta AS b";
		$rewritten = "DELETE FROM $wpdb->options WHERE option_id IN (SELECT MIN(option_id) FROM $wpdb->options GROUP BY option_name HAVING COUNT(*) > 1)";
		if (stripos($this->_query, $pattern) !== false) {
			$this->_query = $rewritten;
		} else if (stripos($this->_query, $pattern2) !== false) {
			$time = time();
			$prep_query = "SELECT a.meta_id AS aid, b.meta_id AS bid FROM $wpdb->sitemeta AS a INNER JOIN $wpdb->sitemeta AS b ON a.meta_key='_site_transient_timeout_'||substr(b.meta_key, 17) WHERE b.meta_key='_site_transient_'||substr(a.meta_key, 25) AND a.meta_value < $time";
			$_wpdb = new PDODB();
			$ids   = $_wpdb->get_results($prep_query);
			foreach ($ids as $id) {
				$ids_to_delete[] = $id->aid;
				$ids_to_delete[] = $id->bid;
			}
			$rewritten = "DELETE FROM $wpdb->sitemeta WHERE meta_id IN (".implode(',', $ids_to_delete).")";
			$this->_query = $rewritten;
		}
	}
private function delete_workaround ( ) { global $ wpdb ; $ pattern = " DELETE o1 FROM  $ wpdb -> options  AS o1 JOIN  $ wpdb -> options  AS o2 " ; $ pattern2 = " DELETE a, b FROM  $ wpdb -> sitemeta  AS a,  $ wpdb -> sitemeta  AS b " ; $ rewritten = " DELETE FROM  $ wpdb -> options  WHERE option_id IN (SELECT MIN(option_id) FROM  $ wpdb -> options  GROUP BY option_name HAVING COUNT(*) > 1) " ; if ( stripos ( $ this -> _query , $ pattern ) !== false ) { $ this -> _query = $ rewritten ; } else if ( stripos ( $ this -> _query , $ pattern2 ) !== false ) { $ time = time ( ) ; $ prep_query = " SELECT a.meta_id AS aid, b.meta_id AS bid FROM  $ wpdb -> sitemeta  AS a INNER JOIN  $ wpdb -> sitemeta  AS b ON a.meta_key='_site_transient_timeout_'||substr(b.meta_key, 17) WHERE b.meta_key='_site_transient_'||substr(a.meta_key, 25) AND a.meta_value <  $ time " ; $ _wpdb = new PDODB ( ) ; $ ids = $ _wpdb -> get_results ( $ prep_query ) ; foreach ( $ ids as $ id ) { $ ids_to_delete [ ] = $ id -> aid ; $ ids_to_delete [ ] = $ id -> bid ; } $ rewritten = " DELETE FROM  $ wpdb -> sitemeta  WHERE meta_id IN ( " . implode ( ',' , $ ids_to_delete ) . " ) " ; $ this -> _query = $ rewritten ; } }
Method to avoid DELETE with JOIN statement.
Method to avoid DELETE with JOIN statement .