{"id":520,"date":"2015-06-17T15:41:44","date_gmt":"2015-06-17T19:41:44","guid":{"rendered":"http:\/\/jaewon.hwang.info\/jaewon\/?p=520"},"modified":"2016-02-07T09:47:28","modified_gmt":"2016-02-07T14:47:28","slug":"another-sqlite-interface-for-matlab","status":"publish","type":"post","link":"https:\/\/jaewon.hwang.info\/jaewon\/2015\/06\/another-sqlite-interface-for-matlab\/","title":{"rendered":"Another SQLite interface for MATLAB"},"content":{"rendered":"<p>This MEX package enables MATLAB to access SQLite databases via SQL queries. I wrote it because previous solutions did not do what I wanted in a simplistic way. The zip file below contains source code and 32-bit &#038; 64-bit binaries for MS Windows.<\/p>\n<p>Download: <a href=\"\/jaewon\/wp-content\/uploads\/2015\/06\/sqlite.zip\">sqlite.zip (2.32MB)<\/a><\/p>\n<p>The code was tested with SQLITE 3.11.0, MATLAB 2015b and Visual Studio Community 2015. You may need to install <a href=\"https:\/\/www.microsoft.com\/en-us\/download\/details.aspx?id=49984\" target=\"_blank\">Visual C++ Redistributable Packages for Visual Studio 2015<\/a> from the Microsoft website to run the included MEX binaries. This program is distributed in the hope that it will be useful, but without any warranty.<\/p>\n<fieldset>\n<legend><strong>Usage:<\/strong><\/legend>\n<pre class=\"brush: matlab; toolbar: false;\">db = sqlite;  % create a class object\r\ndb.version    % SQLite version\r\ndb.connect('test.db');\r\ndb.query('CREATE TABLE Test (Subject TEXT, Score INTEGER);');\r\ndb.query('INSERT INTO Test (Subject,Score) VALUES (''English'',50);');\r\ndb.query('INSERT INTO Test (Subject,Score) VALUES (?,?);','Math',90); % bind parameter\r\ndb.query('UPDATE Test SET Score=80 WHERE Subject=''English'';');\r\ntable = db.query('SELECT * from Test;');\r\ndb.query('DELETE FROM Test WHERE Score<90;');\r\n\r\ncell_mat = { uint8('A byte stream in a cell matrix is considered a blob.') };\r\ndb.query('CREATE TABLE BinaryLargeOBject (Object BLOB);');\r\ndb.query('INSERT INTO BinaryLargeOBject (Object) VALUES (?);',cell_mat); % handle blob\r\n\r\nclear db;  % This also disconnect DB<\/pre>\n<\/fieldset>\n","protected":false},"excerpt":{"rendered":"<p>This MEX package enables MATLAB to access SQLite databases via SQL queries. I wrote it because previous solutions did not do what I wanted in a simplistic way. The zip file below contains source code and 32-bit &#038; 64-bit binaries for MS Windows. Download: sqlite.zip (2.32MB) The code was tested with SQLITE 3.11.0, MATLAB 2015b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[77],"class_list":["post-520","post","type-post","status-publish","format-standard","hentry","category-computer","tag-matlab"],"_links":{"self":[{"href":"https:\/\/jaewon.hwang.info\/jaewon\/wp-json\/wp\/v2\/posts\/520","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jaewon.hwang.info\/jaewon\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jaewon.hwang.info\/jaewon\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jaewon.hwang.info\/jaewon\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jaewon.hwang.info\/jaewon\/wp-json\/wp\/v2\/comments?post=520"}],"version-history":[{"count":0,"href":"https:\/\/jaewon.hwang.info\/jaewon\/wp-json\/wp\/v2\/posts\/520\/revisions"}],"wp:attachment":[{"href":"https:\/\/jaewon.hwang.info\/jaewon\/wp-json\/wp\/v2\/media?parent=520"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jaewon.hwang.info\/jaewon\/wp-json\/wp\/v2\/categories?post=520"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jaewon.hwang.info\/jaewon\/wp-json\/wp\/v2\/tags?post=520"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}