@@ -297,6 +297,75 @@ dbHelper.executeSelectQuery(tableName, values, hasConditions, conditionalValues,
297
297
// either for entire table or for a single column
298
298
299
299
dbHelper. getRecordCount(tableName, values, hasConditions, conditionalValues);
300
+
301
+ > ** Now creating table and inserting records in database is more simpler. **
302
+
303
+ ** Creating Table **
304
+ // this example is with single data type and no constraints
305
+ dbHelper. addColumnForTable(new DbColumns (" ID" /* this is the name of the column*/ , " integer" /* this is the data type for that column*/ ))
306
+ .createTable(" TABLE_NAME" );
307
+
308
+ // if you want to create table with constraints then use following example
309
+ dbHelper. addColumnForTable(new DbColumns (" ID" , new String []{" integer" , " primary key" , " autoincrement" }))
310
+ .createTable(" TABLE_NAME" );
311
+
312
+
313
+ ** Inserting Records **
314
+ // this is an example for inserting records
315
+ dbHelper. addDataForTable(new DbData (" age" /* this is the name of the column*/ , 26 /* data for that column*/ ))
316
+ .insertData(" TABLE_NAME" );'
317
+
318
+ >**Getting all records directly into you model class:**
319
+
320
+ /**
321
+ * @param tableName - name of the table for getting the record
322
+ *
323
+ * @param isAscending - True for ascending order and False for descending order
324
+ *
325
+ * @param orderByColumnName - name of the column for getting records in descending order
326
+ *
327
+ * @param tClass - Pass your Model class like this
328
+ * Ex: ModelClass.class this is required for setting the values
329
+ * make sure your model class' s setters has same name as database column name
330
+ * Example : columnName: " age" , so setter' s name should be: "setAge"
331
+ *
332
+ * @return Array list of ModelClass you provided in method
333
+ *
334
+ * this method will get all the records from the table
335
+ * in ascending or descending order as provided by the user
336
+ *
337
+ * this method is a generic method which can be directly bounded to the array list of custom type
338
+ **/
339
+ // For getting all the records from database
340
+ ArrayList<YourModelClassName> arrayList = dbHelper.getAllRecords(
341
+ "TABLE_NAME", isAscending: true or false, orderByColumnName: null or name of the column, YourModelClassName.class);
342
+
343
+ /**
344
+ * @param tableName - name of the table for getting the record
345
+ *
346
+ * @param conditionalValues - conditions for selecting records from table in database
347
+ * either individual conditions for multiple conditions
348
+ * Ex: ID = 1 or code = 1 or firstName = ' FirstName '
349
+ * or ID = 1 AND firstName = ' FirstName '
350
+ *
351
+ * @param isAscending - True for ascending order and False for descending order
352
+ *
353
+ * @param orderByColumnName - name of the column for getting records in descending order
354
+ *
355
+ * @param tClass - Pass your Model class like this
356
+ * Ex: ModelClass.class this is required for setting the values
357
+ * make sure your model class' s setters has same name as database column name
358
+ * Example : columnName: " age" , so setter' s name should be: "setAge"
359
+ *
360
+ * @return Array list of ModelClass you provided in method
361
+ *
362
+ * this method will get all the records from the table
363
+ * in ascending or descending order as provided by the user
364
+ *
365
+ * this method is a generic method which can be directly bounded to the array list of custom type
366
+ **/
367
+ ArrayList<YourModelClassName> arrayList = dbHelper.getAllRecords(
368
+ "TABLE_NAME", isAscending: true or false, conditionalValues, orderByColumnName: null or name of the column, YourModelClassName.class);
300
369
```
301
370
302
371
### DatePickerFragment
0 commit comments