diff --git a/connector/php/tarantool.c b/connector/php/tarantool.c index 90283c99eca2dac7b483b672cfab449212b49572..e28f70396bb3b106558b01358048ab6013327984 100644 --- a/connector/php/tarantool.c +++ b/connector/php/tarantool.c @@ -125,8 +125,12 @@ struct tnt_call_request { struct tnt_response { /* return code */ int32_t return_code; - /* count */ - int32_t count; + union { + /* count */ + int32_t count; + /* error message */ + char return_msg[0]; + }; } __attribute__((packed)); @@ -585,7 +589,10 @@ PHP_METHOD(tarantool_class, select) if (response->return_code) { /* error happen, throw exceprion */ zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_DC, - "select failed: %"PRIi32, response->return_code); + "select failed: %"PRIi32"(0x%08"PRIx32"): %s", + response->return_code, + response->return_code, + response->return_msg); return; } @@ -703,7 +710,10 @@ PHP_METHOD(tarantool_class, insert) if (response->return_code) { /* error happen, throw exceprion */ zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_DC, - "insert failed: %"PRIi32, response->return_code); + "insert failed: %"PRIi32"(0x%08"PRIx32"): %s", + response->return_code, + response->return_code, + response->return_msg); return; } @@ -947,7 +957,10 @@ PHP_METHOD(tarantool_class, update_fields) if (response->return_code) { /* error happen, throw exceprion */ zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_DC, - "update fields failed: %"PRIi32, response->return_code); + "update fields failed: %"PRIi32"(0x%08"PRIx32"): %s", + response->return_code, + response->return_code, + response->return_msg); return; } @@ -1059,7 +1072,10 @@ PHP_METHOD(tarantool_class, delete) if (response->return_code) { /* error happen, throw exceprion */ zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_DC, - "delete failed: %"PRIi32, response->return_code); + "delete failed: %"PRIi32"(0x%08"PRIx32"): %s", + response->return_code, + response->return_code, + response->return_msg); return; } @@ -1174,7 +1190,10 @@ PHP_METHOD(tarantool_class, call) if (response->return_code) { /* error happen, throw exceprion */ zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_DC, - "call failed: %"PRIi32, response->return_code); + "call failed: %"PRIi32"(0x%08"PRIx32"): %s", + response->return_code, + response->return_code, + response->return_msg); return; } diff --git a/connector/php/test/call.phpt b/connector/php/test/call.phpt index 5a28f0a8dc269adbdeec9982aaf3bf121d4ef86d..3268d55592bf02929e9eaac240fd940ce6a2d521 100644 --- a/connector/php/test/call.phpt +++ b/connector/php/test/call.phpt @@ -87,7 +87,7 @@ freedom to the galaxy.... ---------- test begin ---------- test call: call undefined function (expected error exception) -catched exception: call failed: 12802 +catched exception: call failed: 12802(0x00003202): Procedure 'fafagaga' is not defined ----------- test end ----------- ===DONE=== \ No newline at end of file diff --git a/connector/php/test/delete.phpt b/connector/php/test/delete.phpt index 7b37a7ba936391dfdbb190b03f973298d84997ae..62586978956e68a8b6de033eefffc6157149516b 100644 --- a/connector/php/test/delete.phpt +++ b/connector/php/test/delete.phpt @@ -54,7 +54,7 @@ catched exception: unsupported field type ---------- test begin ---------- test delete: invalid key (expected error exception) -catched exception: delete failed: 514 +catched exception: delete failed: 514(0x00000202): Illegal parameters, key must be single valued ----------- test end ----------- ---------- test begin ---------- diff --git a/connector/php/test/insert.phpt b/connector/php/test/insert.phpt index 047db2a297a2fc4ff1d2e04b283f1d7ff4290247..20a8512b60a35b044c4c423f9825ffe11340ff28 100644 --- a/connector/php/test/insert.phpt +++ b/connector/php/test/insert.phpt @@ -100,12 +100,12 @@ count = 1 ---------- test begin ---------- test insert: add existed tuple (expected error exception) -catched exception: insert failed: 14082 +catched exception: insert failed: 14082(0x00003702): Tuple already exists ----------- test end ----------- ---------- test begin ---------- test insert: replace not existed tuple (expected error exception) -catched exception: insert failed: 12546 +catched exception: insert failed: 12546(0x00003102): Tuple doesn't exist ----------- test end ----------- ---------- test begin ---------- diff --git a/connector/php/test/lib/php/tarantool_utest.php b/connector/php/test/lib/php/tarantool_utest.php index 6371d7cef1f8a0cf725ea244cacc4e927d350959..7e4de7aac4254120fd12ff7b2a8907694c97f552 100644 --- a/connector/php/test/lib/php/tarantool_utest.php +++ b/connector/php/test/lib/php/tarantool_utest.php @@ -160,9 +160,9 @@ function test_delete($tarantool, $space_no, $key, $flags) { } } -function test_call($tarantool, $proc, $key, $flags) { +function test_call($tarantool, $proc, $tuple_args, $flags) { try { - $result = $tarantool->call($proc, $key, $flags); + $result = $tarantool->call($proc, $tuple_args, $flags); echo "result:\n"; echo "count = ", $result["count"], "\n"; $tuples_list = $result["tuples_list"]; diff --git a/connector/php/test/update_fields.phpt b/connector/php/test/update_fields.phpt index d9a02ef0413f7d1f1767a8163e91279f25e4d861..620a7e4cc770ee280f204f7e28323b0dac7b500a 100644 --- a/connector/php/test/update_fields.phpt +++ b/connector/php/test/update_fields.phpt @@ -57,7 +57,7 @@ test_clean($tarantool, 0); --EXPECT-- ---------- test begin ---------- test update fields: do update w/o operations (expected error exception) -catched exception: update fields failed: 514 +catched exception: update fields failed: 514(0x00000202): Illegal parameters, no operations for update ----------- test end ----------- ---------- test begin ----------