{"action":"created","issue":{"url":"https://api.github.com/repos/php/php-src/issues/2635","repository_url":"https://api.github.com/repos/php/php-src","labels_url":"https://api.github.com/repos/php/php-src/issues/2635/labels{/name}","comments_url":"https://api.github.com/repos/php/php-src/issues/2635/comments","events_url":"https://api.github.com/repos/php/php-src/issues/2635/events","html_url":"https://github.com/php/php-src/pull/2635","id":243222653,"number":2635,"title":"fix return of mysql_handle_commit","user":{"login":"yaoguais","id":6268554,"avatar_url":"https://avatars2.githubusercontent.com/u/6268554?v=4","gravatar_id":"","url":"https://api.github.com/users/yaoguais","html_url":"https://github.com/yaoguais","followers_url":"https://api.github.com/users/yaoguais/followers","following_url":"https://api.github.com/users/yaoguais/following{/other_user}","gists_url":"https://api.github.com/users/yaoguais/gists{/gist_id}","starred_url":"https://api.github.com/users/yaoguais/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yaoguais/subscriptions","organizations_url":"https://api.github.com/users/yaoguais/orgs","repos_url":"https://api.github.com/users/yaoguais/repos","events_url":"https://api.github.com/users/yaoguais/events{/privacy}","received_events_url":"https://api.github.com/users/yaoguais/received_events","type":"User","site_admin":false},"labels":[{"id":148912728,"url":"https://api.github.com/repos/php/php-src/labels/Quickfix","name":"Quickfix","color":"fef2c0","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-07-16T07:18:03Z","updated_at":"2017-07-18T19:47:01Z","closed_at":"2017-07-18T19:47:01Z","pull_request":{"url":"https://api.github.com/repos/php/php-src/pulls/2635","html_url":"https://github.com/php/php-src/pull/2635","diff_url":"https://github.com/php/php-src/pull/2635.diff","patch_url":"https://github.com/php/php-src/pull/2635.patch"},"body":"We use the distributed database TIDB, which is compatible with the mysql protocol, but it uses an optimistic transaction model that will cause COMMIT to return an error. But the mysql_handle_commit () function does not distinguish between this error.\r\n\r\nmysql_commit() return enum_func_status, and it cause mysql_handle_commit() always return 1.\r\n\r\n```\r\ntypedef enum func_status\r\n{\r\n\tPASS = 0,\r\n\tFAIL = 1\r\n} enum_func_status;\r\n\r\nstatic int mysql_handle_commit(pdo_dbh_t *dbh)\r\n{\r\n\tPDO_DBG_ENTER(\"mysql_handle_commit\");\r\n\tPDO_DBG_INF_FMT(\"dbh=%p\", dbh);\r\n#if MYSQL_VERSION_ID >= 40100 || defined(PDO_USE_MYSQLND)\r\n\tPDO_DBG_RETURN(0 <= mysql_commit(((pdo_mysql_db_handle *)dbh->driver_data)->server));\r\n#else\r\n\tPDO_DBG_RETURN(0 <= mysql_handle_doer(dbh, ZEND_STRL(\"COMMIT\")));\r\n#endif\r\n}\r\n```\r\n\r\n[here is the log of mysqlnd](https://github.com/yaoguais/cabin/blob/master/tidb/trans_test/mysqlnd.trace.2.separate/27579.log#L648)\r\n\r\nIt really return \"FAIL\", but mysql_handle_commit() return 1.\r\n\r\nThen PDO will not throw an exception, and it cause an error."},"comment":{"url":"https://api.github.com/repos/php/php-src/issues/comments/316176750","html_url":"https://github.com/php/php-src/pull/2635#issuecomment-316176750","issue_url":"https://api.github.com/repos/php/php-src/issues/2635","id":316176750,"user":{"login":"nikic","id":216080,"avatar_url":"https://avatars3.githubusercontent.com/u/216080?v=4","gravatar_id":"","url":"https://api.github.com/users/nikic","html_url":"https://github.com/nikic","followers_url":"https://api.github.com/users/nikic/followers","following_url":"https://api.github.com/users/nikic/following{/other_user}","gists_url":"https://api.github.com/users/nikic/gists{/gist_id}","starred_url":"https://api.github.com/users/nikic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikic/subscriptions","organizations_url":"https://api.github.com/users/nikic/orgs","repos_url":"https://api.github.com/users/nikic/repos","events_url":"https://api.github.com/users/nikic/events{/privacy}","received_events_url":"https://api.github.com/users/nikic/received_events","type":"User","site_admin":false},"created_at":"2017-07-18T19:47:01Z","updated_at":"2017-07-18T19:47:01Z","body":"Merged as https://github.com/php/php-src/commit/51cdd3dc50af88461d83aec0fac1dca83400b58f into 7.0+. Thanks!"}}
{"actor":{"display_login":"nikic"}}