{"id":1830,"date":"2022-08-30T15:19:48","date_gmt":"2022-08-30T15:19:48","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/12\/02\/app-gets-force-close-upon-running-an-sql-query-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:19:48","modified_gmt":"2022-08-30T15:19:48","slug":"app-gets-force-close-upon-running-an-sql-query-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/app-gets-force-close-upon-running-an-sql-query-collection-of-common-programming-errors\/","title":{"rendered":"App gets Force Close upon running an SQL query-Collection of common programming errors"},"content":{"rendered":"<p>You should create queries like this:<\/p>\n<pre><code>Cursor c = db.rawQuery(\"SELECT * FROM  sharelist  WHERE category=?\", \n                       new String[] {category});\n<\/code><\/pre>\n<p>This will do the proper quoting for you and save you from SQL injections attacks.<\/p>\n<p>Also, whenever you see a Force Close, there is an unhandled Exception associated with it. You can see that in the LogCat (this is available in Eclipse&#8217;s Debug perspective). The type and the message of the Exception are invaluable information for debugging the error.<\/p>\n<p id=\"rop\"><small>Originally posted 2013-12-02 20:56:32. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>You should create queries like this: Cursor c = db.rawQuery(&#8220;SELECT * FROM sharelist WHERE category=?&#8221;, new String[] {category}); This will do the proper quoting for you and save you from SQL injections attacks. Also, whenever you see a Force Close, there is an unhandled Exception associated with it. You can see that in the LogCat [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1830","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1830","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1830"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1830\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1830"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1830"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1830"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}