{"id":374,"date":"2018-03-18T16:43:55","date_gmt":"2018-03-18T15:43:55","guid":{"rendered":"https:\/\/asdw.de\/scriptcase-sc_exec_sql-mit-fehlerbehandlung\/"},"modified":"2018-03-18T16:54:00","modified_gmt":"2018-03-18T15:54:00","slug":"scriptcase-sc_exec_sql-with_error_handling","status":"publish","type":"post","link":"https:\/\/asdw.de\/en\/scriptcase-sc_exec_sql-with_error_handling\/","title":{"rendered":"Scriptcase sc_exec_sql with error handling"},"content":{"rendered":"<h2>sc_exec_sql with error handling<\/h2>\n<p>The macro\u00a0<span class=\"lang:php decode:true crayon-inline\">sc_exec_sql()\u00a0<\/span>\u00a0is used in Scriptcase to execute SQL commands. Unfortunately it does not return errors when executed.<\/p>\n<p>As another way the macro\u00a0<span class=\"lang:php decode:true crayon-inline \">sc_select()<\/span>\u00a0 can be used to execute SQL commands.<br \/>\nAnd it is abe to return (and analyse) the errors.<\/p>\n<p><strong>Hint:<\/strong> sc_select can be used to execute ANY SQL commands, not only to select data.<\/p>\n<p>If you want to execute SQL-commands as UPDATE, INSERT,DELETE,&#8230; just ignore any returned data. Only check if the {recordset} equals false.<\/p>\n<p>Sample:<\/p>\n<pre class=\"lang:php decode:true\" title=\"sc_select als Ersatz von sc_exec_sql mit Fehlerbehandlung\">if ({my_data} === false)\r\n{\r\n\techo \"SQL error. Message =\". {my_data_erro};\r\n}\r\n<\/pre>\n<p><a href=\"https:\/\/asdw.de\/wp-content\/uploads\/2018\/03\/sc_exec_sql_with_error_handling.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-371\" src=\"https:\/\/asdw.de\/wp-content\/uploads\/2018\/03\/sc_exec_sql_with_error_handling.png\" alt=\"Replace Scriptcases's sc_exec_sql with sc_select for error handling\" width=\"816\" height=\"484\" srcset=\"https:\/\/asdw.de\/wp-content\/uploads\/2018\/03\/sc_exec_sql_with_error_handling.png 816w, https:\/\/asdw.de\/wp-content\/uploads\/2018\/03\/sc_exec_sql_with_error_handling-300x178.png 300w, https:\/\/asdw.de\/wp-content\/uploads\/2018\/03\/sc_exec_sql_with_error_handling-768x456.png 768w, https:\/\/asdw.de\/wp-content\/uploads\/2018\/03\/sc_exec_sql_with_error_handling-600x356.png 600w, https:\/\/asdw.de\/wp-content\/uploads\/2018\/03\/sc_exec_sql_with_error_handling-100x59.png 100w, https:\/\/asdw.de\/wp-content\/uploads\/2018\/03\/sc_exec_sql_with_error_handling-150x89.png 150w, https:\/\/asdw.de\/wp-content\/uploads\/2018\/03\/sc_exec_sql_with_error_handling-200x119.png 200w, https:\/\/asdw.de\/wp-content\/uploads\/2018\/03\/sc_exec_sql_with_error_handling-450x267.png 450w\" sizes=\"(max-width: 816px) 100vw, 816px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>sc_exec_sql with error handling The macro\u00a0sc_exec_sql()\u00a0\u00a0is used in Scriptcase to execute SQL commands. Unfortunately it does not return errors when executed. As another way the macro\u00a0sc_select()\u00a0 can be used to execute SQL commands. And it is abe to return (and<span class=\"ellipsis\">&hellip;<\/span><\/p>\n<div class=\"read-more\"><a href=\"https:\/\/asdw.de\/en\/scriptcase-sc_exec_sql-with_error_handling\/\">Read more &#8250;<\/a><\/div>\n<p><!-- end of .read-more --><\/p>\n","protected":false},"author":2,"featured_media":372,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[55],"tags":[116,121,50,118,119,120],"_links":{"self":[{"href":"https:\/\/asdw.de\/en\/wp-json\/wp\/v2\/posts\/374"}],"collection":[{"href":"https:\/\/asdw.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/asdw.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/asdw.de\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/asdw.de\/en\/wp-json\/wp\/v2\/comments?post=374"}],"version-history":[{"count":4,"href":"https:\/\/asdw.de\/en\/wp-json\/wp\/v2\/posts\/374\/revisions"}],"predecessor-version":[{"id":378,"href":"https:\/\/asdw.de\/en\/wp-json\/wp\/v2\/posts\/374\/revisions\/378"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/asdw.de\/en\/wp-json\/wp\/v2\/media\/372"}],"wp:attachment":[{"href":"https:\/\/asdw.de\/en\/wp-json\/wp\/v2\/media?parent=374"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/asdw.de\/en\/wp-json\/wp\/v2\/categories?post=374"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/asdw.de\/en\/wp-json\/wp\/v2\/tags?post=374"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}