cvs: /php3 ChangeLog /php3/functions mysql.c php3_mysql.h
| From: | Rasmus Lerdorf | Date: | Fri, 05 Nov 1999 21:28:39 +0000 |
| Subject: | cvs: /php3 ChangeLog /php3/functions mysql.c php3_mysql.h | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-12146@lists.php.net to get a copy of this message | ||
rasmus Fri Nov 5 16:28:39 1999 EDT
Modified files:
/php3 ChangeLog
/php3/functions mysql.c php3_mysql.h
Log:
Add mysql_change_user() function
Index: php3/ChangeLog
diff -u php3/ChangeLog:1.784 php3/ChangeLog:1.785
--- php3/ChangeLog:1.784 Fri Nov 5 03:51:59 1999
+++ php3/ChangeLog Fri Nov 5 16:28:37 1999
@@ -2,6 +2,7 @@
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Nov 5, 1999, Version 3.0.13
+- Add mysql_change_user() function (Rasmus)
- Fixed garbage returned at the end of certain Sybase-Columns (Thies)
Patch submitted by: neal@wanlink.com
- XML_Parse_Into_Struct() no longer eats data. (Thies)
@@ -42,7 +43,7 @@
- Return false from mysql_query() and mysql_db_query() in case saving the
result set data fails (Zeev)
- Make --with-apache --with-xml pick up Apache-bundled expat lib (Rasmus)
-- Carry special Apache CFLAGS into PHP build for apxs build (Rasmus)
+- Carry special Apache CFLAGS into PHP build for apxs build
This should fix any PHP/mod_ssl compile issues (Rasmus)
- Fixed a crash that would occur if wddx_deserialize did not receive
a valid packet (Andrey)
Index: php3/functions/mysql.c
diff -u php3/functions/mysql.c:1.189 php3/functions/mysql.c:1.190
--- php3/functions/mysql.c:1.189 Mon Sep 6 15:28:16 1999
+++ php3/functions/mysql.c Fri Nov 5 16:28:38 1999
@@ -27,7 +27,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mysql.c,v 1.189 1999/09/06 19:28:16 eschmid Exp $ */
+/* $Id: mysql.c,v 1.190 1999/11/05 21:28:38 rasmus Exp $ */
/* TODO:
@@ -102,8 +102,13 @@
#define MYSQL_NUM 1<<1
#define MYSQL_BOTH (MYSQL_ASSOC|MYSQL_NUM)
+#if MYSQL_VERSION_ID < 32224
#define PHP_MYSQL_VALID_RESULT(mysql) \
(mysql_num_fields(mysql)>0)
+#else
+#define PHP_MYSQL_VALID_RESULT(mysql) \
+ (mysql_field_count(mysql)>0)
+#endif
function_entry mysql_functions[] = {
{"mysql_connect", php3_mysql_connect, NULL},
@@ -158,6 +163,10 @@
{"mysql_listfields", php3_mysql_list_fields, NULL},
{"mysql_db_name", php3_mysql_result, NULL},
{"mysql_dbname", php3_mysql_result, NULL},
+#if MYSQL_VERSION_ID > 32302
+ {"mysql_change_user", php3_mysql_change_user, NULL},
+#endif
+
{NULL, NULL, NULL}
};
@@ -743,6 +752,67 @@
}
}
/* }}} */
+
+#if MYSQL_VERSION_ID > 32302
+/* {{{ proto int mysql_change_user(string user, string password [, string database [, int
link_identifier]])
+ Changes the logged in user on the current connection */
+void php3_mysql_change_user(INTERNAL_FUNCTION_PARAMETERS)
+{
+ pval *user=NULL,*passwd=NULL,*db=NULL,*mysql_link=NULL;
+ int id,type;
+ MYSQL *mysql;
+ MySQL_TLS_VARS;
+
+
+ switch(ARG_COUNT(ht)) {
+ case 2:
+ if (getParameters(ht, 2, &user, &passwd)==FAILURE) {
+ RETURN_FALSE;
+ }
+ convert_to_string(user);
+ convert_to_string(passwd);
+ break;
+ case 3:
+ if (getParameters(ht, 3, &user, &passwd, &db)==FAILURE) {
+ RETURN_FALSE;
+ }
+ convert_to_string(user);
+ convert_to_string(passwd);
+ convert_to_string(db);
+ break;
+ case 4:
+ if (getParameters(ht, 4, &user, &passwd, &db, &mysql_link)==FAILURE) {
+ RETURN_FALSE;
+ }
+ convert_to_string(user);
+ convert_to_string(passwd);
+ convert_to_string(db);
+ convert_to_long(mysql_link);
+ id = mysql_link->value.lval;
+ break;
+ default:
+ WRONG_PARAM_COUNT;
+ break;
+ }
+ CHECK_LINK(id);
+
+ mysql = (MYSQL *) php3_list_find(id,&type);
+ if (type!=MySQL_GLOBAL(php3_mysql_module).le_link &&
type!=MySQL_GLOBAL(php3_mysql_module).le_plink) {
+ php3_error(E_WARNING,"%d is not a MySQL link index",id);
+ RETURN_FALSE;
+ }
+ if (mysql_change_user(mysql,
+ user ? user->value.str.val:NULL,
+ passwd ? passwd->value.str.val:NULL,
+ db ? db->value.str.val:NULL) != 0) {
+ RETURN_FALSE;
+ } else {
+ RETURN_TRUE;
+ }
+
+}
+/* }}} */
+#endif
/* {{{ proto int mysql_create_db(string database_name [, int link_identifier])
Create a MySQL database */
Index: php3/functions/php3_mysql.h
diff -u php3/functions/php3_mysql.h:1.24 php3/functions/php3_mysql.h:1.25
--- php3/functions/php3_mysql.h:1.24 Fri Jan 1 12:59:16 1999
+++ php3/functions/php3_mysql.h Fri Nov 5 16:28:38 1999
@@ -28,7 +28,7 @@
*/
-/* $Id: php3_mysql.h,v 1.24 1999/01/01 17:59:16 zeev Exp $ */
+/* $Id: php3_mysql.h,v 1.25 1999/11/05 21:28:38 rasmus Exp $ */
#ifndef _PHP3_MYSQL_H
#define _PHP3_MYSQL_H
@@ -54,6 +54,7 @@
extern void php3_mysql_pconnect(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_mysql_close(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_mysql_select_db(INTERNAL_FUNCTION_PARAMETERS);
+extern void php3_mysql_change_user(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_mysql_create_db(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_mysql_drop_db(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_mysql_query(INTERNAL_FUNCTION_PARAMETERS);