{"action":"created","issue":{"url":"https://api.github.com/repos/Azure/elastic-db-tools/issues/148","repository_url":"https://api.github.com/repos/Azure/elastic-db-tools","labels_url":"https://api.github.com/repos/Azure/elastic-db-tools/issues/148/labels{/name}","comments_url":"https://api.github.com/repos/Azure/elastic-db-tools/issues/148/comments","events_url":"https://api.github.com/repos/Azure/elastic-db-tools/issues/148/events","html_url":"https://github.com/Azure/elastic-db-tools/issues/148","id":192725896,"number":148,"title":"MultiShardDataReader Multiple Result Sets","user":{"login":"adminnz","id":1552285,"avatar_url":"https://avatars.githubusercontent.com/u/1552285?v=3","gravatar_id":"","url":"https://api.github.com/users/adminnz","html_url":"https://github.com/adminnz","followers_url":"https://api.github.com/users/adminnz/followers","following_url":"https://api.github.com/users/adminnz/following{/other_user}","gists_url":"https://api.github.com/users/adminnz/gists{/gist_id}","starred_url":"https://api.github.com/users/adminnz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adminnz/subscriptions","organizations_url":"https://api.github.com/users/adminnz/orgs","repos_url":"https://api.github.com/users/adminnz/repos","events_url":"https://api.github.com/users/adminnz/events{/privacy}","received_events_url":"https://api.github.com/users/adminnz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-01T00:56:14Z","updated_at":"2016-12-01T01:36:03Z","closed_at":null,"body":"Could someone explain the reasoning behind not supporting multiple result sets.\r\ne.g. \r\n```\r\nusing (var cnn = new MultiShardConnection(shardmap.GetShards(), credentialString))\r\n{\r\n   using (var cmd = cnn.CreateCommand())\r\n   {\r\n       cmd.CommandText = \"SELECT [Id], [Value] FROM [ValueTable]; SELECT [Id], [Name] FROM [NameTable];\";\r\n       using (var reader = cmd.ExecuteReader())\r\n       {\r\n           while (reader.Read())\r\n           {\r\n               Console.WriteLine(\"Id: {0}, Value: {1}\", reader.GetInt32(0), reader.GetInt32(1));\r\n           }\r\n           if (reader.NextResult())\r\n           {\r\n               while (reader.Read())\r\n               {\r\n                   Console.WriteLine(\"Id: {0}, Name: {1}\", reader.GetInt32(0), reader.GetString(1));\r\n               }\r\n            }\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nI can see internally that your running a ConcurrentQueue and Dequeuing the LabeledDbDataReaders but I'm not sure why you couldn't keep a List<LabeledDbDataReader> of currentlyRead readers once you complete a result set in a reader add it to the List. Then when NextResult() is called move all the readers back to the queue and being reading again."},"comment":{"url":"https://api.github.com/repos/Azure/elastic-db-tools/issues/comments/264052748","html_url":"https://github.com/Azure/elastic-db-tools/issues/148#issuecomment-264052748","issue_url":"https://api.github.com/repos/Azure/elastic-db-tools/issues/148","id":264052748,"user":{"login":"jaredmoo","id":3248887,"avatar_url":"https://avatars.githubusercontent.com/u/3248887?v=3","gravatar_id":"","url":"https://api.github.com/users/jaredmoo","html_url":"https://github.com/jaredmoo","followers_url":"https://api.github.com/users/jaredmoo/followers","following_url":"https://api.github.com/users/jaredmoo/following{/other_user}","gists_url":"https://api.github.com/users/jaredmoo/gists{/gist_id}","starred_url":"https://api.github.com/users/jaredmoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaredmoo/subscriptions","organizations_url":"https://api.github.com/users/jaredmoo/orgs","repos_url":"https://api.github.com/users/jaredmoo/repos","events_url":"https://api.github.com/users/jaredmoo/events{/privacy}","received_events_url":"https://api.github.com/users/jaredmoo/received_events","type":"User","site_admin":false},"created_at":"2016-12-01T01:36:02Z","updated_at":"2016-12-01T01:36:02Z","body":"The idea was to avoid a design where all connections would need to be opened concurrently. If you do a MultiShardCommand against 1000 shards, you don't want to have 1000 ports open for as long as it takes you to read through all the rows.\r\n\r\nI think that currently MultiShardCommand waits for all readers to return before returning the MultiShardReader, but this isn't actually necessary - the command could potentially return the MultiShardReader immediately or after the first reader returns. This would allow a command to run against thousands of shards but potentially only have a single connection open at a time.\r\n\r\nWe haven't implemented this ability, but we designed for the ability to add this at a later date."}}
{"actor":{"display_login":"jaredmoo"}}