NOTE: the CREATE TABLE clause in the audio_playlist.install isn't quite right, but if I enter that configuration manually into the database, and make the following mods for SELECT DISTINCT, ORDER BY, all appears to work ok for now...
Preliminary patch follows:
diff -rubBp playlist/audio_playlist/audio_playlist.module /var/www/html/modules/playlist/audio_playlist/audio_playlist.module
--- playlist/audio_playlist/audio_playlist.module 2006-07-19 05:03:49.000000000 -0400
+++ /var/www/html/modules/playlist/audio_playlist/audio_playlist.module 2006-08-28 21:23:20.000000000 -0400
@@ -937,19 +937,19 @@ function audio_playlist_browse($playlist
$keys = check_plain($keys);
//because playtime is stored in the audio table and not as a tagged value, we have to add extra logic.
if ($keys && $order_by[$tag] == 'playtime') {
- $result = pager_query("SELECT DISTINCT a.value, n.nid FROM {node} n INNER JOIN {audio_metadata} a ON n.vid = a.vid INNER JOIN {audio} af ON n.vid = af.vid WHERE n.status = 1 AND LOWER(a.value) LIKE LOWER('%%%s%%') ORDER BY af.playtime %s", $pager_length, 0, null, $keys, $sort);
+ $result = pager_query("SELECT DISTINCT a.value, n.nid, af.playtime FROM {node} n INNER JOIN {audio_metadata} a ON n.vid = a.vid INNER JOIN {audio} af ON n.vid = af.vid WHERE n.status = 1 AND LOWER(a.value) LIKE LOWER('%%%s%%') ORDER BY af.playtime %s", $pager_length, 0, null, $keys, $sort);
}
else if ($keys) {
- $result = pager_query("SELECT DISTINCT a.value, n.nid FROM {node} n INNER JOIN {audio_metadata} a ON n.vid = a.vid INNER JOIN {audio} af ON n.vid = af.vid WHERE n.status = 1 AND LOWER(a.value) LIKE LOWER('%%%s%%') ORDER BY a.clean %s", $pager_length, 0, null, $keys, $sort);
+ $result = pager_query("SELECT DISTINCT a.value, n.nid, a.clean FROM {node} n INNER JOIN {audio_metadata} a ON n.vid = a.vid INNER JOIN {audio} af ON n.vid = af.vid WHERE n.status = 1 AND LOWER(a.value) LIKE LOWER('%%%s%%') ORDER BY a.clean %s", $pager_length, 0, null, $keys, $sort);
}
else if ($order_by[$tag] == 'playtime') {
$result = pager_query("SELECT DISTINCT af.playtime, n.nid, a.vid FROM {node} n INNER JOIN {audio_metadata} a ON n.vid = a.vid INNER JOIN {audio} af ON n.vid = af.vid WHERE n.status = 1 ORDER BY af.playtime %s", $pager_length, 0, NULL, $sort);
}
else if ($tag && $sort) {
- $result = pager_query("SELECT DISTINCT a.value, n.nid FROM {node} n INNER JOIN {audio_metadata} a ON n.vid = a.vid INNER JOIN {audio} af ON n.vid = af.vid WHERE a.tag = '%s' AND n.status = 1 ORDER BY a.clean %s", $pager_length, 0, NULL, $order_by[$tag], $sort);
+ $result = pager_query("SELECT DISTINCT a.value, n.nid, a.clean FROM {node} n INNER JOIN {audio_metadata} a ON n.vid = a.vid INNER JOIN {audio} af ON n.vid = af.vid WHERE a.tag = '%s' AND n.status = 1 ORDER BY a.clean %s", $pager_length, 0, NULL, $order_by[$tag], $sort);
}
else {
- $result = pager_query("SELECT DISTINCT n.nid, a.vid FROM {node} n INNER JOIN {audio_metadata} a ON n.vid = a.vid INNER JOIN {audio} af ON n.vid = af.vid WHERE n.status = 1 ORDER BY n.created DESC", $pager_length, 0, NULL);
+ $result = pager_query("SELECT DISTINCT n.nid, a.vid, n.created FROM {node} n INNER JOIN {audio_metadata} a ON n.vid = a.vid INNER JOIN {audio} af ON n.vid = af.vid WHERE n.status = 1 ORDER BY n.created DESC", $pager_length, 0, NULL);
}
while ($row = db_fetch_object($result)) {
Only in /var/www/html/modules/playlist/audio_playlist: audio_playlist.module~
diff -rubBp playlist/playlist.install /var/www/html/modules/playlist/playlist.install
--- playlist/playlist.install 2006-08-04 21:02:41.000000000 -0400
+++ /var/www/html/modules/playlist/playlist.install 2006-08-28 20:54:33.000000000 -0400
@@ -21,6 +21,18 @@ function playlist_install() {
MYSQL_UPDATE
);
break;
+ case 'pgsql':
+ db_query("
+ CREATE TABLE {playlist_relate} (
+ rid serial,
+ type varchar(255) NOT NULL default '',
+ parent_id integer NOT NULL default 0,
+ child_id integer NOT NULL default 0,
+ weight integer default 0,
+ PRIMARY KEY (rid)
+ );;
+ ");
+ break;
}
}
Comments
Comment #1
zirafa commentedThanks for stepping up for this. Anyway you could post this as a regular file attachment? Just to eliminate the possibility that the input filter botched line breaks, etc.
Comment #2
ricdude commentedPatch file attached. Again, it's not entirely working yet, but it's close enough to be one "CREATE TABLE" statement away from operability...
Comment #3
zirafa commentedCool. I will add this anyway. But if there are any pgsql experts that could help, much appreciated.