rpm  5.4.15
Data Structures | Macros | Typedefs | Functions | Variables
sqlite.c File Reference
#include "system.h"
#include <sqlite3.h>
#include <rpmsql.h>
#include <rpmlog.h>
#include <rpmmacro.h>
#include <rpmurl.h>
#include <rpmtag.h>
#include <rpmdb.h>
#include "debug.h"
Include dependency graph for sqlite.c:

Go to the source code of this file.

Data Structures

struct  key_s
 
struct  _sql_dbcursor_s
 

Macros

#define _RPMSQL_INTERNAL
 
#define _RPMDB_INTERNAL
 
#define UINT32_T   uint32_t
 
#define SQLDBDEBUG(_dbi, _list)   if (((_dbi) && (_dbi)->dbi_debug) || (_sqldb_debug)) fprintf _list
 
#define _DBT_ENTRY(_v)   { DB_DBT_##_v, #_v, }
 
#define _KEYDATA(_K, _P, _D, _R)   fmtKDR(_K, _P, _D, _R)
 
#define cvtdberr(_dbi, _msg, _error)   Xcvtdberr(_dbi, _msg, _error, _sqldb_debug, __FUNCTION__, __FILE__, __LINE__)
 
#define SCPDEBUG(_dbi, _list)   if (_scp_debug) fprintf _list
 
#define scpUnlink(_scp)   ((SCP_t)rpmioUnlinkPoolItem((rpmioItem)(_scp), __FUNCTION__, __FILE__, __LINE__))
 
#define scpLink(_scp)   ((SCP_t)rpmioLinkPoolItem((rpmioItem)(_scp), __FUNCTION__, __FILE__, __LINE__))
 
#define scpFree(_scp)   ((SCP_t)rpmioFreePoolItem((rpmioItem)(_scp), __FUNCTION__, __FILE__, __LINE__))
 

Typedefs

typedef struct key_s KEY
 
typedef struct _sql_dbcursor_sSCP_t
 

Functions

static const char * tblName (uint32_t v, KEY *tbl, size_t ntbl)
 
static const char * fmtBits (uint32_t flags, KEY tbl[], size_t ntbl, char *t)
 
static char * fmtDBT (const DBT *K, char *te)
 
static const char * fmtKDR (const DBT *K, const DBT *P, const DBT *D, const DBT *R)
 
static int Xcvtdberr (dbiIndex dbi, const char *msg, int error, int printit, const char *func, const char *fn, unsigned ln)
 
SCP_t scpUnlink (SCP_t scp)
 Unreference a SCP wrapper instance. More...
 
SCP_t scpLink (SCP_t scp)
 Reference a SCP wrapper instance. More...
 
SCP_t scpFree (SCP_t scp)
 Destroy a SCP wrapper. More...
 
static void dbg_scp (void *ptr)
 
static void dbg_keyval (const char *msg, dbiIndex dbi, DBC *dbcursor, DBT *key, DBT *data, unsigned int flags)
 
static SCP_t scpResetKeys (SCP_t scp)
 
static SCP_t scpResetAv (SCP_t scp)
 
static SCP_t scpReset (SCP_t scp)
 
static void scpFini (void *_scp)
 
static SCP_t scpGetPool (rpmioPool pool)
 
static SCP_t scpNew (void *dbp)
 
static int sql_step (dbiIndex dbi, SCP_t scp)
 
static int sql_bind_key (dbiIndex dbi, SCP_t scp, int pos, DBT *key)
 
static int sql_bind_data (dbiIndex dbi, SCP_t scp, int pos, DBT *data)
 
static int sql_exec (dbiIndex dbi, const char *cmd, int(*callback)(void *, int, char **, char **), void *context)
 
static int sql_busy_handler (void *_dbi, int time)
 
static int sql_initDB_cb (void *_dbi, int argc, char **argv, char **cols)
 
static int sql_initDB (dbiIndex dbi)
 Verify the DB is setup. More...
 
