{"id":2977,"date":"2013-01-16T23:49:02","date_gmt":"2013-01-17T07:49:02","guid":{"rendered":"http:\/\/www.mysqltutorial.org\/?page_id=2977"},"modified":"2023-09-24T21:10:33","modified_gmt":"2023-09-25T04:10:33","slug":"perl-mysql-transaction","status":"publish","type":"page","link":"https:\/\/www.mysqltutorial.org\/perl-mysql\/perl-mysql-transaction\/","title":{"rendered":"Perl MySQL Transaction"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you will learn how to handle database transactions by using Perl DBI to ensure the integrity of the data.<\/p>\n\n\n\n<p>By definition, a database <a href=\"https:\/\/www.mysqltutorial.org\/mysql-stored-procedure\/mysql-transactions\/\">transaction<\/a> is a set of SQL statements that execute in an all-or-nothing manner. If all SQL statements are executed successfully, the transaction is considered to be successful. A failure of any SQL statement will cause the system to roll back to its original state to prevent data inconsistency.<\/p>\n\n\n\n<p>A database transaction must be A.C.I.D, which is atomic, consistent, isolated, and durable:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Atomic<\/strong>: the operations against the database must either all occur, or nothing occurs. This helps avoid data inconsistency by a partial update.<\/li>\n\n\n\n<li><strong>Consistent<\/strong>: to make sure that the transaction does not violate the integrity constraints.<\/li>\n\n\n\n<li><strong>Isolated<\/strong>: to make sure that the change made by one operation becomes visible to other concurrent operations.<\/li>\n\n\n\n<li><strong>Durable<\/strong>: to ensure that the committed transactions will survive permanently.<\/li>\n<\/ul>\n\n\n\n<p>Perl DBI provides a set of APIs that allows you to deal with transactions effectively. To handle transactions in Perl DBI, you do the following steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Set <code>AutoCommit<\/code> attribute to <code>false<\/code> to enable the transaction.<\/li>\n\n\n\n<li>Execute operations in an <code>eval<\/code> block, at the end of the <code>eval<\/code> block, call the&nbsp; <code>commit()<\/code> method of the database handle object to commit the changes.<\/li>\n\n\n\n<li>Check the variable&nbsp; <code>$@<\/code> for error and call the&nbsp; <code>rollback()<\/code> method of the database to roll back the changes if an error occurred.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Perl MySQL Transaction example<\/h2>\n\n\n\n<p>In this example, we will:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Insert a new link into the <code>links<\/code> table; get the <a href=\"https:\/\/www.mysqltutorial.org\/mysql-functions\/mysql-last_insert_id\/\">last insert id<\/a> of the inserted link.<\/li>\n\n\n\n<li>Insert a new tag into the <code>tags<\/code> table; get the last insert id of the inserted tag.<\/li>\n\n\n\n<li>Associate the inserted link and tag by adding a new row to the&nbsp; <code>link_tags<\/code> table with the link id and tag id from the first and second operations.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"461\" height=\"160\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/06\/Perl-MySQL-Create-Table-Sample-Tables.png\" alt=\"Perl MySQL Transaction - Sample Tables\" class=\"wp-image-2948\" title=\"Perl MySQL Transaction - Sample Tables\" srcset=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/06\/Perl-MySQL-Create-Table-Sample-Tables.png 461w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/06\/Perl-MySQL-Create-Table-Sample-Tables-300x104.png 300w\" sizes=\"auto, (max-width: 461px) 100vw, 461px\" \/><\/figure>\n<\/div>\n\n\n<p>We will wrap the three operations inside a transaction. The following script illustrates how to handle the transaction using Perl DBI:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"Perl\" data-shcb-language-slug=\"perl\"><span><code class=\"hljs language-perl\"><span class=\"hljs-comment\">#!\/usr\/bin\/perl<\/span>\n<span class=\"hljs-keyword\">use<\/span> strict;\n<span class=\"hljs-keyword\">use<\/span> warnings;\n<span class=\"hljs-keyword\">use<\/span> v5.<span class=\"hljs-number\">10<\/span>; <span class=\"hljs-comment\"># for say() function<\/span>\n\n<span class=\"hljs-keyword\">use<\/span> DBI;\n\n<span class=\"hljs-keyword\">say<\/span> <span class=\"hljs-string\">\"Perl MySQL Transaction Demo\"<\/span>;\n\n<span class=\"hljs-comment\"># MySQL database configurations<\/span>\n<span class=\"hljs-keyword\">my<\/span> $dsn = <span class=\"hljs-string\">\"DBI:mysql:perlmysqldb\"<\/span>;\n<span class=\"hljs-keyword\">my<\/span> $username = <span class=\"hljs-string\">\"root\"<\/span>;\n<span class=\"hljs-keyword\">my<\/span> $password = <span class=\"hljs-string\">''<\/span>;\n\n<span class=\"hljs-comment\"># connect to MySQL database<\/span>\n<span class=\"hljs-keyword\">my<\/span> %attr = (<span class=\"hljs-string\">RaiseError=&gt;<\/span><span class=\"hljs-number\">1<\/span>,  <span class=\"hljs-comment\"># error handling enabled <\/span>\n\t    <span class=\"hljs-string\">AutoCommit=&gt;<\/span><span class=\"hljs-number\">0<\/span>); <span class=\"hljs-comment\"># transaction enabled<\/span>\n\n<span class=\"hljs-keyword\">my<\/span> $dbh = DBI-&gt;<span class=\"hljs-keyword\">connect<\/span>($dsn,$username,$password, \\%attr);\n\n<span class=\"hljs-keyword\">eval<\/span>{\n\t<span class=\"hljs-comment\"># insert a new link<\/span>\n\t<span class=\"hljs-keyword\">my<\/span> $sql = <span class=\"hljs-string\">\"INSERT INTO links(title,url,target)\n\t\t   VALUES(?,?,?)\"<\/span>;\n\t<span class=\"hljs-keyword\">my<\/span> $sth = $dbh-&gt;prepare($sql);\n\t$sth-&gt;execute(<span class=\"hljs-string\">\"Comprehensive Perl Archive Network\"<\/span>,<span class=\"hljs-string\">\"http:\/\/www.cpan.org\/\"<\/span>,<span class=\"hljs-string\">\"_blank\"<\/span>);\n\t<span class=\"hljs-comment\"># get last insert id of the link<\/span>\n\t<span class=\"hljs-keyword\">my<\/span> $link_id = $dbh-&gt;{<span class=\"hljs-string\">q{mysql_insertid}<\/span>};\n\n\t<span class=\"hljs-comment\"># insert a new tag<\/span>\n\t$sql = <span class=\"hljs-string\">\"INSERT INTO tags(tag) VALUES(?)\"<\/span>;\n\t$sth = $dbh-&gt;prepare($sql);\n\t$sth-&gt;execute(<span class=\"hljs-string\">'Perl'<\/span>);\n\n\t<span class=\"hljs-comment\"># get last insert id of the tag<\/span>\n\t<span class=\"hljs-keyword\">my<\/span> $tag_id = $dbh-&gt;{<span class=\"hljs-string\">q{mysql_insertid}<\/span>};\n\n\t<span class=\"hljs-comment\"># insert a new link and tag relationship<\/span>\n\t$sql = <span class=\"hljs-string\">\"INSERT INTO link_tags(link_id,tag_id)\n\t\tVALUES(?,?)\"<\/span>;\n\t$sth = $dbh-&gt;prepare($sql);\n\t$sth-&gt;execute($link_id,$tag_id);\n\n\t<span class=\"hljs-comment\"># if everything is OK, commit to the database<\/span>\n\t$dbh-&gt;commit();\n\t<span class=\"hljs-keyword\">say<\/span> <span class=\"hljs-string\">\"Link and tag have been inserted and associated successfully!\"<\/span>;\n};\n\n<span class=\"hljs-keyword\">if<\/span>($@){\n\t<span class=\"hljs-keyword\">say<\/span> <span class=\"hljs-string\">\"Error inserting the link and tag: $@\"<\/span>;\n\t$dbh-&gt;rollback();\n}\n\n<span class=\"hljs-comment\"># disconnect from the MySQL database<\/span>\n$dbh-&gt;disconnect();<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Perl<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">perl<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Notice that the&nbsp; <code>$dbh-&gt;{q{mysql_insertid}}<\/code> expression returns the last insert id.<\/p>\n\n\n\n<p>The following is the output of the script:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">Perl MySQL Transaction Demo\nLink and tag have been inserted and associated successfully!<\/code><\/span><\/pre>\n\n\n<p>We can verify the transaction by querying the <code>links<\/code> , <code>tags<\/code> and&nbsp; <code>link_tags<\/code> tables:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> * <span class=\"hljs-keyword\">FROM<\/span> links;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"591\" height=\"127\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/01\/perl-mysql-transaction-links-table.png\" alt=\"perl mysql transaction - links table\" class=\"wp-image-2980\" srcset=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/01\/perl-mysql-transaction-links-table.png 591w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/01\/perl-mysql-transaction-links-table-300x64.png 300w\" sizes=\"auto, (max-width: 591px) 100vw, 591px\" \/><\/figure>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> * <span class=\"hljs-keyword\">FROM<\/span> tags;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"134\" height=\"41\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/01\/perl-mysql-transaction-tags-table.png\" alt=\"perl mysql transaction - tags table\" class=\"wp-image-2981\"\/><\/figure>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> * <span class=\"hljs-keyword\">FROM<\/span> link_tags;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>It works.<\/p>\n\n\n\n<p>In this tutorial, we have shown you how to handle MySQL database transactions in Perl by using the&nbsp; <code>commit()<\/code> and&nbsp; <code>rollback()<\/code> methods of the database handle object.<\/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=\"2977\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/perl-mysql\/perl-mysql-transaction\/\"\n\t\t\t\tdata-post-title=\"Perl MySQL Transaction\"\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=\"2977\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/perl-mysql\/perl-mysql-transaction\/\"\n\t\t\t\tdata-post-title=\"Perl MySQL Transaction\"\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 handle database transaction using Perl DBI API to ensure the data integrity of the data.<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":2938,"menu_order":3,"comment_status":"open","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-2977","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Perl MySQL Transaction Tutorial<\/title>\n<meta name=\"description\" content=\"In this Perl MySQL transaction tutorial, you will learn how to handle database transactions using Perl DBI API to ensure the integrity of the data.\" \/>\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.mysqltutorial.org\/perl-mysql\/perl-mysql-transaction\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Perl MySQL Transaction Tutorial\" \/>\n<meta property=\"og:description\" content=\"In this Perl MySQL transaction tutorial, you will learn how to handle database transactions using Perl DBI API to ensure the integrity of the data.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mysqltutorial.org\/perl-mysql\/perl-mysql-transaction\/\" \/>\n<meta property=\"og:site_name\" content=\"MySQL Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2023-09-25T04:10:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/06\/Perl-MySQL-Create-Table-Sample-Tables.png\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/perl-mysql\\\/perl-mysql-transaction\\\/\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/perl-mysql\\\/perl-mysql-transaction\\\/\",\"name\":\"Perl MySQL Transaction Tutorial\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/perl-mysql\\\/perl-mysql-transaction\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/perl-mysql\\\/perl-mysql-transaction\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2013\\\/06\\\/Perl-MySQL-Create-Table-Sample-Tables.png\",\"datePublished\":\"2013-01-17T07:49:02+00:00\",\"dateModified\":\"2023-09-25T04:10:33+00:00\",\"description\":\"In this Perl MySQL transaction tutorial, you will learn how to handle database transactions using Perl DBI API to ensure the integrity of the data.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/perl-mysql\\\/perl-mysql-transaction\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mysqltutorial.org\\\/perl-mysql\\\/perl-mysql-transaction\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/perl-mysql\\\/perl-mysql-transaction\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2013\\\/06\\\/Perl-MySQL-Create-Table-Sample-Tables.png\",\"contentUrl\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2013\\\/06\\\/Perl-MySQL-Create-Table-Sample-Tables.png\",\"width\":461,\"height\":160,\"caption\":\"Perl MySQL Transaction - Sample Tables\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/perl-mysql\\\/perl-mysql-transaction\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Perl MySQL Tutorial\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/perl-mysql\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Perl MySQL Transaction\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\",\"name\":\"MySQL Tutorial\",\"description\":\"A comprehensive MySQL Tutorial\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mysqltutorial.org\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Perl MySQL Transaction Tutorial","description":"In this Perl MySQL transaction tutorial, you will learn how to handle database transactions using Perl DBI API to ensure the integrity of the data.","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.mysqltutorial.org\/perl-mysql\/perl-mysql-transaction\/","og_locale":"en_US","og_type":"article","og_title":"Perl MySQL Transaction Tutorial","og_description":"In this Perl MySQL transaction tutorial, you will learn how to handle database transactions using Perl DBI API to ensure the integrity of the data.","og_url":"https:\/\/www.mysqltutorial.org\/perl-mysql\/perl-mysql-transaction\/","og_site_name":"MySQL Tutorial","article_modified_time":"2023-09-25T04:10:33+00:00","og_image":[{"url":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/06\/Perl-MySQL-Create-Table-Sample-Tables.png","type":"","width":"","height":""}],"twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.mysqltutorial.org\/perl-mysql\/perl-mysql-transaction\/","url":"https:\/\/www.mysqltutorial.org\/perl-mysql\/perl-mysql-transaction\/","name":"Perl MySQL Transaction Tutorial","isPartOf":{"@id":"https:\/\/www.mysqltutorial.org\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mysqltutorial.org\/perl-mysql\/perl-mysql-transaction\/#primaryimage"},"image":{"@id":"https:\/\/www.mysqltutorial.org\/perl-mysql\/perl-mysql-transaction\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/06\/Perl-MySQL-Create-Table-Sample-Tables.png","datePublished":"2013-01-17T07:49:02+00:00","dateModified":"2023-09-25T04:10:33+00:00","description":"In this Perl MySQL transaction tutorial, you will learn how to handle database transactions using Perl DBI API to ensure the integrity of the data.","breadcrumb":{"@id":"https:\/\/www.mysqltutorial.org\/perl-mysql\/perl-mysql-transaction\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mysqltutorial.org\/perl-mysql\/perl-mysql-transaction\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mysqltutorial.org\/perl-mysql\/perl-mysql-transaction\/#primaryimage","url":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/06\/Perl-MySQL-Create-Table-Sample-Tables.png","contentUrl":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/06\/Perl-MySQL-Create-Table-Sample-Tables.png","width":461,"height":160,"caption":"Perl MySQL Transaction - Sample Tables"},{"@type":"BreadcrumbList","@id":"https:\/\/www.mysqltutorial.org\/perl-mysql\/perl-mysql-transaction\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.mysqltutorial.org\/"},{"@type":"ListItem","position":2,"name":"Perl MySQL Tutorial","item":"https:\/\/www.mysqltutorial.org\/perl-mysql\/"},{"@type":"ListItem","position":3,"name":"Perl MySQL Transaction"}]},{"@type":"WebSite","@id":"https:\/\/www.mysqltutorial.org\/#website","url":"https:\/\/www.mysqltutorial.org\/","name":"MySQL Tutorial","description":"A comprehensive MySQL Tutorial","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mysqltutorial.org\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/2977","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/comments?post=2977"}],"version-history":[{"count":1,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/2977\/revisions"}],"predecessor-version":[{"id":10578,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/2977\/revisions\/10578"}],"up":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/2938"}],"wp:attachment":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/media?parent=2977"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}