Skip to content

Commit 51fc750

Browse files
authored
Update README.md v2.0
1 parent c04954e commit 51fc750

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

README.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,24 @@ Before you using this helper, you must be install plugin [nativescript-community
1313

1414
## Instructions
1515
1. Download file [sqlite_helper.js](https://github.com/dyazincahya/sqlite-helper-nativescript/blob/main/sqlite_helper.js) and save that file here : ```\YOUR_NATIVESCRIPT_PROJECT\app```
16-
2. Create ```.db``` file using [SQLite Browser](https://sqlitebrowser.org)
17-
3. And after that put the ```your_database.db``` in ```\YOUR_NATIVESCRIPT_PROJECT\app```
18-
4. Then in the ```sqlite_helper.js``` file, find ```openOrCreate("your_database.db")``` code and change with your database name.
19-
5. Still in the ```sqlite_helper.js``` file, find ```showError``` variable then set it to ```true``` if you want to see all errors that occur during development on your sqlite.
20-
6. import file sql_helper.js on your module, like :
16+
2. Create ```.db``` file using [SQLite Browser](https://sqlitebrowser.org) and create ```assets\db``` folder on ```\YOUR_NATIVESCRIPT_PROJECT\app```
17+
3. And after that put the ```your_database.db``` in ```\YOUR_NATIVESCRIPT_PROJECT\app\assets\db```
18+
4. Open [sqlite_helper.js](https://github.com/dyazincahya/sqlite-helper-nativescript/blob/main/sqlite_helper.js) file, you can adjust configuration here
19+
```javascript
20+
const config = {
21+
databaseName: "YOUR_DATABASE_NAME.db", // set your database name
22+
debug: true, // set false for production and set true for development
23+
paths: {
24+
documentsFolder: knownFolders.documents(), // don't change this part, this for get root directory file
25+
assetsFolder: "assets/db", // location your sqlite file database
26+
},
27+
};
28+
```
29+
5. import file sql_helper.js on your module, like :
2130
``` javascript
2231
import { SQL__select, SQL__selectRaw, SQL__insert, SQL__update, SQL__delete, SQL__truncate, SQL__query } from "~/sqlite_helper";
2332
```
24-
7. Avaliable methode on ```sql_helper.js```
33+
6. Avaliable methode on ```sql_helper.js```
2534
| Method | Description | Return |
2635
|-------------------|-------------------------------------------------------------|--------|
2736
| SQL__select(...) | for get data from table | Array |
@@ -31,7 +40,7 @@ Before you using this helper, you must be install plugin [nativescript-community
3140
| SQL__delete(...) | for delete data row from table | void |
3241
| SQL__truncate(...) | for clear all data on the table | void |
3342
| SQL__query(...) | for execute raw query like Create new Table or Etc | ? |
34-
8. For details, you can look at the [sqlite_helper.js](https://github.com/dyazincahya/sqlite-helper-nativescript/blob/main/sqlite_helper.js) file directly
43+
7. For details, you can look at the [sqlite_helper.js](https://github.com/dyazincahya/sqlite-helper-nativescript/blob/main/sqlite_helper.js) file directly
3544

3645

3746
## Sample Code

0 commit comments

Comments
 (0)