rpm  5.4.15
Data Structures | Macros | Typedefs | Functions | Variables
libsql.c File Reference
#include "system.h"
#include <fts.h>
#include <mire.h>
#include <rpmdir.h>
#include <rpmmacro.h>
#include <rpmurl.h>
#include <rpmsql.h>
#include <sqlite3.h>
#include <rpmtypes.h>
#include <rpmtag.h>
#include <rpmts.h>
#include <rpmgi.h>
#include "debug.h"
Include dependency graph for libsql.c:

Go to the source code of this file.

Data Structures

struct  key_s
 

Macros

#define _RPMIOB_INTERNAL   /* rpmiobSlurp */
 
#define _RPMSQL_INTERNAL
 
#define _RPMVT_INTERNAL
 
#define _RPMVC_INTERNAL
 
#define _RPMTAG_INTERNAL
 
#define dbN   vt->argv[1]
 
#define tblN   vt->argv[2]
 
#define dbN   vt->argv[1]
 
#define tblN   vt->argv[2]
 

Typedefs

typedef struct key_s KEY
 

Functions

static const char * hasSqlType (const char *s)
 
static char * tagJoin (const char *a, const char **argv, const char *z)
 
static char * tagAppendCols (rpmvt vt, const char **av)
 
static int tagLoadArgv (rpmvt vt, rpmvt *vtp)
 
static int tagCreate (void *_db, void *pAux, int argc, const char *const *argv, rpmvt *vtp, char **pzErr)
 
static char * _rpmvtJoin (const char *a, const char **argv, const char *z)
 
static char * _rpmvtAppendCols (rpmvt vt, const char **av)
 
static int _rpmvtLoadArgv (rpmvt vt, rpmvt *vtp)
 
static int hdrColumn (rpmvc vc, void *_pContext, int colx)
 
static int hdrLoadNext (rpmvc vc)
 
static int hdrFilter (rpmvc vc, int idxNum, const char *idxStr, int argc, rpmvArg *_argv)
 
static int hdrNext (rpmvc vc)
 
static int hdrEof (rpmvc vc)
 
static int hdrCreate (void *_db, void *pAux, int argc, const char *const *argv, rpmvt *vtp, char **pzErr)
 
static int hdrDestroy (rpmvt vt)
 
int sqlite3_extension_init (void *_db)
 

Variables

static KEY sqlTypes []
 
static size_t nsqlTypes = sizeof(sqlTypes) / sizeof(sqlTypes[0])
 
static KEY tagTypes []
 
static int _tag_debug
 
static struct rpmvd_s _tagVD
 
struct sqlite3_module tagModule
 
static int _xxx_debug = 0
 
static struct rpmvd_s _hdrVD
 
struct sqlite3_module hdrModule
 
static struct rpmsqlVMT_s __VMT []
 

Macro Definition Documentation

#define _RPMIOB_INTERNAL   /* rpmiobSlurp */

Definition at line 3 of file libsql.c.

#define _RPMSQL_INTERNAL

Definition at line 10 of file libsql.c.

#define _RPMTAG_INTERNAL

Definition at line 18 of file libsql.c.

#define _RPMVC_INTERNAL

Definition at line 12 of file libsql.c.

#define _RPMVT_INTERNAL

Definition at line 11 of file libsql.c.

#define dbN   vt->argv[1]

Referenced by _rpmvtAppendCols(), and tagAppendCols().

#define dbN   vt->argv[1]
#define tblN   vt->argv[2]

Referenced by _rpmvtAppendCols(), and tagAppendCols().

#define tblN   vt->argv[2]

Typedef Documentation

typedef struct key_s KEY

Function Documentation

static char* _rpmvtAppendCols ( rpmvt  vt,
const char **  av 
)
static

Definition at line 308 of file libsql.c.

References _free(), _rpmvtJoin(), argvAppend(), dbN, rpmExpand(), and tblN.

static char* _rpmvtJoin ( const char *  a,
const char **  argv,
const char *  z 
)
static

Definition at line 280 of file libsql.c.

References hasSqlType(), stpcpy(), and xmalloc.

Referenced by _rpmvtAppendCols().

static int _rpmvtLoadArgv ( rpmvt  vt,
rpmvt vtp 
)
static

Definition at line 335 of file libsql.c.

References db.

Referenced by hdrCreate().

static const char* hasSqlType ( const char *  s)
static

Definition at line 92 of file libsql.c.

References i, key_s::k, and nsqlTypes.

Referenced by _rpmvtJoin(), and tagJoin().

static int hdrColumn ( rpmvc  vc,
void *  _pContext,
int  colx 
)
static
static int hdrCreate ( void *  _db,
void *  pAux,
int  argc,
const char *const *  argv,
rpmvt vtp,
char **  pzErr 
)
static
static int hdrDestroy ( rpmvt  vt)
static

Definition at line 642 of file libsql.c.

References headerFree(), rpmgiFree(), and rpmtsFree().

static int hdrEof ( rpmvc  vc)
static

Definition at line 602 of file libsql.c.

static int hdrFilter ( rpmvc  vc,
int  idxNum,
const char *  idxStr,
int  argc,
rpmvArg _argv 
)
static

Definition at line 566 of file libsql.c.

