{"action":"created","issue":{"url":"https://api.github.com/repos/blackbeam/rust-mysql-simple/issues/19","labels_url":"https://api.github.com/repos/blackbeam/rust-mysql-simple/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/blackbeam/rust-mysql-simple/issues/19/comments","events_url":"https://api.github.com/repos/blackbeam/rust-mysql-simple/issues/19/events","html_url":"https://github.com/blackbeam/rust-mysql-simple/issues/19","id":96807657,"number":19,"title":"Wrong implementation of from_value called","user":{"login":"asib","id":8368500,"avatar_url":"https://avatars.githubusercontent.com/u/8368500?v=3","gravatar_id":"","url":"https://api.github.com/users/asib","html_url":"https://github.com/asib","followers_url":"https://api.github.com/users/asib/followers","following_url":"https://api.github.com/users/asib/following{/other_user}","gists_url":"https://api.github.com/users/asib/gists{/gist_id}","starred_url":"https://api.github.com/users/asib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asib/subscriptions","organizations_url":"https://api.github.com/users/asib/orgs","repos_url":"https://api.github.com/users/asib/repos","events_url":"https://api.github.com/users/asib/events{/privacy}","received_events_url":"https://api.github.com/users/asib/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-23T12:58:49Z","updated_at":"2015-07-23T13:34:50Z","closed_at":"2015-07-23T13:02:46Z","body":"I have the following code to run a `SELECT` query and map the result to a struct vec:\r\n\r\n```rust\r\n#[derive(Debug, PartialEq, Eq)]\r\nstruct Terminal {\r\n    did: u64,\r\n    tid: String,\r\n    rn_cd: u32,\r\n    rn_a: u32,\r\n}\r\n\r\npool.prep_exec(\"SELECT d.id, d_v.tid \\\r\n    FROM d_v \\\r\n    INNER JOIN d on d_v.o_d_id = d.id \\\r\n    WHERE d_v.t_is_i = 1 \\\r\n    AND d.active = 1\", ())\r\n.map(|result| {\r\n    result.map(|x| x.unwrap()).map(|mut row| {\r\n        Terminal {\r\n            did: from_value::<u64>(row.pop().unwrap()),\r\n            tid: from_value::<String>(row.pop().unwrap()),\r\n            rn_cn: 0,\r\n            rn_a: 0,\r\n        }\r\n    }).collect()\r\n}).unwrap();\r\n```\r\n\r\nWhen I run this, the program panics with `Error retrieving String from value`. If I change the first line of the query to `SELECT CONVERT(d.id, CHAR) as id, d_v.tid \\`, then this doesn't happen and the program runs fine.\r\n\r\nSo my question is, why does it appear that the `String` implementation of `from_value` is being called for the first column, when I'm explicitly calling the `u64` implementation with `from_value::<u64>()`?"},"comment":{"url":"https://api.github.com/repos/blackbeam/rust-mysql-simple/issues/comments/124101743","html_url":"https://github.com/blackbeam/rust-mysql-simple/issues/19#issuecomment-124101743","issue_url":"https://api.github.com/repos/blackbeam/rust-mysql-simple/issues/19","id":124101743,"user":{"login":"blackbeam","id":155883,"avatar_url":"https://avatars.githubusercontent.com/u/155883?v=3","gravatar_id":"","url":"https://api.github.com/users/blackbeam","html_url":"https://github.com/blackbeam","followers_url":"https://api.github.com/users/blackbeam/followers","following_url":"https://api.github.com/users/blackbeam/following{/other_user}","gists_url":"https://api.github.com/users/blackbeam/gists{/gist_id}","starred_url":"https://api.github.com/users/blackbeam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blackbeam/subscriptions","organizations_url":"https://api.github.com/users/blackbeam/orgs","repos_url":"https://api.github.com/users/blackbeam/repos","events_url":"https://api.github.com/users/blackbeam/events{/privacy}","received_events_url":"https://api.github.com/users/blackbeam/received_events","type":"User","site_admin":false},"created_at":"2015-07-23T13:34:50Z","updated_at":"2015-07-23T13:34:50Z","body":"I have plans to provide `FromRow` trait to solve this."}}