M
MileHighCelt
I have a CSV file with 100 columns and an unknown number of rows that I
am going to parse and insert into a database. I can't just fill up an
ArrayList with potentially 65K objects because performance just tanks.
At every 1000 records, I thought I would just shot that ArrayList over
to my DAO to do the insert of those row objects.
However, I am trying to think of a better way to handle that break than
comparing a counter to "1000" like this
if (aa ==1000) {
// call DAO
aa =0;
arraylist.clear;
}
because that will obviously fail near the end if there are not exactly
1000 records left to insert. Does anyone have any suggestions on how
to do this? I know this should be pretty basic (didn't we learn this in
school), but for the life of me I can't recall how to do it.
am going to parse and insert into a database. I can't just fill up an
ArrayList with potentially 65K objects because performance just tanks.
At every 1000 records, I thought I would just shot that ArrayList over
to my DAO to do the insert of those row objects.
However, I am trying to think of a better way to handle that break than
comparing a counter to "1000" like this
if (aa ==1000) {
// call DAO
aa =0;
arraylist.clear;
}
because that will obviously fail near the end if there are not exactly
1000 records left to insert. Does anyone have any suggestions on how
to do this? I know this should be pretty basic (didn't we learn this in
school), but for the life of me I can't recall how to do it.