db_fetch_object() implementations circumvent functionality present in the original functions (mysql_fetch_object(), mysqli_fetch_object() and pg_fetch_object()) which allows a typed objects of a specific class to be populated with the query resultset, rather than stdClass.

This is a major shortcoming for people who want to implement proper OO structure in modules.

Comments

irakli’s picture

Title: db_fetch_object() circumvents the ability to load typed objects present in the original functions. » db_fetch_object() loses the ability to load typed objects present in the original functions.

Title edit: circumvent -> lose. The same applies to the bug description. Sorry for the confusion.

Basically, db_fetch_object unnecessarily loses a functionality that would otherwise be present.

irakli’s picture

StatusFileSize
new2.92 KB

Attached patch should fix the problem in a backwards-compatible way.

irakli’s picture

bump

febbraro’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, db_fetch_object-3612804-2.patch, failed testing.

irakli’s picture

Status: Needs work » Needs review

#2: db_fetch_object-3612804-2.patch queued for re-testing.

irakli’s picture

StatusFileSize
new2.9 KB

Re-rolled patch

Status: Needs review » Needs work

The last submitted patch, db_fetch_object-3612804-7.patch, failed testing.

irakli’s picture

Version: 6.x-dev » 6.19
irakli’s picture

Status: Needs work » Needs review

#7: db_fetch_object-3612804-7.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, db_fetch_object-3612804-7.patch, failed testing.

irakli’s picture

Status: Needs work » Needs review

I don't know why this patch fails. The patch is definitely valid.

I think it keeps trying to apply the patch to D7 (current HEAD), but the patch is only relevant to D6, so I am not sure how to fix that.

Any help is appreciated.

irakli’s picture

Version: 6.19 » 6.20
jducro’s picture

Version: 6.20 » 6.28
StatusFileSize
new2.77 KB

Try a patch with the last version

Status: Needs review » Needs work

The last submitted patch, db_fetch_object-3612804.patch, failed testing.

jducro’s picture

Status: Needs work » Needs review

#14: db_fetch_object-3612804.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, db_fetch_object-3612804.patch, failed testing.

jducro’s picture

Version: 6.28 » 6.x-dev
Category: bug » feature
Priority: Major » Normal
Status: Needs work » Needs review
StatusFileSize
new2.82 KB

Status: Needs review » Needs work

The last submitted patch, db_fetch_object-3612804.patch, failed testing.

jducro’s picture

Status: Needs work » Needs review
StatusFileSize
new2.9 KB

Fix syntax error in patch if no class is passed to mysqli_fetch_object()

Status: Needs review » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.