}
php_pqdt_from_string(zv, NULL, str->val, str->len, "Y-m-d", NULL);
break;
-
+#ifdef PHP_PQ_OID_ABSTIME
case PHP_PQ_OID_ABSTIME:
if (!(res->auto_convert & PHP_PQRES_CONV_DATETIME)) {
goto noconversion;
}
php_pqdt_from_string(zv, NULL, str->val, str->len, "Y-m-d H:i:s", NULL);
break;
-
+#endif
case PHP_PQ_OID_TIMESTAMP:
if (!(res->auto_convert & PHP_PQRES_CONV_DATETIME)) {
goto noconversion;
break;
#if PHP_PQ_HAVE_PHP_JSON_H && defined(PHP_PQ_OID_JSON)
-# ifdef PHP_PQ_OID_JSONB
+# ifdef PHP_PQ_OID_JSONB
case PHP_PQ_OID_JSONB:
-# endif
+# endif
case PHP_PQ_OID_JSON:
if (!(res->auto_convert & PHP_PQRES_CONV_JSON)) {
goto noconversion;
}
}
-static void php_pqres_object_read_diag(zval *object, void *o, zval *return_value)
-{
- php_pqres_object_t *obj = o;
- int i;
- struct {
- char code;
- const char *const name;
- } diag[] = {
-#ifdef PG_DIAG_SEVERITY
- {PG_DIAG_SEVERITY, "severity"},
+#ifndef PG_DIAG_SEVERITY
+# define PG_DIAG_SEVERITY 'S'
#endif
-#ifdef PG_DIAG_SQLSTATE
- {PG_DIAG_SQLSTATE, "sqlstate"},
+#ifndef PG_DIAG_SQLSTATE
+# define PG_DIAG_SQLSTATE 'C'
#endif
-#ifdef PG_DIAG_MESSAGE_PRIMARY
- {PG_DIAG_MESSAGE_PRIMARY, "message_primary"},
+#ifndef PG_DIAG_MESSAGE_PRIMARY
+# define PG_DIAG_MESSAGE_PRIMARY 'M'
#endif
-#ifdef PG_DIAG_MESSAGE_DETAIL
- {PG_DIAG_MESSAGE_DETAIL, "message_detail"},
+#ifndef PG_DIAG_MESSAGE_DETAIL
+# define PG_DIAG_MESSAGE_DETAIL 'D'
#endif
-#ifdef PG_DIAG_MESSAGE_HINT
- {PG_DIAG_MESSAGE_HINT, "message_hint"},
+#ifndef PG_DIAG_MESSAGE_HINT
+# define PG_DIAG_MESSAGE_HINT 'H'
#endif
-#ifdef PG_DIAG_STATEMENT_POSITION
- {PG_DIAG_STATEMENT_POSITION,"statement_position"},
+#ifndef PG_DIAG_STATEMENT_POSITION
+# define PG_DIAG_STATEMENT_POSITION 'P'
#endif
-#ifdef PG_DIAG_INTERNAL_POSITION
- {PG_DIAG_INTERNAL_POSITION, "internal_position"},
+#ifndef PG_DIAG_INTERNAL_POSITION
+# define PG_DIAG_INTERNAL_POSITION 'p'
#endif
-#ifdef PG_DIAG_INTERNAL_QUERY
- {PG_DIAG_INTERNAL_QUERY, "internal_query"},
+#ifndef PG_DIAG_INTERNAL_QUERY
+# define PG_DIAG_INTERNAL_QUERY 'q'
#endif
-#ifdef PG_DIAG_CONTEXT
- {PG_DIAG_CONTEXT, "context"},
+#ifndef PG_DIAG_CONTEXT
+# define PG_DIAG_CONTEXT 'W'
#endif
-#ifdef PG_DIAG_SCHEMA_NAME
- {PG_DIAG_SCHEMA_NAME, "schema_name"},
+#ifndef PG_DIAG_SCHEMA_NAME
+# define PG_DIAG_SCHEMA_NAME 's'
#endif
-#ifdef PG_DIAG_TABLE_NAME
- {PG_DIAG_TABLE_NAME, "table_name"},
+#ifndef PG_DIAG_TABLE_NAME
+# define PG_DIAG_TABLE_NAME 't'
#endif
-#ifdef PG_DIAG_COLUMN_NAME
- {PG_DIAG_COLUMN_NAME, "column_name"},
+#ifndef PG_DIAG_COLUMN_NAME
+# define PG_DIAG_COLUMN_NAME 'c'
#endif
-#ifdef PG_DIAG_DATATYPE_NAME
- {PG_DIAG_DATATYPE_NAME, "datatype_name"},
+#ifndef PG_DIAG_DATATYPE_NAME
+# define PG_DIAG_DATATYPE_NAME 'd'
#endif
-#ifdef PG_DIAG_CONSTRAINT_NAME
- {PG_DIAG_CONSTRAINT_NAME, "constraint_name"},
+#ifndef PG_DIAG_CONSTRAINT_NAME
+# define PG_DIAG_CONSTRAINT_NAME 'n'
#endif
-#ifdef PG_DIAG_SOURCE_FILE
- {PG_DIAG_SOURCE_FILE, "source_file"},
+#ifndef PG_DIAG_SOURCE_FILE
+# define PG_DIAG_SOURCE_FILE 'F'
#endif
-#ifdef PG_DIAG_SOURCE_LINE
- {PG_DIAG_SOURCE_LINE, "source_line"},
+#ifndef PG_DIAG_SOURCE_LINE
+# define PG_DIAG_SOURCE_LINE 'L'
#endif
-#ifdef PG_DIAG_SOURCE_FUNCTION
- {PG_DIAG_SOURCE_FUNCTION, "source_function"},
+#ifndef PG_DIAG_SOURCE_FUNCTION
+# define PG_DIAG_SOURCE_FUNCTION 'R'
#endif
+
+static void php_pqres_object_read_diag(zval *object, void *o, zval *return_value)
+{
+ php_pqres_object_t *obj = o;
+ int i;
+ struct {
+ char code;
+ const char *const name;
+ } diag[] = {
+ {PG_DIAG_SEVERITY, "severity"},
+ {PG_DIAG_SQLSTATE, "sqlstate"},
+ {PG_DIAG_MESSAGE_PRIMARY, "message_primary"},
+ {PG_DIAG_MESSAGE_DETAIL, "message_detail"},
+ {PG_DIAG_MESSAGE_HINT, "message_hint"},
+ {PG_DIAG_STATEMENT_POSITION,"statement_position"},
+ {PG_DIAG_INTERNAL_POSITION, "internal_position"},
+ {PG_DIAG_INTERNAL_QUERY, "internal_query"},
+ {PG_DIAG_CONTEXT, "context"},
+ {PG_DIAG_SCHEMA_NAME, "schema_name"},
+ {PG_DIAG_TABLE_NAME, "table_name"},
+ {PG_DIAG_COLUMN_NAME, "column_name"},
+ {PG_DIAG_DATATYPE_NAME, "datatype_name"},
+ {PG_DIAG_CONSTRAINT_NAME, "constraint_name"},
+ {PG_DIAG_SOURCE_FILE, "source_file"},
+ {PG_DIAG_SOURCE_LINE, "source_line"},
+ {PG_DIAG_SOURCE_FUNCTION, "source_function"},
};
array_init_size(return_value, 32);
php_pqres_object_handlers.read_property = php_pq_object_read_prop;
php_pqres_object_handlers.write_property = php_pq_object_write_prop;
php_pqres_object_handlers.clone_obj = NULL;
- php_pqres_object_handlers.get_property_ptr_ptr = NULL;
+ php_pqres_object_handlers.get_property_ptr_ptr = php_pq_object_get_prop_ptr_null;
php_pqres_object_handlers.get_gc = php_pq_object_get_gc;
php_pqres_object_handlers.get_debug_info = php_pq_object_debug_info;
php_pqres_object_handlers.get_properties = php_pq_object_properties;