return rc;
}
-static int db3cdup(dbiIndex dbi, DBC * dbcursor, DBC ** dbcp,
- unsigned int flags)
-{
- int rc;
-
- if (dbcp) *dbcp = NULL;
- rc = dbcursor->c_dup(dbcursor, dbcp, flags);
- rc = cvtdberr(dbi, "dbcursor->c_dup", rc, _debug);
- /* FIX: *dbcp can be NULL */
- return rc;
-}
-
static int db3cclose(dbiIndex dbi, DBC * dbcursor,
unsigned int flags)
{
return rc;
}
-static int db3cpget(dbiIndex dbi, DBC * dbcursor, DBT * key, DBT * pkey,
- DBT * data, unsigned int flags)
-{
- DB * db = dbi->dbi_db;
- int _printit;
- int rc;
-
- assert(db != NULL);
- assert(dbcursor != NULL);
-
- /* XXX db3 does DB_FIRST on uninitialized cursor */
- rc = dbcursor->c_pget(dbcursor, key, pkey, data, flags);
- /* XXX DB_NOTFOUND can be returned */
- _printit = (rc == DB_NOTFOUND ? 0 : _debug);
- rc = cvtdberr(dbi, "dbcursor->c_pget", rc, _printit);
-
- return rc;
-}
-
static int db3ccount(dbiIndex dbi, DBC * dbcursor,
unsigned int * countp,
unsigned int flags)
return rc;
}
-static int db3associate(dbiIndex dbi, dbiIndex dbisecondary,
- int (*callback)(DB *, const DBT *, const DBT *, DBT *),
- unsigned int flags)
-{
- DB * db = dbi->dbi_db;
- DB * secondary = dbisecondary->dbi_db;
- int rc;
-
- DB_TXN * txnid = NULL;
-
-assert(db != NULL);
- rc = db->associate(db, txnid, secondary, callback, flags);
- rc = cvtdberr(dbi, "db->associate", rc, _debug);
- return rc;
-}
-
-static int db3join(dbiIndex dbi, DBC ** curslist, DBC ** dbcp,
- unsigned int flags)
-{
- DB * db = dbi->dbi_db;
- int rc;
-
-assert(db != NULL);
- rc = db->join(db, curslist, dbcp, flags);
- rc = cvtdberr(dbi, "db->join", rc, _debug);
- return rc;
-}
-
static int db3close(dbiIndex dbi, unsigned int flags)
{
rpmdb rpmdb = dbi->dbi_rpmdb;
RPM_GNUC_INTERNAL
const struct _dbiVec db3vec = {
DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
- db3open, db3close, db3sync, db3associate, db3join,
- db3copen, db3cclose, db3cdup, db3cdel, db3cget, db3cpget, db3cput, db3ccount,
- db3byteswapped, db3stat
+ db3open, db3close, db3sync, db3copen, db3cclose, db3cdel,
+ db3cget, db3cput, db3ccount, db3byteswapped, db3stat
};
**************************************************/
/**
- * Associate secondary database with primary.
- * @param dbi index database handle
- * @param dbisecondary secondary index database handle
- * @param callback create secondary key from primary (NULL if DB_RDONLY)
- * @param flags DB_CREATE or 0
- * @return 0 on success
- */
-static int sql_associate (dbiIndex dbi, dbiIndex dbisecondary,
- int (*callback) (DB *, const DBT *, const DBT *, DBT *),
- unsigned int flags)
-{
-if (_debug)
-fprintf(stderr, "*** %s:\n", __FUNCTION__);
- return EINVAL;
-}
-
-/**
- * Return join cursor for list of cursors.
- * @param dbi index database handle
- * @param curslist NULL terminated list of database cursors
- * @retval dbcp address of join database cursor
- * @param flags DB_JOIN_NOSORT or 0
- * @return 0 on success
- */
-static int sql_join (dbiIndex dbi, DBC ** curslist, DBC ** dbcp,
- unsigned int flags)
-{
-if (_debug)
-fprintf(stderr, "*** %s:\n", __FUNCTION__);
- return EINVAL;
-}
-
-/**
- * Duplicate a database cursor.
- * @param dbi index database handle
- * @param dbcursor database cursor
- * @retval dbcp address of new database cursor
- * @param flags DB_POSITION for same position, 0 for uninitialized
- * @return 0 on success
- */
-static int sql_cdup (dbiIndex dbi, DBC * dbcursor, DBC ** dbcp,
- unsigned int flags)
-{
-if (_debug)
-fprintf(stderr, "*** %s:\n", __FUNCTION__);
- return EINVAL;
-}
-
-/**
- * Retrieve (key,data) pair using dbcursor->c_pget.
- * @param dbi index database handle
- * @param dbcursor database cursor
- * @param key secondary retrieve key value/length/flags
- * @param pkey primary retrieve key value/length/flags
- * @param data primary retrieve data value/length/flags
- * @param flags DB_NEXT, DB_SET, or 0
- * @return 0 on success
- */
-static int sql_cpget (dbiIndex dbi, DBC * dbcursor,
- DBT * key, DBT * pkey, DBT * data, unsigned int flags)
-{
-if (_debug)
-fprintf(stderr, "*** %s:\n", __FUNCTION__);
- return EINVAL;
-}
-
-/**
* Retrieve count of (possible) duplicate items using dbcursor->c_count.
* @param dbi index database handle
* @param dbcursor database cursor
sql_open,
sql_close,
sql_sync,
- sql_associate,
- sql_join,
sql_copen,
sql_cclose,
- sql_cdup,
sql_cdel,
sql_cget,
- sql_cpget,
sql_cput,
sql_ccount,
sql_byteswapped,
int (*sync) (dbiIndex dbi, unsigned int flags);
/** \ingroup dbi
- * Associate secondary database with primary.
- * @param dbi index database handle
- * @param dbisecondary secondary index database handle
- * @param callback create secondary key from primary (NULL if DB_RDONLY)
- * @param flags DB_CREATE or 0
- * @return 0 on success
- */
- int (*associate) (dbiIndex dbi, dbiIndex dbisecondary,
- int (*callback) (DB *, const DBT *, const DBT *, DBT *),
- unsigned int flags);
-
-/** \ingroup dbi
- * Return join cursor for list of cursors.
- * @param dbi index database handle
- * @param curslist NULL terminated list of database cursors
- * @retval dbcp address of join database cursor
- * @param flags DB_JOIN_NOSORT or 0
- * @return 0 on success
- */
- int (*join) (dbiIndex dbi, DBC ** curslist, DBC ** dbcp,
- unsigned int flags);
-
-/** \ingroup dbi
* Open database cursor.
* @param dbi index database handle
* @param txnid database transaction handle
int (*cclose) (dbiIndex dbi, DBC * dbcursor, unsigned int flags);
/** \ingroup dbi
- * Duplicate a database cursor.
- * @param dbi index database handle
- * @param dbcursor database cursor
- * @retval dbcp address of new database cursor
- * @param flags DB_POSITION for same position, 0 for uninitialized
- * @return 0 on success
- */
- int (*cdup) (dbiIndex dbi, DBC * dbcursor, DBC ** dbcp,
- unsigned int flags);
-
-/** \ingroup dbi
* Delete (key,data) pair(s) using db->del or dbcursor->c_del.
* @param dbi index database handle
* @param dbcursor database cursor (NULL will use db->del)
unsigned int flags);
/** \ingroup dbi
- * Retrieve (key,data) pair using dbcursor->c_pget.
- * @param dbi index database handle
- * @param dbcursor database cursor
- * @param key secondary retrieve key value/length/flags
- * @param pkey primary retrieve key value/length/flags
- * @param data primary retrieve data value/length/flags
- * @param flags DB_NEXT, DB_SET, or 0
- * @return 0 on success
- */
- int (*cpget) (dbiIndex dbi, DBC * dbcursor,
- DBT * key, DBT * pkey, DBT * data, unsigned int flags);
-
-/** \ingroup dbi
* Store (key,data) pair using db->put or dbcursor->c_put.
* @param dbi index database handle
* @param dbcursor database cursor (NULL will use db->put)
}
/** \ingroup dbi
- * Duplicate a database cursor.
- * @param dbi index database handle
- * @param dbcursor database cursor
- * @retval dbcp address of new database cursor
- * @param flags DB_POSITION for same position, 0 for uninitialized
- * @return 0 on success
- */
-static inline
-int dbiCdup(dbiIndex dbi, DBC * dbcursor, DBC ** dbcp,
- unsigned int flags)
-{
- return (*dbi->dbi_vec->cdup) (dbi, dbcursor, dbcp, flags);
-}
-
-/** \ingroup dbi
* Delete (key,data) pair(s) from index database.
* @param dbi index database handle
* @param dbcursor database cursor (NULL will use db->del)
}
/** \ingroup dbi
- * Retrieve (key,data) pair using dbcursor->c_pget.
- * @param dbi index database handle
- * @param dbcursor database cursor (NULL will use db->get)
- * @param key secondary retrieve key value/length/flags
- * @param pkey primary retrieve key value/length/flags
- * @param data primary retrieve data value/length/flags
- * @param flags DB_NEXT, DB_SET, or 0
- * @return 0 on success
- */
-static inline
-int dbiPget(dbiIndex dbi, DBC * dbcursor,
- DBT * key, DBT * pkey, DBT * data, unsigned int flags)
-{
- int rc;
- assert((flags == DB_NEXT) || (key->data != NULL && key->size > 0));
- (void) rpmswEnter(&dbi->dbi_rpmdb->db_getops, 0);
- rc = (dbi->dbi_vec->cpget) (dbi, dbcursor, key, pkey, data, flags);
- (void) rpmswExit(&dbi->dbi_rpmdb->db_getops, (ssize_t) data->size);
- return rc;
-}
-
-/** \ingroup dbi
* Store (key,data) pair in index database.
* @param dbi index database handle
* @param dbcursor database cursor (NULL will use db->put)
}
/** \ingroup dbi
- * Associate secondary database with primary.
- * @param dbi index database handle
- * @param dbisecondary secondary index database handle
- * @param callback create secondary key from primary (NULL if DB_RDONLY)
- * @param flags DB_CREATE or 0
- * @return 0 on success
- */
-static inline
-int dbiAssociate(dbiIndex dbi, dbiIndex dbisecondary,
- int (*callback) (DB *, const DBT *, const DBT *, DBT *),
- unsigned int flags)
-{
- return (*dbi->dbi_vec->associate) (dbi, dbisecondary, callback, flags);
-}
-
-/** \ingroup dbi
- * Return join cursor for list of cursors.
- * @param dbi index database handle
- * @param curslist NULL terminated list of database cursors
- * @retval dbcp address of join database cursor
- * @param flags DB_JOIN_NOSORT or 0
- * @return 0 on success
- */
-static inline
-int dbiJoin(dbiIndex dbi, DBC ** curslist, DBC ** dbcp,
- unsigned int flags)
-{
- return (*dbi->dbi_vec->join) (dbi, curslist, dbcp, flags);
-}
-
-/** \ingroup dbi
* Is database byte swapped?
* @param dbi index database handle
* @return 0 same order, 1 swapped order