MyLoader/MyConnection after Exception
Posted: Thu 01 Mar 2007 11:50
Hello!
I'm using version 4.30.0.12 of MyDac for C++ Builder 6. It works perfect until today.
I would like to load a table with some unique index.
I use TMyLoader for inserting the data. The program crashes when I'm in contradiction with unique index.
I know that one possibly solution would be that I store the row one by one using TMyQuery and checking if the value is duplicated. But I have a table which consists of many million records and this solution will take too much time.
The second solution would be with error handling.
If unique index "protest" against duplicated value I just handle with this information (just count the amount of duplicated values from tmp file for example). There is the "code":
while (reading from file line by line){
//read the line and prepare the values for MyLoader
try
{
MyLoader2->Finish();
ok++;
}
catch (Exception &exception)
{
not_ok++;
}
}
BUT, when I get first (duplicate) error I coudn't do anything else (insert, select, update,...). I get the same error as in first case (duplicate error...bla bla). I tried to reconnect the MyConnection in catch clause but without success.
I looked in Forum history but I haven't found any solution.
Thank's in advance...
pJer
I'm using version 4.30.0.12 of MyDac for C++ Builder 6. It works perfect until today.
I would like to load a table with some unique index.
I use TMyLoader for inserting the data. The program crashes when I'm in contradiction with unique index.
I know that one possibly solution would be that I store the row one by one using TMyQuery and checking if the value is duplicated. But I have a table which consists of many million records and this solution will take too much time.
The second solution would be with error handling.
If unique index "protest" against duplicated value I just handle with this information (just count the amount of duplicated values from tmp file for example). There is the "code":
while (reading from file line by line){
//read the line and prepare the values for MyLoader
try
{
MyLoader2->Finish();
ok++;
}
catch (Exception &exception)
{
not_ok++;
}
}
BUT, when I get first (duplicate) error I coudn't do anything else (insert, select, update,...). I get the same error as in first case (duplicate error...bla bla). I tried to reconnect the MyConnection in catch clause but without success.
I looked in Forum history but I haven't found any solution.
Thank's in advance...
pJer