Hello, I once needed a duplicate search on my database so I added this script to automate the process. I figured maybe it could be added. I used the link below a field name when browsing.
//// Duplicate search URL
if ($analyzed_sql[0]['group_by_clause'] && $analyzed_sql[0]['having_clause']) {
$dup_url = "";
} else {
$dup_field = PMA_backquote($fields_meta[$i]->name);
$dup_table = PMA_backquote($table);
$dup_query = "SELECT ". $dup_field .", COUNT(*) AS n FROM ". $dup_table ." GROUP BY ". $dup_field ." HAVING n > 1";
$dup_url = 'sql.php?' . PMA_generate_common_url($db, $table) .'&sql_query='. urlencode($dup_query);
}
........
if ($dup_url != "") {
$dup_link = PMA_linkOrButton($dup_url, "<font size='1'>(Find duplicates)</font>", "", false, false);
}
........
if ($_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {
echo ' valign="bottom"';
}
echo '>' . $order_link . $dup_link. $comments . </th>';
/// End
Logged In: YES
user_id=1547980
Originator: YES
CORRECTION:
$dup_link = PMA_linkOrButton($dup_url, "<br><font size='1'>(Find
duplicates)</font>", "", false, false);
Logged In: YES
user_id=210714
Originator: NO
Nice idea but I would not clutter the normal Browse page with this. Better to put it on the table Search page (maybe in another dialog under the main one). Please have a look at current trunk for 3.0-dev and suggest something (or attach a patch :) ).
Logged In: YES
user_id=210714
Originator: NO
Any feedback about my proposal?
Logged In: YES
user_id=1547980
Originator: YES
Yes, I've been away for a while. I will do this by today or tommorow.
Logged In: YES
user_id=1547980
Originator: YES
Ok, so I will make the duplicate search table below the "Select fields (at least one):" table. Would that be ok?
Logged In: YES
user_id=210714
Originator: NO
Yes. I was wondering what's the best: show all fields with radio boxes or in a drop-down (with the possibility of selecting just one field).
Another possibility: the "Select fields" dialog could be replaced by checkboxes in the Query by example dialog and this would take care of the field selection part. Then the new dialog for duplicates would be at the bottom.
Logged In: YES
user_id=1312539
Originator: NO
This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).