com php-src: Merge remote-tracking branch 'origin/master' into str_size_and_int64: ext/json/json.c ext/json/ php_json.h ext/pgsql/pgsql.c
ext/pgsql/php_pgsql. h
| From: | Anatol Belski | Date: | Mon, 17 Feb 2014 11:27:33 +0000 |
| Subject: | com php-src: Merge remote-tracking branch 'origin/master' into str_size_and_int64: ext/json/json.c ext/json/ php_json.h ext/pgsql/pgsql.c ext/pgsql/php_pgsql. h |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-76045@lists.php.net to get a copy of this message | ||
Commit: cbaea7d21437d1cc68211a72f94ffb4f9e880867
Author: Anatol Belski <ab@php.net> Mon, 17 Feb 2014 12:27:33 +0100
Parents: 107df3d32b0533e6f2c1060536ff4583baa588f4 90325ba7ef0368cc2c3b27956502739b5cb068ee
Branches: str_size_and_int64
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=cbaea7d21437d1cc68211a72f94ffb4f9e880867
Log:
Merge remote-tracking branch 'origin/master' into str_size_and_int64
Conflicts:
ext/json/php_json.h
ext/pgsql/pgsql.c
ext/pgsql/php_pgsql.h
Changed paths:
MM ext/json/json.c
MM ext/json/php_json.h
MM ext/pgsql/pgsql.c
MM ext/pgsql/php_pgsql.h
Diff:
diff --cc ext/json/php_json.h
index 2317207,e00de6a..1a62762
--- a/ext/json/php_json.h
+++ b/ext/json/php_json.h
@@@ -49,9 -49,9 +49,9 @@@ ZEND_END_MODULE_GLOBALS(json
# define JSON_G(v) (json_globals.v)
#endif
-PHP_JSON_API void php_json_encode(smart_str *buf, zval *val, int options TSRMLS_DC);
-PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, int str_len, int options, long
depth TSRMLS_DC);
+PHP_JSON_API void php_json_encode(smart_str *buf, zval *val, php_int_t options TSRMLS_DC);
+PHP_JSON_API void php_json_decode_ex(zval *return_value, char *str, php_size_t str_len, php_int_t
options, php_int_t depth TSRMLS_DC);
- extern zend_class_entry *php_json_serializable_ce;
+ extern PHP_JSON_API zend_class_entry *php_json_serializable_ce;
/* json_encode() options */
diff --cc ext/pgsql/pgsql.c
index 27ce263,bd9a3f6..6c98345
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@@ -5264,28 -5247,29 +5279,29 @@@ PHP_PGSQL_API int php_pgsql_meta_data(P
char *name;
MAKE_STD_ZVAL(elem);
array_init(elem);
+ /* pg_attribute.attnum */
- add_assoc_long(elem, "num", atoi(PQgetvalue(pg_result,i,1)));
+ add_assoc_int(elem, "num", atoi(PQgetvalue(pg_result,i,1)));
+ /* pg_type.typname */
add_assoc_string(elem, "type", PQgetvalue(pg_result,i,2), 1);
+ /* pg_attribute.attlen */
- add_assoc_long(elem, "len", atoi(PQgetvalue(pg_result,i,3)));
+ add_assoc_int(elem, "len", atoi(PQgetvalue(pg_result,i,3)));
- if (!strcmp(PQgetvalue(pg_result,i,4), "t")) {
- add_assoc_bool(elem, "not null", 1);
- }
- else {
- add_assoc_bool(elem, "not null", 0);
- }
- if (!strcmp(PQgetvalue(pg_result,i,5), "t")) {
- add_assoc_bool(elem, "has default", 1);
- }
- else {
- add_assoc_bool(elem, "has default", 0);
- }
+ /* pg_attribute.attnonull */
+ add_assoc_bool(elem, "not null", !strcmp(PQgetvalue(pg_result,i,4), "t"));
+ /* pg_attribute.atthasdef */
+ add_assoc_bool(elem, "has default", !strcmp(PQgetvalue(pg_result,i,5),
"t"));
+ /* pg_attribute.attndims */
- add_assoc_long(elem, "array dims", atoi(PQgetvalue(pg_result,i,6)));
+ add_assoc_int(elem, "array dims", atoi(PQgetvalue(pg_result,i,6)));
- if (!strcmp(PQgetvalue(pg_result,i,7), "t")) {
- add_assoc_bool(elem, "is enum", 1);
- }
- else {
- add_assoc_bool(elem, "is enum", 0);
+ /* pg_type.typtype */
+ add_assoc_bool(elem, "is enum", !strcmp(PQgetvalue(pg_result,i,7), "e"));
+ if (extended) {
+ /* pg_type.typtype */
+ add_assoc_bool(elem, "is base", !strcmp(PQgetvalue(pg_result,i,7), "b"));
+ add_assoc_bool(elem, "is composite", !strcmp(PQgetvalue(pg_result,i,7),
"c"));
+ add_assoc_bool(elem, "is pesudo", !strcmp(PQgetvalue(pg_result,i,7), "p"));
+ /* pg_description.description */
+ add_assoc_string(elem, "description", PQgetvalue(pg_result,i,8), 1);
}
+ /* pg_attribute.attname */
name = PQgetvalue(pg_result,i,0);
add_assoc_zval(meta, name, elem);
}
@@@ -5303,12 -5287,13 +5319,13 @@@ PHP_FUNCTION(pg_meta_data
{
zval *pgsql_link;
char *table_name;
- uint table_name_len;
+ php_size_t table_name_len;
+ zend_bool extended=0;
PGconn *pgsql;
- int id = -1;
+ php_int_t id = -1;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rS",
- &pgsql_link, &table_name, &table_name_len) == FAILURE) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|b",
++ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rS|b",
+ &pgsql_link, &table_name, &table_name_len, &extended) == FAILURE) {
return;
}
@@@ -6395,13 -6369,15 +6401,16 @@@ PHP_FUNCTION(pg_insert
{
zval *pgsql_link, *values;
char *table, *sql = NULL;
- int table_len;
- ulong option = PGSQL_DML_EXEC, return_sql;
+ php_size_t table_len;
- php_uint_t option = PGSQL_DML_EXEC;
++ php_uint_t option = PGSQL_DML_EXEC, return_sql;
PGconn *pg_link;
+ PGresult *pg_result;
+ ExecStatusType status;
+ pgsql_result_handle *pgsql_handle;
- int id = -1, argc = ZEND_NUM_ARGS();
+ php_int_t id = -1;
+ int argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "rsa|l",
+ if (zend_parse_parameters(argc TSRMLS_CC, "rSa|i",
&pgsql_link, &table, &table_len, &values, &option) == FAILURE) {
return;
}
diff --cc ext/pgsql/php_pgsql.h
index 3f92f51,b6caf9d..26b72d1
--- a/ext/pgsql/php_pgsql.h
+++ b/ext/pgsql/php_pgsql.h
@@@ -201,13 -203,14 +203,14 @@@ PHP_FUNCTION(pg_select)
#define PGSQL_DML_STRING (1<<11) /* Return query string */
#define PGSQL_DML_ESCAPE (1<<12) /* No convert, but escape only */
+
/* exported functions */
- PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, zval *meta
TSRMLS_DC);
+ PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, zval *meta,
zend_bool extended TSRMLS_DC);
-PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values,
zval *result, ulong opt TSRMLS_DC);
-PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *values, ulong opt,
char **sql TSRMLS_DC);
-PHP_PGSQL_API int php_pgsql_update(PGconn *pg_link, const char *table, zval *values, zval *ids,
ulong opt , char **sql TSRMLS_DC);
-PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids, ulong opt, char
**sql TSRMLS_DC);
-PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids, zval *ret_array,
ulong opt, char **sql TSRMLS_DC);
+PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values,
zval *result, php_uint_t opt TSRMLS_DC);
+PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *values, php_uint_t
opt, char **sql TSRMLS_DC);
+PHP_PGSQL_API int php_pgsql_update(PGconn *pg_link, const char *table, zval *values, zval *ids,
php_uint_t opt , char **sql TSRMLS_DC);
+PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids, php_uint_t opt,
char **sql TSRMLS_DC);
+PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids, zval *ret_array,
php_uint_t opt, char **sql TSRMLS_DC);
PHP_PGSQL_API int php_pgsql_result2array(PGresult *pg_result, zval *ret_array TSRMLS_DC);
/* internal functions */