static int sql_cclose (dbiIndex dbi, DBC *dbcursor, unsigned int flags)
 Close database cursor. More...
 
static int sql_close (dbiIndex dbi, unsigned int flags)
 Close index database, and destroy database handle. More...
 
static int sql_open (rpmdb rpmdb, rpmTag rpmtag, dbiIndex *dbip)
 Return handle for an index database. More...
 
static int sql_sync (dbiIndex dbi, unsigned int flags)
 Flush pending operations to disk. More...
 
static int sql_exists (dbiIndex dbi, DBT *key, unsigned int flags)
 Return whether key exists in a database. More...
 
static int sql_seqno_cb (void *_dbi, int argc, char **argv, char **cols)
 
static int sql_seqno (dbiIndex dbi, int64_t *seqnop, unsigned int flags)
 Return next sequence number. More...
 
static int sql_copen (dbiIndex dbi, DB_TXN *txnid, DBC **dbcp, unsigned int flags)
 Open database cursor. More...
 
static int sql_cdel (dbiIndex dbi, DBC *dbcursor, DBT *key, DBT *data, unsigned int flags)
 Delete (key,data) pair(s) using db->del or dbcursor->c_del. More...
 
static int sql_cget (dbiIndex dbi, DBC *dbcursor, DBT *key, DBT *data, unsigned int flags)
 Retrieve (key,data) pair using db->get or dbcursor->c_get. More...
 
static int sql_cput (dbiIndex dbi, DBC *dbcursor, DBT *key, DBT *data, unsigned int flags)
 Store (key,data) pair using db->put or dbcursor->c_put. More...
 
static int sql_byteswapped (dbiIndex dbi)
 Is database byte swapped? More...
 
static int sql_associate (dbiIndex dbi, dbiIndex dbisecondary, int(*callback)(DB *, const DBT *, const DBT *, DBT *), unsigned int flags)
 Associate secondary database with primary. More...
 
static int sql_associate_foreign (dbiIndex dbi, dbiIndex dbisecondary, int(*callback)(DB *, const DBT *, DBT *, const DBT *, int *), unsigned int flags)
 Associate secondary database with primary. More...
 
static int sql_join (dbiIndex dbi, DBC **curslist, DBC **dbcp, unsigned int flags)
 Return join cursor for list of cursors. More...
 
static int sql_cdup (dbiIndex dbi, DBC *dbcursor, DBC **dbcp, unsigned int flags)
 Duplicate a database cursor. More...
 
static int sql_cpget (dbiIndex dbi, DBC *dbcursor, DBT *key, DBT *pkey, DBT *data, unsigned int flags)
 Retrieve (key,data) pair using dbcursor->c_pget. More...
 
static int sql_ccount (dbiIndex dbi, DBC *dbcursor, unsigned int *countp, unsigned int flags)
 Retrieve count of (possible) duplicate items using dbcursor->c_count. More...
 
static int sql_stat_cb (void *_dbi, int argc, char **argv, char **cols)
 
static int sql_stat (dbiIndex dbi, unsigned int flags)
 Save statistics in database handle. More...
 

Variables

int _sqldb_debug = 0
 
static KEY DBTflags []
 
static size_t nDBTflags = sizeof(DBTflags) / sizeof(DBTflags[0])
 
int _scp_debug = 0
 
rpmioPool _scpPool = NULL
 
static const char _Packages_sql_init []
 
static const char * tagTypes []
 
static size_t ntagTypes = sizeof(tagTypes) / sizeof(tagTypes[0])
 
static const char seqno_inc_cmd []
 
struct _dbiVec sqlitevec
 

Macro Definition Documentation

#define _DBT_ENTRY (   _v)    { DB_DBT_##_v, #_v, }

Definition at line 129 of file sqlite.c.

#define _KEYDATA (   _K,
  _P,
  _D,
  _R 
)    fmtKDR(_K, _P, _D, _R)

