RPMDB Database API.
Collaboration diagram for RPMDB Database API.:

## Files

file | rpmlib.h
| In Memoriam: Steve Taylor stayl.nosp@m.or@r.nosp@m.edhat.nosp@m..com was here, now he's not.
file | dbconfig.c
file | hdrNVR.c
file | rpmdb.c
file | rpmdb.h
| Access RPM indices using Berkeley DB interface(s).

## Typedefs

typedef struct _dbiIndexSet * | dbiIndexSet
| A single element (i.e. More...
typedef struct tagStore_s * | tagStore_t
typedef struct rpmdb_s * | rpmdb
| Database of headers and tag value indices. More...
typedef struct rpmmi_s * | rpmmi
| Database iterator. More...

## Enumerations

enum | rpmdbFlags { RPMDB_FLAG_JUSTCHECK = (1 << 0), RPMDB_FLAG_MINIMAL = (1 << 1), RPMDB_FLAG_CHROOT = (1 << 2) }

## Functions

int | rpmdbFindFpList (void *_db, fingerPrint *fpList, void *_matchList, int numItems, unsigned int exclude)
| Find fingerprint matches in database. More...
rpmdb | rpmdbUnlink (rpmdb db, const char *msg)
| Unreference a database instance. More...
rpmdb | rpmdbLink (rpmdb db, const char *msg)
| Reference a database instance. More...
int | rpmdbOpen (const char *prefix, rpmdb *dbp, int mode, int perms)
| Open rpm database. More...
int | rpmdbInit (const char *prefix, int perms)
| Initialize database. More...
int | rpmdbVerifyAllDBI (rpmdb db)
| Verify all database components. More...
int | rpmdbVerify (const char *prefix)
| Open and verify all database components. More...
int | rpmdbClose (rpmdb db)
| Close all database indices and free rpmdb. More...
int | rpmdbSync (rpmdb db)
| Sync all database indices. More...
int | rpmdbOpenAll (rpmdb db)
| Open all database indices. More...
int | rpmdbCount (rpmdb db, rpmTag tag, const void *keyp, size_t keylen)
| Return number of instances of key in a tag index. More...
int | rpmdbCountPackages (rpmdb db, const char *name)
| Return number of instances of package in Name index. More...
unsigned int | rpmmiInstance (rpmmi mi)
| Return header instance join key for current position of rpmdb iterator. More...
unsigned int | rpmmiFilenum (rpmmi mi)
| Return header tag index join key for current position of rpmdb iterator. More...
int | rpmmiCount (rpmmi mi)
| Return number of elements in rpm database iterator. More...
int | rpmmiGrow (rpmmi mi, const int *hdrNums, int nHdrNums)
| Append items to set of package instances to iterate. More...
int | rpmmiPrune (rpmmi mi, int *hdrNums, int nHdrNums, int sorted)
| Remove items from set of package instances to iterate. More...
int | rpmmiAddPattern (rpmmi mi, rpmTag tag, rpmMireMode mode, const char *pattern)
| Add pattern to iterator selector. More...
int | rpmmiSetRewrite (rpmmi mi, int rewrite)
| Prepare iterator for lazy writes. More...
int | rpmmiSetModified (rpmmi mi, int modified)
| Modify iterator to mark header for lazy write on release. More...
int | rpmmiSetHdrChk (rpmmi mi, rpmts ts)
| Modify iterator to verify retrieved header blobs. More...
rpmmi | rpmmiInit (rpmdb db, rpmTag tag, const void *keyp, size_t keylen)
| Return database iterator. More...
Header | rpmmiNext (rpmmi mi)
| Return next package header from iteration. More...
int | rpmdbCheckTerminate (int terminate)
| Check rpmdb signal handler for trapped signal and/or requested exit. More...
int | rpmdbCheckSignals (void)
| Check for and exit on termination signals. More...
rpmmi | rpmmiUnlink (rpmmi mi)
| Unreference a rpm database iterator. More...
rpmmi | rpmmiLink (rpmmi mi)
| Reference a rpm database iterator. More...
rpmmi | rpmmiFree (rpmmi mi)
| Destroy rpm database iterator. More...
int | rpmdbMireApply (rpmdb db, rpmTag tag, rpmMireMode mode, const char *pat, const char ***argvp)
| Return array of keys matching a pattern. More...
int | rpmdbAdd (rpmdb db, int iid, Header h, rpmts ts)
| Add package header to rpm database and indices. More...
int | rpmdbRemove (rpmdb db, int rid, unsigned int hdrNum, rpmts ts)
| Remove package header from rpm database and indices. More...
int | rpmdbRebuild (const char *prefix, rpmts ts)
| Rebuild database indices from package headers. More...

## Detailed Description

## Typedef Documentation

typedef struct _dbiIndexSet* dbiIndexSet

A single element (i.e.

inverted list from tag values) of a database.

Definition at line 49 of file rpmdb.h.

typedef struct rpmdb_s* rpmdb

Database of headers and tag value indices.

Definition at line 38 of file rpmtypes.h.

typedef struct rpmmi_s* rpmmi

Database iterator.

Definition at line 43 of file rpmtypes.h.

typedef struct tagStore_s* tagStore_t

Definition at line 503 of file rpmtag.h.

## Enumeration Type Documentation

enum rpmdbFlags

Enumerator
RPMDB_FLAG_JUSTCHECK |
RPMDB_FLAG_MINIMAL |
RPMDB_FLAG_CHROOT |

Definition at line 481 of file rpmdb.h.

## Function Documentation

int rpmdbAdd | ( | rpmdb | db,
|  | int | iid,
|  | Header | h,
|  | rpmts | ts
| ) |  |

Add package header to rpm database and indices.

Parameters

  db | rpm database
  iid | install transaction id (iid = 0 or -1 to skip)
  h | header
  ts | (unused) transaction set (or NULL)

Returns
  0 on success

Definition at line 3306 of file rpmdb.c.

References _, _db_tagged_file_indices, _DBSWAP, _free(), alloca(), rpmDataType_u::argv, blockSignals(), _HE_s::c, D_, __db_dbt::data, DB_KEYLAST, DB_NOTFOUND, DB_SET, DB_WRITECURSOR, dbiAppendSet(), dbiFreeIndexSet(), dbiIndexNewItem(), dbiOpen(), dbt2set(), headerCheck(), headerDel(), headerGet(), headerIsEntry(), headerPut(), headerSetInstance(), headerUnload(), hGetColor(), nibble(), _HE_s::p, pgpExtractPubkeyFingerprint(), rpmDataType_u::ptr, RPM_BIN_TYPE, RPM_I18NSTRING_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, RPM_UINT16_TYPE, RPM_UINT32_TYPE, RPM_UINT64_TYPE, RPM_UINT8_TYPE, RPMDBI_ADDED, RPMDBI_AVAILABLE, RPMDBI_DEPENDS, RPMDBI_PACKAGES, RPMDBI_REMOVED, rpmlog(), RPMLOG_DEBUG, RPMLOG_ERR, RPMRC_FAIL, RPMRC_NOTFOUND, RPMTAG_BASENAMES, RPMTAG_DIRINDEXES, RPMTAG_DIRNAMES, RPMTAG_FILEDIGESTS, RPMTAG_INSTALLTID, RPMTAG_PACKAGECOLOR, RPMTAG_PUBKEYS, RPMTAG_REMOVETID, RPMTAG_REQUIREFLAGS, RPMTAG_REQUIRENAME, RPMTAG_TRIGGERNAME, rpmtsCleanDig(), rpmtsDig(), set2dbt(), __db_dbt::size, rpmDataType_u::str, _HE_s::t, _HE_s::tag, taghash(), tagName(), _dbswap::ui, rpmDataType_u::ui16p, rpmDataType_u::ui32p, rpmDataType_u::ui64p, rpmDataType_u::ui8p, UINT32_T, unblockSignals(), and xcalloc().

Referenced by ftsCacheUpdate(), rpmcliImportPubkey(), rpmdbRebuild(), and rpmpsmStage().

int rpmdbCheckSignals | ( | void |  | ) |

Check for and exit on termination signals.

Definition at line 804 of file rpmdb.c.

References D_, EXIT_FAILURE, rpmdbCheckTerminate(), rpmlog(), RPMLOG_DEBUG, and rpmsqCaught.

Referenced by checkSignals(), rpmdbClose(), rpmgiShowMatches(), rpmmiFini(), rpmmiInit(), rpmQueryVerify(), rpmtsRun(), and unblockSignals().

int rpmdbCheckTerminate | ( | int | terminate | ) |

Check rpmdb signal handler for trapped signal and/or requested exit.

Clean up any open iterators and databases on termination condition. On non-zero exit any open references to rpmdb are invalid and cannot be accessed anymore, calling process should terminate immediately.

Parameters

  terminate | 0 to only check for signals, 1 to terminate anyway

Returns
  0 to continue, 1 if termination cleanup was done.

Definition at line 757 of file rpmdb.c.

References rpmmi_s::mi_next, rpmdbClose(), rpmmiFree(), and rpmsqCaught.

Referenced by rpm_exithook(), rpmdbCheckSignals(), and rpmts_Die().

int rpmdbClose | ( | rpmdb | db | ) |

Close all database indices and free rpmdb.

Parameters

  db | rpm database

Returns
  0 on success

Definition at line 1019 of file rpmdb.c.

References _free(), _rpmdb_debug, L, PBM_FREE, rpmdbCheckSignals(), rpmdbRock, rpmioPutPool(), rpmsqEnable(), and tagStoreFree().

Referenced by rpmdb_dealloc(), rpmdbCheckTerminate(), rpmdbInit(), rpmdbOpenDatabase(), rpmdbRebuild(), rpmdbVerifyAllDBI(), rpmmiFini(), rpmtsCloseDB(), and rpmtsCloseSDB().

int rpmdbCount | ( | rpmdb | db,
|  | rpmTag | tag,
|  | const void * | keyp,
|  | size_t | keylen
| ) |  |

Return number of instances of key in a tag index.

Parameters

  db | rpm database
  tag | rpm tag
  keyp | key data
  keylen | key data length (0 will use strlen(keyp))

Returns
  number of instances

Definition at line 1676 of file rpmdb.c.

References _, __db_dbt::data, DB_NOTFOUND, DB_SET, dbiFreeIndexSet(), dbiIndexSetCount(), dbiOpen(), dbt2set(), rpmlog(), RPMLOG_ERR, __db_dbt::size, tagName(), and UINT32_T.

Referenced by rpmdbCountPackages().

int rpmdbCountPackages | ( | rpmdb | db,
|  | const char * | name
| ) |  |

Return number of instances of package in Name index.

Parameters

  db | rpm database
  name | rpm package name

Returns
  number of instances

Definition at line 1736 of file rpmdb.c.

References rpmdbCount(), and RPMTAG_NAME.

Referenced by handleOneTrigger(), rpmpsmStage(), and runTriggers().

int rpmdbFindFpList | ( | void * | _db,
|  | fingerPrint * | fpList,
|  | void * | _matchList,
|  | int | numItems,
|  | unsigned int | exclude
| ) |  |

Find fingerprint matches in database.

Parameters

  _db | rpm database
  fpList | fingerprint array

Return values

  _matchList | returned fingerprint matches

Parameters

  numItems | number of fingerprint items
  exclude | excluded header instance (0 to disable)

Returns
  0 always

Definition at line 3744 of file rpmdb.c.

References _db_tagged_file_indices, _free(), alloca(), rpmDataType_u::argv, __db_dbt::data, dbiAppendSet(), FP_EQUAL, fpCacheCreate(), fpCacheFree(), fpLookupList(), headerGet(), rpmmi_s::mi_data, rpmmi_s::mi_key, rpmmi_s::mi_set, rpmmi_s::mi_setx, _HE_s::p, rpmdbGrowIterator(), rpmdbSortIterator(), rpmmiCount(), rpmmiFree(), rpmmiInit(), rpmmiNext(), RPMTAG_BASENAMES, RPMTAG_DIRINDEXES, RPMTAG_DIRNAMES, __db_dbt::size, _HE_s::tag, taghash(), rpmDataType_u::ui32p, UINT32_T, and xcalloc().

Referenced by rpmtsRun().

int rpmdbInit | ( | const char * | prefix,
|  | int | perms
| ) |  |

Initialize database.

Parameters

  prefix | path to top of install tree
  perms | database permissions

Returns
  0 on success

Definition at line 1337 of file rpmdb.c.

References RPMDB_FLAG_JUSTCHECK, rpmdbClose(), rpmdbOpenAll(), rpmdbOpenDatabase(), and rpmExpandNumeric().

Referenced by rpmtsInitDB().

rpmdb rpmdbLink | ( | rpmdb | db,
|  | const char * | msg
| ) |  |

Reference a database instance.

Parameters

  db | rpm database
  msg |

Returns
  new rpm database reference

Referenced by db3open(), rpmdbNew(), and rpmmiInit().

int rpmdbMireApply | ( | rpmdb | db,
|  | rpmTag | tag,
|  | rpmMireMode | mode,
|  | const char * | pat,
|  | const char *** | argvp
| ) |  |

Return array of keys matching a pattern.

Parameters

  db | rpm database
  tag | rpm tag
  mode | type of pattern match
  pat | pattern to match

Return values

  *argvp | array of keys that match

Returns
  0 on success

Definition at line 2935 of file rpmdb.c.

References _, _free(), alloca(), argvAdd(), argvAppend(), argvFree(), __db_dbt::data, DB_NEXT, dbiOpen(), mireFree(), mireNew(), mireRegcomp(), mireRegexec(), rpmlog(), RPMLOG_ERR, __db_dbt::size, tagName(), and xmalloc().

Referenced by rpmdbTriggerGlobs(), and runImmedTriggers().

int rpmdbOpen | ( | const char * | prefix,
|  | rpmdb * | dbp,
|  | int | mode,
|  | int | perms
| ) |  |

Open rpm database.

Parameters

  prefix | path to top of install tree

Return values

  dbp | address of rpm database

Parameters

  mode | open(2) flags: O_RDWR or O_RDONLY (O_CREAT also)
  perms | database permissions

Returns
  0 on success

Definition at line 1331 of file rpmdb.c.

References rpmdbOpenDatabase(), and rpmExpandNumeric().

Referenced by rpmtsFindPubkey(), rpmtsOpenDB(), and rpmtsOpenSDB().

int rpmdbOpenAll | ( | rpmdb | db | ) |

Open all database indices.

Parameters

  db | rpm database

Returns
  0 on success

Definition at line 944 of file rpmdb.c.

References dbiOpen(), RPMDBI_ADDED, RPMDBI_AVAILABLE, RPMDBI_DEPENDS, and RPMDBI_REMOVED.

Referenced by rpmdbInit(), rpmdbVerifyAllDBI(), and rpmtsRun().

int rpmdbRebuild | ( | const char * | prefix,
|  | rpmts | ts
| ) |  |

Rebuild database indices from package headers.

Parameters

  prefix | path to top of install tree
  ts | transaction set (or NULL)

Returns
  0 on success

Definition at line 4078 of file rpmdb.c.

References _, _db_filter_dups, _free(), _rebuildinprogress, _RECNUM, Access(), D_, dbiTagsInit(), errno, F_OK, headerCopy(), headerFree(), headerIsEntry(), headerNEVRA(), Mkdir(), name, Rmdir(), RPMDB_FLAG_MINIMAL, rpmdbAdd(), rpmdbClose(), RPMDBI_PACKAGES, rpmdbMoveDatabase(), rpmdbOpenDatabase(), rpmdbRemoveDatabase(), rpmDefineMacro(), rpmExpandNumeric(), rpmGetPath(), rpmlog(), RPMLOG_DEBUG, RPMLOG_ERR, RPMLOG_NOTICE, RPMLOG_WARNING, rpmmiAddPattern(), rpmmiFree(), rpmmiInit(), rpmmiNext(), RPMMIRE_DEFAULT, rpmmiSetHdrChk(), RPMTAG_ARCH, RPMTAG_BUILDTIME, RPMTAG_HEADERIMAGE, RPMTAG_NAME, RPMTAG_RELEASE, RPMTAG_SOURCERPM, RPMTAG_VERSION, stpcpy(), tagStoreFree(), URL_IS_UNKNOWN, urlPath(), xmalloc(), and xstrdup().

Referenced by rpmtsRebuildDB().

int rpmdbRemove | ( | rpmdb | db,
|  | int | rid,
|  | unsigned int | hdrNum,
|  | rpmts | ts
| ) |  |

Remove package header from rpm database and indices.

Parameters

  db | rpm database
  rid | (unused) remove transaction id (rid = 0 or -1 to skip)
  hdrNum | package instance number in database
  ts | (unused) transaction set (or NULL)

Returns
  0 on success

Definition at line 2989 of file rpmdb.c.

References _, _DBSWAP, _free(), alloca(), rpmDataType_u::argv, blockSignals(), _HE_s::c, D_, __db_dbt::data, DB_KEYLAST, DB_NOTFOUND, DB_SET, DB_WRITECURSOR, dbiFreeIndexSet(), dbiIndexNewItem(), dbiOpen(), dbiPruneSet(), dbt2set(), headerFree(), headerGet(), headerLink(), headerPut(), nibble(), _HE_s::p, pgpExtractPubkeyFingerprint(), rpmDataType_u::ptr, RPM_BIN_TYPE, RPM_I18NSTRING_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, RPM_UINT16_TYPE, RPM_UINT32_TYPE, RPM_UINT64_TYPE, RPM_UINT8_TYPE, RPMDBI_ADDED, RPMDBI_AVAILABLE, RPMDBI_DEPENDS, RPMDBI_PACKAGES, RPMDBI_REMOVED, rpmlog(), RPMLOG_DEBUG, RPMLOG_ERR, rpmmiFree(), rpmmiInit(), rpmmiNext(), RPMTAG_FILEDIGESTS, RPMTAG_NVRA, RPMTAG_PUBKEYS, RPMTAG_REMOVETID, set(), set2dbt(), __db_dbt::size, rpmDataType_u::str, _HE_s::t, _HE_s::tag, tagName(), _dbswap::ui, rpmDataType_u::ui16p, rpmDataType_u::ui32p, rpmDataType_u::ui64p, rpmDataType_u::ui8p, UINT32_T, unblockSignals(), and xcalloc().

Referenced by rpmpsmStage(), and rpmtsRollback().

int rpmdbSync | ( | rpmdb | db | ) |

Sync all database indices.

Parameters

  db | rpm database

Returns
  0 on success

Definition at line 1089 of file rpmdb.c.

Referenced by rpmtsRun().

rpmdb rpmdbUnlink | ( | rpmdb | db,
|  | const char * | msg
| ) |  |

Unreference a database instance.

Parameters

  db | rpm database
  msg |

Returns
  NULL always

int rpmdbVerify | ( | const char * | prefix | ) |

Open and verify all database components.

Parameters

  prefix | path to top of install tree

Returns
  0 on success

Definition at line 1390 of file rpmdb.c.

References rpmdbOpenDatabase(), rpmdbVerifyAllDBI(), and rpmExpandNumeric().

Referenced by rpmtsVerifyDB().

int rpmdbVerifyAllDBI | ( | rpmdb | db | ) |

Verify all database components.

Parameters

  db | rpm database

Returns
  0 on success

Definition at line 1358 of file rpmdb.c.

References rpmdbClose(), and rpmdbOpenAll().

Referenced by db3open(), and rpmdbVerify().

int rpmmiAddPattern | ( | rpmmi | mi,
|  | rpmTag | tag,
|  | rpmMireMode | mode,
|  | const char * | pattern
| ) |  |

Add pattern to iterator selector.

Parameters

  mi | rpm database iterator
  tag | rpm tag
  mode | type of pattern match
  pattern | pattern to match

Returns
  0 on success

Definition at line 2207 of file rpmdb.c.

References _free(), _mirePool, rpmmi_s::mi_nre, rpmmi_s::mi_re, mireCmp(), mireDup(), mireFree(), mireGetPool(), mireNew(), mireRegcomp(), rpmExpand(), RPMMIRE_DEFAULT, RPMMIRE_GLOB, RPMMIRE_REGEX, RPMMIRE_STRCMP, and xrealloc().

Referenced by dbiFindMatches(), IDTXload(), rpmdbRebuild(), rpmgiInitFilter(), rpmmi_Pattern(), rpmpsmStage(), rpmtsInitIterator(), and rpmtsRun().

int rpmmiCount | ( | rpmmi | mi | ) |

Return number of elements in rpm database iterator.

Parameters

  mi | rpm database iterator

Returns
  number of elements

Definition at line 2090 of file rpmdb.c.

References rpmmi_s::mi_set.

Referenced by ftsCacheUpdate(), rpmcliInstall(), rpmdbFindFpList(), rpmmi_Count(), rpmts_AddErase(), and runImmedTriggers().

unsigned int rpmmiFilenum | ( | rpmmi | mi | ) |

Return header tag index join key for current position of rpmdb iterator.

Parameters

  mi | rpm database iterator

Definition at line 2086 of file rpmdb.c.

References rpmmi_s::mi_filenum.

Referenced by rpmtsFindPubkey().

rpmmi rpmmiFree | ( | rpmmi | mi | ) |

Destroy rpm database iterator.

Parameters

  mi | rpm database iterator

Returns
  NULL always

Referenced by checkPackageSet(), dbiFindMatches(), ftsCacheUpdate(), handleInstInstalledFiles(), handleRmvdInstalledFiles(), IDTXload(), markReplacedFiles(), nwlookupTag(), rpmcliEraseElement(), rpmcliInstall(), rpmcliShowMatches(), rpmdb_length(), rpmdb_subscript(), rpmdbCheckTerminate(), rpmdbFindByFile(), rpmdbFindFpList(), rpmdbRebuild(), rpmdbRemove(), rpmErase(), rpmgiFini(), rpmgiInitFilter(), rpmgiNext(), rpmmi_dealloc(), rpmmi_iternext(), rpmpsmStage(), rpmts_AddErase(), rpmtsAddObsoletes(), rpmtsAddUpgrades(), rpmtsCheck(), rpmtsEraseDebuginfo(), rpmtsFindPubkey(), rpmtsRun(), rpmtsSolve(), runImmedTriggers(), runTriggersLoop(), unsatisfiedDepend(), and wnlookupTag().

int rpmmiGrow | ( | rpmmi | mi,
|  | const int * | hdrNums,
|  | int | nHdrNums
| ) |  |

Append items to set of package instances to iterate.

Parameters

  mi | rpm database iterator
  hdrNums | array of package instances
  nHdrNums | number of elements in array

Returns
  0 on success, 1 on failure (bad args)

Definition at line 2798 of file rpmdb.c.

References dbiAppendSet(), rpmmi_s::mi_set, and xcalloc().

Referenced by markReplacedFiles().

rpmmi rpmmiInit | ( | rpmdb | db,
|  | rpmTag | tag,
|  | const void * | keyp,
|  | size_t | keylen
| ) |  |

Return database iterator.

Parameters

  db | rpm database
  tag | rpm tag
  keyp | key data (NULL for sequential access)
  keylen | key data length (0 will use strlen(keyp))

Returns
  NULL on failure

Definition at line 2809 of file rpmdb.c.

References _, __db_dbt::data, DB_SET, dbiFindByLabel(), dbiFreeIndexSet(), dbiOpen(), dbt2set(), rpmmi_s::mi_cflags, rpmmi_s::mi_db, rpmmi_s::mi_dbc, rpmmi_s::mi_filenum, rpmmi_s::mi_h, rpmmi_s::mi_modified, rpmmi_s::mi_next, rpmmi_s::mi_nre, rpmmi_s::mi_offset, rpmmi_s::mi_prevoffset, rpmmi_s::mi_re, rpmmi_s::mi_rpmtag, rpmmi_s::mi_set, rpmmi_s::mi_setx, rpmmi_s::mi_sorted, rpmmi_s::mi_ts, rpmdbCheckSignals(), rpmdbFindByFile(), RPMDBI_LABEL, RPMDBI_PACKAGES, rpmdbLink(), rpmioFreePoolItem(), rpmioLinkPoolItem(), rpmlog(), RPMLOG_ERR, rpmmiGetPool(), rpmmiRock, RPMTAG_BASENAMES, RPMTAG_NAME, set(), __db_dbt::size, tagName(), _dbswap::ui, UINT32_T, and xcalloc().

Referenced by dbiFindMatches(), nwlookupTag(), rpmdb_length(), rpmdb_Match(), rpmdb_subscript(), rpmdbFindByFile(), rpmdbFindFpList(), rpmdbRebuild(), rpmdbRemove(), rpmtsFindPubkey(), rpmtsInitIterator(), rpmtsSolve(), and wnlookupTag().

unsigned int rpmmiInstance | ( | rpmmi | mi | ) |

Return header instance join key for current position of rpmdb iterator.

Parameters

  mi | rpm database iterator

Returns
  current header join key

Definition at line 2082 of file rpmdb.c.

References rpmmi_s::mi_offset.

Referenced by IDTXload(), markReplacedFiles(), nwlookupTag(), rpmcliEraseElement(), rpmdbFindByFile(), rpmErase(), rpmgiNext(), rpmmi_Instance(), rpmpsmStage(), rpmts_AddErase(), rpmtsAddObsoletes(), rpmtsAddUpgrades(), rpmtsEraseDebuginfo(), rpmtsFindPubkey(), runImmedTriggers(), runTriggersLoop(), and wnlookupTag().

rpmmi rpmmiLink | ( | rpmmi | mi | ) |

Reference a rpm database iterator.

Parameters

  mi | rpm database iterator

Returns
  NULL on last dereference

Header rpmmiNext | ( | rpmmi | mi | ) |

Return next package header from iteration.

Parameters

  mi | rpm database iterator

Returns
  NULL on end of iteration.

< Is 1st header region mmap'd?

< Is 1st header region rdonly?

Definition at line 2501 of file rpmdb.c.

References _, _DBSWAP, _free(), _rpmmi_usermem, __db_dbt::data, DB_NEXT, DB_SET, dbiIndexRecordFileNumber(), dbiIndexRecordOffset(), dbiOpen(), headerToken_s::flags, headerCheck(), headerCopyLoad(), HEADERFLAG_MAPPED, HEADERFLAG_RDONLY, headerFree(), headerIsEntry(), headerLoad(), headerSetInstance(), headerSetOrigin(), rpmmi_s::mi_cflags, rpmmi_s::mi_db, rpmmi_s::mi_dbc, rpmmi_s::mi_filenum, rpmmi_s::mi_h, rpmmi_s::mi_modified, rpmmi_s::mi_offset, rpmmi_s::mi_prevoffset, rpmmi_s::mi_rpmtag, rpmmi_s::mi_set, rpmmi_s::mi_setx, rpmmi_s::mi_ts, miFreeHeader(), mireSkip(), PBM_ISSET, PBM_REALLOC(), PBM_SET, RPMDBI_PACKAGES, rpmlog(), RPMLOG_DEBUG, RPMLOG_ERR, rpmmiGet(), RPMRC_FAIL, RPMRC_NOTFOUND, RPMRC_OK, RPMTAG_NAME, rpmtsCleanDig(), rpmtsDig(), __db_dbt::size, and _dbswap::ui.

Referenced by checkPackageSet(), dbiFindMatches(), handleInstInstalledFiles(), handleRmvdInstalledFiles(), IDTXload(), markReplacedFiles(), nwlookupTag(), rpmcliEraseElement(), rpmcliInstall(), rpmcliShowMatches(), rpmdb_length(), rpmdb_subscript(), rpmdbFindByFile(), rpmdbFindFpList(), rpmdbRebuild(), rpmdbRemove(), rpmErase(), rpmgiNext(), rpmmi_iternext(), rpmpsmStage(), rpmts_AddErase(), rpmtsAddObsoletes(), rpmtsAddUpgrades(), rpmtsEraseDebuginfo(), rpmtsFindPubkey(), rpmtsRun(), rpmtsSolve(), runImmedTriggers(), runTriggersLoop(), unsatisfiedDepend(), and wnlookupTag().

int rpmmiPrune | ( | rpmmi | mi,
|  | int * | hdrNums,
|  | int | nHdrNums,
|  | int | sorted
| ) |  |

Remove items from set of package instances to iterate.

Note
  Sorted hdrNums are always passed in rpmlib.

Parameters

  mi | rpm database iterator
  hdrNums | array of package instances
  nHdrNums | number of elements in array
  sorted | is the array sorted? (array will be sorted on return)

Returns
  0 on success, 1 on failure (bad args)

Definition at line 2788 of file rpmdb.c.

References dbiPruneSet(), and rpmmi_s::mi_set.

Referenced by checkPackageSet(), nwlookupTag(), rpmtsAddObsoletes(), rpmtsEraseDebuginfo(), runImmedTriggers(), runTriggersLoop(), unsatisfiedDepend(), and wnlookupTag().

int rpmmiSetHdrChk | ( | rpmmi | mi,
|  | rpmts | ts
| ) |  |

Modify iterator to verify retrieved header blobs.

Parameters

  mi | rpm database iterator
  ts | transaction set

Returns
  0 always

Definition at line 2441 of file rpmdb.c.

References rpmmi_s::mi_ts.

Referenced by rpmdbRebuild(), and rpmtsInitIterator().

int rpmmiSetModified | ( | rpmmi | mi,
|  | int | modified
| ) |  |

Modify iterator to mark header for lazy write on release.

Parameters

  mi | rpm database iterator
  modified | new value of modified

Returns
  previous value

Definition at line 2431 of file rpmdb.c.

References rpmmi_s::mi_modified.

Referenced by markReplacedFiles().

int rpmmiSetRewrite | ( | rpmmi | mi,
|  | int | rewrite
| ) |  |

Prepare iterator for lazy writes.

Note
  Must be called before rpmmiNext() with CDB model database.

Parameters

  mi | rpm database iterator
  rewrite | new value of rewrite

Returns
  previous value

Definition at line 2418 of file rpmdb.c.

References DB_WRITECURSOR, and rpmmi_s::mi_cflags.

Referenced by markReplacedFiles().

rpmmi rpmmiUnlink | ( | rpmmi | mi | ) |

Unreference a rpm database iterator.

Parameters

  mi | rpm database iterator

Returns
  NULL on last dereference