Can't delete rows when database uses prwfixes
vito_swat - October 27, 2007 - 13:44
| Project: | Database Administration |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
The code follows:
<?php
function dba_delete_row_submit($form_id, $form_values) {
if (user_access('dba administer database')) {
$key = $form_values['key'];
$keyid = $form_values['keyid'];
$table = $form_values['table'];
$query = "DELETE FROM $table WHERE $key = '$keyid'";
drupal_set_message(check_plain($query));
$query = "DELETE FROM {%s} WHERE %s = '%s'";
db_query($query, $table, $key, $keyid);
}
return "admin/build/database/table/$table/view";
}
</code>
?>And it should be:
<?php
function dba_delete_row_submit($form_id, $form_values) {
if (user_access('dba administer database')) {
$key = $form_values['key'];
$keyid = $form_values['keyid'];
$table = $form_values['table'];
$query = "DELETE FROM $table WHERE $key = '$keyid'";
drupal_set_message(check_plain($query));
$query = "DELETE FROM %s WHERE %s = '%s'";
db_query($query, $table, $key, $keyid);
}
return "admin/build/database/table/$table/view";
}
?>Curly brackets makes Drupal add additional prefix when it is allready in $table variable.
Sorry for not providing the real path but I'm away my developer computer with a proper tools.

#1
Tested and confirmed. Committed the change to HEAD and DRUPAL-4-7. Thanks.
#2
Automatically closed -- issue fixed for two weeks with no activity.