Definition at line 219 of file sqlite.c.

Referenced by sql_cdel(), sql_cget(), sql_cpget(), sql_cput(), and sql_exists().

#define _RPMDB_INTERNAL

Definition at line 48 of file sqlite.c.

#define _RPMSQL_INTERNAL

Definition at line 40 of file sqlite.c.

#define cvtdberr (   _dbi,
  _msg,
  _error 
)    Xcvtdberr(_dbi, _msg, _error, _sqldb_debug, __FUNCTION__, __FILE__, __LINE__)
#define SCPDEBUG (   _dbi,
  _list 
)    if (_scp_debug) fprintf _list

Definition at line 295 of file sqlite.c.

Referenced by scpFini(), scpReset(), scpResetAv(), and scpResetKeys().

#define scpFree (   _scp)    ((SCP_t)rpmioFreePoolItem((rpmioItem)(_scp), __FUNCTION__, __FILE__, __LINE__))

Definition at line 328 of file sqlite.c.

Referenced by sql_cclose(), sql_cdel(), and sql_cput().

#define scpLink (   _scp)    ((SCP_t)rpmioLinkPoolItem((rpmioItem)(_scp), __FUNCTION__, __FILE__, __LINE__))

Definition at line 316 of file sqlite.c.

Referenced by scpNew(), sql_cdel(), and sql_cput().

#define scpUnlink (   _scp)    ((SCP_t)rpmioUnlinkPoolItem((rpmioItem)(_scp), __FUNCTION__, __FILE__, __LINE__))

Definition at line 305 of file sqlite.c.

#define SQLDBDEBUG (   _dbi,
  _list 
)    if (((_dbi) && (_dbi)->dbi_debug) || (_sqldb_debug)) fprintf _list
#define UINT32_T   uint32_t

Definition at line 61 of file sqlite.c.

Referenced by sql_cget().

Typedef Documentation

typedef struct key_s KEY
typedef struct _sql_dbcursor_s* SCP_t

Definition at line 251 of file sqlite.c.

Function Documentation

static void dbg_keyval ( const char *  msg,
dbiIndex  dbi,
DBC dbcursor,
DBT key,
DBT data,
unsigned int  flags 
)
static

Definition at line 342 of file sqlite.c.

References __db_dbt::data, dbg_scp(), RPMTAG_NAME, and __db_dbt::size.

Referenced by sql_cdel(), sql_cget(), and sql_cput().

static void dbg_scp ( void *  ptr)
static
static const char* fmtBits ( uint32_t  flags,
KEY  tbl[],
size_t  ntbl,
char *  t 
)
static

Definition at line 103 of file sqlite.c.

References i, name, stpcpy(), and tblName().

Referenced by fmtDBT().

static char* fmtDBT ( const DBT K,
char *  te 
)
static

Definition at line 146 of file sqlite.c.

References __db_dbt::data, DB_DBT_MULTIPLE, __db_dbt::flags, fmtBits(), i, nDBTflags, __db_dbt::size, and xisprint().

Referenced by fmtKDR().

static const char* fmtKDR ( const DBT K,
const DBT P,
const DBT D,
const DBT R 
)
static

Definition at line 193 of file sqlite.c.

References fmtDBT(), and stpcpy().

static void scpFini ( void *  _scp)
static

Definition at line 461 of file sqlite.c.

References _free(), _sql_dbcursor_s::av, _sql_dbcursor_s::avlen, SCPDEBUG, scpReset(), and scpResetKeys().

Referenced by scpGetPool().

SCP_t scpFree ( SCP_t  scp)

Destroy a SCP wrapper.

Parameters
scpSCP wrapper
Returns
NULL on last dereference
static SCP_t scpGetPool ( rpmioPool  pool)
static

Definition at line 477 of file sqlite.c.

References _sql_dbcursor_s::_item, _scpPool, rpmioGetPool(), rpmioNewPool(), and scpFini().

