# RPMDB Database API.

## Files

file | rpmlib.h
| In Memoriam: Steve Taylor <staylor@redhat.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 rpmdb_s * | rpmdb
| Database of headers and tag value indices.
typedef struct rpmdbMatchIterator_s * | rpmdbMatchIterator
| Database iterator.
typedef struct _dbiIndexSet * | dbiIndexSet
| A single element (i.e.
typedef struct tagStore_s * | tagStore_t

## Enumerations

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

## Functions

int | rpmdbFindFpList (rpmdb db, fingerPrint *fpList, dbiIndexSet *matchList, int numItems, unsigned int exclude)
| Find fingerprint matches in database.
rpmdb | rpmdbUnlink (rpmdb db, const char *msg)
| Unreference a database instance.
rpmdb | rpmdbLink (rpmdb db, const char *msg)
| Reference a database instance.
int | rpmdbOpen (const char *prefix, rpmdb *dbp, int mode, int perms)
| Open rpm database.
int | rpmdbInit (const char *prefix, int perms)
| Initialize database.
int | rpmdbVerifyAllDBI (rpmdb db)
| Verify all database components.
int | rpmdbVerify (const char *prefix)
| Open and verify all database components.
int | rpmdbClose (rpmdb db)
| Close all database indices and free rpmdb.
int | rpmdbSync (rpmdb db)
| Sync all database indices.
int | rpmdbOpenAll (rpmdb db)
| Open all database indices.
int | rpmdbCountPackages (rpmdb db, const char *name)
| Return number of instances of package in rpm database.
unsigned int | rpmdbGetIteratorOffset (rpmdbMatchIterator mi)
| Return header instance join key for current position of rpmdb iterator.
unsigned int | rpmdbGetIteratorFileNum (rpmdbMatchIterator mi)
| Return header tag index join key for current position of rpmdb iterator.
int | rpmdbGetIteratorCount (rpmdbMatchIterator mi)
| Return number of elements in rpm database iterator.
int | rpmdbAppendIterator (rpmdbMatchIterator mi, const int *hdrNums, int nHdrNums)
| Append items to set of package instances to iterate.
int | rpmdbPruneIterator (rpmdbMatchIterator mi, int *hdrNums, int nHdrNums, int sorted)
| Remove items from set of package instances to iterate.
int | rpmdbSetIteratorRE (rpmdbMatchIterator mi, rpmTag tag, rpmMireMode mode, const char *pattern)
| Add pattern to iterator selector.
int | rpmdbSetIteratorRewrite (rpmdbMatchIterator mi, int rewrite)
| Prepare iterator for lazy writes.
int | rpmdbSetIteratorModified (rpmdbMatchIterator mi, int modified)
| Modify iterator to mark header for lazy write on release.
int | rpmdbSetHdrChk (rpmdbMatchIterator mi, rpmts ts)
| Modify iterator to verify retrieved header blobs.
rpmdbMatchIterator | rpmdbInitIterator (rpmdb db, rpmTag rpmtag, const void *keyp, size_t keylen)
| Return database iterator.
Header | rpmdbNextIterator (rpmdbMatchIterator mi)
| Return next package header from iteration.
int | rpmdbCheckTerminate (int terminate)
| Check rpmdb signal handler for trapped signal and/or requested exit.
int | rpmdbCheckSignals (void)
| Check for and exit on termination signals.
rpmdbMatchIterator | rpmdbFreeIterator (rpmdbMatchIterator mi)
| Destroy rpm database iterator.
int | rpmdbAdd (rpmdb db, int iid, Header h, rpmts ts)
| Add package header to rpm database and indices.
int | rpmdbRemove (rpmdb db, int rid, unsigned int hdrNum, rpmts ts)
| Remove package header from rpm database and indices.
int | rpmdbRebuild (const char *prefix, rpmts ts)
| Rebuild database indices from package headers.

## Typedef Documentation

typedef struct _dbiIndexSet* dbiIndexSet

A single element (i.e.

inverted list from tag values) of a database.

Definition at line 43 of file rpmdb.h.

typedef struct rpmdb_s* rpmdb

Database of headers and tag value indices.

Definition at line 104 of file rpmlib.h.

typedef struct rpmdbMatchIterator_s* rpmdbMatchIterator

Database iterator.

Definition at line 109 of file rpmlib.h.

typedef struct tagStore_s* tagStore_t

Definition at line 471 of file rpmtag.h.

## Enumeration Type Documentation

enum rpmdbFlags

Enumerator:

  RPMDB_FLAG_JUSTCHECK |
  RPMDB_FLAG_MINIMAL |
  RPMDB_FLAG_CHROOT |

Definition at line 472 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 3113 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(), headerGetMagic(), headerIsEntry(), headerPut(), headerSetInstance(), headerSizeof(), 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, 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, unblockSignals(), and xcalloc().

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

int rpmdbAppendIterator | ( | rpmdbMatchIterator | 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 2648 of file rpmdb.c.

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

Referenced by markReplacedFiles().

int rpmdbCheckSignals | ( | void |  | ) |

Check for and exit on termination signals.

Definition at line 783 of file rpmdb.c.

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

Referenced by checkSignals(), rpmdbFreeIterator(), rpmdbInitIterator(), 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 740 of file rpmdb.c.

References rpmdbMatchIterator_s::mi_next, rpmdbClose(), rpmdbFreeIterator(), and rpmsqCaught.

Referenced by rpm_exithook(), and rpmdbCheckSignals().

int rpmdbClose | ( | rpmdb | db | ) |

Close all database indices and free rpmdb.

Parameters:

  | db | rpm database

Returns:
  0 on success

Definition at line 998 of file rpmdb.c.

References _free(), next, PBM_FREE, rpmdbUnlink, rpmsqEnable(), and tagStoreFree().

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

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

Return number of instances of package in rpm database.

Parameters:

  | db | rpm database
  | name | rpm package name

Returns:
  number of instances

Definition at line 1567 of file rpmdb.c.

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

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

int rpmdbFindFpList | ( | rpmdb | db,
|  | fingerPrint * | fpList,
|  | dbiIndexSet * | 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 3582 of file rpmdb.c.

References _db_tagged_file_indices, _free(), alloca(), rpmDataType_u::argv, __db_dbt::data, dbiAppendSet(), FP_EQUAL, fpCacheCreate(), fpCacheFree(), fpLookupList(), headerGet(), rpmdbMatchIterator_s::mi_data, rpmdbMatchIterator_s::mi_key, rpmdbMatchIterator_s::mi_set, rpmdbMatchIterator_s::mi_setx, _HE_s::p, rpmdbFreeIterator(), rpmdbGetIteratorCount(), rpmdbGrowIterator(), rpmdbInitIterator(), rpmdbNextIterator(), rpmdbSortIterator(), __db_dbt::size, _HE_s::tag, taghash(), rpmDataType_u::ui32p, and xcalloc().

Referenced by rpmtsRun().

rpmdbMatchIterator rpmdbFreeIterator | ( | rpmdbMatchIterator | mi | ) |

Destroy rpm database iterator.

Parameters:

  | mi | rpm database iterator

Returns:
  NULL always

Definition at line 1910 of file rpmdb.c.

References _free(), dbiFreeIndexSet(), dbiOpen(), rpmdbMatchIterator_s::mi_db, rpmdbMatchIterator_s::mi_dbc, rpmdbMatchIterator_s::mi_keyp, rpmdbMatchIterator_s::mi_next, rpmdbMatchIterator_s::mi_nre, rpmdbMatchIterator_s::mi_re, rpmdbMatchIterator_s::mi_set, miFreeHeader(), next, rpmdbCheckSignals(), RPMDBI_PACKAGES, and rpmdbUnlink.

Referenced by checkPackageSet(), dbiFindMatches(), handleInstInstalledFiles(), handleRmvdInstalledFiles(), IDTXload(), markReplacedFiles(), rpmcliInstall(), rpmcliShowMatches(), rpmdb_length(), rpmdb_subscript(), rpmdbCheckTerminate(), rpmdbFindByFile(), rpmdbFindFpList(), rpmdbRebuild(), rpmdbRemove(), rpmErase(), rpmgiFree(), rpmgiInitFilter(), rpmgiNext(), rpmmi_dealloc(), rpmmi_iternext(), rpmpsmStage(), rpmts_AddErase(), rpmtsAddInstallElement(), rpmtsCheck(), rpmtsFindPubkey(), rpmtsRun(), rpmtsSolve(), runImmedTriggers(), runTriggers(), and unsatisfiedDepend().

int rpmdbGetIteratorCount | ( | rpmdbMatchIterator | mi | ) |

Return number of elements in rpm database iterator.

Parameters:

  | mi | rpm database iterator

Returns:
  number of elements

Definition at line 1964 of file rpmdb.c.

References rpmdbMatchIterator_s::mi_set.

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

unsigned int rpmdbGetIteratorFileNum | ( | rpmdbMatchIterator | mi | ) |

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

Parameters:

  | mi | rpm database iterator

Definition at line 1960 of file rpmdb.c.

References rpmdbMatchIterator_s::mi_filenum.

Referenced by rpmtsFindPubkey().

unsigned int rpmdbGetIteratorOffset | ( | rpmdbMatchIterator | 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 1956 of file rpmdb.c.

References rpmdbMatchIterator_s::mi_offset.

Referenced by IDTXload(), markReplacedFiles(), rpmErase(), rpmgiNext(), rpmmi_Instance(), rpmpsmStage(), rpmts_AddErase(), rpmtsAddInstallElement(), and rpmtsFindPubkey().

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 1316 of file rpmdb.c.

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

Referenced by rpmtsInitDB().

rpmdbMatchIterator rpmdbInitIterator | ( | rpmdb | db,
|  | rpmTag | rpmtag,
|  | const void * | keyp,
|  | size_t | keylen |
| ) |  |  |

Return database iterator.

Parameters:

  | db | rpm database
  | rpmtag | 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 2659 of file rpmdb.c.

References _, _DBSWAP, _free(), __db_dbt::data, DB_SET, dbiFindByLabel(), dbiFreeIndexSet(), dbiOpen(), dbt2set(), rpmdbMatchIterator_s::mi_cflags, rpmdbMatchIterator_s::mi_data, rpmdbMatchIterator_s::mi_db, rpmdbMatchIterator_s::mi_dbc, rpmdbMatchIterator_s::mi_filenum, rpmdbMatchIterator_s::mi_h, rpmdbMatchIterator_s::mi_key, rpmdbMatchIterator_s::mi_keylen, rpmdbMatchIterator_s::mi_keyp, rpmdbMatchIterator_s::mi_modified, rpmdbMatchIterator_s::mi_next, rpmdbMatchIterator_s::mi_nre, rpmdbMatchIterator_s::mi_offset, rpmdbMatchIterator_s::mi_prevoffset, rpmdbMatchIterator_s::mi_re, rpmdbMatchIterator_s::mi_rpmtag, rpmdbMatchIterator_s::mi_set, rpmdbMatchIterator_s::mi_setx, rpmdbMatchIterator_s::mi_sorted, rpmdbMatchIterator_s::mi_ts, rpmdbCheckSignals(), rpmdbFindByFile(), RPMDBI_LABEL, RPMDBI_PACKAGES, rpmdbLink, rpmlog(), RPMLOG_ERR, __db_dbt::size, tagName(), _dbswap::ui, xcalloc(), and xmalloc().

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

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

Reference a database instance.

Parameters:

  | db | rpm database
  | msg |

Returns:
  new rpm database reference

Header rpmdbNextIterator | ( | rpmdbMatchIterator | mi | ) |

Return next package header from iteration.

Parameters:

  | mi | rpm database iterator

Returns:
  NULL on end of iteration.

Definition at line 2309 of file rpmdb.c.

References _, _DBSWAP, _free(), __db_dbt::data, DB_DBT_MALLOC, DB_NEXT, DB_SET, dbiIndexRecordFileNumber(), dbiIndexRecordOffset(), dbiOpen(), headerToken_s::flags, __db_dbt::flags, headerCheck(), headerCopyLoad(), HEADERFLAG_ALLOCATED, headerIsEntry(), headerLoad(), headerSetInstance(), headerSetOrigin(), rpmdbMatchIterator_s::mi_cflags, rpmdbMatchIterator_s::mi_data, rpmdbMatchIterator_s::mi_db, rpmdbMatchIterator_s::mi_dbc, rpmdbMatchIterator_s::mi_filenum, rpmdbMatchIterator_s::mi_h, rpmdbMatchIterator_s::mi_key, rpmdbMatchIterator_s::mi_keylen, rpmdbMatchIterator_s::mi_keyp, rpmdbMatchIterator_s::mi_modified, rpmdbMatchIterator_s::mi_offset, rpmdbMatchIterator_s::mi_prevoffset, rpmdbMatchIterator_s::mi_set, rpmdbMatchIterator_s::mi_setx, rpmdbMatchIterator_s::mi_ts, miFreeHeader(), mireSkip(), PBM_ISSET, PBM_REALLOC(), PBM_SET, RPMDBI_PACKAGES, rpmlog(), RPMLOG_DEBUG, RPMLOG_ERR, RPMRC_FAIL, RPMRC_NOTFOUND, RPMRC_OK, rpmtsCleanDig(), rpmtsDig(), __db_dbt::size, and _dbswap::ui.

Referenced by checkPackageSet(), dbiFindMatches(), handleInstInstalledFiles(), handleRmvdInstalledFiles(), IDTXload(), markReplacedFiles(), rpmcliInstall(), rpmcliShowMatches(), rpmdb_length(), rpmdb_subscript(), rpmdbFindByFile(), rpmdbFindFpList(), rpmdbRebuild(), rpmdbRemove(), rpmErase(), rpmgiNext(), rpmmi_iternext(), rpmpsmStage(), rpmts_AddErase(), rpmtsAddInstallElement(), rpmtsFindPubkey(), rpmtsRun(), rpmtsSolve(), runImmedTriggers(), runTriggers(), and unsatisfiedDepend().

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 1310 of file rpmdb.c.

References rpmdbOpenDatabase(), and rpmExpandNumeric().

Referenced by rpmtsOpenDB(), and rpmtsOpenSDB().

int rpmdbOpenAll | ( | rpmdb | db | ) |

Open all database indices.

Parameters:

  | db | rpm database

Returns:
  0 on success

Definition at line 923 of file rpmdb.c.

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

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

int rpmdbPruneIterator | ( | rpmdbMatchIterator | 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 2637 of file rpmdb.c.

References dbiPruneSet(), and rpmdbMatchIterator_s::mi_set.

Referenced by checkPackageSet(), rpmtsAddInstallElement(), and unsatisfiedDepend().

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 3893 of file rpmdb.c.

References _, _db_filter_dups, _free(), _rebuildinprogress, _RECNUM, Access(), D_, dbiTagsInit(), errno, F_OK, headerCopy(), headerFree(), headerIsEntry(), headerNEVRA(), Mkdir(), Rmdir(), RPMDB_FLAG_MINIMAL, rpmdbAdd(), rpmdbClose(), rpmdbFreeIterator(), RPMDBI_PACKAGES, rpmdbInitIterator(), rpmdbMoveDatabase(), rpmdbNextIterator(), rpmdbOpenDatabase(), rpmdbRemoveDatabase(), rpmdbSetHdrChk(), rpmdbSetIteratorRE(), rpmDefineMacro(), rpmExpandNumeric(), rpmGetPath(), rpmlog(), RPMLOG_DEBUG, RPMLOG_ERR, RPMLOG_NOTICE, RPMLOG_WARNING, RPMTAG_HEADERIMAGE, 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 2796 of file rpmdb.c.

References _, _DBSWAP, _free(), alloca(), blockSignals(), D_, __db_dbt::data, DB_KEYLAST, DB_NOTFOUND, DB_SET, DB_WRITECURSOR, dbiFreeIndexSet(), dbiIndexNewItem(), dbiOpen(), dbiPruneSet(), dbt2set(), headerFree(), headerGet(), headerLink(), headerPut(), nibble(), pgpExtractPubkeyFingerprint(), 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, rpmdbFreeIterator(), RPMDBI_ADDED, RPMDBI_AVAILABLE, RPMDBI_DEPENDS, RPMDBI_PACKAGES, RPMDBI_REMOVED, rpmdbInitIterator(), rpmdbNextIterator(), rpmlog(), RPMLOG_DEBUG, RPMLOG_ERR, set2dbt(), __db_dbt::size, tagName(), _dbswap::ui, unblockSignals(), and xcalloc().

Referenced by rpmpsmStage(), and rpmtsRollback().

int rpmdbSetHdrChk | ( | rpmdbMatchIterator | mi,
|  | rpmts | ts |
| ) |  |  |

Modify iterator to verify retrieved header blobs.

Parameters:

  | mi | rpm database iterator
  | ts | transaction set

Returns:
  0 always

Definition at line 2296 of file rpmdb.c.

References rpmdbMatchIterator_s::mi_ts.

Referenced by rpmdbRebuild(), and rpmtsInitIterator().

int rpmdbSetIteratorModified | ( | rpmdbMatchIterator | 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 2286 of file rpmdb.c.

References rpmdbMatchIterator_s::mi_modified.

Referenced by markReplacedFiles().

int rpmdbSetIteratorRE | ( | rpmdbMatchIterator | 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 2081 of file rpmdb.c.

References _free(), rpmdbMatchIterator_s::mi_nre, rpmdbMatchIterator_s::mi_re, mireCmp(), mireDup(), rpmExpand(), and xrealloc().

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

int rpmdbSetIteratorRewrite | ( | rpmdbMatchIterator | mi,
|  | int | rewrite |
| ) |  |  |

Prepare iterator for lazy writes.

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

Parameters:

  | mi | rpm database iterator
  | rewrite | new value of rewrite

Returns:
  previous value

Definition at line 2273 of file rpmdb.c.

References DB_WRITECURSOR, and rpmdbMatchIterator_s::mi_cflags.

Referenced by markReplacedFiles().

int rpmdbSync | ( | rpmdb | db | ) |

Sync all database indices.

Parameters:

  | db | rpm database

Returns:
  0 on success

Definition at line 1058 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 1369 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 1337 of file rpmdb.c.

References rpmdbClose(), and rpmdbOpenAll().

Referenced by db3open(), and rpmdbVerify().