本文整理汇总了C++中Db::error_policy方法的典型用法代码示例。如果您正苦于以下问题:C++ Db::error_policy方法的具体用法?C++ Db::error_policy怎么用?C++ Db::error_policy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Db
的用法示例。
在下文中一共展示了Db::error_policy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _append_recno_intercept
//static
int Db::_append_recno_intercept(DB *db, DBT *data, db_recno_t recno)
{
int err;
if (db == 0) {
DB_ERROR("Db::append_recno_callback", EINVAL, ON_ERROR_UNKNOWN);
return (EINVAL);
}
Db *cxxdb = (Db *)db->cj_internal;
if (cxxdb == 0) {
DB_ERROR("Db::append_recno_callback", EINVAL, ON_ERROR_UNKNOWN);
return (EINVAL);
}
if (cxxdb->append_recno_callback_ == 0) {
DB_ERROR("Db::append_recno_callback", EINVAL, cxxdb->error_policy());
return (EINVAL);
}
// making these copies is slow but portable.
// Another alternative is to cast the DBT* manufactured
// by the C layer to a Dbt*. It 'should be' safe since
// Dbt is a thin shell over DBT, adding no extra data,
// but is nonportable, and could lead to errors if anything
// were added to the Dbt class.
//
Dbt cxxdbt;
memcpy((DBT *)&cxxdbt, data, sizeof(DBT));
err = (*cxxdb->append_recno_callback_)(cxxdb, &cxxdbt, recno);
memcpy(data, (DBT *)&cxxdbt, sizeof(DBT));
return (err);
}
示例2: _feedback_intercept
//static
void Db::_feedback_intercept(DB *db, int opcode, int pct)
{
if (db == 0) {
DB_ERROR("Db::feedback_callback", EINVAL, ON_ERROR_UNKNOWN);
return;
}
Db *cxxdb = (Db *)db->cj_internal;
if (cxxdb == 0) {
DB_ERROR("Db::feedback_callback", EINVAL, ON_ERROR_UNKNOWN);
return;
}
if (cxxdb->feedback_callback_ == 0) {
DB_ERROR("Db::feedback_callback", EINVAL, cxxdb->error_policy());
return;
}
(*cxxdb->feedback_callback_)(cxxdb, opcode, pct);
}