Referenced by scpNew().

SCP_t scpLink ( SCP_t  scp)

Reference a SCP wrapper instance.

Parameters
scpSCP wrapper
Returns
new SCP wrapper reference
static SCP_t scpNew ( void *  dbp)
static

Definition at line 493 of file sqlite.c.

References _sql_dbcursor_s::ldata, _sql_dbcursor_s::lkey, scpGetPool(), scpLink, and _sql_dbcursor_s::used.

Referenced by sql_copen().

static SCP_t scpReset ( SCP_t  scp)
static
static SCP_t scpResetAv ( SCP_t  scp)
static
static SCP_t scpResetKeys ( SCP_t  scp)
static

Definition at line 367 of file sqlite.c.

References _free(), __db_dbt::data, dbg_scp(), _sql_dbcursor_s::keys, _sql_dbcursor_s::nkeys, and SCPDEBUG.

Referenced by scpFini(), and sql_cget().

SCP_t scpUnlink ( SCP_t  scp)

Unreference a SCP wrapper instance.

Parameters
scpSCP wrapper
Returns
NULL on last dereference
static int sql_associate ( dbiIndex  dbi,
dbiIndex  dbisecondary,
int(*)(DB *, const DBT *, const DBT *, DBT *)  callback,
unsigned int  flags 
)
static

Associate secondary database with primary.

Parameters
dbiindex database handle
dbisecondarysecondary index database handle
callbackcreate secondary key from primary (NULL if DB_RDONLY)
flagsDB_CREATE or 0
Returns
0 on success

Definition at line 1628 of file sqlite.c.

References SQLDBDEBUG.

static int sql_associate_foreign ( dbiIndex  dbi,
dbiIndex  dbisecondary,
int(*)(DB *, const DBT *, DBT *, const DBT *, int *)  callback,
unsigned int  flags 
)
static

Associate secondary database with primary.

Parameters
dbiindex database handle
dbisecondarysecondary index database handle
callbackcreate secondary key from primary (NULL if DB_RDONLY)
flagsDB_CREATE or 0
Returns
0 on success

Definition at line 1647 of file sqlite.c.

References SQLDBDEBUG.

static int sql_bind_data ( dbiIndex  dbi,
SCP_t  scp,
int  pos,
DBT data 
)
static

Definition at line 730 of file sqlite.c.

References cvtdberr, __db_dbt::data, _sql_dbcursor_s::pStmt, and __db_dbt::size.

Referenced by sql_cdel(), and sql_cput().

static int sql_bind_key ( dbiIndex  dbi,
SCP_t  scp,
int  pos,
DBT key 
)
static
static int sql_busy_handler ( void *  _dbi,
int  time 
)
static

Definition at line 760 of file sqlite.c.

References _, rpmlog(), RPMLOG_WARNING, and SQLDBDEBUG.

Referenced by sql_open().

static int sql_byteswapped ( dbiIndex  dbi)
static

Is database byte swapped?

Parameters
dbiindex database handle
Returns
0 no

Definition at line 1609 of file sqlite.c.

References SQLDBDEBUG.

static int sql_cclose ( dbiIndex  dbi,
DBC dbcursor,
unsigned int  flags 
)
static

Close database cursor.

Parameters
dbiindex database handle
dbcursordatabase cursor
flags(unused)
Returns
0 on success

Definition at line 1061 of file sqlite.c.

References _free(), _sql_dbcursor_s::ldata, _sql_dbcursor_s::lkey, scpFree, and SQLDBDEBUG.

Referenced by sql_copen().

static int sql_ccount ( dbiIndex  dbi,
DBC dbcursor,
unsigned int *  countp,
unsigned int  flags 
)
static

Retrieve count of (possible) duplicate items using dbcursor->c_count.

Parameters
dbiindex database handle
dbcursordatabase cursor
countpaddress of count
flags(unused)
Returns
0 on success

Definition at line 1730 of file sqlite.c.

References SQLDBDEBUG.

static int sql_cdel ( dbiIndex  dbi,
DBC dbcursor,
DBT key,
DBT data,
unsigned int  flags 
)
static

Delete (key,data) pair(s) using db->del or dbcursor->c_del.

Parameters
dbiindex database handle
dbcursordatabase cursor (NULL will use db->del)
keydelete key value/length/flags
datadelete data value/length/flags
flags(unused)
Returns
0 on success

Definition at line 1348 of file sqlite.c.

References _KEYDATA, _sql_dbcursor_s::cmd, cvtdberr, dbg_keyval(), _sql_dbcursor_s::pStmt, _sql_dbcursor_s::pzErrmsg, rpmlog(), RPMLOG_WARNING, scpFree, scpLink, sql_bind_data(), sql_bind_key(), sql_step(), and SQLDBDEBUG.

static int sql_cdup ( dbiIndex  dbi,
DBC dbcursor,
DBC **  dbcp,
unsigned int  flags 
)
static

Duplicate a database cursor.

Parameters
dbiindex database handle
dbcursordatabase cursor
Return values
dbcpaddress of new database cursor
Parameters
flagsDB_POSITION for same position, 0 for uninitialized
Returns
0 on success

Definition at line 1686 of file sqlite.c.

References SQLDBDEBUG.

static int sql_cget ( dbiIndex  dbi,
DBC dbcursor,
DBT key,
DBT data,
unsigned int  flags 
)
static

Retrieve (key,data) pair using db->get or dbcursor->c_get.

Parameters
dbiindex database handle
dbcursordatabase cursor (NULL will use db->get)
keyretrieve key value/length/flags
dataretrieve data value/length/flags
flags(unused)
Returns
0 on success

Definition at line 1394 of file sqlite.c.

References _free(), _KEYDATA, _sql_dbcursor_s::all, _sql_dbcursor_s::av, _sql_dbcursor_s::avlen, _sql_dbcursor_s::cmd, cvtdberr, __db_dbt::data, DB_DBT_MALLOC, DB_NOTFOUND, DB_SET, dbg_keyval(), __db_dbt::flags, _sql_dbcursor_s::keys, _sql_dbcursor_s::ldata, _sql_dbcursor_s::lkey, _sql_dbcursor_s::nkeys, _sql_dbcursor_s::nr, _sql_dbcursor_s::pStmt, _sql_dbcursor_s::pzErrmsg, RPMDBI_PACKAGES, rpmlog(), RPMLOG_WARNING, _sql_dbcursor_s::rx, scpReset(), scpResetAv(), scpResetKeys(), __db_dbt::size, sql_bind_key(), sql_step(), SQLDBDEBUG, UINT32_T, _sql_dbcursor_s::used, xcalloc(), and xmalloc.

static int sql_close ( dbiIndex  dbi,
unsigned int  flags 
)
static

Close index database, and destroy database handle.

Parameters
dbiindex database handle
flags(unused)
Returns
0 on success

Definition at line 1089 of file sqlite.c.

References _free(), D_, DB_PRIVATE, rpmGenPath(), rpmlog(), RPMLOG_DEBUG, rpmsqlFree(), SQLDBDEBUG, Unlink(), and urlPath().

Referenced by sql_open().

static int sql_copen ( dbiIndex  dbi,
DB_TXN txnid,
DBC **  dbcp,
unsigned int  flags 
)
static

Open database cursor.

Parameters
dbiindex database handle
txniddatabase transaction handle
Return values
dbcpaddress of new database cursor
Parameters
flagsDB_WRITECURSOR or 0
Returns
0 on success

Definition at line 1317 of file sqlite.c.

References RPM_MASK_TYPE, scpNew(), sql_cclose(), SQLDBDEBUG, tagName(), and tagType().

static int sql_cpget ( dbiIndex  dbi,
DBC dbcursor,
DBT key,
DBT pkey,
DBT data,
unsigned int  flags 
)
static

