Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open Existing SQLite DB file (pre-population) #172

Closed
gtjr92 opened this issue Jan 7, 2015 · 4 comments
Closed

Open Existing SQLite DB file (pre-population) #172

gtjr92 opened this issue Jan 7, 2015 · 4 comments

Comments

@gtjr92
Copy link

gtjr92 commented Jan 7, 2015

I am trying to open an existing sqllite database. I can't seem to get it to open.
I have copied the db file to the platforms/android/assets directory. I don't get any errors in the output.
I am using ionic framework
here is my code

     <script src="lib/ionic/js/ionic.bundle.js"></script>
     <script src="js/ng-cordova.min.js"></script>
  <script src="cordova.js"></script>
  <script>

var db =null;
function onDeviceReady() {
db = sqlitePlugin.openDatabase({name: "testdb"});
db.transaction(function(tx) {
tx.executeSql("SELECT * FROM people limit 20;",[], function() {
var testTable = new htTable();
testTable.setHeader(['name', 'address', 'phone']);
for( var i = 0; i < r.rows.length; i++ ) {
var row = r.rows.item(i);
testTable.addRow([row.city, row.state, row.zipcode]);
}
element('data').innerHTML = testTable.getTableHTML();

    });

}, function(e) {
  console.log("ERROR: " + e.message);
});
}
</script>
DB TEST
@brodycj brodycj changed the title Open Existing Sqllite DB file Open Existing SQLite DB file (pre-population) Jan 22, 2015
@brodycj
Copy link
Contributor

brodycj commented Jan 22, 2015

This is pre-population, which others have been asking for. See #10 for old discussions.

@brodycj
Copy link
Contributor

brodycj commented Jan 22, 2015

There are some old forks that have implemented pre-population. Solutions have been given over the net, and also on the forum. I am now considering integrating (Android and iOS only), under an optional parameter.

brodycj pushed a commit that referenced this issue Feb 17, 2015
…10/#172)

Updates to readme to remove support for SQLCipher from this project
brodycj pushed a commit that referenced this issue Feb 18, 2015
Major changes from common-src:
Implement pre-population ref: #10/#172
Choose DB location to make iCloud backup optional ref: #16/#143
Fix db close conditions & prevent double-marshaling of data ref: pull #170
brodycj pushed a commit that referenced this issue Feb 18, 2015
Major changes from common-src & master-src:
- Implement pre-population ref: #10/#172
- Choose DB location to make iCloud backup optional ref: #16/#143
- Fix db close conditions & prevent double-marshaling of data ref: pull #170
brodycj pushed a commit that referenced this issue Feb 18, 2015
Important changes:
- Implement pre-population ref: #10/#172
- Choose DB location to make iCloud backup optional ref: #16/#143
- Fix db close conditions & prevent double-marshaling of data ref: pull #170
@brodycj
Copy link
Contributor

brodycj commented Feb 18, 2015

I have now pushed a new release to master with optional support for pre-populated database. Please see README.md for details.

@taaa22
Copy link

taaa22 commented Jun 7, 2018

If you still interested please look at this solution:
https://github.com/taaa22/Ionic-Sqlite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants