{"id":1253,"date":"2017-06-26T11:36:14","date_gmt":"2017-06-26T04:36:14","guid":{"rendered":"http:\/\/www.sqlitetutorial.net\/?page_id=1253"},"modified":"2024-10-27T16:41:18","modified_gmt":"2024-10-27T09:41:18","slug":"controlling-execution-flow-statements","status":"publish","type":"page","link":"https:\/\/www.sqlitetutorial.net\/sqlite-nodejs\/statements-control-flow\/","title":{"rendered":"Controlling the Execution Flow of Statements"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you will learn how to control the execution flow of SQL statements from Node.js.<\/p>\n\n\n\n<p>The <code>sqlite3<\/code> module provides you with two methods for controlling the execution flow of statements:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The <code>serialize()<\/code> method allows you to execute statements in <em>serialized mode<\/em>.<\/li>\n\n\n\n<li>The <code>parallelize()<\/code> method executes the statements in <em>parallel mode<\/em>.<\/li>\n<\/ul>\n\n\n\n<p>Let&#8217;s look into each method in detail to understand how it works.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Executing SQL statements in serialized mode<\/h2>\n\n\n\n<p>The <code>serialize()<\/code> method puts the execution mode into serialized mode. It means that only one statement can be executed at a time. Other statements have to wait in a queue until all the previous statements are completed.<\/p>\n\n\n\n<p>After the <code>serialize()<\/code> method returns, the execution mode is set to the original mode again.<\/p>\n\n\n\n<p>It is safe to nest the <code>serialize()<\/code> method as follows:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">db.serialize(<span class=\"hljs-function\"><span class=\"hljs-params\">()<\/span> =&gt;<\/span> {\n  <span class=\"hljs-comment\">\/\/ queries will execute in serialized mode<\/span>\n  db.serialize(<span class=\"hljs-function\"><span class=\"hljs-params\">()<\/span> =&gt;<\/span> {\n    <span class=\"hljs-comment\">\/\/ queries will execute in serialized mode<\/span>\n  });\n  <span class=\"hljs-comment\">\/\/ queries will execute in serialized mode<\/span>\n});\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Suppose you want to execute the following three statements in sequence:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Create a new table.<\/li>\n\n\n\n<li>Insert data into the table.<\/li>\n\n\n\n<li>Query data from the table.<\/li>\n<\/ol>\n\n\n\n<p>To do this, you place these statements in the <code>serialize()<\/code> method as follows:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const<\/span> sqlite3 = <span class=\"hljs-built_in\">require<\/span>(<span class=\"hljs-string\">'sqlite3'<\/span>).verbose();\n\n<span class=\"hljs-comment\">\/\/ open the database connection<\/span>\n<span class=\"hljs-keyword\">let<\/span> db = <span class=\"hljs-keyword\">new<\/span> sqlite3.Database(<span class=\"hljs-string\">':memory:'<\/span>, (err) =&gt; {\n  <span class=\"hljs-keyword\">if<\/span> (err) {\n    <span class=\"hljs-built_in\">console<\/span>.error(err.message);\n  }\n});\n\ndb.serialize(<span class=\"hljs-function\"><span class=\"hljs-params\">()<\/span> =&gt;<\/span> {\n  <span class=\"hljs-comment\">\/\/ Queries scheduled here will be serialized.<\/span>\n  db.run(<span class=\"hljs-string\">'CREATE TABLE greetings(message text)'<\/span>)\n    .run(<span class=\"hljs-string\">`INSERT INTO greetings(message)\n          VALUES('Hi'),\n                ('Hello'),\n                ('Welcome')`<\/span>)\n    .each(<span class=\"hljs-string\">`SELECT message FROM greetings`<\/span>, (err, row) =&gt; {\n      <span class=\"hljs-keyword\">if<\/span> (err){\n        <span class=\"hljs-keyword\">throw<\/span> err;\n      }\n      <span class=\"hljs-built_in\">console<\/span>.log(row.message);\n    });\n});\n\n<span class=\"hljs-comment\">\/\/ close the database connection<\/span>\ndb.close(<span class=\"hljs-function\">(<span class=\"hljs-params\">err<\/span>) =&gt;<\/span> {\n  <span class=\"hljs-keyword\">if<\/span> (err) {\n    <span class=\"hljs-keyword\">return<\/span> <span class=\"hljs-built_in\">console<\/span>.error(err.message);\n  }\n});\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Because the <code>run()<\/code> method returns a <code>Database<\/code> object so that we could chain the method calls.<\/p>\n\n\n\n<p>Let&#8217;s run the program to see how it works.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">node<\/span> <span class=\"hljs-selector-tag\">serialize<\/span><span class=\"hljs-selector-class\">.js<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">Hi\nHello\nWelcome<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Notice that if you don&#8217;t place three statements in the <code>serialize()<\/code> method, all three statements may execute in parallel which would cause an error.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Executing SQL statements in parallel mode<\/h2>\n\n\n\n<p>If you want the scheduled queries to execute in parallel, you place them in the <code>parallelize()<\/code> method.<\/p>\n\n\n\n<p>Similar to the <code>serialize()<\/code> method, it is safe to nest the <code>parallelize()<\/code> method as follows:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">db.parallelize(<span class=\"hljs-function\"><span class=\"hljs-params\">()<\/span> =&gt;<\/span> {\n  <span class=\"hljs-comment\">\/\/ queries will execute in parallel mode<\/span>\n  db.parallelize(<span class=\"hljs-function\"><span class=\"hljs-params\">()<\/span> =&gt;<\/span> {\n    <span class=\"hljs-comment\">\/\/ queries will execute in parallel mode<\/span>\n  });\n  <span class=\"hljs-comment\">\/\/ queries will execute in parallel mode<\/span>\n});\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>For the demonstration, we will create a new function that calculates the sum of two numbers using SQLite database and place the function calls in the <code>parallelize()<\/code> method as shown in the following example:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">const<\/span> sqlite3 = <span class=\"hljs-built_in\">require<\/span>(<span class=\"hljs-string\">'sqlite3'<\/span>).verbose();\n\n<span class=\"hljs-comment\">\/\/ open a database connection<\/span>\n<span class=\"hljs-keyword\">let<\/span> db = <span class=\"hljs-keyword\">new<\/span> sqlite3.Database(<span class=\"hljs-string\">':memory:'<\/span>, (err) =&gt; {\n  <span class=\"hljs-keyword\">if<\/span> (err) {\n    <span class=\"hljs-built_in\">console<\/span>.error(err.message);\n  }\n});\n\ndb.parallelize(<span class=\"hljs-function\"><span class=\"hljs-params\">()<\/span> =&gt;<\/span> {\n  dbSum(<span class=\"hljs-number\">1<\/span>, <span class=\"hljs-number\">1<\/span>, db);\n  dbSum(<span class=\"hljs-number\">2<\/span>, <span class=\"hljs-number\">2<\/span>, db);\n  dbSum(<span class=\"hljs-number\">3<\/span>, <span class=\"hljs-number\">3<\/span>, db);\n  dbSum(<span class=\"hljs-number\">4<\/span>, <span class=\"hljs-number\">4<\/span>, db);\n  dbSum(<span class=\"hljs-number\">5<\/span>, <span class=\"hljs-number\">5<\/span>, db);\n});\n\n<span class=\"hljs-comment\">\/\/ close the database connection<\/span>\ndb.close(<span class=\"hljs-function\">(<span class=\"hljs-params\">err<\/span>) =&gt;<\/span> {\n  <span class=\"hljs-keyword\">if<\/span> (err) {\n    <span class=\"hljs-keyword\">return<\/span> <span class=\"hljs-built_in\">console<\/span>.error(err.message);\n  }\n});\n\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">dbSum<\/span>(<span class=\"hljs-params\">a, b, db<\/span>) <\/span>{\n  db.get(<span class=\"hljs-string\">'SELECT (? + ?) sum'<\/span>, &#91;a, b], (err, row) =&gt; {\n    <span class=\"hljs-keyword\">if<\/span> (err) {\n      <span class=\"hljs-built_in\">console<\/span>.error(err.message);\n    }\n    <span class=\"hljs-built_in\">console<\/span>.log(<span class=\"hljs-string\">`The sum of <span class=\"hljs-subst\">${a}<\/span> and <span class=\"hljs-subst\">${b}<\/span> is <span class=\"hljs-subst\">${row.sum}<\/span>`<\/span>);\n  });\n}\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Let&#8217;s run the <code>parallelize.js<\/code> program.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">node<\/span> <span class=\"hljs-selector-tag\">parallelize<\/span><span class=\"hljs-selector-class\">.js<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">The sum <span class=\"hljs-keyword\">of<\/span> <span class=\"hljs-number\">5<\/span> and <span class=\"hljs-number\">5<\/span> is <span class=\"hljs-number\">10<\/span>\nThe sum <span class=\"hljs-keyword\">of<\/span> <span class=\"hljs-number\">1<\/span> and <span class=\"hljs-number\">1<\/span> is <span class=\"hljs-number\">2<\/span>\nThe sum <span class=\"hljs-keyword\">of<\/span> <span class=\"hljs-number\">4<\/span> and <span class=\"hljs-number\">4<\/span> is <span class=\"hljs-number\">8<\/span>\nThe sum <span class=\"hljs-keyword\">of<\/span> <span class=\"hljs-number\">3<\/span> and <span class=\"hljs-number\">3<\/span> is <span class=\"hljs-number\">6<\/span>\nThe sum <span class=\"hljs-keyword\">of<\/span> <span class=\"hljs-number\">2<\/span> and <span class=\"hljs-number\">2<\/span> is <span class=\"hljs-number\">4<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The output shows that the execution order differs from the order in which the statements were called in the program.<\/p>\n\n\n\n<p>Note that the statements execute in parallel, so each time you run the program, the order of execution may vary.<\/p>\n\n\n\n<p>In this tutorial, you have learned how to control the execution flow of the statements.<\/p>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful ?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"1253\"\n\t\t\t\tdata-post-url=\"https:\/\/www.sqlitetutorial.net\/sqlite-nodejs\/statements-control-flow\/\"\n\t\t\t\tdata-post-title=\"Controlling the Execution Flow of Statements\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"1253\"\n\t\t\t\tdata-post-url=\"https:\/\/www.sqlitetutorial.net\/sqlite-nodejs\/statements-control-flow\/\"\n\t\t\t\tdata-post-title=\"Controlling the Execution Flow of Statements\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\n\t\t\t<button class=\"btn btn-primary wth-btn-submit\">Send<\/button>\n\t\t\t<button class=\"btn wth-btn-cancel\">Cancel<\/button>\n\t\t\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you will learn how to control the execution flow of SQL statements from Node.js.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1244,"menu_order":6,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1253","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>SQLite Node.js: Controlling the Execution Flow of Statements<\/title>\n<meta name=\"description\" content=\"In this tutorial, you will learn how to control the execution flow of SQL statements from Node.js.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlitetutorial.net\/sqlite-nodejs\/statements-control-flow\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQLite Node.js: Controlling the Execution Flow of Statements\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, you will learn how to control the execution flow of SQL statements from Node.js.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlitetutorial.net\/sqlite-nodejs\/statements-control-flow\/\" \/>\n<meta property=\"og:site_name\" content=\"SQLite Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2024-10-27T09:41:18+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-nodejs\/statements-control-flow\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-nodejs\/statements-control-flow\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/www.sqlitetutorial.net\/#\/schema\/person\/6d69b968cad0102e30d6694ed8dc6427\"},\"headline\":\"Controlling the Execution Flow of Statements\",\"datePublished\":\"2017-06-26T04:36:14+00:00\",\"dateModified\":\"2024-10-27T09:41:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-nodejs\/statements-control-flow\/\"},\"wordCount\":350,\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-nodejs\/statements-control-flow\/\",\"url\":\"https:\/\/www.sqlitetutorial.net\/sqlite-nodejs\/statements-control-flow\/\",\"name\":\"SQLite Node.js: Controlling the Execution Flow of Statements\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlitetutorial.net\/#website\"},\"datePublished\":\"2017-06-26T04:36:14+00:00\",\"dateModified\":\"2024-10-27T09:41:18+00:00\",\"description\":\"In this tutorial, you will learn how to control the execution flow of SQL statements from Node.js.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-nodejs\/statements-control-flow\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlitetutorial.net\/sqlite-nodejs\/statements-control-flow\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlitetutorial.net\/sqlite-nodejs\/statements-control-flow\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlitetutorial.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQLite Node.js\",\"item\":\"https:\/\/www.sqlitetutorial.net\/sqlite-nodejs\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Controlling the Execution Flow of Statements\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlitetutorial.net\/#website\",\"url\":\"https:\/\/www.sqlitetutorial.net\/\",\"name\":\"SQLite Tutorial\",\"description\":\"A Step-by-step SQLite Tutorial\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlitetutorial.net\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqlitetutorial.net\/#\/schema\/person\/6d69b968cad0102e30d6694ed8dc6427\",\"name\":\"admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SQLite Node.js: Controlling the Execution Flow of Statements","description":"In this tutorial, you will learn how to control the execution flow of SQL statements from Node.js.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sqlitetutorial.net\/sqlite-nodejs\/statements-control-flow\/","og_locale":"en_US","og_type":"article","og_title":"SQLite Node.js: Controlling the Execution Flow of Statements","og_description":"In this tutorial, you will learn how to control the execution flow of SQL statements from Node.js.","og_url":"https:\/\/www.sqlitetutorial.net\/sqlite-nodejs\/statements-control-flow\/","og_site_name":"SQLite Tutorial","article_modified_time":"2024-10-27T09:41:18+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.sqlitetutorial.net\/sqlite-nodejs\/statements-control-flow\/#article","isPartOf":{"@id":"https:\/\/www.sqlitetutorial.net\/sqlite-nodejs\/statements-control-flow\/"},"author":{"name":"admin","@id":"https:\/\/www.sqlitetutorial.net\/#\/schema\/person\/6d69b968cad0102e30d6694ed8dc6427"},"headline":"Controlling the Execution Flow of Statements","datePublished":"2017-06-26T04:36:14+00:00","dateModified":"2024-10-27T09:41:18+00:00","mainEntityOfPage":{"@id":"https:\/\/www.sqlitetutorial.net\/sqlite-nodejs\/statements-control-flow\/"},"wordCount":350,"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.sqlitetutorial.net\/sqlite-nodejs\/statements-control-flow\/","url":"https:\/\/www.sqlitetutorial.net\/sqlite-nodejs\/statements-control-flow\/","name":"SQLite Node.js: Controlling the Execution Flow of Statements","isPartOf":{"@id":"https:\/\/www.sqlitetutorial.net\/#website"},"datePublished":"2017-06-26T04:36:14+00:00","dateModified":"2024-10-27T09:41:18+00:00","description":"In this tutorial, you will learn how to control the execution flow of SQL statements from Node.js.","breadcrumb":{"@id":"https:\/\/www.sqlitetutorial.net\/sqlite-nodejs\/statements-control-flow\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlitetutorial.net\/sqlite-nodejs\/statements-control-flow\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlitetutorial.net\/sqlite-nodejs\/statements-control-flow\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlitetutorial.net\/"},{"@type":"ListItem","position":2,"name":"SQLite Node.js","item":"https:\/\/www.sqlitetutorial.net\/sqlite-nodejs\/"},{"@type":"ListItem","position":3,"name":"Controlling the Execution Flow of Statements"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlitetutorial.net\/#website","url":"https:\/\/www.sqlitetutorial.net\/","name":"SQLite Tutorial","description":"A Step-by-step SQLite Tutorial","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlitetutorial.net\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlitetutorial.net\/#\/schema\/person\/6d69b968cad0102e30d6694ed8dc6427","name":"admin"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlitetutorial.net\/wp-json\/wp\/v2\/pages\/1253","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlitetutorial.net\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.sqlitetutorial.net\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlitetutorial.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlitetutorial.net\/wp-json\/wp\/v2\/comments?post=1253"}],"version-history":[{"count":3,"href":"https:\/\/www.sqlitetutorial.net\/wp-json\/wp\/v2\/pages\/1253\/revisions"}],"predecessor-version":[{"id":3895,"href":"https:\/\/www.sqlitetutorial.net\/wp-json\/wp\/v2\/pages\/1253\/revisions\/3895"}],"up":[{"embeddable":true,"href":"https:\/\/www.sqlitetutorial.net\/wp-json\/wp\/v2\/pages\/1244"}],"wp:attachment":[{"href":"https:\/\/www.sqlitetutorial.net\/wp-json\/wp\/v2\/media?parent=1253"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}