Retrieve (key,data) pair using dbcursor->c_pget.

Parameters
dbiindex database handle
dbcursordatabase cursor
keysecondary retrieve key value/length/flags
pkeyprimary retrieve key value/length/flags
dataprimary retrieve data value/length/flags
flagsDB_NEXT, DB_SET, or 0
Returns
0 on success

Definition at line 1708 of file sqlite.c.

References _KEYDATA, and SQLDBDEBUG.

static int sql_cput ( dbiIndex  dbi,
DBC dbcursor,
DBT key,
DBT data,
unsigned int  flags 
)
static

Store (key,data) pair using db->put or dbcursor->c_put.

Parameters
dbiindex database handle
dbcursordatabase cursor (NULL will use db->put)
keystore key value/length/flags
datastore data value/length/flags
flags(unused)
Returns
0 on success

Definition at line 1566 of file sqlite.c.

References _KEYDATA, _sql_dbcursor_s::cmd, cvtdberr, dbg_keyval(), _sql_dbcursor_s::pStmt, _sql_dbcursor_s::pzErrmsg, rpmlog(), RPMLOG_WARNING, scpFree, scpLink, sql_bind_data(), sql_bind_key(), sql_step(), and SQLDBDEBUG.

static int sql_exec ( dbiIndex  dbi,
const char *  cmd,
int(*)(void *, int, char **, char **)  callback,
void *  context 
)
static

Definition at line 745 of file sqlite.c.

References _free(), cvtdberr, and SQLDBDEBUG.

Referenced by sql_initDB(), sql_seqno(), and sql_stat().

static int sql_exists ( dbiIndex  dbi,
DBT key,
unsigned int  flags 
)
static

Return whether key exists in a database.

Parameters
dbiindex database handle
keyretrieve key value/length/flags
flagsusually 0
Returns
0 if key exists, DB_NOTFOUND if not, else error

Definition at line 1256 of file sqlite.c.

References _KEYDATA, and SQLDBDEBUG.

static int sql_initDB ( dbiIndex  dbi)
static

Verify the DB is setup.

. if not initialize it

Create the table.. create the db_info

Definition at line 912 of file sqlite.c.

References _free(), DB_EXCL, name, RPM_MASK_TYPE, RPMDBI_PACKAGES, RPMDBI_SEQNO, rpmGenPath(), rpmioMkpath(), RPMTAG_PUBKEYS, sql_exec(), sql_initDB_cb(), SQLDBDEBUG, and tagType().

Referenced by sql_open().

static int sql_initDB_cb ( void *  _dbi,
int  argc,
char **  argv,
char **  cols 
)
static

Definition at line 894 of file sqlite.c.

References SQLDBDEBUG.

Referenced by sql_initDB().

static int sql_join ( dbiIndex  dbi,
DBC **  curslist,
DBC **  dbcp,
unsigned int  flags 
)
static

Return join cursor for list of cursors.

Parameters
dbiindex database handle
curslistNULL terminated list of database cursors
Return values
dbcpaddress of join database cursor
Parameters
flagsDB_JOIN_NOSORT or 0
Returns
0 on success

Definition at line 1666 of file sqlite.c.

References SQLDBDEBUG.

static int sql_open ( rpmdb  rpmdb,
rpmTag  rpmtag,
dbiIndex dbip 
)
static

Return handle for an index database.

Parameters
rpmdbrpm database
rpmtagrpm tag
Return values
*dbipindex database handle
Returns
0 on success

Definition at line 1131 of file sqlite.c.

References _free(), cvtdberr, D_, DB_PRIVATE, rpmGenPath(), rpmioMkpath(), rpmlog(), RPMLOG_DEBUG, rpmsqlNew(), sql_busy_handler(), sql_close(), sql_initDB(), SQLDBDEBUG, sqlitevec, tagName(), urlPath(), and xstrdup().

