Skip to content

Releases: dyazincahya/sqlite-helper-nativescript

2.0

27 Oct 13:00
f383f41
Compare
Choose a tag to compare

Supports the use of existing databases

Open sqlite_helper.js file, you can adjust configuration here

const config = {
  databaseName: "YOUR_DATABASE_NAME.db", // set your database name
  debug: true, // set false for production and set true for development
  paths: {
    documentsFolder: knownFolders.documents(), // don't change this part, this for get root directory
    assetsFolder: "assets/db", // location your sqlite file database
  },
};

Put your existing database in assetsFolder

1.0

26 Oct 07:16
746aee9
Compare
Choose a tag to compare
1.0

Function

  • SQL__select
  • SQL__selectRaw
  • SQL__insert
  • SQL__update
  • SQL__delete
  • SQL__truncate
  • SQL__dropTable
  • SQL__query

Example

    SQL__select("table_name", "field1, field2", "WHERE id = 1")
    SQL__selectRaw("SELECT * FROM table_name WHERE id = 1")
    SQL__insert("table_name", [{field: "field1", value: "value1"}, {field: "field2", value: "value2"}])
    SQL__update("table_name", [{field: "field1", value: "new_value1"}, {field: "field2", value: "new_value2"}], 1, "WHERE id = 1")
    SQL__delete("table_name", 1, "WHERE id = 1")
    SQL__truncate("table_name")
    SQL__dropTable("table_name")
    SQL__query("SELECT * FROM table_name")