Make WordPress Core

Opened 15 years ago

Closed 11 years ago

#10819 closed enhancement (maybelater)

Suggestion: Addition to dbDelta - returns FALSE on mySQL error

Reported by: tinwatchman's profile tinwatchman Owned by: ryan's profile ryan
Milestone: Priority: normal
Severity: normal Version: 2.8.4
Component: Database Keywords:
Focuses: Cc:

Description

I don't have any idea how to submit or recommend a change to the WordPress core, but I'm going to give this a shot anyway... having just spent a lot of time struggling with the dbDelta function while programming a plugin, I had a possible suggestion to make. It strikes me that said function would be a lot easier to use if something similar to the following code was added, starting on line 1363 of wp-admin/includes/upgrade.php:

if($execute) {

$query_error_num = 0;
foreach($allqueries as $query) {

echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">".print_r($query, true)."</pre>\n";
$qresult = $wpdb->query($query);
if ($qresult === false) {

$query_error_num++;
$qerror = 'error' . $query_error_num;
$for_update[$qerror] = "Query error - The following query failed: " . $query;

}

}

}

return $for_update;

There's probably a more optimized way to go about it - programming isn't my strong suit by any stretch of the means - but at least this way errors caused when *creating* tables with the function will return some kind of error message, even if it's PHP only.

Opinions?

Change History (2)

#1 @tinwatchman
15 years ago

  • Component changed from Upgrade/Install to Database
  • Keywords changed from has-patch, needs-testing, 2nd-opinion, dev-feedback to has-patch needs-testing 2nd-opinion dev-feedback
  • Milestone changed from Unassigned to Future Release
  • Owner set to ryan

#2 @wonderboymusic
11 years ago

  • Keywords has-patch needs-testing 2nd-opinion dev-feedback removed
  • Milestone Future Release deleted
  • Resolution set to maybelater
  • Status changed from new to closed

This ticket is a mess / 4 years old

Note: See TracTickets for help on using tickets.