static int sql_seqno ( dbiIndex  dbi,
int64_t *  seqnop,
unsigned int  flags 
)
static

Return next sequence number.

Parameters
dbiindex database handle (with attached sequence)
Return values
*seqnopIN: delta (0 does seqno++) OUT: returned 64bit seqno
Parameters
flagsusually 0
Returns
0 on success

Definition at line 1297 of file sqlite.c.

References sql_exec(), sql_seqno_cb(), and SQLDBDEBUG.

static int sql_seqno_cb ( void *  _dbi,
int  argc,
char **  argv,
char **  cols 
)
static

Definition at line 1276 of file sqlite.c.

References SQLDBDEBUG.

Referenced by sql_seqno().

static int sql_stat ( dbiIndex  dbi,
unsigned int  flags 
)
static

Save statistics in database handle.

Parameters
dbiindex database handle
flagsretrieve statistics that don't require traversal?
Returns
0 on success

Definition at line 1761 of file sqlite.c.

References _free(), cmd, __db_h_stat::hash_nkeys, sql_exec(), sql_stat_cb(), SQLDBDEBUG, and xcalloc().

static int sql_stat_cb ( void *  _dbi,
int  argc,
char **  argv,
char **  cols 
)
static

Definition at line 1742 of file sqlite.c.

References SQLDBDEBUG.

Referenced by sql_stat().

static int sql_step ( dbiIndex  dbi,
SCP_t  scp 
)
static
static int sql_sync ( dbiIndex  dbi,
unsigned int  flags 
)
static

Flush pending operations to disk.

Parameters
dbiindex database handle
flags(unused)
Returns
0 on success

Definition at line 1237 of file sqlite.c.

References SQLDBDEBUG.

static const char* tblName ( uint32_t  v,
KEY tbl,
size_t  ntbl 
)
static

Definition at line 83 of file sqlite.c.

References i, key_s::n, and snprintf().

Referenced by fmtBits().

static int Xcvtdberr ( dbiIndex  dbi,
const char *  msg,
int  error,
int  printit,
const char *  func,
const char *  fn,
unsigned  ln 
)
static

Definition at line 222 of file sqlite.c.

References rpmlog(), and RPMLOG_ERR.

Variable Documentation

const char _Packages_sql_init[]
static

Definition at line 781 of file sqlite.c.

int _scp_debug = 0

Definition at line 293 of file sqlite.c.

rpmioPool _scpPool = NULL

Definition at line 475 of file sqlite.c.

Referenced by rpmcliFini(), and scpGetPool().

int _sqldb_debug = 0

Definition at line 68 of file sqlite.c.

KEY DBTflags[]
static
Initial value:
= {
{ 0x010 , "MALLOC", },
{ 0x080 , "REALLOC", },
{ 0x800 , "USERMEM", },
{ 0x040 , "PARTIAL", },
{ 0x001 , "APPMALLOC", },
{ 0x020 , "MULTIPLE", },
{ 0x100 , "READONLY", },
}

Definition at line 131 of file sqlite.c.

size_t nDBTflags = sizeof(DBTflags) / sizeof(DBTflags[0])
static

Definition at line 144 of file sqlite.c.

Referenced by fmtDBT().

size_t ntagTypes = sizeof(tagTypes) / sizeof(tagTypes[0])
static

Definition at line 892 of file sqlite.c.

const char seqno_inc_cmd[]
static
Initial value:
= "\
BEGIN EXCLUSIVE TRANSACTION;\n\
REPLACE INTO Seqno VALUES (0,\n\
COALESCE((SELECT value FROM Seqno WHERE key == 0), 0) + 1);\n\
SELECT value FROM Seqno WHERE key == 0;\n\
COMMIT TRANSACTION;\n\
"

Definition at line 1268 of file sqlite.c.

