На таблице висит констрейн на уникальность...т.е. мы ловим ошибку при попытке вставить новую запись не соответствующую уникальности...при этом остальные записи также не вставляются.Каким образом можно модифицировать исключение и продолжить обработку?
int _tmain(int argc, _TCHAR* argv[])
{
std::locale::global(std::locale(""));
int cat = 911;
int num = 1;
int dop_attr = 1001;
try
{
session abs;
abs.open(oracle, "service=test.world user=asd password=123");
session sms;
sms.open(oracle, "service=test.world user=zxc password=456");
string caccacc;
boost::tuple<string, string, string> person;
int i1 = 0;
soci::statement st = (abs.prepare <<
"select a.CGACACC, b.CACCNAME_SH, d.CVALUE \
from gac a, acc b, acc_add_atr c, acc_add_atr_val d \
where a.IGACCAT = :cat \
and a.IGACNUM = :num \
and b.CACCACC = a.CGACACC \
and c.CACCACC = b.CACCACC \
and c.ID_ATR = :dop_attr \
and d.ID_VALUE = c.ID_VALUE",
into(person),
use(cat, "cat"),
use(num, "num"),
use(dop_attr, "dop_attr"));
st.execute();
while (st.fetch())
{
cout << person.get<0>().c_str() <<":"<< person.get<1>().c_str() <<":"<< person.get<2>().c_str()<<endl;
sms << "insert into sms_acc(acc, telephone) values(:acc, :telephone)",
use(person.get<0>(), "acc"),
use(person.get<2>(), "telephone");
}
}
catch (oracle_soci_error const & e)
{
cerr << "Oracle error: " << e.err_num_
<< " " << e.what() << endl;
}
catch (exception const & e)
{
cerr << "Some other error: " << e.what() << endl;
}
...............................................
}