@@ -134,8 +134,7 @@ public DBHelper(Context context)
134
134
* @return true or false
135
135
**/
136
136
// endregion
137
- public boolean executeDatabaseOperations (String tableName ,
138
- String operations ,
137
+ public boolean executeDatabaseOperations (String tableName , String operations ,
139
138
LinkedHashMap <String , String > values ,
140
139
boolean hasConditions ,
141
140
LinkedHashMap <String , String > conditionalValues )
@@ -403,8 +402,7 @@ public Cursor executeSelectQuery(String query)
403
402
* no matter condition is there or not
404
403
**/
405
404
// endregion COMMENTS FOR executeSelectQuery method
406
- public Cursor executeSelectQuery (String tableName ,
407
- String values ,
405
+ public Cursor executeSelectQuery (String tableName , String values ,
408
406
boolean hasConditions ,
409
407
StringBuilder conditionalValues )
410
408
{
@@ -505,11 +503,9 @@ public Cursor executeSelectQuery(String tableName,
505
503
*
506
504
**/
507
505
//#endregion COMMENTS FOR executeSelectQuery method
508
- public <T > ArrayList <T > executeSelectQuery (String tableName ,
509
- String values ,
506
+ public <T > ArrayList <T > executeSelectQuery (String tableName , String values ,
510
507
boolean hasConditions ,
511
- String conditionalValues ,
512
- Class <T > tClass )
508
+ String conditionalValues , Class <T > tClass )
513
509
{
514
510
try
515
511
{
@@ -562,7 +558,7 @@ public <T> ArrayList<T> executeSelectQuery(String tableName,
562
558
{
563
559
// setting new instance of the class passed
564
560
// for invoking the values returned from database
565
- Object instance = tClass .newInstance ();
561
+ T instance = tClass .newInstance ();
566
562
567
563
//#region LOOP FOR COUNT OF COLUMNS
568
564
for (int j = 0 ; j < cursor .getColumnCount (); j ++)
@@ -634,7 +630,7 @@ else if (double.class == method.getParameterTypes()[0])
634
630
}
635
631
//#endregion LOOP FOR COUNT OF COLUMNS
636
632
637
- tArrayList .add (( T ) instance );
633
+ tArrayList .add (instance );
638
634
cursor .moveToNext ();
639
635
}
640
636
//#endregion LOOP FOR EXTRACTING DATA FROM DATABASE
@@ -692,10 +688,8 @@ else if (double.class == method.getParameterTypes()[0])
692
688
*** @return this method will return the count of the record in the table
693
689
**/
694
690
// endregion COMMENTS FOR getRecordCount method
695
- public int getRecordCount (String tableName ,
696
- String values ,
697
- boolean hasConditions ,
698
- StringBuilder conditionalValues )
691
+ public int getRecordCount (String tableName , String values ,
692
+ boolean hasConditions , StringBuilder conditionalValues )
699
693
{
700
694
try
701
695
{
@@ -961,7 +955,7 @@ public DBHelper createTable(String tableName)
961
955
}
962
956
963
957
// checking if columns were provided or not for creating table
964
- if (dbColumnArrayList == null || dbColumnArrayList .size () > 0 )
958
+ if (dbColumnArrayList == null || dbColumnArrayList .size () == 0 )
965
959
{
966
960
Log .e (TAG , "createTable: No columns provided for creating table." );
967
961
return this ;
@@ -1357,7 +1351,7 @@ public <T> ArrayList<T> getAllRecords(String tableName, boolean isAscending,
1357
1351
{
1358
1352
// setting new instance of the class passed
1359
1353
// for invoking the values returned from database
1360
- Object instance = tClass .newInstance ();
1354
+ T instance = tClass .newInstance ();
1361
1355
1362
1356
//#region LOOP FOR COUNT OF COLUMNS
1363
1357
for (int j = 0 ; j < cursor .getColumnCount (); j ++)
@@ -1428,7 +1422,7 @@ else if (double.class == method.getParameterTypes()[0])
1428
1422
}
1429
1423
//#endregion LOOP FOR COUNT OF COLUMNS
1430
1424
1431
- tArrayList .add (( T ) instance );
1425
+ tArrayList .add (instance );
1432
1426
cursor .moveToNext ();
1433
1427
}
1434
1428
//#endregion LOOP FOR EXTRACTING DATA FROM DATABASE
@@ -1529,7 +1523,7 @@ public <T> ArrayList<T> getAllRecords(String tableName, boolean isAscending,
1529
1523
{
1530
1524
// setting new instance of the class passed
1531
1525
// for invoking the values returned from database
1532
- Object instance = tClass .newInstance ();
1526
+ T instance = tClass .newInstance ();
1533
1527
1534
1528
//#region LOOP FOR COUNT OF COLUMNS
1535
1529
for (int j = 0 ; j < cursor .getColumnCount (); j ++)
@@ -1600,7 +1594,7 @@ else if (double.class == method.getParameterTypes()[0])
1600
1594
}
1601
1595
//#endregion LOOP FOR COUNT OF COLUMNS
1602
1596
1603
- tArrayList .add (( T ) instance );
1597
+ tArrayList .add (instance );
1604
1598
cursor .moveToNext ();
1605
1599
}
1606
1600
//#endregion LOOP FOR EXTRACTING DATA FROM DATABASE
0 commit comments