You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### 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
+
37
49
```
38
50
EasyDB easyDB = EasyDB.init(this, "TEST", null, 1) // TEST is the name of the DATABASE
39
51
.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
43
55
.doneTableColumn();
44
56
```
45
57
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...
47
59
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. **
53
61
54
62
** You don't have to add any primary key. The library does it by default (as ```ID``` column) **
55
63
@@ -62,7 +70,7 @@ You can call the ```addData()``` in two ways:
62
70
63
71
```data``` parameter in ```addData()``` can be either integer or string. After adding all data, call ```doneDataAdding()``` method.
64
72
65
-
```columnName``` is String and ```columnNumber``` is integer
73
+
```columnName``` is a String and ```columnNumber``` is an integer
66
74
67
75
Example:
68
76
```
@@ -85,15 +93,6 @@ Thus, it will return a boolean value.
85
93
```True``` means data added successfully,
86
94
```False``` means data isn't added successfully.
87
95
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
-
97
96
### Get/Read All Data:
98
97
To get all data as a ```Cursor``` object, call ```getAllData()``` like this:
0 commit comments