{"id":1236,"date":"2013-07-15T15:54:18","date_gmt":"2013-07-15T15:54:18","guid":{"rendered":"https:\/\/clarionsharp.com\/blog\/?p=1236"},"modified":"2013-07-15T15:54:18","modified_gmt":"2013-07-15T15:54:18","slug":"c9-sql-improved-with-propsqlrowset","status":"publish","type":"post","link":"https:\/\/clarionsharp.com\/blog\/c9-sql-improved-with-propsqlrowset\/","title":{"rendered":"C9 &#8211; SQL improved with PROP:SQLRowSet"},"content":{"rendered":"<p>PROP:SQL parses the passed SQL and only sets things up for a return result if the SQL is a CALL or SELECT statement.\u00a0 It cannot always assume a result set as some backends (MSSQL in particular) do not work if you call UPDATE using calls that normally return a result set.\u00a0 PROP:SQLRowSet offloads the work of which type of calls to use to the developer.\u00a0 This allows calls that are not CALL or SELECT that return result sets (eg PRAGMA statement in SQLite), to work.<\/p>\n<p>So we could write code like this:<\/p>\n<p>SQLiteFile{PROP:SQLRowSet}=&#8217;PRAGMA table_list&#8217; ! get the list of tables in the database<br \/>\nLOOP<br \/>\nNEXT(SQLiteFile)<br \/>\n&#8230;<br \/>\nEND<\/p>\n<p>or if using MSSQL<\/p>\n<p>MSSQLfile{PROP:SQLRowSet} = &#8216;WITH q AS (SELECT COUNT(*) FROM f) SELECT * FROM q&#8217;<br \/>\nLOOP<br \/>\nNEXT(MSSQLfile)<br \/>\n&#8230;<br \/>\nEND<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PROP:SQL parses the passed SQL and only sets things up for a return result if the SQL is a CALL or SELECT statement.\u00a0 It cannot always assume a result set as some backends (MSSQL in particular) do not work if you call UPDATE using calls that normally return a result set.\u00a0 PROP:SQLRowSet offloads the work &hellip; <a href=\"https:\/\/clarionsharp.com\/blog\/c9-sql-improved-with-propsqlrowset\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">C9 &#8211; SQL improved with PROP:SQLRowSet<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31,5],"tags":[],"class_list":["post-1236","post","type-post","status-publish","format-standard","hentry","category-clarion9","category-clarionnews"],"_links":{"self":[{"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/posts\/1236","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/comments?post=1236"}],"version-history":[{"count":4,"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/posts\/1236\/revisions"}],"predecessor-version":[{"id":1266,"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/posts\/1236\/revisions\/1266"}],"wp:attachment":[{"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/media?parent=1236"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/categories?post=1236"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/tags?post=1236"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}