rpm  5.4.10
Macros | Typedefs | Functions | Variables
rpmsql.h File Reference
#include <rpmiotypes.h>
#include <rpmio.h>
#include <argv.h>
Include dependency graph for rpmsql.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define RPMSQL_H
 
#define rpmsqlUnlink(_sql)   ((rpmsql)rpmioUnlinkPoolItem((rpmioItem)(_sql), __FUNCTION__, __FILE__, __LINE__))
 
#define rpmsqlLink(_sql)   ((rpmsql)rpmioLinkPoolItem((rpmioItem)(_sql), __FUNCTION__, __FILE__, __LINE__))
 
#define rpmsqlFree(_sql)   ((rpmsql)rpmioFreePoolItem((rpmioItem)(_sql), __FUNCTION__, __FILE__, __LINE__))
 

Typedefs

typedef void * rpmvArg
 
typedef struct rpmvd_s * rpmvd
 
typedef struct rpmvc_s * rpmvc
 
typedef struct rpmvt_s * rpmvt
 
typedef struct rpmsql_s * rpmsql
 

Functions

int rpmsqlCmd (rpmsql sql, const char *msg, void *_db, int rc)
 Check sqlite3 return code, displaying error messages. More...
 
rpmsql rpmsqlUnlink (rpmsql sql)
 Unreference a sql interpreter instance. More...
 
rpmsql rpmsqlLink (rpmsql sql)
 Reference a sql interpreter instance. More...
 
rpmsql rpmsqlFree (rpmsql sql)
 Destroy a sql interpreter. More...
 
rpmsql rpmsqlNew (char **av, uint32_t flags)
 Create and load a sql interpreter. More...
 
const char ** rpmsqlArgv (rpmsql sql, int *argcp)
 Return arguments from a sql interpreter. More...
 
rpmRC rpmsqlRun (rpmsql sql, const char *str, const char **resultp)
 Execute sql from STRING | FILE | STDIN | INTERACTIVE. More...
 

Variables

int _rpmsql_debug
 
int _rpmvt_debug
 
int _rpmvc_debug
 
rpmsql _rpmsqlI
 
volatile int _rpmsqlSeenInterrupt
 

Macro Definition Documentation

§ RPMSQL_H

#define RPMSQL_H

Definition at line 2 of file rpmsql.h.

§ rpmsqlFree

#define rpmsqlFree (   _sql)    ((rpmsql)rpmioFreePoolItem((rpmioItem)(_sql), __FUNCTION__, __FILE__, __LINE__))

Definition at line 254 of file rpmsql.h.

§ rpmsqlLink

#define rpmsqlLink (   _sql)    ((rpmsql)rpmioLinkPoolItem((rpmioItem)(_sql), __FUNCTION__, __FILE__, __LINE__))

Definition at line 242 of file rpmsql.h.

§ rpmsqlUnlink

#define rpmsqlUnlink (   _sql)    ((rpmsql)rpmioUnlinkPoolItem((rpmioItem)(_sql), __FUNCTION__, __FILE__, __LINE__))

Definition at line 231 of file rpmsql.h.

Typedef Documentation

§ rpmsql

typedef struct rpmsql_s* rpmsql

Definition at line 18 of file rpmsql.h.

§ rpmvArg

typedef void* rpmvArg

Definition at line 12 of file rpmsql.h.

§ rpmvc

typedef struct rpmvc_s* rpmvc

Definition at line 16 of file rpmsql.h.

§ rpmvd

typedef struct rpmvd_s* rpmvd

Definition at line 14 of file rpmsql.h.

§ rpmvt

typedef struct rpmvt_s* rpmvt

Definition at line 17 of file rpmsql.h.

Function Documentation

§ rpmsqlArgv()

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 5225 of file rpmsql.c.

References _, _free(), argvAppend(), argvCount(), argvFree(), and stpcpy().

§ rpmsqlCmd()

int rpmsqlCmd ( rpmsql  sql,
const char *  msg,
void *  _db,
int  rc 
)

Check sqlite3 return code, displaying error messages.

Parameters
sqlsql interpreter
msgsql method name
_dbsq; database handle (i.e. "sqlite3 *")
rcsql method return code
Returns
rc is returned

Referenced by rpmsqlFini(), rpmsqlI(), rpmsqlNew(), and rpmvtNew().

§ rpmsqlFree()

rpmsql rpmsqlFree ( rpmsql  sql)

Destroy a sql interpreter.

Parameters
sqlsql interpreter
Returns
NULL on last dereference

Referenced by expandMacro(), psmWait(), rpmioClean(), and sql_close().

§ rpmsqlLink()

rpmsql rpmsqlLink ( rpmsql  sql)

Reference a sql interpreter instance.

Parameters
sqlsql interpreter
Returns
new sql interpreter reference

Referenced by rpmsqlNew().

§ rpmsqlNew()

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 5295 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(), psmWait(), rpmsqlI(), and sql_open().

§ rpmsqlRun()

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 5397 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(), and psmWait().

§ rpmsqlUnlink()

rpmsql rpmsqlUnlink ( rpmsql  sql)

Unreference a sql interpreter instance.

Parameters
sqlsql interpreter
Returns
NULL on last dereference

Variable Documentation

§ _rpmsql_debug

int _rpmsql_debug

Definition at line 43 of file rpmsql.c.

Referenced by rpmsqlGetPool(), rpmsqlI(), and rpmsqlNew().

§ _rpmsqlI

rpmsql _rpmsqlI

Definition at line 52 of file rpmsql.c.

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

§ _rpmsqlSeenInterrupt

volatile int _rpmsqlSeenInterrupt

Definition at line 55 of file rpmsql.c.

Referenced by rpmsqlI().

§ _rpmvc_debug

int _rpmvc_debug

Definition at line 49 of file rpmsql.c.

Referenced by rpmvcGetPool(), and rpmvcNew().

§ _rpmvt_debug

int _rpmvt_debug

Definition at line 46 of file rpmsql.c.

Referenced by rpmvtGetPool(), and rpmvtNew().