{"id":1279,"date":"2015-01-07T11:24:59","date_gmt":"2015-01-07T11:24:59","guid":{"rendered":"https:\/\/ibex.tech\/visualcpp\/?p=1279"},"modified":"2022-02-17T06:24:03","modified_gmt":"2022-02-17T06:24:03","slug":"insert-queries","status":"publish","type":"post","link":"https:\/\/ibex.tech\/visualcpp\/databases\/sqlite\/queries\/insert-queries","title":{"rendered":"INSERT Queries"},"content":{"rendered":"<h4>\nINSERT Example<br \/>\n<\/h4>\n<pre>\r\n<code>\r\n\tString ^sTemp = &quot;INSERT INTO myTable (\t\\\r\n\t\t\t\t\tSomeValueColumn,\t\\\r\n\t\t\t\t\tSomeStringColumn\t\\\r\n\t\t\t\t) Values (\t\t\t\t\t\\\r\n\t\t\t\t@SomeValue,\t\t\t\t\t\\\r\n\t\t\t\t@SomeString\t\t\t\t\t\\\r\n\t\t\t\t)&quot;;\r\n\tCommand1-&gt;CommandText = sTemp;\r\n\t\/\/Strings should be added as parameters to avoid sanatisation risks unless you know they are safe.\r\n\t\/\/Other values can be added as parameters too or inline in the INSERT text.\r\n\tCommand1-&gt;Parameters-&gt;AddWithValue(&quot;@SomeValue&quot;, 1234);\r\n\tCommand1-&gt;Parameters-&gt;AddWithValue(&quot;@SomeString&quot;, &quot;Hello&quot;);\r\n\r\n\tCommand1-&gt;ExecuteNonQuery();\r\n<\/code><\/pre>\n<h4>\nINSERT OR REPLACE<br \/>\n<\/h4>\n<p>\nAdd if it doesn&#39;t exist or update if it does already exist\n<\/p>\n<pre>\r\n<code>\r\n\tINSERT OR REPLACE INTO table(column_a, column_b) VALUES(value_a, value_b);\r\n<\/code><\/pre>\n<p>\n&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>INSERT Example String ^sTemp = &quot;INSERT INTO myTable ( \\ SomeValueColumn, \\ SomeStringColumn \\ ) Values ( \\ @SomeValue, \\ @SomeString \\ )&quot;; Command1-&gt;CommandText = sTemp; \/\/Strings should be added as parameters to avoid sanatisation risks unless you know they are safe. \/\/Other values can be added as parameters too or inline in the INSERT [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[110],"tags":[],"class_list":["post-1279","post","type-post","status-publish","format-standard","hentry","category-queries"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/1279","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/comments?post=1279"}],"version-history":[{"count":2,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/1279\/revisions"}],"predecessor-version":[{"id":1467,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/1279\/revisions\/1467"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/media?parent=1279"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/categories?post=1279"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/tags?post=1279"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}