{"id":328,"date":"2021-05-12T06:12:27","date_gmt":"2021-05-12T06:12:27","guid":{"rendered":"https:\/\/randomlinuxnotes.d13.com\/?p=328"},"modified":"2021-05-12T06:12:27","modified_gmt":"2021-05-12T06:12:27","slug":"julia-mysql-mariadb-dbinterface-update","status":"publish","type":"post","link":"https:\/\/randomlinuxnotes.d13.com\/?p=328","title":{"rendered":"julia mysql mariadb dbinterface update"},"content":{"rendered":"<p><a href=\"https:\/\/github.com\/JuliaDatabases\/DBInterface.jl\">https:\/\/github.com\/JuliaDatabases\/DBInterface.jl<\/a>\u00a0 mariadb &#8212; mysql<\/p>\n<p>while doing a query on &#8220;conn&#8221;, I opended second connection &#8220;conn2&#8221;, and updated the table while stepping through the results of the first query<\/p>\n<pre>conn = DBInterface.connect(MySQL.Connection,\"localhost\",\"user\",\"pass\",db=\"foo\")\nsql = \"\"\"select char from foo\"\"\"\nresponse = DBInterface.execute(conn,sql)\nconn2 = DBInterface.connect(MySQL.Connection,\"localhost\",\"user\",\"pass\",db=\"foo\")\nsql2 = DBInterface.prepare(conn2, \"UPDATE foo set agility = ?, bravery = ? where character = ?\")\nfor row in response\n    ag=agility(char)\n    br=bravery(char)\n    DBInterface.execute(sql2, (ag, br, char))\nend<\/pre>\n<p><em>julia complains without the parens around the arguments on the DBInterace.execute line.<br \/>\n<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/github.com\/JuliaDatabases\/DBInterface.jl\u00a0 mariadb &#8212; mysql while doing a query on &#8220;conn&#8221;, I opended second connection &#8220;conn2&#8221;, and updated the table while stepping through the results of the first query conn = DBInterface.connect(MySQL.Connection,&#8221;localhost&#8221;,&#8221;user&#8221;,&#8221;pass&#8221;,db=&#8221;foo&#8221;) sql = &#8220;&#8221;&#8221;select char from foo&#8221;&#8221;&#8221; response = DBInterface.execute(conn,sql) conn2 = DBInterface.connect(MySQL.Connection,&#8221;localhost&#8221;,&#8221;user&#8221;,&#8221;pass&#8221;,db=&#8221;foo&#8221;) sql2 = DBInterface.prepare(conn2, &#8220;UPDATE foo set agility [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[35,64,83,90,146],"class_list":["post-328","post","type-post","status-publish","format-standard","hentry","category-rln","tag-dbinterface","tag-julia","tag-mariadb","tag-mysql","tag-update"],"_links":{"self":[{"href":"https:\/\/randomlinuxnotes.d13.com\/index.php?rest_route=\/wp\/v2\/posts\/328","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/randomlinuxnotes.d13.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/randomlinuxnotes.d13.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/randomlinuxnotes.d13.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/randomlinuxnotes.d13.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=328"}],"version-history":[{"count":0,"href":"https:\/\/randomlinuxnotes.d13.com\/index.php?rest_route=\/wp\/v2\/posts\/328\/revisions"}],"wp:attachment":[{"href":"https:\/\/randomlinuxnotes.d13.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=328"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomlinuxnotes.d13.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=328"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomlinuxnotes.d13.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=328"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}