{"action":"created","issue":{"url":"https://api.github.com/repos/fsprojects/SQLProvider/issues/256","repository_url":"https://api.github.com/repos/fsprojects/SQLProvider","labels_url":"https://api.github.com/repos/fsprojects/SQLProvider/issues/256/labels{/name}","comments_url":"https://api.github.com/repos/fsprojects/SQLProvider/issues/256/comments","events_url":"https://api.github.com/repos/fsprojects/SQLProvider/issues/256/events","html_url":"https://github.com/fsprojects/SQLProvider/issues/256","id":152035672,"number":256,"title":"\"System.Byte[]\" is inserted as the value of BLOB (MySQL)","user":{"login":"vain0","id":6957032,"avatar_url":"https://avatars.githubusercontent.com/u/6957032?v=3","gravatar_id":"","url":"https://api.github.com/users/vain0","html_url":"https://github.com/vain0","followers_url":"https://api.github.com/users/vain0/followers","following_url":"https://api.github.com/users/vain0/following{/other_user}","gists_url":"https://api.github.com/users/vain0/gists{/gist_id}","starred_url":"https://api.github.com/users/vain0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vain0/subscriptions","organizations_url":"https://api.github.com/users/vain0/orgs","repos_url":"https://api.github.com/users/vain0/repos","events_url":"https://api.github.com/users/vain0/events{/privacy}","received_events_url":"https://api.github.com/users/vain0/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-04-30T15:10:19Z","updated_at":"2016-06-03T07:11:52Z","closed_at":null,"body":"### Repro steps\r\n1. Create a table containing a field of BLOB type. (MySQL)\r\n2. Insert a row into the table with SQLProvider.\r\n\r\nThis is an example.\r\n\r\n```fsharp\r\nopen System.IO\r\nopen FSharp.Data.Sql\r\n\r\ntype sql =\r\n  SqlDataProvider<\r\n      Common.DatabaseProviderTypes.MYSQL\r\n    , ConnectionString  = \"Data Source=localhost; Port=3306; user=root; password=;\"\r\n    , ResolutionPath    = @\"C:/Program Files (x86)/MySQL/MySQL Connector Net 6.9.8/Assemblies/v4.5\"\r\n    , UseOptionTypes    = true\r\n    , Owner             = \"test\"\r\n    >\r\n\r\n[<EntryPoint>]\r\nlet main argv =\r\n  let ctx = sql.GetDataContext()\r\n  let db = ctx.Test\r\n  let item = db.items.Create()\r\n  item.Content <- Array.create 100 (byte 'a')\r\n  ctx.SubmitUpdates()\r\n  0\r\n```\r\n\r\n### Expected behavior\r\n\r\nThe assigned binary data (byte[]) should be inserted as the value of the field.\r\n\r\n### Actual behavior\r\n\r\n\"System.Byte[]\" (13byte) is inserted.\r\n\r\n### Related information \r\n* Windows 10\r\n* SQLProvider 1.0 (from NuGet)\r\n* F#4.0\r\n* .NET framework 4.5\r\n"},"comment":{"url":"https://api.github.com/repos/fsprojects/SQLProvider/issues/comments/223507372","html_url":"https://github.com/fsprojects/SQLProvider/issues/256#issuecomment-223507372","issue_url":"https://api.github.com/repos/fsprojects/SQLProvider/issues/256","id":223507372,"user":{"login":"vain0","id":6957032,"avatar_url":"https://avatars.githubusercontent.com/u/6957032?v=3","gravatar_id":"","url":"https://api.github.com/users/vain0","html_url":"https://github.com/vain0","followers_url":"https://api.github.com/users/vain0/followers","following_url":"https://api.github.com/users/vain0/following{/other_user}","gists_url":"https://api.github.com/users/vain0/gists{/gist_id}","starred_url":"https://api.github.com/users/vain0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vain0/subscriptions","organizations_url":"https://api.github.com/users/vain0/orgs","repos_url":"https://api.github.com/users/vain0/repos","events_url":"https://api.github.com/users/vain0/events{/privacy}","received_events_url":"https://api.github.com/users/vain0/received_events","type":"User","site_admin":false},"created_at":"2016-06-03T07:11:52Z","updated_at":"2016-06-03T07:11:52Z","body":"Thanks for your work.\r\n\r\nNow I should try to insert a blob data by using only MySqlData.dll & Parameters. My script is the following, which succeeded to insert actual value of blob type.\r\n\r\n```fsharp\r\nopen System.Configuration\r\nopen System.Data\r\nopen MySql.Data.MySqlClient\r\n\r\nlet connectionString =\r\n  let b =\r\n    MySqlConnectionStringBuilder\r\n      ( UserID = \"root\"\r\n      , Password = \"\"\r\n      , Server = \"localhost\"\r\n      , Database = \"test\"\r\n      )\r\n  in b.ConnectionString\r\n\r\nlet withDb f =\r\n  use connection = new MySqlConnection(connectionString)\r\n  try\r\n    connection.Open()\r\n    f connection\r\n  finally\r\n    connection.Close()\r\n\r\nlet insert connection =\r\n  let value = Array.create 100 (byte 'a')\r\n  let sql = \"INSERT INTO tests (data) VALUES (@data)\"\r\n  let command = new MySqlCommand(sql, connection)\r\n  command.Parameters.AddWithValue(\"data\", value) |> ignore\r\n  command.ExecuteNonQuery() |> ignore\r\n\r\n[<EntryPoint>]\r\nlet main argv =\r\n  withDb insert\r\n  0\r\n```\r\n"}}
{"actor":{"display_login":"vain0"}}