diff options
author | Peter Pentchev <roam@FreeBSD.org> | 2004-06-03 15:49:13 +0000 |
---|---|---|
committer | Peter Pentchev <roam@FreeBSD.org> | 2004-06-03 15:49:13 +0000 |
commit | f2b221a3576c6098ae48631f1b39a0e2d5acea30 (patch) | |
tree | 481a85eaf7760e528b0c0ae86e440309af9c8bc6 | |
parent | Update MASTER_SITES (diff) |
Commit something that I've been sitting on for just about months now:
make the PHP3 ports work with any version of MySQL, not just 3.23.x.
The main (actually, the only) problem was that MySQL 4.x no longer has
mysql_drop_db() and mysql_create_db() as separate functions, and just as
mentioned in the manual, the solution is to use mysql_query() (or
rather, mysql_real_query()) and emulate them.
Notes
Notes:
svn path=/head/; revision=110781
-rw-r--r-- | www/mod_php3/Makefile | 4 | ||||
-rw-r--r-- | www/mod_php3/files/patch-functions::mysql.c | 52 | ||||
-rw-r--r-- | www/mod_php3/scripts/configure.php | 2 |
3 files changed, 55 insertions, 3 deletions
diff --git a/www/mod_php3/Makefile b/www/mod_php3/Makefile index 9a12ba4a4369..910d54933a64 100644 --- a/www/mod_php3/Makefile +++ b/www/mod_php3/Makefile @@ -7,7 +7,7 @@ PORTNAME?= mod_php3 PORTVERSION= 3.0.18 -PORTREVISION?= 3 +PORTREVISION?= 4 CATEGORIES?= www MASTER_SITES= ${MASTER_SITE_PHP} MASTER_SITE_SUBDIR= distributions @@ -102,7 +102,7 @@ post-clean: # Has to be kept in sync with the defaults in configure.php .ifndef(WITHOUT_MYSQL) .ifmake describe -LIB_DEPENDS+= mysqlclient.10:${PORTSDIR}/databases/mysql323-client +USE_MYSQL= yes .endif .endif diff --git a/www/mod_php3/files/patch-functions::mysql.c b/www/mod_php3/files/patch-functions::mysql.c new file mode 100644 index 000000000000..cbf509ecb039 --- /dev/null +++ b/www/mod_php3/files/patch-functions::mysql.c @@ -0,0 +1,52 @@ +--- functions/mysql.c.orig Thu Jun 3 13:17:04 2004 ++++ functions/mysql.c Thu Jun 3 13:17:09 2004 +@@ -785,7 +785,9 @@ + void php3_mysql_create_db(INTERNAL_FUNCTION_PARAMETERS) + { + pval *db,*mysql_link; +- int id,type; ++ int id,type,res; ++ char *qbuf; ++ size_t qsize; + MYSQL *mysql; + MySQL_TLS_VARS; + +@@ -818,7 +820,12 @@ + } + + convert_to_string(db); +- if (mysql_create_db(mysql,db->value.str.val)==0) { ++ qsize = strlen(db->value.str.val) + 20; ++ qbuf = (char *)emalloc(qsize); ++ snprintf(qbuf, qsize, "CREATE DATABASE %s", db->value.str.val); ++ res = mysql_real_query(mysql,qbuf,strlen(qbuf)); ++ efree(qbuf); ++ if (res) { + RETURN_TRUE; + } else { + RETURN_FALSE; +@@ -831,7 +838,9 @@ + void php3_mysql_drop_db(INTERNAL_FUNCTION_PARAMETERS) + { + pval *db,*mysql_link; +- int id,type; ++ int id,type,res; ++ char *qbuf; ++ size_t qsize; + MYSQL *mysql; + MySQL_TLS_VARS; + +@@ -864,7 +873,12 @@ + } + + convert_to_string(db); +- if (mysql_drop_db(mysql,db->value.str.val)==0) { ++ qsize = strlen(db->value.str.val) + 20; ++ qbuf = (char *)emalloc(qsize); ++ snprintf(qbuf, qsize, "DROP DATABASE %s", db->value.str.val); ++ res = mysql_real_query(mysql,qbuf,strlen(qbuf)); ++ efree(qbuf); ++ if (res) { + RETURN_TRUE; + } else { + RETURN_FALSE; diff --git a/www/mod_php3/scripts/configure.php b/www/mod_php3/scripts/configure.php index 8770231603c8..af41539f1fa5 100644 --- a/www/mod_php3/scripts/configure.php +++ b/www/mod_php3/scripts/configure.php @@ -90,7 +90,7 @@ while [ "$1" ]; do echo "CONFIGURE_ARGS+=--with-imap=\${PREFIX}" ;; \"MySQL\") - echo "LIB_DEPENDS+= mysqlclient.10:\${PORTSDIR}/databases/mysql323-client" + echo "USE_MYSQL= yes" echo "CONFIGURE_ARGS+=--with-mysql=\${PREFIX}" MYSQL=1 ;; |