Skip to content

Commit 7b753a4

Browse files
committed
1.3.3
1 parent 9ee7b65 commit 7b753a4

File tree

13 files changed

+101
-131
lines changed

13 files changed

+101
-131
lines changed

.gradle/4.1/fileHashes/fileHashes.bin

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
861 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

.idea/workspace.xml

Lines changed: 80 additions & 113 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ allprojects {
1414
Add the dependency
1515
```
1616
dependencies {
17-
implementation 'com.github.p32929:AndroidEasySQL-Library:1.3.2'
17+
implementation 'com.github.p32929:AndroidEasySQL-Library:1.3.3'
1818
}
1919
```
2020

@@ -34,6 +34,18 @@ After that you can do:
3434

3535
## Code example
3636
### Initialization, Set Table Name, Add columns, altogether:
37+
38+
```
39+
EasyDB easyDB = EasyDB.init(this, "TEST", null, 1) // TEST is the name of the DATABASE
40+
.setTableName("DEMO TABLE") // You can ignore this line if you want
41+
.addColumn(new Column("C1", new String[]{"text", "unique"}))
42+
.addColumn(new Column("C1", new String[]{"text", "not null"}))
43+
.addColumn(new Column("C1", new String[]{"text"}))
44+
.doneTableColumn();
45+
```
46+
47+
or
48+
3749
```
3850
EasyDB easyDB = EasyDB.init(this, "TEST", null, 1) // TEST is the name of the DATABASE
3951
.setTableName("DEMO TABLE") // You can ignore this line if you want
@@ -43,13 +55,9 @@ EasyDB easyDB = EasyDB.init(this, "TEST", null, 1) // TEST is the name of the DA
4355
.doneTableColumn();
4456
```
4557

46-
You can add as many constraint methods like ```unique()``` , ```notNull()``` etc. Just, don't forget to call the ```done()``` method at the end. See the example above...
58+
** You can add as many constraint methods like ```unique()``` , ```notNull()``` etc. Just, don't forget to call the ```done()``` method at the end. See the example above...
4759

48-
> addColumn(column)
49-
50-
> Column(columnName, dataType)
51-
52-
** Saving the object into a variable will make easier to work with the database later. **
60+
** Saving the ```easyDB``` object into a variable will make easier to work with the database later. **
5361

5462
** You don't have to add any primary key. The library does it by default (as ```ID``` column) **
5563

@@ -62,7 +70,7 @@ You can call the ```addData()``` in two ways:
6270
6371
```data``` parameter in ```addData()``` can be either integer or string. After adding all data, call ```doneDataAdding()``` method.
6472

65-
```columnName``` is String and ```columnNumber``` is integer
73+
```columnName``` is a String and ```columnNumber``` is an integer
6674

6775
Example:
6876
```
@@ -85,15 +93,6 @@ Thus, it will return a boolean value.
8593
```True``` means data added successfully,
8694
```False``` means data isn't added successfully.
8795

88-
### Get all column names:
89-
To get all column names as array of ```String``` call ```getAllColumns()``` Method.
90-
91-
Example:
92-
```
93-
String columns[] = easyDB.getAllColumns();
94-
```
95-
```columns[0]``` contains the value of ```row ID```. Your custom columns will start from ```columns[1]```...
96-
9796
### Get/Read All Data:
9897
To get all data as a ```Cursor``` object, call ```getAllData()``` like this:
9998

@@ -116,7 +115,9 @@ String aStringVariable = res.getString(columnIndex);
116115
here ```columnIndex``` is an integer, starts from 0
117116

118117
Example:
118+
119119
```
120+
Cursor res = easyDB.getAllData();
120121
while (res.moveToNext()) {
121122
int anIntegerVariable = res.getInt(columnIndex);
122123
String aStringVariable = res.getString(columnIndex);
@@ -130,6 +131,7 @@ Example:
130131
Cursor res = easyDB.getOneRowData(1);
131132
if (res != null) {
132133
res.moveToFirst(); // Because here's only one row data
134+
String ID = res.getString(0); // This is the rowID, getting from the ID column
133135
String c1 = res.getString(1);
134136
String c2 = res.getString(2);
135137
}

app/src/main/java/p32929/databaseeasier/MainActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ protected void onCreate(Bundle savedInstanceState) {
4040
easyDB = EasyDB.init(this, "TEST", null, 1) // TEST is the name of the DATABASE
4141
.setTableName("DEMO TABLE") // You can ignore this line if you want
4242
.addColumn(new Column("C1", new String[]{"text", "unique"}))
43-
.addColumn(new Column("C1", new String[]{"text", "unique"}))
43+
.addColumn(new Column("C2", new String[]{"text", "unique"}))
4444
.doneTableColumn();
4545

4646
buttonShow.setOnClickListener(new View.OnClickListener() {

build/android-profile/profile-2018-12-16-15-39-49-372.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.
Binary file not shown.

0 commit comments

Comments
 (0)