BerkeleyDB

 view release on metacpan or  search on metacpan

BerkeleyDB.xs  view on Meta::CPAN

#endif
	OUTPUT:
	  RETVAL
	  countp

#ifdef AT_LEAST_DB_4_1
#  define db_associate(db, sec, cb, flags)\
	(db->Status = ((db->dbp)->associate)(db->dbp, db->txn, sec->dbp, &cb, flags))
#else
#  define db_associate(db, sec, cb, flags)\
	(db->Status = ((db->dbp)->associate)(db->dbp, sec->dbp, &cb, flags))
#endif
DualType
associate(db, secondary, callback, flags=0)
	BerkeleyDB::Common	db
	BerkeleyDB::Common	secondary
	SV*			callback
	u_int32_t		flags
	PREINIT:
	  dMY_CXT;
	INIT:
	  ckActive_Database(db->active) ;
	CODE:
#ifndef AT_LEAST_DB_3_3
          softCrash("associate needs Berkeley DB 3.3 or later") ;
#else
	  saveCurrentDB(db) ;
	  /* db->associated = newSVsv(callback) ; */
	  secondary->associated = newSVsv(callback) ;
	  secondary->primary_recno_or_queue = db->recno_or_queue ;
	  /* secondary->dbp->app_private = secondary->associated ; */
	  secondary->secondary_db = TRUE;
      if (secondary->recno_or_queue)
          RETVAL = db_associate(db, secondary, associate_cb_recno, flags);
      else
          RETVAL = db_associate(db, secondary, associate_cb, flags);
#endif
	OUTPUT:
	  RETVAL

#define db_associate_foreign(db, sec, cb, flags)\
	(db->Status = ((db->dbp)->associate_foreign)(db->dbp, sec->dbp, cb, flags))
DualType
associate_foreign(db, secondary, callback, flags)
	BerkeleyDB::Common	db
	BerkeleyDB::Common	secondary
	SV*			callback
	u_int32_t		flags
    foreign_cb_type callback_ptr = NULL;
	PREINIT:
	  dMY_CXT;
	INIT:
	  ckActive_Database(db->active) ;
	CODE:
#ifndef AT_LEAST_DB_4_8
          softCrash("associate_foreign needs Berkeley DB 4.8 or later") ;
#else
	  saveCurrentDB(db) ;
	  if (callback != &PL_sv_undef)
	  {
          //softCrash("associate_foreign does not support callbacks yet") ;
          secondary->associated_foreign = newSVsv(callback) ;
          callback_ptr = ( secondary->recno_or_queue
                                ? 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)) {



( run in 2.133 seconds using v1.01-cache-2.11-cpan-140bd7fdf52 )