コード例 #1
0
ファイル: test_rc.cpp プロジェクト: PickXu/zero-xum
w_rc_t _testing2()
{

    w_rc_t rc = RC(fcOS);
    RC_AUGMENT(rc);
    RC_AUGMENT(rc);
    RC_AUGMENT(rc);
    RC_AUGMENT(rc);
    RC_AUGMENT(rc);

    // This constitutes a check on THIS rc
    if (rc.is_error())  {; } 

    return rc;
}
コード例 #2
0
ファイル: sort_funcs2.cpp プロジェクト: glycerine/shore-mt
/*
 * Scan the file, deleting corresponding entries from
 * the rtree index.  Probe, Delete the key/elem pr, re-probe,
 * re-insert, re-probe, re-delete, re-probe.
 * This tests insert/remove of null entries, for one thing.
 * The file given should be the original file if it still
 * exists, so that we can avoid deleting in sorted order.
 */
w_rc_t
delete_rtree_entries(
    stid_t idx,
    stid_t fid,
    smsize_t keyoffset
)
{
    char    stringbuffer[MAXBV];
    scan_file_i  scanf(fid, ss_m::t_cc_file);

    bool    nullfound=false;
    bool     feof;
    w_rc_t    rc;
    pin_i*    pin;
    nbox_t     key;
    vec_t     elem;
    smsize_t     klen, elen;
    rid_t    rid;
    int     i=0;
    while ( !(rc=scanf.next(pin, 0, feof)).is_error() && !feof ) {
    i++;

    smsize_t ridoffset = pin->body_size() - sizeof(rid_t);
    klen = ridoffset - keyoffset;

    smsize_t offset = keyoffset;

    /* Get key from file record */
    while(pin->start_byte()+pin->length() <= offset){ 
        rc = pin->next_bytes(feof); 
        if(rc.is_error()) {
        DBG(<<"rc=" << rc);
        return RC_AUGMENT(rc);
        }
        w_assert3(!feof);
    }
    offset -=  pin->start_byte();
    // not handling logical case...
        smsize_t amt = pin->length() - offset;
        DBG(<<"offset=" <<offset << " amt=" << amt);
        memcpy(&stringbuffer, pin->body() + offset, amt);

    if(offset + klen > pin->length()) {
        rc = pin->next_bytes(feof); 
        if(rc.is_error()) {
        DBG(<<"rc=" << rc);
        return RC_AUGMENT(rc);
        }
コード例 #3
0
ファイル: log.cpp プロジェクト: glycerine/shore-mt
/*********************************************************************
 *
 *  log_i::next(lsn, r)
 *
 *  Read the next record into r and return its lsn in lsn.
 *  Return false if EOF reached. true otherwise.
 *
 *********************************************************************/
bool log_i::next(lsn_t& lsn, logrec_t*& r)  
{
    bool eof = (cursor == lsn_t::null);
    if (! eof) {
        lsn = cursor;
        rc_t rc = log.fetch(lsn, r, &cursor);
        
        // release right away, since this is only
        // used in recovery.
        log.release();

        if (rc.is_error())  {
            last_rc = rc;
            RC_AUGMENT(last_rc);
            RC_APPEND_MSG(last_rc, << "trying to fetch lsn " << cursor);
            
            if (last_rc.err_num() == smlevel_0::eEOF)  
                eof = true;
            else  {
                smlevel_0::errlog->clog << fatal_prio 
                << "Fatal error : " << RC_PUSH(last_rc, smlevel_0::eINTERNAL) << flushl;
            }
        }