cvs: php4 /ext/sybase php_sybase_db.c
| From: | Rasmus Lerdorf | Date: | Mon, 07 Aug 2000 00:15:37 +0000 |
| Subject: | cvs: php4 /ext/sybase php_sybase_db.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-1078@lists.php.net to get a copy of this message | ||
rasmus Sun Aug 6 17:15:37 2000 EDT
Modified files:
/php4/ext/sybase php_sybase_db.c
Log:
Add 4th optional parameter to sybase_[p]connect to specify the charset
for the connection
@- Add 4th optional parameter to sybase_[p]connect to specify the charset
@ for the connection (alf@alpha.ulatina.ac.cr)
Index: php4/ext/sybase/php_sybase_db.c
diff -u php4/ext/sybase/php_sybase_db.c:1.2 php4/ext/sybase/php_sybase_db.c:1.3
--- php4/ext/sybase/php_sybase_db.c:1.2 Mon Jul 3 15:04:09 2000
+++ php4/ext/sybase/php_sybase_db.c Sun Aug 6 17:15:36 2000
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_sybase_db.c,v 1.2 2000/07/03 22:04:09 zeev Exp $ */
+/* $Id: php_sybase_db.c,v 1.3 2000/08/07 00:15:36 rasmus Exp $ */
#include "php.h"
@@ -254,7 +254,7 @@
static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
{
- char *user,*passwd,*host;
+ char *user,*passwd,*host,*charset;
char *hashed_details;
int hashed_details_length;
sybase_link sybase,*sybase_ptr;
@@ -313,6 +313,25 @@
sprintf(hashed_details,"sybase_%s_%s_%s",yyhost->value.str.val,yyuser->value.str.val,yypasswd->value.str.val);
/* SAFE */
}
break;
+ case 4: {
+ pval *yyhost,*yyuser,*yypasswd,*yycharset;
+
+ if (getParameters(ht, 4, &yyhost, &yyuser, &yypasswd, &yycharset) == FAILURE) {
+ RETURN_FALSE;
+ }
+ convert_to_string(yyhost);
+ convert_to_string(yyuser);
+ convert_to_string(yypasswd);
+ convert_to_string(yycharset);
+ host = yyhost->value.str.val;
+ user = yyuser->value.str.val;
+ passwd = yypasswd->value.str.val;
+ charset = yycharset->value.str.val;
+ hashed_details_length =
yyhost->value.str.len+yyuser->value.str.len+yypasswd->value.str.len+yycharset->value.str.len+6+3;
+ hashed_details = (char *) emalloc(hashed_details_length+1);
+ sprintf(hashed_details,"sybase_%s_%s_%s_%s",yyhost->value.str.val,yyuser->value.str.val,yypasswd->value.str.val,yycharset->value.str.val);
/* SAFE */
+ }
+ break;
default:
WRONG_PARAM_COUNT;
break;
@@ -331,6 +350,9 @@
if (passwd) {
DBSETLPWD(sybase.login,passwd);
}
+ if (charset) {
+ DBSETLCHARSET(sybase.login,charset);
+ }
DBSETLAPP(sybase.login,php_sybase_module.appname);
sybase.valid = 1;
@@ -483,7 +505,7 @@
}
-/* {{{ proto int sybase_connect([string host [, string user [, string password]]])
+/* {{{ proto int sybase_connect([string host [, string user [, string password [, string
charset]]]])
Open Sybase server connection */
PHP_FUNCTION(sybase_connect)
{
@@ -491,7 +513,7 @@
}
/* }}} */
-/* {{{ proto int sybase_pconnect([string host [, string user [, string password]]])
+/* {{{ proto int sybase_pconnect([string host [, string user [, string password [, string
charset]]]])
Open persistent Sybase connection */
PHP_FUNCTION(sybase_pconnect)
{