Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

awdb.h File Reference


Detailed Description

Generic database related code and structures.

Warning:
Yes, these macros are ugly.

Yes, I could have created a "base class" with this code with function pointers and casting, etc.

BUT, in the end it probably would not be any cleaner (in this case) than macros...I think...

This is where C++ templates would work well.

Maybe I'll change it later. -RRL

#include "monitor.h"
#include "regexmatch.h"

Go to the source code of this file.

Data Structures

struct  aw_db_cevents_t
 Events generated for connect() and sql completion. More...

struct  aw_db_counter_t
 Event to generate w/count match. More...

struct  aw_db_regex_t
 Specifies a regex and associated events. More...

struct  aw_db_revents_t
 Events generated for regex matching. More...

struct  aw_db_rwatcher_t
 Compiled regex, associated events and state. More...


Defines

#define AW_DB_CONNECT(CONN_TYPE, PREFIX)
#define AW_DB_DISCONNECT(PREFIX)
#define AW_DB_DISCONNECT_ALL(PREFIX)
#define AW_DB_DISCONNECT_POOL(CONN_TYPE)
#define MAX_CONNECTION_DELAY   60

Functions

void aw_db_handler_rmatch (aw_handler_args_t *args, aw_event_t *event, byte_t *row_as_string, u_int32_t nwatchers, aw_db_rwatcher_t *watchers, u_int32_t *match_markers)
 Match each cell in row, if match send string event.


Define Documentation

#define AW_DB_CONNECT (  CONN_TYPE,
PREFIX   ) 
 

#define AW_DB_DISCONNECT (  PREFIX   ) 
 

#define AW_DB_DISCONNECT_ALL (  PREFIX   ) 
 

Value:

do {                                                                                                                        \
  byte_t                                                                                                                  \
    key[128];                                                                                                               \
                                                                                                                            \
  /* close this one */                                                                                                      \
  aw_ ## PREFIX ## _disconnect (cinfo, state, logger, 1);                                                                   \
                                                                                                                            \
  /* close the pool */                                                                                                      \
  make_connection_key(key, sizeof(key), cinfo);                                                                             \
                                                                                                                            \
  disconnect_all(key);                                                                                                      \
} while(0);

#define AW_DB_DISCONNECT_POOL (  CONN_TYPE   ) 
 

Value:

do {                                                                                                                        \
 CONN_TYPE                                                                                                                  \
  *conn;                                                                                                                    \
 while( (conn = aw_llt_getobj(key, dbpool)) != NULL ) free_connection(conn);                                                \
} while(0);

#define MAX_CONNECTION_DELAY   60
 


Function Documentation

void aw_db_handler_rmatch (  aw_handler_args_t *  args,
aw_event_t *  event,
byte_t *  row_as_string,
u_int32_t  nwatchers,
aw_db_rwatcher_t *  watchers,
u_int32_t *  match_markers
) 
 

Match each cell in row, if match send string event.

aw_db_handler_rmatch

Parameters:
args Handler args
event Event that triggered sql
row_as_string String with row result as delimited string
nwatchers Number of regex watchers
watchers Array of regex watchers
match_markers Match markers

Aware 0.11.1 Copyright (C) 1998-2005 Russell Leighton (russ@elegant-software.com)