<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Miguel -- the debug modules in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Reading-prepopulated-sqlite-database-in-app/m-p/1123291#M76979</link>
    <description>&lt;P&gt;Miguel -- the debug modules are not able to work for all situations. In those cases, you need to debug on a built app. See this link for help on debugging a built app &amp;gt; &lt;A href="https://software.intel.com/en-us/xdk/docs/intel-xdk-debug-and-test-overview#RemoteChromeDevTools" target="_blank"&gt;https://software.intel.com/en-us/xdk/docs/intel-xdk-debug-and-test-overview#RemoteChromeDevTools&lt;/A&gt; &amp;lt;&lt;/P&gt;</description>
    <pubDate>Thu, 29 Sep 2016 19:40:17 GMT</pubDate>
    <dc:creator>PaulF_IntelCorp</dc:creator>
    <dc:date>2016-09-29T19:40:17Z</dc:date>
    <item>
      <title>Reading prepopulated sqlite database in app.</title>
      <link>https://community.intel.com/t5/Software-Archive/Reading-prepopulated-sqlite-database-in-app/m-p/1123282#M76970</link>
      <description>&lt;P&gt;&lt;SPAN style="color: rgb(36, 39, 41); font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 15px; line-height: 19.5px;"&gt;I am working with intel XDK and there I have a prepopulated .db file which i need to read inside my code. As we do in native app where we put db files in assets directory and then access those database by copying them in app's database directory. I am new to xdk.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 09:04:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Reading-prepopulated-sqlite-database-in-app/m-p/1123282#M76970</guid>
      <dc:creator>puneet_d_</dc:creator>
      <dc:date>2016-05-11T09:04:43Z</dc:date>
    </item>
    <item>
      <title>Try using the SQLite plugin</title>
      <link>https://community.intel.com/t5/Software-Archive/Reading-prepopulated-sqlite-database-in-app/m-p/1123283#M76971</link>
      <description>&lt;P&gt;Try using the SQLite plugin and following his instructions on how to add your DB to the project.&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 18:26:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Reading-prepopulated-sqlite-database-in-app/m-p/1123283#M76971</guid>
      <dc:creator>PaulF_IntelCorp</dc:creator>
      <dc:date>2016-05-11T18:26:04Z</dc:date>
    </item>
    <item>
      <title>Quote:Paul F. (Intel) wrote:</title>
      <link>https://community.intel.com/t5/Software-Archive/Reading-prepopulated-sqlite-database-in-app/m-p/1123284#M76972</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Paul F. (Intel) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Try using the SQLite plugin and following his instructions on how to add your DB to the project.&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 13.008px; line-height: 19.512px;"&gt;I tried that way..adding sqlite plugin, but didnt succeed. Any sample code would be helpful!&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2016 04:35:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Reading-prepopulated-sqlite-database-in-app/m-p/1123284#M76972</guid>
      <dc:creator>puneet_d_</dc:creator>
      <dc:date>2016-05-12T04:35:06Z</dc:date>
    </item>
    <item>
      <title>What you asking is beyond the</title>
      <link>https://community.intel.com/t5/Software-Archive/Reading-prepopulated-sqlite-database-in-app/m-p/1123285#M76973</link>
      <description>&lt;P&gt;What you asking is beyond the scope of this forum. I recommend you search StackOverflow for help with adding a DB to your Cordova or PhoneGap app. The XDK creates Cordova apps, anything you find there that addresses your issue can be used with the XDK.&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2016 14:38:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Reading-prepopulated-sqlite-database-in-app/m-p/1123285#M76973</guid>
      <dc:creator>PaulF_IntelCorp</dc:creator>
      <dc:date>2016-05-12T14:38:30Z</dc:date>
    </item>
    <item>
      <title>Puneet - many of Qnimate's</title>
      <link>https://community.intel.com/t5/Software-Archive/Reading-prepopulated-sqlite-database-in-app/m-p/1123286#M76974</link>
      <description>&lt;P&gt;Puneet - many of Qnimate's tutorials are a little old but they are helpful in describing processes., The Local Database Storage tutorial (http://qnimate.com/local-database-storage-using-intel-xdk/), is a great one to read through it you will understand the basic process of storing data locally. The plugin he uses seems to be gone, but once you decide which plugin to use you can look at the function calls for that plugin. Our plugin manager has changed significantly as well - you will find it in Build Settings in the PROJECT page.&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2016 19:57:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Reading-prepopulated-sqlite-database-in-app/m-p/1123286#M76974</guid>
      <dc:creator>Pamela_H_Intel</dc:creator>
      <dc:date>2016-05-13T19:57:45Z</dc:date>
    </item>
    <item>
      <title>I tried every way to add and</title>
      <link>https://community.intel.com/t5/Software-Archive/Reading-prepopulated-sqlite-database-in-app/m-p/1123287#M76975</link>
      <description>&lt;P&gt;I tried every way to add and access pre-populated sqlite database through cordova sqlite storage plugin by lite helpers, also i tried ext version of this plugin as it is mentioned somewhere that it works but i didn't succeed doing this. please provide support with a sample project so that i can understand and implement that. requirement &amp;nbsp;is simple, I have an .db format sqlite databse file which i created with Sqlite Browser, Now I need to read that file in my app.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2016 06:45:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Reading-prepopulated-sqlite-database-in-app/m-p/1123287#M76975</guid>
      <dc:creator>puneet_d_</dc:creator>
      <dc:date>2016-09-29T06:45:01Z</dc:date>
    </item>
    <item>
      <title>Hi punnet,</title>
      <link>https://community.intel.com/t5/Software-Archive/Reading-prepopulated-sqlite-database-in-app/m-p/1123288#M76976</link>
      <description>&lt;P&gt;Hi punnet,&lt;/P&gt;

