{"action":"created","issue":{"url":"https://api.github.com/repos/mysql-otp/mysql-otp/issues/81","repository_url":"https://api.github.com/repos/mysql-otp/mysql-otp","labels_url":"https://api.github.com/repos/mysql-otp/mysql-otp/issues/81/labels{/name}","comments_url":"https://api.github.com/repos/mysql-otp/mysql-otp/issues/81/comments","events_url":"https://api.github.com/repos/mysql-otp/mysql-otp/issues/81/events","html_url":"https://github.com/mysql-otp/mysql-otp/issues/81","id":311462249,"number":81,"title":"CHAR/VARCHAR vs BINARY/VARBINARY","user":{"login":"adrianboston","id":1435167,"avatar_url":"https://avatars1.githubusercontent.com/u/1435167?v=4","gravatar_id":"","url":"https://api.github.com/users/adrianboston","html_url":"https://github.com/adrianboston","followers_url":"https://api.github.com/users/adrianboston/followers","following_url":"https://api.github.com/users/adrianboston/following{/other_user}","gists_url":"https://api.github.com/users/adrianboston/gists{/gist_id}","starred_url":"https://api.github.com/users/adrianboston/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adrianboston/subscriptions","organizations_url":"https://api.github.com/users/adrianboston/orgs","repos_url":"https://api.github.com/users/adrianboston/repos","events_url":"https://api.github.com/users/adrianboston/events{/privacy}","received_events_url":"https://api.github.com/users/adrianboston/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-04-05T03:38:13Z","updated_at":"2018-04-05T19:43:47Z","closed_at":null,"author_association":"NONE","body":"Is there a method to accurately distinguish between a `CHAR/VARCHAR` and a `BINARY/VARBINARY` column.\r\n\r\nA `BINARY` column in mysql is often defined as `TYPE_STRING` within mysql-otp (debugging msql_protocol.erl) while `VARBINARY` is often defined as `TYPE_VAR_STRING`.\r\n\r\nThe `type` seems to be determined from the element following the `column` name as shown where the `253` matches to `TYPE_VAR_STRING`.\r\n\r\nColDef={col,<<\"columnname\">>,**253**,33,150,0,0};\r\n\r\nIMPORTANT:\r\nIs the element following the `type` some sort of `sub-type.` As seen, `33` shows up for `CHAR/VARCHAR` while `63` for `BINARY/VARBINARY` columns.\r\nCan anyone confirm this sub-type??\r\n\r\n`CHAR, VARCHAR` and `TEXT` appear to be consistently `33`; while **all** others are `63`.\r\n\r\n\r\nData types according to protocol.hrl\r\n\r\n%% --- Types ---\r\n\r\n-define(TYPE_DECIMAL, 16#00).\r\n-define(TYPE_TINY, 16#01).\r\n-define(TYPE_SHORT, 16#02).\r\n-define(TYPE_LONG, 16#03).\r\n-define(TYPE_FLOAT, 16#04).\r\n-define(TYPE_DOUBLE, 16#05).\r\n-define(TYPE_NULL, 16#06).\r\n-define(TYPE_TIMESTAMP, 16#07).\r\n-define(TYPE_LONGLONG, 16#08).\r\n-define(TYPE_INT24, 16#09).\r\n-define(TYPE_DATE, 16#0a).\r\n-define(TYPE_TIME, 16#0b).\r\n-define(TYPE_DATETIME, 16#0c).\r\n-define(TYPE_YEAR, 16#0d).\r\n-define(TYPE_VARCHAR, 16#0f).\r\n-define(TYPE_BIT, 16#10).\r\n-define(TYPE_JSON, 16#f5).\r\n-define(TYPE_NEWDECIMAL, 16#f6).\r\n-define(TYPE_ENUM, 16#f7).\r\n-define(TYPE_SET, 16#f8).\r\n-define(TYPE_TINY_BLOB, 16#f9).\r\n-define(TYPE_MEDIUM_BLOB, 16#fa).\r\n-define(TYPE_LONG_BLOB, 16#fb).\r\n-define(TYPE_BLOB, 16#fc).\r\n-define(TYPE_VAR_STRING, 16#fd).\r\n-define(TYPE_STRING, 16#fe).\r\n-define(TYPE_GEOMETRY, 16#ff).\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/mysql-otp/mysql-otp/issues/comments/379054217","html_url":"https://github.com/mysql-otp/mysql-otp/issues/81#issuecomment-379054217","issue_url":"https://api.github.com/repos/mysql-otp/mysql-otp/issues/81","id":379054217,"user":{"login":"adrianboston","id":1435167,"avatar_url":"https://avatars1.githubusercontent.com/u/1435167?v=4","gravatar_id":"","url":"https://api.github.com/users/adrianboston","html_url":"https://github.com/adrianboston","followers_url":"https://api.github.com/users/adrianboston/followers","following_url":"https://api.github.com/users/adrianboston/following{/other_user}","gists_url":"https://api.github.com/users/adrianboston/gists{/gist_id}","starred_url":"https://api.github.com/users/adrianboston/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adrianboston/subscriptions","organizations_url":"https://api.github.com/users/adrianboston/orgs","repos_url":"https://api.github.com/users/adrianboston/repos","events_url":"https://api.github.com/users/adrianboston/events{/privacy}","received_events_url":"https://api.github.com/users/adrianboston/received_events","type":"User","site_admin":false},"created_at":"2018-04-05T19:43:47Z","updated_at":"2018-04-05T19:43:47Z","author_association":"NONE","body":"Collation is only applied to CHAR, VARCHAR, or TEXT, according to mysql docs.\r\n\r\nIn other words, `63` seems to be consistent for BINARY/VARBINARY (and INTS, etc), while the `33` is not consistent for any of those 3 columns. Which suggests it is possible to determine the difference.\r\n\r\nsay,\r\n```\r\n-define(TYPE_BINARY, {16#fe, 63}).\r\n-define(TYPE_STRING, {16#fe, _}).\r\n\r\n```"}}
{"actor":{"display_login":"adrianboston"}}