rpm 5.3.12
Defines | Functions | Variables
rpmio/rpmsql.c File Reference
#include "system.h"
#include <popt.h>
#include "rpmio_internal.h"
#include <rpmmacro.h>
#include <rpmdir.h>
#include <rpmurl.h>
#include <mire.h>
#include <rpmsql.h>
#include "debug.h"
Include dependency graph for rpmsql.c:

Go to the source code of this file.

Defines

#define _RPMIOB_INTERNAL
#define _RPMSQL_INTERNAL
#define _RPMVT_INTERNAL
#define _RPMVC_INTERNAL
#define readline(sql, p)   local_getline(sql, p)
#define add_history(X)
#define read_history(X)
#define write_history(X)
#define stifle_history(X)
#define VTDBG(_vt, _l)   if ((_vt)->debug) fprintf _l
#define VTDBGNOISY(_vt, _l)   if ((_vt)->debug < 0) fprintf _l
#define VCDBG(_vc, _l)   if ((_vc)->debug) fprintf _l
#define VCDBGNOISY(_vc, _l)   if ((_vc)->debug < 0) fprintf _l
#define rpmsqlDebugDump(_sql)   _rpmsqlDebugDump(_sql, __FUNCTION__, __FILE__, __LINE__)

Functions

static void rpmvtFini (void *_VT)
 rpmvt pool destructor.
static rpmvt rpmvtGetPool (rpmioPool pool)
rpmvt rpmvtNew (void *db, void *pModule, const char *const *argv, rpmvd vd)
static void rpmvcFini (void *_VC)
 rpmvc pool destructor.
static rpmvc rpmvcGetPool (rpmioPool pool)
rpmvc rpmvcNew (rpmvt vt, int nrows)
static void _rpmsqlDebugDump (rpmsql sql, const char *_func, const char *_fn, unsigned _ln)
static rpmsql rpmsqlI (void)
 Return the global interpreter, creating laziliy if needed.
static void rpmsqlFini (void *_sql)
 rpmsql pool destructor.
static rpmsql rpmsqlGetPool (rpmioPool pool)
const char ** rpmsqlArgv (rpmsql sql, int *argcp)
 Return arguments from a sql interpreter.
rpmsql rpmsqlNew (char **av, uint32_t flags)
 Create and load a sql interpreter.
rpmRC rpmsqlRun (rpmsql sql, const char *str, const char **resultp)
 Execute sql from STRING | FILE | STDIN | INTERACTIVE.

Variables

int _rpmsql_debug = 0
int _rpmvt_debug = 0
int _rpmvc_debug = 0
rpmsql _rpmsqlI = NULL
volatile int _rpmsqlSeenInterrupt
rpmioPool _rpmvtPool
rpmioPool _rpmvcPool
rpmioPool _rpmsqlPool

Define Documentation

#define _RPMIOB_INTERNAL

Definition at line 5 of file rpmsql.c.

#define _RPMSQL_INTERNAL

Definition at line 22 of file rpmsql.c.

#define _RPMVC_INTERNAL

Definition at line 24 of file rpmsql.c.

#define _RPMVT_INTERNAL

Definition at line 23 of file rpmsql.c.

#define add_history (   X)

Definition at line 35 of file rpmsql.c.

#define read_history (   X)

Definition at line 36 of file rpmsql.c.

Referenced by rpmsqlRun().

#define readline (   sql,
 
)    local_getline(sql, p)

Definition at line 34 of file rpmsql.c.

#define rpmsqlDebugDump (   _sql)    _rpmsqlDebugDump(_sql, __FUNCTION__, __FILE__, __LINE__)

Definition at line 854 of file rpmsql.c.

#define stifle_history (   X)

Definition at line 38 of file rpmsql.c.

Referenced by rpmsqlRun().

#define VCDBG (   _vc,
  _l 
)    if ((_vc)->debug) fprintf _l

Definition at line 577 of file rpmsql.c.

#define VCDBGNOISY (   _vc,
  _l 
)    if ((_vc)->debug < 0) fprintf _l

Definition at line 578 of file rpmsql.c.

Referenced by rpmvcFini().

#define VTDBG (   _vt,
  _l 
)    if ((_vt)->debug) fprintf _l

Definition at line 64 of file rpmsql.c.

Referenced by rpmvtNew().

#define VTDBGNOISY (   _vt,
  _l 
)    if ((_vt)->debug < 0) fprintf _l

Definition at line 65 of file rpmsql.c.

Referenced by rpmvtFini().

#define write_history (   X)

Definition at line 37 of file rpmsql.c.

Referenced by rpmsqlRun().


Function Documentation

static void _rpmsqlDebugDump ( rpmsql  sql,
const char *  _func,
const char *  _fn,
unsigned  _ln 
) [static]

Definition at line 814 of file rpmsql.c.

References _rpmsqlI, and argvCount().

const char** rpmsqlArgv ( rpmsql  sql,
int *  argcp 
)

Return arguments from a sql interpreter.

Parameters:
sqlsql interpreter
Return values:
*argcpno. of arguments
Returns:
sql interpreter args