References hdrLoadNext().

static int hdrLoadNext ( rpmvc  vc)
static

Definition at line 541 of file libsql.c.

References headerFree(), headerLink(), rpmgiHeader(), rpmgiNext(), and RPMRC_NOTFOUND.

Referenced by hdrFilter(), and hdrNext().

static int hdrNext ( rpmvc  vc)
static

Definition at line 586 of file libsql.c.

References hdrLoadNext().

int sqlite3_extension_init ( void *  _db)

Definition at line 673 of file libsql.c.

static char* tagAppendCols ( rpmvt  vt,
const char **  av 
)
static

Definition at line 139 of file libsql.c.

References _free(), argvAppend(), dbN, rpmExpand(), tagJoin(), and tblN.

Referenced by tagLoadArgv().

static int tagCreate ( void *  _db,
void *  pAux,
int  argc,
const char *const *  argv,
rpmvt vtp,
char **  pzErr 
)
static

Definition at line 264 of file libsql.c.

References rpmvtNew(), and tagLoadArgv().

static char* tagJoin ( const char *  a,
const char **  argv,
const char *  z 
)
static

Definition at line 111 of file libsql.c.

References hasSqlType(), stpcpy(), and xmalloc.

Referenced by tagAppendCols().

static int tagLoadArgv ( rpmvt  vt,
rpmvt vtp 
)
static

Variable Documentation

struct rpmsqlVMT_s __VMT[]
static
Initial value:
= {
{ "Rpmtags", &tagModule, NULL },
{ "Header", &hdrModule, NULL },
{ NULL, NULL, NULL }
}
struct sqlite3_module hdrModule
Definition: libsql.c:652
struct sqlite3_module tagModule
Definition: libsql.c:271

Definition at line 666 of file libsql.c.

struct rpmvd_s _hdrVD
static
Initial value:
= {
.prefix = "%{?_repodb}%{!?_repodb:/X/popt/}",
.split = "/|",
.parse = "Name|Epoch integer|Version|Release|Arch|Os|Providename|Provideversion|Provideflags|Sigmd5 blob|Nvra|Summary",
}

Definition at line 614 of file libsql.c.

int _tag_debug
static

Definition at line 109 of file libsql.c.

struct rpmvd_s _tagVD
static
Initial value:
= {
.split = "|",
.parse = "tag integer primary key|attrs integer|type|name",
}

Definition at line 259 of file libsql.c.

int _xxx_debug = 0
static

Definition at line 278 of file libsql.c.

struct sqlite3_module hdrModule
Initial value:
= {
.iVersion = 0,
.xCreate = (void *) hdrCreate,
.xConnect = (void *) hdrCreate,
.xColumn = (void *) hdrColumn,
.xFilter = (void *) hdrFilter,
.xNext = (void *) hdrNext,
.xEof = (void *) hdrEof,
.xDisconnect= (void *) hdrDestroy,
.xDestroy = (void *) hdrDestroy,
}
static int hdrFilter(rpmvc vc, int idxNum, const char *idxStr, int argc, rpmvArg *_argv)
Definition: libsql.c:566
static int hdrNext(rpmvc vc)
Definition: libsql.c:586
static int hdrCreate(void *_db, void *pAux, int argc, const char *const *argv, rpmvt *vtp, char **pzErr)
Definition: libsql.c:621
static int hdrEof(rpmvc vc)
Definition: libsql.c:602
static int hdrDestroy(rpmvt vt)
Definition: libsql.c:642
static int hdrColumn(rpmvc vc, void *_pContext, int colx)
Definition: libsql.c:474

Definition at line 652 of file libsql.c.

size_t nsqlTypes = sizeof(sqlTypes) / sizeof(sqlTypes[0])
static

Definition at line 41 of file libsql.c.

Referenced by hasSqlType().

KEY sqlTypes[]
static
Initial value:
= {
{ "blob", SQLITE_BLOB },
{ "float", SQLITE_FLOAT },
{ "int", SQLITE_INTEGER },
{ "integer",SQLITE_INTEGER },
{ "null", SQLITE_NULL },
{ "text", SQLITE_TEXT },
}

Definition at line 33 of file libsql.c.

struct sqlite3_module tagModule
Initial value:
= {
.iVersion = 0,
.xCreate = (void *) tagCreate,
.xConnect = (void *) tagCreate,
}
static int tagCreate(void *_db, void *pAux, int argc, const char *const *argv, rpmvt *vtp, char **pzErr)
Definition: libsql.c:264

Definition at line 271 of file libsql.c.

KEY tagTypes[]
static
Initial value:
= {
{ "", 0 },
{ "INTEGER", RPM_UINT8_TYPE },
{ "INTEGER", RPM_UINT8_TYPE },
{ "INTEGER", RPM_UINT16_TYPE },
{ "INTEGER", RPM_UINT32_TYPE },
{ "INTEGER", RPM_UINT64_TYPE },
{ "TEXT", RPM_STRING_TYPE },
{ "BLOB", RPM_BIN_TYPE },
{ "TEXT", RPM_STRING_ARRAY_TYPE },
{ "TEXT", RPM_I18NSTRING_TYPE },
}

Definition at line 76 of file libsql.c.