{"id":90,"date":"2007-06-21T03:54:20","date_gmt":"2007-06-21T01:54:20","guid":{"rendered":"http:\/\/appinf.com\/poco\/blog\/?p=90"},"modified":"2007-06-21T03:54:20","modified_gmt":"2007-06-21T01:54:20","slug":"the-latest-on-data","status":"publish","type":"post","link":"https:\/\/pocoproject.org\/blog\/?p=90","title":{"rendered":"The latest on Data"},"content":{"rendered":"<p>The latest is null support. Not being able to insert\/update and check for nulls was an important shortcoming, so I have pushed it ahead of Unicode.<\/p>\n<p>Now, the following works:<\/p>\n<pre class=\"codelisting\">ses &lt;&lt; \"CREATE TABLE NullTest (i INTEGER)\", now;\nses &lt;&lt; \"INSERT INTO NullTest VALUES(:i)\", use(null), now;\nRecordSet rs(ses, \"SELECT * FROM NullTest\");\nrs.moveFirst();\nassert (rs.isNull(\"i\"));\nassert (rs[\"i\"] == 0);<\/pre>\n<p><strong>Update:<\/strong> the commented portion in italics does not apply anymore (see the reply below)<\/p>\n<p>\/*<\/p>\n<p><em>SQLite is a bit more gracious than ODBC and will accept generic null value. For ODBC, the difference is that when inserting\/updating null fileds, data type has to be specified, so the above code looks like this:<\/em><\/p>\n<pre class=\"codelisting\"><em>ses &lt;&lt; \"INSERT INTO NullTest VALUES(?)\", use(NULL_INT32), now;<\/em><\/pre>\n<p><em>The rest is the same. ODBC code will work for SQLite (which will gracefully take any of NullData enum values), while the other way around is not true &#8211; ODBC will throw up when fed the generic one.<\/em><\/p>\n<p>*\/<\/p>\n<p>Code is in SVN, tested on windows with all supported drivers and Linux with PostgreSQL. Comments and bug reports are welcome.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The latest is null support. Not being able to insert\/update and check for nulls was an important shortcoming, so I have pushed it ahead of Unicode. Now, the following works: ses &lt;&lt; &#8220;CREATE TABLE NullTest (i INTEGER)&#8221;, now; ses &lt;&lt; &#8220;INSERT INTO NullTest VALUES(:i)&#8221;, use(null), now; RecordSet rs(ses, &#8220;SELECT * FROM NullTest&#8221;); rs.moveFirst(); assert (rs.isNull(&#8220;i&#8221;)); [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-90","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/pocoproject.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/90","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pocoproject.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pocoproject.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pocoproject.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/pocoproject.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=90"}],"version-history":[{"count":0,"href":"https:\/\/pocoproject.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/90\/revisions"}],"wp:attachment":[{"href":"https:\/\/pocoproject.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=90"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pocoproject.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=90"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pocoproject.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=90"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}