i just rewrote the queries so as to work with postgres. see the diff below.
taxonomy_image.module is the postgres version,
taxonomy_image.module.bkp is the (original) mysql version with the queries that don't work under postgres.
now the thing is, i directly changed the requests and do not know if these work in mysql. So for those that don't, you might have to add a switch or so.
anyways here's the diff, would be nice if you could add postgres support to the official taxonomy_image.module file:
-------------------------
$ diff taxonomy_image.module taxonomy_image.module.bkp
30c30
< if ($image[$tid] = db_fetch_object(db_query('SELECT i.path, d.name FROM term_image i, term_data d WHERE i.tid = d.tid AND i.tid = %d', $tid))) {
---
> if ($image[$tid] = db_fetch_object(db_query('SELECT i.path, d.name FROM {term_image} i INNER JOIN {term_data} d WHERE i.tid = d.tid AND i.tid = %d', $tid))) {
36c36
< while ($parent = db_fetch_object(db_query('SELECT t.tid FROM term_hierarchy h, term_data t WHERE h.parent = t.tid AND h.tid = %d ORDER BY weight, name', $tid))) {
---
> while ($parent = db_fetch_object(db_query('SELECT t.tid FROM {term_hierarchy} h, {term_data} t WHERE h.parent = t.tid AND h.tid = %d ORDER BY weight, name', $tid))) {
43c43
< else if ($image[$tid] = db_fetch_object(db_query('SELECT i.path, d.name FROM term_image i, term_data d WHERE i.tid = d.tid AND i.tid = %d', $tid))) {
---
> else if ($image[$tid] = db_fetch_object(db_query('SELECT i.path, d.name FROM {term_image} i INNER JOIN {term_data} d WHERE i.tid = d.tid AND i.tid = %d', $tid))) {
340c340
< return db_fetch_object(db_query('SELECT d.name, d.description, d.tid, i.path FROM term_data d LEFT JOIN term_image i ON d.tid = i.tid WHERE d.tid = %d', $tid));
---
> return db_fetch_object(db_query('SELECT d.name, d.description, d.tid, i.path FROM {term_data} d LEFT JOIN {term_image} i ON d.tid = i.tid WHERE d.tid = %d', $tid));
394c394
< if ($old_image = db_fetch_object(db_query('SELECT tid FROM term_image WHERE tid = %d', $edit['tid']))) {
---
> if ($old_image = db_fetch_object(db_query('SELECT tid FROM {term_image} WHERE tid = %d', $edit['tid']))) {
403c403
< db_query('INSERT INTO term_image (' .implode(', ', $fields). ') VALUES (\'' .implode('\', \'', $values). '\')');
---
> db_query('INSERT INTO {term_image} (' .implode(', ', $fields). ') VALUES (\'' .implode('\', \'', $values). '\')');
419,420c419,420
< file_delete(db_result(db_query('SELECT path FROM term_image WHERE tid = %d', $tid)));
< db_query('DELETE FROM term_image WHERE tid = %d', $tid);
---
> file_delete(db_result(db_query('SELECT path FROM {term_image} WHERE tid = %d', $tid)));
> db_query('DELETE FROM {term_image} WHERE tid = %d', $tid);
426c426
< if (db_fetch_object(db_query('SELECT path FROM term_image WHERE tid = %d', $tid))) {
---
> if (db_fetch_object(db_query('SELECT path FROM {term_image} WHERE tid = %d', $tid))) {

Comments

nancydru’s picture

Status: Active » Closed (duplicate)