The dpm() function and consorts currently do not return anything. To ease debugging it would be helpful to simply return the original input value, which would allow debugging inside code statements where currently copy-pasting code is required. E.g. the following would become possible:

// Debugging inside if() statements:
if (dpm(function_result_to_check()) || dpm(another_function())) { …

// Debugging return values without having to copy-paste first:
return dpq(db_select(…)->fields(…)->execute());
Files: 
CommentFileSizeAuthor
#2 transparent_dpm.1226482.2.patch2.18 KBsalvis
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch transparent_dpm.1226482.2.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots. View
#1 devel-chainable-1226482.patch2.02 KBsmk-ka
FAILED: [[SimpleTest]]: [MySQL] Invalid patch format in devel-chainable-1226482.patch. View

Comments

smk-ka’s picture

Status: Active » Needs review
FileSize
2.02 KB
FAILED: [[SimpleTest]]: [MySQL] Invalid patch format in devel-chainable-1226482.patch. View

Like this.

salvis’s picture

FileSize
2.18 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch transparent_dpm.1226482.2.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots. View

Great idea, this has bothered me, too.

However, have you tried your example?

+++ b/devel.module
@@ -1576,34 +1578,50 @@ function dpq($query, $return = FALSE, $name = NULL) {
+      return dpm($sql, $name);

This returns the SQL string rather than the $query object.

I'd suggest doing it this way.

salvis’s picture

Title: Make dpm() and friends chainable (sort of) » Make dpm() and friends transparent
Status: Needs review » Fixed

Well, I want to have this!

Committed #2 to D8/D7. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.