protected function _prepareQuery( $table, $columns, $criteria ) {
		$where = '1 = 1';
		$params = array();
		
		foreach ( $criteria as $column => $value ) {
			$pattern = '%s';
			if ( is_null( $value ) ) {
				$pattern = '%s AND `%s` IS NULL';
			} elseif ( is_numeric( $value ) ) {
				$pattern = '%s AND `%s` = %%d';
				$params[] = $value;
			} else {
				$pattern = '%s AND `%s` = %%s';
				$params[] = $value;
			}

			$where = sprintf( $pattern, $where, $column );
		}

		if ( is_array( $columns ) ) {
			$columns = implode( ', ', $columns );
		}

		$query = sprintf( 'SELECT %s FROM %s WHERE %s', $columns, $table, $where );
		if ( ! empty( $params ) ) {
			$query = $this->_wpdb->prepare( $query, $params );
		}

		return $query;
	}
protected function _prepareQuery( $table, $columns, $criteria ) {
		$where = '1 = 1';
		$params = array();
		
		foreach ( $criteria as $column => $value ) {
			$pattern = '%s';
			if ( is_null( $value ) ) {
				$pattern = '%s AND `%s` IS NULL';
			} elseif ( is_numeric( $value ) ) {
				$pattern = '%s AND `%s` = %%d';
				$params[] = $value;
			} else {
				$pattern = '%s AND `%s` = %%s';
				$params[] = $value;
			}

			$where = sprintf( $pattern, $where, $column );
		}

		if ( is_array( $columns ) ) {
			$columns = implode( ', ', $columns );
		}

		$query = sprintf( 'SELECT %s FROM %s WHERE %s', $columns, $table, $where );
		if ( ! empty( $params ) ) {
			$query = $this->_wpdb->prepare( $query, $params );
		}

		return $query;
	}
protected function _prepareQuery ( $ table , $ columns , $ criteria ) { $ where = '1 = 1' ; $ params = array ( ) ; foreach ( $ criteria as $ column => $ value ) { $ pattern = '%s' ; if ( is_null ( $ value ) ) { $ pattern = '%s AND `%s` IS NULL' ; } elseif ( is_numeric ( $ value ) ) { $ pattern = '%s AND `%s` = %%d' ; $ params [ ] = $ value ; } else { $ pattern = '%s AND `%s` = %%s' ; $ params [ ] = $ value ; } $ where = sprintf ( $ pattern , $ where , $ column ) ; } if ( is_array ( $ columns ) ) { $ columns = implode ( ', ' , $ columns ) ; } $ query = sprintf ( 'SELECT %s FROM %s WHERE %s' , $ columns , $ table , $ where ) ; if ( ! empty ( $ params ) ) { $ query = $ this -> _wpdb -> prepare ( $ query , $ params ) ; } return $ query ; }
Builds query.

@since 1.0.0

@access protected
@param string $table The table name.
@param array|string $columns The array of columns to select.
@param array $criteria The array of conditions.
@return string The query string.
Builds query .