struct _dbiVec sqlitevec
Initial value:
= {
"Sqlite " SQLITE_VERSION,
((SQLITE_VERSION_NUMBER / (1000 * 1000)) % 1000),
((SQLITE_VERSION_NUMBER / ( 1000)) % 1000),
((SQLITE_VERSION_NUMBER ) % 1000),
}
static int sql_join(dbiIndex dbi, DBC **curslist, DBC **dbcp, unsigned int flags)
Return join cursor for list of cursors.
Definition: sqlite.c:1666
static int sql_stat(dbiIndex dbi, unsigned int flags)
Save statistics in database handle.
Definition: sqlite.c:1761
static int sql_ccount(dbiIndex dbi, DBC *dbcursor, unsigned int *countp, unsigned int flags)
Retrieve count of (possible) duplicate items using dbcursor->c_count.
Definition: sqlite.c:1730
static int sql_sync(dbiIndex dbi, unsigned int flags)
Flush pending operations to disk.
Definition: sqlite.c:1237
static int sql_seqno(dbiIndex dbi, int64_t *seqnop, unsigned int flags)
Return next sequence number.
Definition: sqlite.c:1297
static int sql_cput(dbiIndex dbi, DBC *dbcursor, DBT *key, DBT *data, unsigned int flags)
Store (key,data) pair using db->put or dbcursor->c_put.
Definition: sqlite.c:1566
static int sql_open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex *dbip)
Return handle for an index database.
Definition: sqlite.c:1131
static int sql_cdel(dbiIndex dbi, DBC *dbcursor, DBT *key, DBT *data, unsigned int flags)
Delete (key,data) pair(s) using db->del or dbcursor->c_del.
Definition: sqlite.c:1348
static int sql_cget(dbiIndex dbi, DBC *dbcursor, DBT *key, DBT *data, unsigned int flags)
Retrieve (key,data) pair using db->get or dbcursor->c_get.
Definition: sqlite.c:1394
static int sql_cdup(dbiIndex dbi, DBC *dbcursor, DBC **dbcp, unsigned int flags)
Duplicate a database cursor.
Definition: sqlite.c:1686
static int sql_cclose(dbiIndex dbi, DBC *dbcursor, unsigned int flags)
Close database cursor.
Definition: sqlite.c:1061
static int sql_cpget(dbiIndex dbi, DBC *dbcursor, DBT *key, DBT *pkey, DBT *data, unsigned int flags)
Retrieve (key,data) pair using dbcursor->c_pget.
Definition: sqlite.c:1708
static int sql_associate_foreign(dbiIndex dbi, dbiIndex dbisecondary, int(*callback)(DB *, const DBT *, DBT *, const DBT *, int *), unsigned int flags)
Associate secondary database with primary.
Definition: sqlite.c:1647
static int sql_copen(dbiIndex dbi, DB_TXN *txnid, DBC **dbcp, unsigned int flags)
Open database cursor.
Definition: sqlite.c:1317
static int sql_byteswapped(dbiIndex dbi)
Is database byte swapped?
Definition: sqlite.c:1609
static int sql_close(dbiIndex dbi, unsigned int flags)
Close index database, and destroy database handle.
Definition: sqlite.c:1089
static int sql_exists(dbiIndex dbi, DBT *key, unsigned int flags)
Return whether key exists in a database.
Definition: sqlite.c:1256
static int sql_associate(dbiIndex dbi, dbiIndex dbisecondary, int(*callback)(DB *, const DBT *, const DBT *, DBT *), unsigned int flags)
Associate secondary database with primary.
Definition: sqlite.c:1628

Definition at line 1793 of file sqlite.c.

Referenced by sql_open().

const char* tagTypes[]
static
Initial value:
= {
"",
"INTEGER NOT NULL",
"INTEGER NOT NULL",
"INTEGER NOT NULL",
"INTEGER NOT NULL",
"INTEGER NOT NULL",
"TEXT NOT NULL",
"BLOB NOT NULL",
"TEXT NOT NULL",
"TEXT NOT NULL",
}

Definition at line 880 of file sqlite.c.