wordpress/wp-content/plugins/sqlite-integration/query_create.class.php
/**
	 * Callback method for rewrite_unique_key.
	 *
	 * @param array	$matches	an array of matches from the Regex
	 * @access private
	 */
Callback method for rewrite_unique_key.
@param array $matches        an array of matches from the Regex
@access private
Callback method for rewrite_unique_key . @param array $matches an array of matches from the Regex @access private
private function _rewrite_unique_key($matches){
		$index_name = trim($matches[1]);
		$col_name   = trim($matches[2]);
		$tbl_name   = $this->table_name;
		if (preg_match('/\(\\d+?\)/', $col_name)) {
			$col_name = preg_replace('/\(\\d+?\)/', '', $col_name);
		}
		$_wpdb = new PDODB();
		$results = $_wpdb->get_results("SELECT name FROM sqlite_master WHERE type='index'");
		$_wpdb = null;
		if ($results) {
			foreach ($results as $result) {
				if ($result->name == $index_name) {
					$r = rand(0, 50);
					$index_name = $index_name . "_$r";
					break;
				}
			}
		}
		$index_name = str_replace(' ', '', $index_name);
		$this->index_queries[] = "CREATE UNIQUE INDEX $index_name ON " . $tbl_name .$col_name;
		return '';
	}
private function _rewrite_unique_key ( $ matches ) { $ index_name = trim ( $ matches [ 1 ] ) ; $ col_name = trim ( $ matches [ 2 ] ) ; $ tbl_name = $ this -> table_name ; if ( preg_match ( '/\(\\d+?\)/' , $ col_name ) ) { $ col_name = preg_replace ( '/\(\\d+?\)/' , '' , $ col_name ) ; } $ _wpdb = new PDODB ( ) ; $ results = $ _wpdb -> get_results ( " SELECT name FROM sqlite_master WHERE type='index' " ) ; $ _wpdb = null ; if ( $ results ) { foreach ( $ results as $ result ) { if ( $ result -> name == $ index_name ) { $ r = rand ( 0 , 50 ) ; $ index_name = $ index_name . " _ $ r " ; break ; } } } $ index_name = str_replace ( ' ' , '' , $ index_name ) ; $ this -> index_queries [ ] = " CREATE UNIQUE INDEX  $ index_name  ON  " . $ tbl_name . $ col_name ; return '' ; }
Callback method for rewrite_unique_key.
Callback method for rewrite_unique_key .