better checks for json support
[m6w6/ext-pq] / src / php_pqcopy.c
index a427f07a869b84e38db781ddd6eb2921366fe717..d652ba6ba6a143785b68652d338a89b27b1ccbf8 100644 (file)
@@ -105,7 +105,7 @@ static void php_pqcopy_object_read_options(zval *object, void *o, zval *return_v
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_pqcopy_construct, 0, 0, 3)
-       ZEND_ARG_OBJ_INFO(0, "connection", pq\\Connection, 0)
+       ZEND_ARG_OBJ_INFO(0, connection, pq\\Connection, 0)
        ZEND_ARG_INFO(0, expression)
        ZEND_ARG_INFO(0, direction)
        ZEND_ARG_INFO(0, options)
@@ -192,7 +192,7 @@ static PHP_METHOD(pqcopy, put) {
                if (!obj->intern) {
                        throw_exce(EX_UNINITIALIZED TSRMLS_CC, "pq\\COPY not initialized");
                } else if (obj->intern->direction != PHP_PQCOPY_FROM_STDIN) {
-                       throw_exce(EX_RUNTIME TSRMLS_CC, "pq\\COPY was not initialized with FROM_STDIN");
+                       throw_exce(EX_BAD_METHODCALL TSRMLS_CC, "pq\\COPY was not initialized with FROM_STDIN");
                } else {
                        if (1 != PQputCopyData(obj->intern->conn->intern->conn, data_str, data_len)) {
                                throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to put COPY data (%s)", PHP_PQerrorMessage(obj->intern->conn->intern->conn));
@@ -219,9 +219,9 @@ static PHP_METHOD(pqcopy, end) {
                php_pqcopy_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
 
                if (!obj->intern) {
-                       throw_exce(EX_RUNTIME TSRMLS_CC, "pq\\COPY not intitialized");
+                       throw_exce(EX_UNINITIALIZED TSRMLS_CC, "pq\\COPY not intitialized");
                } else if (obj->intern->direction != PHP_PQCOPY_FROM_STDIN) {
-                       throw_exce(EX_RUNTIME TSRMLS_CC, "pq\\COPY was not intitialized with FROM_STDIN");
+                       throw_exce(EX_BAD_METHODCALL TSRMLS_CC, "pq\\COPY was not intitialized with FROM_STDIN");
                } else {
                        if (1 != PQputCopyEnd(obj->intern->conn->intern->conn, error_str)) {
                                throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to end COPY (%s)", PHP_PQerrorMessage(obj->intern->conn->intern->conn));