{"action":"created","issue":{"url":"https://api.github.com/repos/praeclarum/sqlite-net/issues/390","labels_url":"https://api.github.com/repos/praeclarum/sqlite-net/issues/390/labels{/name}","comments_url":"https://api.github.com/repos/praeclarum/sqlite-net/issues/390/comments","events_url":"https://api.github.com/repos/praeclarum/sqlite-net/issues/390/events","html_url":"https://github.com/praeclarum/sqlite-net/issues/390","id":108309048,"number":390,"title":"any way to Query without Mapping?","user":{"login":"osrufung","id":583458,"avatar_url":"https://avatars.githubusercontent.com/u/583458?v=3","gravatar_id":"","url":"https://api.github.com/users/osrufung","html_url":"https://github.com/osrufung","followers_url":"https://api.github.com/users/osrufung/followers","following_url":"https://api.github.com/users/osrufung/following{/other_user}","gists_url":"https://api.github.com/users/osrufung/gists{/gist_id}","starred_url":"https://api.github.com/users/osrufung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/osrufung/subscriptions","organizations_url":"https://api.github.com/users/osrufung/orgs","repos_url":"https://api.github.com/users/osrufung/repos","events_url":"https://api.github.com/users/osrufung/events{/privacy}","received_events_url":"https://api.github.com/users/osrufung/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-25T11:40:22Z","updated_at":"2015-10-08T19:26:12Z","closed_at":null,"body":"I don't know the Database structure in runtime, so I need a way to query the rows and cols without an existent Class Mapping. Any idea? Thanks!"},"comment":{"url":"https://api.github.com/repos/praeclarum/sqlite-net/issues/comments/146662552","html_url":"https://github.com/praeclarum/sqlite-net/issues/390#issuecomment-146662552","issue_url":"https://api.github.com/repos/praeclarum/sqlite-net/issues/390","id":146662552,"user":{"login":"JosephMichels","id":4354636,"avatar_url":"https://avatars.githubusercontent.com/u/4354636?v=3","gravatar_id":"","url":"https://api.github.com/users/JosephMichels","html_url":"https://github.com/JosephMichels","followers_url":"https://api.github.com/users/JosephMichels/followers","following_url":"https://api.github.com/users/JosephMichels/following{/other_user}","gists_url":"https://api.github.com/users/JosephMichels/gists{/gist_id}","starred_url":"https://api.github.com/users/JosephMichels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JosephMichels/subscriptions","organizations_url":"https://api.github.com/users/JosephMichels/orgs","repos_url":"https://api.github.com/users/JosephMichels/repos","events_url":"https://api.github.com/users/JosephMichels/events{/privacy}","received_events_url":"https://api.github.com/users/JosephMichels/received_events","type":"User","site_admin":false},"created_at":"2015-10-08T19:26:12Z","updated_at":"2015-10-08T19:26:12Z","body":"There doesn't appear to be anything built in, but I added the following function that returns the results of queries as an object array. I mainly did this for performance reasons, but it could easily be adapted for your purposes.\r\n\r\n(Note that for my specific query, I only needed to handle the Text and Int datatypes)\r\n\r\nIn the SQLiteCommand class:\r\n\r\n        public IEnumerable<object[]> ExecuteUntypedQuery()\r\n        {\r\n            if (_conn.Trace)\r\n            {\r\n                Debug.WriteLine(\"Executing Query: \" + this);\r\n            }\r\n\r\n            var stmt = Prepare();\r\n            var cols = SQLite3.ColumnCount(stmt);\r\n            try\r\n            {\r\n                while (SQLite3.Step(stmt) == SQLite3.Result.Row)\r\n                {\r\n                    object[] result = new object[cols];\r\n                    for (int i = 0; i < cols; i++)\r\n                    {\r\n                        var colType = SQLite3.ColumnType(stmt, i);\r\n                        if(colType == SQLite3.ColType.Integer)\r\n                            result[i] = SQLite3.ColumnInt(stmt,i);\r\n                        else if(colType == SQLite3.ColType.Text)\r\n                            result[i] = SQLite3.ColumnString(stmt,i);\r\n                    }\r\n                    yield return (object[])result;\r\n                }\r\n            }\r\n            finally\r\n            {\r\n                SQLite3.Finalize(stmt);\r\n            }\r\n        }\r\n\r\nAnd then the following function in SQLiteConnection to expose the query command:\r\n\r\n        public List<object[]> Query(string query, params object[] args)\r\n        {\r\n            var cmd = CreateCommand(query, args);\r\n            return cmd.ExecuteUntypedQuery().ToList<object[]>();\r\n        }"}}