summaryrefslogtreecommitdiff
path: root/ext/mysqli/mysqli_nonapi.c
diff options
context:
space:
mode:
authorGeorg Richter <georg@php.net>2005-06-03 08:49:01 +0000
committerGeorg Richter <georg@php.net>2005-06-03 08:49:01 +0000
commitd486da963e02271623db034adde6fc55d9fcb6cb (patch)
tree3370693d63e1f3efe0798ca372966ee4415daeff /ext/mysqli/mysqli_nonapi.c
parentd3a665248d1850987164368393cedb289214c73c (diff)
downloadphp-git-d486da963e02271623db034adde6fc55d9fcb6cb.tar.gz
added new function mysqli_get_charset
Diffstat (limited to 'ext/mysqli/mysqli_nonapi.c')
-rw-r--r--ext/mysqli/mysqli_nonapi.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c
index e5f3cda793..77a3eb4262 100644
--- a/ext/mysqli/mysqli_nonapi.c
+++ b/ext/mysqli/mysqli_nonapi.c
@@ -274,6 +274,31 @@ PHP_FUNCTION(mysqli_set_charset)
/* }}} */
#endif
+/* {{{ object mysqli_get_charset(object link)
+ returns a character set object */
+PHP_FUNCTION(mysqli_get_charset)
+{
+ MY_MYSQL *mysql;
+ zval *mysql_link;
+ CHARSET_INFO *cs;
+
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
+ return;
+ }
+ MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL*, &mysql_link, "mysqli_link");
+
+ object_init(return_value);
+
+ cs = (CHARSET_INFO *)mysql->mysql->charset;
+
+ add_property_string(return_value, "charset", (cs->name) ? (char *)cs->csname : "", 1);
+ add_property_string(return_value, "collation",(cs->name) ? (char *)cs->name : "", 1);
+ add_property_string(return_value, "comment", (cs->comment) ? (char *)cs->comment : "", 1);
+ add_property_long(return_value, "min_length", cs->mbminlen);
+ add_property_long(return_value, "max_length", cs->mbmaxlen);
+}
+/* }}} */
+
/*
* Local variables:
* tab-width: 4