$w = $data = array(); $sql_query = 'SELECT *'; //Add the table $sql_query .= ' FROM ' . PMA_backquote($table); for ($i = 0; $i < 4; $i++) { if ($inputs[$i] == 'pma_null') { continue; } $tmp = array(); // The where clause $charsets = array(); $cnt_func = count($zoomFunc[$i]); $func_type = $zoomFunc[$i]; list($charsets[$i]) = explode('_', $collations[$i]); $unaryFlag = isset($GLOBALS['cfg']['UnaryOperators'][$func_type]) && $GLOBALS['cfg']['UnaryOperators'][$func_type] == 1 ? true : false; $whereClause = PMA_tbl_search_getWhereClause($fields[$i], $inputs[$i], $types[$i], $collations[$i], $func_type, $unaryFlag); if ($whereClause) { $w[] = $whereClause; } } // end for if ($w) { $sql_query .= ' WHERE ' . implode(' AND ', $w); } $sql_query .= ' LIMIT ' . $maxPlotLimit; /* * Query execution part */ $result = PMA_DBI_query($sql_query . ";", null, PMA_DBI_QUERY_STORE); $fields_meta = PMA_DBI_get_fields_meta($result); while ($row = PMA_DBI_fetch_assoc($result)) {
$sql_query .= ' FROM ' . PMA_backquote($table); // The where clause if (trim($where) != '') { $sql_query .= ' WHERE ' . $where; } else { $w = $charsets = array(); $cnt_func = count($func); reset($func); while (list($i, $func_type) = each($func)) { list($charsets[$i]) = explode('_', $collations[$i]); $unaryFlag = (isset($GLOBALS['cfg']['UnaryOperators'][$func_type]) && $GLOBALS['cfg']['UnaryOperators'][$func_type] == 1) ? true : false; $tmp_geom_func = isset($geom_func[$i]) ? $geom_func[$i] : null; $whereClause = PMA_tbl_search_getWhereClause($fields[$i], $names[$i], $types[$i], $collations[$i], $func_type, $unaryFlag, $tmp_geom_func); if($whereClause) $w[] = $whereClause; } // end for if ($w) { $sql_query .= ' WHERE ' . implode(' AND ', $w); } } // end if if ($orderField != '--nil--') { $sql_query .= ' ORDER BY ' . PMA_backquote($orderField) . ' ' . $order; } // end if include 'sql.php'; }