projects
/
m6w6
/
ext-pq
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
prepare v2.2.3
[m6w6/ext-pq]
/
src
/
php_pq_params.c
diff --git
a/src/php_pq_params.c
b/src/php_pq_params.c
index 3c6b920c73d7dbb65ed4d06a907be75553fae2b2..9e92226f7b3f83b5fe07e03cb4681768bbd2fa60 100644
(file)
--- a/
src/php_pq_params.c
+++ b/
src/php_pq_params.c
@@
-16,9
+16,7
@@
#include <php.h>
#include <ext/standard/php_string.h>
#include <php.h>
#include <ext/standard/php_string.h>
-#if PHP_PQ_HAVE_PHP_JSON_H
-#include <php_json.h> /* we've added the include directory to INCLUDES */
-#endif
+#include <ext/json/php_json.h>
#include <Zend/zend_smart_str.h>
#include <Zend/zend_interfaces.h>
#include <Zend/zend_smart_str.h>
#include <Zend/zend_interfaces.h>
@@
-75,19
+73,19
@@
unsigned php_pq_params_add_type_oid(php_pq_params_t *p, Oid type)
static zend_string *object_param_to_string(php_pq_params_t *p, zval *zobj, Oid type)
{
static zend_string *object_param_to_string(php_pq_params_t *p, zval *zobj, Oid type)
{
-#if
PHP_PQ_HAVE_PHP_JSON_H && defined(PHP_PQ_OID_JSON)
+#if
def PHP_PQ_OID_JSON
smart_str str = {0};
#endif
switch (type) {
smart_str str = {0};
#endif
switch (type) {
-#if
PHP_PQ_HAVE_PHP_JSON_H && defined(PHP_PQ_OID_JSON)
-#
ifdef PHP_PQ_OID_JSONB
+#if
def PHP_PQ_OID_JSON
+# ifdef PHP_PQ_OID_JSONB
case PHP_PQ_OID_JSONB:
case PHP_PQ_OID_JSONB:
-#
endif
+# endif
case PHP_PQ_OID_JSON:
case PHP_PQ_OID_JSON:
-#
if PHP_VERSION_ID >= 70100
+# if PHP_VERSION_ID >= 70100
JSON_G(encode_max_depth) = PHP_JSON_PARSER_DEFAULT_DEPTH;
JSON_G(encode_max_depth) = PHP_JSON_PARSER_DEFAULT_DEPTH;
-#
endif
+# endif
php_json_encode(&str, zobj, PHP_JSON_UNESCAPED_UNICODE);
smart_str_0(&str);
return str.s;
php_json_encode(&str, zobj, PHP_JSON_UNESCAPED_UNICODE);
smart_str_0(&str);
return str.s;
@@
-95,10
+93,10
@@
static zend_string *object_param_to_string(php_pq_params_t *p, zval *zobj, Oid t
case PHP_PQ_OID_DATE:
return php_pqdt_to_string(zobj, "Y-m-d");
case PHP_PQ_OID_DATE:
return php_pqdt_to_string(zobj, "Y-m-d");
-
+#ifdef PHP_PQ_OID_ABSTIME
case PHP_PQ_OID_ABSTIME:
return php_pqdt_to_string(zobj, "Y-m-d H:i:s");
case PHP_PQ_OID_ABSTIME:
return php_pqdt_to_string(zobj, "Y-m-d H:i:s");
-
+#endif
case PHP_PQ_OID_TIMESTAMP:
return php_pqdt_to_string(zobj, "Y-m-d H:i:s.u");
case PHP_PQ_OID_TIMESTAMP:
return php_pqdt_to_string(zobj, "Y-m-d H:i:s.u");
@@
-133,7
+131,7
@@
static int apply_to_param_from_array(zval *zparam, void *arg_ptr)
zval ztype, rv;
ZVAL_LONG(&ztype, arg->type);
zval ztype, rv;
ZVAL_LONG(&ztype, arg->type);
-
zend_call_method_with_2_params(arg->zconv, NULL, NULL, "converttostring"
, &rv, zparam, &ztype);
+
php_pq_call_method(arg->zconv, "converttostring", 2
, &rv, zparam, &ztype);
tmpstr = zval_get_string(&rv);
zval_ptr_dtor(&rv);
goto append_string;
tmpstr = zval_get_string(&rv);
zval_ptr_dtor(&rv);
goto append_string;
@@
-207,10
+205,10
@@
static zend_string *array_param_to_string(php_pq_params_t *p, zval *zarr, Oid ty
struct apply_to_param_from_array_arg arg = {NULL};
switch (type) {
struct apply_to_param_from_array_arg arg = {NULL};
switch (type) {
-#if
PHP_PQ_HAVE_PHP_JSON_H && defined(PHP_PQ_OID_JSON)
-#
ifdef PHP_PQ_OID_JSONB
+#if
def PHP_PQ_OID_JSON
+# ifdef PHP_PQ_OID_JSONB
case PHP_PQ_OID_JSONB:
case PHP_PQ_OID_JSONB:
-#
endif
+# endif
case PHP_PQ_OID_JSON:
php_json_encode(&s, zarr, PHP_JSON_UNESCAPED_UNICODE);
break;
case PHP_PQ_OID_JSON:
php_json_encode(&s, zarr, PHP_JSON_UNESCAPED_UNICODE);
break;
@@
-243,7
+241,7
@@
static void php_pq_params_set_param(php_pq_params_t *p, unsigned index, zval *zp
ZVAL_NULL(&rv);
ZVAL_LONG(&ztype, type);
ZVAL_NULL(&rv);
ZVAL_LONG(&ztype, type);
-
zend_call_method_with_2_params(zconv, NULL, NULL, "converttostring"
, &rv, zpp, &ztype);
+
php_pq_call_method(zconv, "converttostring", 2
, &rv, zpp, &ztype);
convert_to_string(&rv);
p->param.strings[index] = Z_STRVAL_P(&rv);
zend_hash_next_index_insert(&p->param.dtor, &rv);
convert_to_string(&rv);
p->param.strings[index] = Z_STRVAL_P(&rv);
zend_hash_next_index_insert(&p->param.dtor, &rv);
@@
-307,7
+305,8
@@
static int apply_to_params(zval *zp, void *arg_ptr)
{
struct apply_to_params_arg *arg = arg_ptr;
{
struct apply_to_params_arg *arg = arg_ptr;
- SEPARATE_ZVAL_IF_NOT_REF(zp);
+ ZVAL_DEREF(zp);
+ SEPARATE_ZVAL(zp);
php_pq_params_set_param(arg->params, arg->index++, zp);
return ZEND_HASH_APPLY_KEEP;
}
php_pq_params_set_param(arg->params, arg->index++, zp);
return ZEND_HASH_APPLY_KEEP;
}