@@ -224,10 +224,32 @@ apiServices.makeApiCall(apiName, requestMethod, parameters, jsonObject, hasToken
224224//
225225// return - the method will return true or false if the operation is successful or failed.
226226//
227-
228227DBHelper dbHelper = new DBHelper (context);
229228dbHelper. executeDatabaseOperation(tableName, operation, values, hasConditions, conditionalValues);
230229
230+ // this method can be used for inserting bulk data into table using database transaction
231+ // pass the name of the table where you want to insert data
232+ // and also pass the total number of columns for which you want to insert data in.
233+ dbHelper. insertDataWithTransaction(" tableName" , 10 );
234+
235+ Example Usage of above method is:
236+ // first we are generating data for inserting into the table
237+ for (int i = 0 ; i < 20000 ; i++ )
238+ {
239+ dbHelper. addDataForTable(new DbData (" columnName1" , " data" ))
240+ .addDataForTable(new DbData (" columnName2" , " data" ))
241+ .addDataForTable(new DbData (" columnName3" , " data" ))
242+ .addDataForTable(new DbData (" columnName4" , " data" ))
243+ .addDataForTable(new DbData (" columnName5" , " data" ))
244+ .addDataForTable(new DbData (" columnName6" , " data" ))
245+ .addDataForTable(new DbData (" columnName7" , " data" ))
246+ .addDataForTable(new DbData (" columnName8" , " data" ))
247+ .addDataForTable(new DbData (" columnName9" , " data" ))
248+ .addDataForTable(new DbData (" columnName10" , " data" ));
249+ }
250+
251+ // remember to put this method outside for loop.
252+ dbHelper. insertDataWithTransaction(" tableName" , 10 );
231253
232254// for select query use this method
233255//
@@ -248,10 +270,8 @@ dbHelper.executeDatabaseOperation(tableName, operation, values, hasConditions, c
248270// it is similar as in executeDatabaseOperation method's conditionalValues parameter.
249271//
250272// return - this method wull return Cursor with values or will return null
251-
252273dbHelper. executeSelectQuery(tableName, values, hasConditions, conditionalValues);
253274
254-
255275/**
256276 * execute Select Query method
257277 * this method is used for selecting data from database
@@ -303,7 +323,6 @@ dbHelper.executeSelectQuery(tableName, values, hasConditions, conditionalValues,
303323//
304324// return - this method wull return count of records in the table
305325// either for entire table or for a single column
306-
307326dbHelper. getRecordCount(tableName, values, hasConditions, conditionalValues);
308327
309328> ** Now creating table and inserting records in database is more simpler. **
0 commit comments