{"id":7257,"date":"2014-06-03T23:26:03","date_gmt":"2014-06-03T23:26:03","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/06\/03\/unexpected-end_of_input-expecting-mysql-collection-of-common-programming-errors\/"},"modified":"2014-06-03T23:26:03","modified_gmt":"2014-06-03T23:26:03","slug":"unexpected-end_of_input-expecting-mysql-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/06\/03\/unexpected-end_of_input-expecting-mysql-collection-of-common-programming-errors\/","title":{"rendered":"Unexpected end_of_input, expecting &#39;;&#39; mysql-Collection of common programming errors"},"content":{"rendered":"<p>Change your <code>Grant<\/code> command statement preparation like below:<\/p>\n<pre><code>   SELECT\n     CONCAT( 'GRANT ALL ON *.* TO ''',\n             new.nombre,\n             '''@''%'' IDENTIFIED BY ''',\n             new.contrase\u00f1a,\n             ''' WITH GRANT OPTION'\n     ) INTO @temp_grant_sql_string;\n<\/code><\/pre>\n<p>Use prepared statement to execute this generated grant statement;<\/p>\n<pre><code>PREPARE stmt FROM @temp_grant_sql_string;\nEXECUTE stmt;\ndeallocate prepare stmt; -- or drop prepare stmt;\n<\/code><\/pre>\n<p>Let me hope you know about <code>delimiter<\/code> part before registering a stored procedure.<\/p>\n<p>Use: <code>delimiter $$<\/code> before trigger definition. And,<br \/>\nuse: <code>delimiter ;<\/code> after trigger definition, to reset to default.<\/p>\n<p>Finally, your trigger should be reading like this:<\/p>\n<pre><code>delimiter $$;\n\ndrop trigger if exists insertusuario\n$$\n\nCREATE TRIGGER insertusuario BEFORE INSERT ON usuario\n  FOR EACH ROW BEGIN\n   SELECT\n     CONCAT( 'GRANT ALL ON *.* TO ''',\n             new.nombre,\n             '''@''%'' IDENTIFIED BY ''',\n             new.contrase\u00f1a,\n             ''' WITH GRANT OPTION'\n     ) INTO @temp_grant_sql_string;\n\n   PREPARE stmt FROM @temp_grant_sql_string;\n   EXECUTE stmt;\n   DEALLOCATE PREPARE stmt; -- or DROP PREPARE stmt;\n\nEND;\n\n$$\n\ndelimiter ;\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Change your Grant command statement preparation like below: SELECT CONCAT( &#8216;GRANT ALL ON *.* TO &#8221;&#8217;, new.nombre, &#8221;&#8217;@&#8221;%&#8221; IDENTIFIED BY &#8221;&#8217;, new.contrase\u00f1a, &#8221;&#8217; WITH GRANT OPTION&#8217; ) INTO @temp_grant_sql_string; Use prepared statement to execute this generated grant statement; PREPARE stmt FROM @temp_grant_sql_string; EXECUTE stmt; deallocate prepare stmt; &#8212; or drop prepare stmt; Let me hope [&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-7257","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7257","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=7257"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7257\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7257"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7257"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7257"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}