BerkeleyDB

 view release on metacpan or  search on metacpan

BerkeleyDB.xs  view on Meta::CPAN

                                ? associate_foreign_cb_recno
                                : associate_foreign_cb);
	  }
	  secondary->primary_recno_or_queue = db->recno_or_queue ;
	  secondary->secondary_db = TRUE;
      RETVAL = db_associate_foreign(db, secondary, callback_ptr, flags);
#endif
	OUTPUT:
	  RETVAL

DualType
compact(db, start=NULL, stop=NULL, c_data=NULL, flags=0, end=NULL)
	PREINIT:
	  dMY_CXT;
    PREINIT:
        DBTKEY	    end_key;
    INPUT:
	BerkeleyDB::Common	db
	SVnull*   	    start
	SVnull*   	    stop
	SVnull*   	    c_data
	u_int32_t	flags
	SVnull*   	    end
	CODE:
    {
#ifndef AT_LEAST_DB_4_4
          softCrash("compact needs Berkeley DB 4.4 or later") ;
#else
        DBTKEY	    start_key;
        DBTKEY	    stop_key;
        DBTKEY*	    start_p = NULL;
        DBTKEY*	    stop_p = NULL;
        DBTKEY*	    end_p = NULL;
	    DB_COMPACT cmpt;
	    DB_COMPACT* cmpt_p = NULL;
	    SV * sv;
        HV* hash = NULL;

        DBT_clear(start_key);
        DBT_clear(stop_key);
        DBT_clear(end_key);
        Zero(&cmpt, 1, DB_COMPACT) ;
        ckActive_Database(db->active) ;
        saveCurrentDB(db) ;
        if (start && SvOK(start)) {
            start_p = &start_key;
            DBM_ckFilter(start, filter_store_key, "filter_store_key");
            GetKey(db, start, start_p);
        }
        if (stop && SvOK(stop)) {
            stop_p = &stop_key;
            DBM_ckFilter(stop, filter_store_key, "filter_store_key");
            GetKey(db, stop, stop_p);
        }
        if (end) {
            end_p = &end_key;
        }
        if (c_data && SvOK(c_data)) {
            hash = (HV*) SvRV(c_data) ;
            cmpt_p = & cmpt;
            cmpt.compact_fillpercent = GetValue_iv(hash,"compact_fillpercent") ;
            cmpt.compact_timeout = (db_timeout_t) GetValue_iv(hash, "compact_timeout");
        }
        RETVAL = (db->dbp)->compact(db->dbp, db->txn, start_p, stop_p, cmpt_p, flags, end_p);
        if (RETVAL == 0 && hash) {
            hv_store_iv(hash, "compact_deadlock", cmpt.compact_deadlock) ;
            hv_store_iv(hash, "compact_levels",   cmpt.compact_levels) ;
            hv_store_iv(hash, "compact_pages_free", cmpt.compact_pages_free) ;
            hv_store_iv(hash, "compact_pages_examine", cmpt.compact_pages_examine) ;
            hv_store_iv(hash, "compact_pages_truncated", cmpt.compact_pages_truncated) ;
        }
#endif
    }
	OUTPUT:
	  RETVAL
	  end		if (RETVAL == 0 && end) OutputValue_B(ST(5), end_key) ;


DualType
get_blob_threshold(db, bytes)
	BerkeleyDB::Common	db
	u_int32_t bytes = NO_INIT
	PREINIT:
	  dMY_CXT;
    CODE:
#ifndef AT_LEAST_DB_6_0
	    softCrash("$db->get_blob_threshold needs Berkeley DB 6.0 or better") ;
#else
        RETVAL = db->dbp->get_blob_threshold(db->dbp, &bytes);
#endif
    OUTPUT:
        RETVAL
        bytes

DualType
get_blob_dir(db, dir)
	BerkeleyDB::Common db
	char* dir = NO_INIT
	PREINIT:
	  dMY_CXT;
    CODE:
#ifndef AT_LEAST_DB_6_0
	    softCrash("$db->get_blob_dir needs Berkeley DB 6.0 or better") ;
#else
        RETVAL = db->dbp->get_blob_dir(db->dbp, (const char**)&dir);
#endif
    OUTPUT:
        RETVAL
        dir


MODULE = BerkeleyDB::Cursor              PACKAGE = BerkeleyDB::Cursor	PREFIX = cu_

BerkeleyDB::Cursor::Raw
_c_dup(db, flags=0)
	u_int32_t		flags
    	BerkeleyDB::Cursor	db
        BerkeleyDB::Cursor 	RETVAL = NULL ;
	PREINIT:
	  dMY_CXT;
	INIT:



( run in 2.980 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )