summaryrefslogtreecommitdiff
path: root/ext/sybase/php_sybase_db.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/sybase/php_sybase_db.c')
-rw-r--r--ext/sybase/php_sybase_db.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/ext/sybase/php_sybase_db.c b/ext/sybase/php_sybase_db.c
index dccf78090d..3ed1106b30 100644
--- a/ext/sybase/php_sybase_db.c
+++ b/ext/sybase/php_sybase_db.c
@@ -254,7 +254,7 @@ PHP_RSHUTDOWN_FUNCTION(sybase)
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 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
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 @@ static void php_sybase_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent)
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 @@ static int php_sybase_get_default_link(INTERNAL_FUNCTION_PARAMETERS)
}
-/* {{{ 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 @@ PHP_FUNCTION(sybase_connect)
}
/* }}} */
-/* {{{ 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)
{