Patches for PostgreSQL dispatch

"Bruce M. Walker" <[email protected]> Mon, 19 May 2003 15:32:55 -0400 (EDT)
Newsgroups gmane.comp.apache.mod-mp3
Message-ID <[email protected]>
This message is in MIME format.

---MOQ10533727751d22ce1d4528474e4e4ecca0db13a8de
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Finally got around to trying out the PostgreSQL dispatch this weekend. I have
plans to improve access to my MP3s so I'm checking out the various Ampache's,
Netjukes, etc.

But the first hurdle was that the PostgreSQL code in mod_mp3 0.39 seems to have
suffered from some cut'n'paste errors from the MySQL code.  I fixed that up and
it works fine now for me under FreeBSD 4.6, with PostgreSQL 7.3.2_1.

Patch is attached.

Enjoy!

-bmw
---MOQ10533727751d22ce1d4528474e4e4ecca0db13a8de
Content-Type: text/plain; name="patch.txt"; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="patch.txt"

--- ./src/mod_mp3.c.orig	Sun May 19 20:45:56 2002
+++ ./src/mod_mp3.c	Sat May 17 13:29:41 2003
@@ -951,9 +951,9 @@
 	{"MP3MySQLTokenTable", mysql_add_token_table, NULL, OR_ALL, TAKE1, MP3MySQLTokenTable},
 #endif
 #ifdef PGSQL_ENABLED
-	{"MP3PgConnectInfo", pgsql_add_connect_info, NULL, OR_ALL, TAKE3, MP3MySQLConnectInfo},
-	{"MP3PgInfo", pgsql_add_database_info, NULL, OR_ALL, TAKE2, MP3MySQLInfo},
-	{"MP3PgTokenTable", pgsql_add_token_table, NULL, OR_ALL, TAKE1, MP3MySQLTokenTable},
+	{"MP3PgConnectInfo", pgsql_add_connect_info, NULL, OR_ALL, TAKE3, MP3PgConnectInfo},
+	{"MP3PgInfo", pgsql_add_database_info, NULL, OR_ALL, TAKE2, MP3PgInfo},
+	{"MP3PgTokenTable", pgsql_add_token_table, NULL, OR_ALL, TAKE1, MP3PgTokenTable},
 #endif
 	{NULL}
 };
--- ./src/directives.h.orig	Sat May 17 13:25:52 2003
+++ ./src/directives.h	Sat May 17 13:26:59 2003
@@ -23,7 +23,7 @@
 #define MP3MySQLInfo "This takes the db name and the table name."
 #define MP3MySQLTokenTable "This takes the table name used for tokens."
 #endif
-#ifdef PG_ENABLED
+#ifdef PGSQL_ENABLED
 #define MP3PgConnectInfo "Host, user and password for connecting to database (defaults to localhost, null, and null)."
 #define MP3PgInfo "This takes the db name and the table name."
 #define MP3PgTokenTable "This takes the table name used for tokens."
--- ./src/pgsql_dispatch.h.orig	Sat May 17 15:14:29 2003
+++ ./src/pgsql_dispatch.h	Sat May 17 15:18:39 2003
@@ -4,7 +4,7 @@
 
 #define PG_MP3_GET "SELECT name,filename,signature,artist,album,comment,track,year,genre FROM %s WHERE signature = '%s'"
 #define PG_MP3_GET_RANDOM "SELECT name,filename,signature,artist,album,comment,track,year,genre FROM %s ORDER BY round(random()*1000) LIMIT 1"
-#define PG_MP3_INSERT "INSERT IGNORE INTO %s (name,filename,signature,artist,album,comment,track,year,genre) VALUES ('%s','%s','%s','%s','%s','%s','%s','%s','%s')"
+#define PG_MP3_INSERT "INSERT INTO %s (name,filename,signature,artist,album,comment,track,year,genre) VALUES ('%s','%s','%s','%s','%s','%s','%s','%s','%s')"
 
 #define PG_MP3_GETS "SELECT name,filename,signature,artist,album,comment,track,year,genre FROM %s"
 #define PG_MP3_GET_LIST "SELECT name,filename,signature,artist,album,comment,track,year,genre FROM %s WHERE signature IN (%s)"
--- ./configure.orig	Thu Sep 19 02:13:21 2002
+++ ./configure	Fri May 16 22:29:21 2003
@@ -227,11 +227,15 @@
 		$pgsql_inc = '/usr/local/pgsql/include/pgsql/';
 	}
 
-	if (-e '/usr/local/mysql/lib/libpq.so') {
+	if (-e '/usr/local/include/postgres_ext.h') {
+		$pgsql_inc = '/usr/local/include/';
+	}
+
+	if (-e '/usr/local/pgsql/lib/libpq.so') {
 		$pgsql_lib = '/usr/local/pgsql/lib/';
 	}
 
-	if (-e '/usr/lib/mysql/libpq.so') {
+	if (-e '/usr/lib/pgsql/libpq.so') {
 		$pgsql_lib = '/usr/lib/pgsql/';
 	}
 
@@ -243,7 +247,7 @@
 		$pgsql_lib = '/usr/local/lib/';
 	}
 
-	if (-e '/usr/local/lib/mysql/libpq.so') {
+	if (-e '/usr/local/lib/pgsql/libpq.so') {
 		$pgsql_lib = '/usr/local/lib/pgsql/';
 	}
 

---MOQ10533727751d22ce1d4528474e4e4ecca0db13a8de--