Definition at line 5234 of file rpmsql.c.

References argvCount().

static void rpmsqlFini ( void *  _sql) [static]

rpmsql pool destructor.

Definition at line 5164 of file rpmsql.c.

References _free(), argvFree(), Fclose(), rpmiobFree(), and rpmsqlCmd().

Referenced by rpmsqlGetPool().

static rpmsql rpmsqlGetPool ( rpmioPool  pool) [static]

Definition at line 5218 of file rpmsql.c.

References _rpmsql_debug, _rpmsqlPool, rpmioGetPool(), rpmioNewPool(), and rpmsqlFini().

Referenced by rpmsqlNew().

static rpmsql rpmsqlI ( void  ) [static]

Return the global interpreter, creating laziliy if needed.

Returns:
global sql interpreter

Definition at line 974 of file rpmsql.c.

References _rpmsqlI, and rpmsqlNew().

Referenced by rpmsqlNew(), and rpmsqlRun().

rpmsql rpmsqlNew ( char **  av,
uint32_t  flags 
)

Create and load a sql interpreter.

Parameters:
avsql interpreter args (or NULL)
flagssql interpreter flags
Returns:
new sql interpreter

Definition at line 5304 of file rpmsql.c.

References _free(), _rpmsql_debug, Access(), argvAppend(), argvCount(), argvPrint(), F_ISSET, Fclose(), fdDup(), getenv(), R_OK, rpmExpand(), rpmGetPath(), rpmiobNew(), rpmsqlCmd(), rpmsqlGetPool(), rpmsqlI(), rpmsqlLink(), and xstrdup().

Referenced by expandMacro(), and rpmsqlI().

rpmRC rpmsqlRun ( rpmsql  sql,
const char *  str,
const char **  resultp 
)

Execute sql from STRING | FILE | STDIN | INTERACTIVE.

The str argument is used to determine how it should be run: A leading '/' indicates a FILE, containing SQL commands. A "-" or "stdin" argument used STD for SQL commands. An empty "" string assumes INTERACTIVE, like STDIN but with prompts. Otherwise, the STRING argument is treated as a sql command.

Parameters:
sqlsql interpreter (NULL uses global interpreter)
strsql string to execute (NULL returns RPMRC_FAIL)
*resultpsql interpreter result
Returns:
RPMRC_OK on success

Definition at line 5406 of file rpmsql.c.

References _, _free(), Fclose(), fdDup(), Fdopen(), Ferror(), Fflush(), _FD_s::flags, Fopen(), Fwrite(), read_history, rpmExpand(), rpmiobRTrim(), rpmiobStr(), RPMRC_FAIL, rpmsqlI(), stifle_history, write_history, xisspace(), and xstrdup().

Referenced by expandMacro().

static void rpmvcFini ( void *  _VC) [static]

rpmvc pool destructor.

Definition at line 583 of file rpmsql.c.

References VCDBGNOISY.

Referenced by rpmvcGetPool().

static rpmvc rpmvcGetPool ( rpmioPool  pool) [static]

Definition at line 599 of file rpmsql.c.

References _rpmvc_debug, _rpmvcPool, rpmioGetPool(), rpmioNewPool(), and rpmvcFini().

Referenced by rpmvcNew().

rpmvc rpmvcNew ( rpmvt  vt,
int  nrows 
)

Definition at line 615 of file rpmsql.c.

References _rpmvc_debug, and rpmvcGetPool().

static void rpmvtFini ( void *  _VT) [static]

rpmvt pool destructor.

Definition at line 70 of file rpmsql.c.

References argvFree(), and VTDBGNOISY.

Referenced by rpmvtGetPool().

static rpmvt rpmvtGetPool ( rpmioPool  pool) [static]

Definition at line 92 of file rpmsql.c.

References _rpmvt_debug, _rpmvtPool, rpmioGetPool(), rpmioNewPool(), and rpmvtFini().

Referenced by rpmvtNew().

rpmvt rpmvtNew ( void *  db,
void *  pModule,
const char *const *  argv,
rpmvd  vd 
)

Variable Documentation

int _rpmsql_debug = 0

Definition at line 43 of file rpmsql.c.

Referenced by rpmsqlGetPool(), and rpmsqlNew().

rpmsql _rpmsqlI = NULL

Definition at line 52 of file rpmsql.c.

Referenced by _rpmsqlDebugDump(), rpmioClean(), and rpmsqlI().

Definition at line 5216 of file rpmsql.c.

Referenced by rpmioClean(), and rpmsqlGetPool().

volatile int _rpmsqlSeenInterrupt

Definition at line 55 of file rpmsql.c.

int _rpmvc_debug = 0

Definition at line 49 of file rpmsql.c.

Referenced by rpmvcGetPool(), and rpmvcNew().

Definition at line 597 of file rpmsql.c.

Referenced by rpmioClean(), and rpmvcGetPool().

int _rpmvt_debug = 0

Definition at line 46 of file rpmsql.c.

Referenced by rpmvtGetPool(), and rpmvtNew().

Definition at line 90 of file rpmsql.c.

Referenced by rpmioClean(), and rpmvtGetPool().