cvs: php3 /functions pgsql.c php3_pdf.h php3_pgsql.h
| From: | Rui Hirokawa | Date: | Tue, 02 Jan 2001 22:47:16 +0000 |
| Subject: | cvs: php3 /functions pgsql.c php3_pdf.h php3_pgsql.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-3329@lists.php.net to get a copy of this message | ||
hirokawa Tue Jan 2 14:47:16 2001 EDT
Modified files:
/php3/functions pgsql.c php3_pdf.h php3_pgsql.h
Log:
update translation.
Index: php3/functions/pgsql.c
diff -u php3/functions/pgsql.c:1.92 php3/functions/pgsql.c:1.93
--- php3/functions/pgsql.c:1.92 Tue Feb 22 07:13:57 2000
+++ php3/functions/pgsql.c Tue Jan 2 14:47:15 2001
@@ -28,7 +28,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pgsql.c,v 1.92 2000/02/22 15:13:57 eschmid Exp $ */
+/* $Id: pgsql.c,v 1.93 2001/01/02 22:47:15 hirokawa Exp $ */
#include <stdlib.h>
@@ -82,6 +82,12 @@
{"pg_loread", php3_pgsql_lo_read, NULL},
{"pg_lowrite", php3_pgsql_lo_write, NULL},
{"pg_loreadall", php3_pgsql_lo_readall, NULL},
+#if HAVE_PQCLIENTENCODING
+ {"pg_set_client_encoding", php3_pgsql_set_client_encoding, NULL},
+ {"pg_client_encoding", php3_pgsql_client_encoding, NULL},
+ {"pg_setclientencoding", php3_pgsql_set_client_encoding, NULL},
+ {"pg_clientencoding", php3_pgsql_client_encoding, NULL},
+#endif
{NULL, NULL, NULL}
};
@@ -1529,6 +1535,102 @@
}
/* }}} */
+#if HAVE_PQCLIENTENCODING
+
+/* {{{ proto int pg_set_client_encoding([int connection,] string encoding)
+ set client side encoding */
+void php3_pgsql_set_client_encoding(INTERNAL_FUNCTION_PARAMETERS)
+{
+ pval *pgsql_link, *encoding;
+ PGconn *pgsql;
+ int id, type, status;
+ char *encoding_string=NULL;
+
+ switch(ARG_COUNT(ht)) {
+ case 1:
+ if (getParameters(ht, 1, &encoding)==FAILURE) {
+ RETURN_FALSE;
+ }
+ convert_to_string(encoding);
+ encoding_string = encoding->value.str.val;
+ id = php3_pgsql_module.default_link;
+ break;
+ case 2:
+ if (getParameters(ht, 2, &pgsql_link, &encoding)==FAILURE) {
+ RETURN_FALSE;
+ }
+ convert_to_long(pgsql_link);
+ id = pgsql_link->value.lval;
+ convert_to_string(encoding);
+ encoding_string = encoding->value.str.val;
+ break;
+ default:
+ WRONG_PARAM_COUNT;
+ break;
+ }
+
+ pgsql = (PGconn *) php3_list_find(id,&type);
+ if (type!=php3_pgsql_module.le_link && type!=php3_pgsql_module.le_plink) {
+ php3_error(E_WARNING,"%d is not a PostgresSQL link index",id);
+ RETURN_FALSE;
+ }
+ status = PQsetClientEncoding(pgsql, encoding_string);
+ if (status == -1) {
+ php3_error(E_WARNING,"PQsetClientEncoding failed. encoding: \"%s\"",
+ encoding_string);
+ RETURN_FALSE;
+ }
+ RETURN_TRUE;
+}
+/* }}} */
+
+/* {{{ proto int pg_client_encoding([int connection])
+ get client side encoding */
+void php3_pgsql_client_encoding(INTERNAL_FUNCTION_PARAMETERS)
+{
+ pval *pgsql_link;
+ PGconn *pgsql;
+ int id, type, encoding_id;
+ char *encoding, *buf;
+ int buf_len;
+ switch(ARG_COUNT(ht)) {
+ case 0:
+ id = php3_pgsql_module.default_link;
+ break;
+ case 1:
+ if (getParameters(ht, 1, &pgsql_link)==FAILURE) {
+ RETURN_FALSE;
+ }
+ convert_to_long(pgsql_link);
+ id = pgsql_link->value.lval;
+ break;
+ default:
+ WRONG_PARAM_COUNT;
+ break;
+ }
+
+ pgsql = (PGconn *) php3_list_find(id,&type);
+ if (type!=php3_pgsql_module.le_link && type!=php3_pgsql_module.le_plink) {
+ php3_error(E_WARNING,"%d is not a PostgresSQL link index",id);
+ RETURN_FALSE;
+ }
+
+#ifndef HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT
+#define pg_encoding_to_char(x) "SQL_ASCII"
+#endif
+
+ encoding_id = PQclientEncoding(pgsql);
+ encoding = (char *)pg_encoding_to_char(encoding_id);
+ buf_len = strlen(encoding);
+ buf = (char *) emalloc(sizeof(char)*(buf_len+1));
+ strcpy(buf, encoding);
+ return_value->value.str.val = buf;
+ return_value->value.str.len = buf_len;
+ return_value->type = IS_STRING;
+}
+/* }}} */
+
+#endif
#endif
Index: php3/functions/php3_pdf.h
diff -u php3/functions/php3_pdf.h:1.15 php3/functions/php3_pdf.h:1.16
--- php3/functions/php3_pdf.h:1.15 Mon Feb 14 02:09:20 2000
+++ php3/functions/php3_pdf.h Tue Jan 2 14:47:15 2001
@@ -26,7 +26,7 @@
| Authors: Uwe Steinmann |
+----------------------------------------------------------------------+
*/
-/* $Id: php3_pdf.h,v 1.15 2000/02/14 10:09:20 kk Exp $ */
+/* $Id: php3_pdf.h,v 1.16 2001/01/02 22:47:15 hirokawa Exp $ */
#ifndef _PHP3_PDF_H
#define _PHP3_PDF_H
@@ -108,6 +108,10 @@
PHP_FUNCTION(pdf_set_transition);
PHP_FUNCTION(pdf_set_duration);
PHP_FUNCTION(pdf_open_jpeg);
+#if PDFLIB_MAJORVERSION == 3
+PHP_FUNCTION(pdf_open_tiff);
+PHP_FUNCTION(pdf_open_png);
+#endif
#if HAVE_LIBGD && HAVE_PDFLIB2
PHP_FUNCTION(pdf_open_memory_image);
#endif
Index: php3/functions/php3_pgsql.h
diff -u php3/functions/php3_pgsql.h:1.21 php3/functions/php3_pgsql.h:1.22
--- php3/functions/php3_pgsql.h:1.21 Fri Dec 31 20:44:09 1999
+++ php3/functions/php3_pgsql.h Tue Jan 2 14:47:15 2001
@@ -27,7 +27,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php3_pgsql.h,v 1.21 2000/01/01 04:44:09 sas Exp $ */
+/* $Id: php3_pgsql.h,v 1.22 2001/01/02 22:47:15 hirokawa Exp $ */
#ifndef _PHP3_PGSQL_H
#define _PHP3_PGSQL_H
@@ -81,6 +81,10 @@
extern void php3_pgsql_lo_read(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_pgsql_lo_write(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_pgsql_lo_readall(INTERNAL_FUNCTION_PARAMETERS);
+#if HAVE_PQCLIENTENCODING
+extern void php3_pgsql_set_client_encoding(INTERNAL_FUNCTION_PARAMETERS);
+extern void php3_pgsql_client_encoding(INTERNAL_FUNCTION_PARAMETERS);
+#endif
void php3_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent);
int php3_pgsql_get_default_link(INTERNAL_FUNCTION_PARAMETERS);