&lt;P&gt;You must copy your database in www directory and you need a plugin, i.e&amp;nbsp;https://github.com/an-rahulpandey/cordova-plugin-dbcopy, to copy de database from this directory to default directory in device.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;// And the code must be something like this&lt;/P&gt;

&lt;P&gt;window.plugins.sqlDB.copy("prueba.db", 1,&amp;nbsp; function () {&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp; var db = window.sqlitePlugin.openDatabase({name: "prueba.db", location: 'default'});&lt;/P&gt;

&lt;P&gt;&amp;nbsp;}&lt;/P&gt;

&lt;P&gt;The problem is this code only works when you build and install app, but not in debug mode.&lt;/P&gt;

&lt;P&gt;Hope this help you,&lt;/P&gt;

&lt;P&gt;Miguel Ángel&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2016 11:25:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Reading-prepopulated-sqlite-database-in-app/m-p/1123288#M76976</guid>
      <dc:creator>Miguel_Ángel_M_</dc:creator>
      <dc:date>2016-09-29T11:25:49Z</dc:date>
    </item>
    <item>
      <title>After a long research and</title>
      <link>https://community.intel.com/t5/Software-Archive/Reading-prepopulated-sqlite-database-in-app/m-p/1123289#M76977</link>
      <description>&lt;P&gt;After a long research and thinking, I do backup and restore &lt;SPAN style="font-size: 13.008px;"&gt;database&amp;nbsp;&lt;/SPAN&gt;using a server.&lt;/P&gt;

&lt;P&gt;My problem to solve was that my app has a database created and populated by the user, but without backup.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Now I have 2 buttons: backup and restore.&lt;/P&gt;

&lt;P&gt;The function for each one is:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;BACKUP&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE class="brush:jscript;"&gt;$(document).on("click", "#botBackup", function()
    {
        myApp.showPreloader("copiando");
        var options = new FileUploadOptions();
        options.fileKey = wNomeDB;
        options.fileName = wNomeDB + "_" + device.uuid;
        options.mimeType = "multipart/form-data";
        db.close(function() {console.log("db fechado");}, function() {console.log("não fechou db");});
        var ft = new FileTransfer();
        ft.upload(cordova.file.applicationStorageDirectory + "databases/" + wNomeDB, encodeURI("http://server/suporte/upload.php"), winCopyDB, failCopyDB, options);
});&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;RESTORE&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE class="brush:jscript;"&gt;$(document).on("click", "#botRestore", function()
    {
        myApp.showPreloader("restaurando");
        db.close(function() {console.log("db fechado");}, function() {console.log("não fechou db");});
        window.sqlitePlugin.deleteDatabase({name: wNomeDB, location: 2}, function() {console.log("db apagado");}, function() {console.log("db NÃO apagado");});
        var fileTransfer = new FileTransfer();
        var uri = encodeURI("http://server/suporte/download.php?id=" + device.uuid);
        var fileURL = cordova.file.applicationStorageDirectory + "databases/" + wNomeDB;
        console.log(fileURL);

        fileTransfer.download(
            uri,
            fileURL,
            function(entry) {
                //prepara o banco de dados
                db = window.sqlitePlugin.openDatabase({
                    name: wNomeDB,
                    location: 2
                });
                myApp.hidePreloader();
            },
            function(error) {
                console.log("download error source " + error.source);
                console.log("download error target " + error.target);
                console.log("upload error code" + error.code);
                myApp.hidePreloader();
            },
            false,
            {
                headers: {
                    "Authorization": "Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=="
                }
            }
        );
    });&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;For each use, I have a PHP program in the server to handle the action.&lt;/P&gt;

&lt;P&gt;Some remarks:&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;wNomeDB = name of my database&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;device.uuid = used to distinguish each database user in the server&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;If you have the database on the server, you can just access it to create copies inside the app.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2016 13:30:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Reading-prepopulated-sqlite-database-in-app/m-p/1123289#M76977</guid>
      <dc:creator>Hamilton_Tenório_da_</dc:creator>
      <dc:date>2016-09-29T13:30:05Z</dc:date>
    </item>
    <item>
      <title>Using dbcopy plugin you can</title>
      <link>https://community.intel.com/t5/Software-Archive/Reading-prepopulated-sqlite-database-in-app/m-p/1123290#M76978</link>
      <description>&lt;P&gt;Using dbcopy plugin you can use a prepopulated database from www directory, like I show in previous comment, but only when build my application and install it in a device. However when I try to debug it in the device (using USB connection) the application can't access database because dbcopy can't copy it from www directory to default location. The error is that the database doen't exists in www directory.&lt;/P&gt;

&lt;P&gt;Debuging the pluging code I can see that really the www directory doesn't contain the database. Intel XDK documentation talk about debug modules and I think the problem is that the application contents (including database file) can't be accessed in debug mode. Then, how can access my application files to copy db file to default location? Is there any way to create a custom debug module to include my database in it?&lt;/P&gt;

&lt;P&gt;Thaks in advance,&lt;/P&gt;

&lt;P&gt;Miguel Ángel&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2016 18:40:21 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Reading-prepopulated-sqlite-database-in-app/m-p/1123290#M76978</guid>
      <dc:creator>Miguel_Ángel_M_</dc:creator>
      <dc:date>2016-09-29T18:40:21Z</dc:date>
    </item>
    <item>
      <title>Miguel -- the debug modules</title>
      <link>https://community.intel.com/t5/Software-Archive/Reading-prepopulated-sqlite-database-in-app/m-p/1123291#M76979</link>
      <description>&lt;P&gt;Miguel -- the debug modules are not able to work for all situations. In those cases, you need to debug on a built app. See this link for help on debugging a built app &amp;gt; &lt;A href="https://software.intel.com/en-us/xdk/docs/intel-xdk-debug-and-test-overview#RemoteChromeDevTools" target="_blank"&gt;https://software.intel.com/en-us/xdk/docs/intel-xdk-debug-and-test-overview#RemoteChromeDevTools&lt;/A&gt; &amp;lt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2016 19:40:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Reading-prepopulated-sqlite-database-in-app/m-p/1123291#M76979</guid>
      <dc:creator>PaulF_IntelCorp</dc:creator>
      <dc:date>2016-09-29T19:40:17Z</dc:date>
    </item>
    <item>
      <title>Thanks Paul,</title>
      <link>https://community.intel.com/t5/Software-Archive/Reading-prepopulated-sqlite-database-in-app/m-p/1123292#M76980</link>
      <description>&lt;P&gt;Thanks Paul,&lt;/P&gt;

&lt;P&gt;The problem with this solution is that you must build the application and install it to test every change in the application. Is there no way to debug an application with a prepopulated sqlite database without having to build and install it?&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2016 18:30:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Reading-prepopulated-sqlite-database-in-app/m-p/1123292#M76980</guid>
      <dc:creator>Miguel_Ángel_M_</dc:creator>
      <dc:date>2016-09-30T18:30:08Z</dc:date>
    </item>
    <item>
      <title>There are clever ways around</title>
      <link>https://community.intel.com/t5/Software-Archive/Reading-prepopulated-sqlite-database-in-app/m-p/1123293#M76981</link>
      <description>&lt;P&gt;There are clever ways around avoiding rebuilding the app. You can use the JavaScript console to redefine functions (rewrite the function in your source file and copy and paste it into the remote CDT JavaScript console). This might require restructuring some of your code, the code you are debugging and also requires that you understand the difference between early and late binding, but it works quite well. Once of the beauties of dealing with a scripted dynamic language.&lt;/P&gt;

&lt;P&gt;Watch the video on this page &amp;gt; &lt;A href="https://software.intel.com/en-us/xdk/docs/using-the-test-tab" target="_blank"&gt;https://software.intel.com/en-us/xdk/docs/using-the-test-tab&lt;/A&gt; &amp;lt; especially around the 20:00 minute point for an example of what I mean.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2016 23:10:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Reading-prepopulated-sqlite-database-in-app/m-p/1123293#M76981</guid>
      <dc:creator>PaulF_IntelCorp</dc:creator>
      <dc:date>2016-09-30T23:10:05Z</dc:date>
    </item>
  </channel>
</rss>

