Logo Search packages:      
Sourcecode: dballe version File versions

simple.c File Reference

Detailed Description

Simplified interface for Dballe.

Every function returns an error indicator, which is 0 if no error happened, or 1 if there has been an error.

When an error happens, the functions in fdba_error.c can be used to get detailed informations about it.

Internals of the simplified interface
Behind the handle returned by idba_preparati() there are a set of variables that are used as implicit parameters:

The simplified interface has two possible states: QUERY and RESULT. Then the interface is in the QUERY state, the idba_enq and idba_set functions operate in the query dba_record, to set and check the parameters of a query. idba_voglioquesto() reads the parameters from the query dba_record and switches the state to RESULT, and further calls to idba_dammelo() will put the query results in the work dba_record, to be read by the idba_enq functions.

In the RESULT state, the idba_enq and idba_set functions operate on the work dba_record, to inspect the results of the queries. A call to idba_ricominciamo() terminates the current query and goes back to the QUERY state, resetting the contents of all the dba_record of the interface.

idba_prendilo() inserts in the database the data coming from the QUERY dba_record if invoked in the query state, or the data coming from the RESULT dba_record if invoked in the result state. This is done because inserting new values in the database should be independent from the state.

qc functions instead always operate on the qc dba_record, which is accessed with the idba_enq and idba_set functions by prefixing the parameter name with an asterisk.

Definition in file simple.c.

#include <dballe/init.h>
#include <dballe/core/verbose.h>
#include <dballe/core/aliases.h>
#include <dballe/db/dba_db.h>
#include <dballe/db/cursor.h>
#include <dballe/db/internals.h>
#include <dballe/formatter.h>
#include <f77.h>
#include <limits.h>
#include <float.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "handles.h"

Go to the source code of this file.


#define _GNU_SOURCE
#define MAX_SESSION   10
#define MAX_SIMPLE   50
#define MISSING_BYTE   0x7f
#define MISSING_DOUBLE   (-2.22507E-308)
#define MISSING_INT   0x7fffffff
#define MISSING_REAL   (-1.1754944E-38)
#define MISSING_STRING   ""
#define PERM_ANA_RO   (1 << 0)
#define PERM_ANA_WRITE   (1 << 1)
#define PERM_ATTR_ADD   (1 << 6)
#define PERM_ATTR_RO   (1 << 5)
#define PERM_ATTR_WRITE   (1 << 7)
#define PERM_DATA_ADD   (1 << 3)
#define PERM_DATA_RO   (1 << 2)
#define PERM_DATA_WRITE   (1 << 4)
#define SESSION   (FDBA_HANDLE(session, FDBA_HANDLE(simple, *handle).session).session)
#define STATE   (FDBA_HANDLE(simple, *handle))


static int check_flag (const char *val, const char *buf, int len)
static void clear_attr_rec (dba_record rec)
static dba_err get_referred_data_id (int *handle, int *id_context, dba_varcode *id_var)
F77_SUBROUTINE() idba_arrivederci (INTEGER(dbahandle))
F77_INTEGER_FUNCTION() idba_dammelo (INTEGER(handle), TRAIL(parameter))
F77_INTEGER_FUNCTION() idba_dimenticami (INTEGER(handle))
F77_INTEGER_FUNCTION() idba_elencamele (INTEGER(handle))
F77_INTEGER_FUNCTION() idba_fatto (INTEGER(handle))
F77_INTEGER_FUNCTION() idba_prendilo (INTEGER(handle))
F77_INTEGER_FUNCTION() idba_preparati (INTEGER(dbahandle), INTEGER(handle), CHARACTER(anaflag), CHARACTER(dataflag), TRAIL(attrflag))
F77_INTEGER_FUNCTION() idba_presentati (INTEGER(dbahandle), CHARACTER(dsn), CHARACTER(user), TRAIL(password))
F77_INTEGER_FUNCTION() idba_quantesono (INTEGER(handle), INTEGER(count))
F77_INTEGER_FUNCTION() idba_scopa (INTEGER(handle), CHARACTER(repinfofile) TRAIL(repinfofile))
F77_INTEGER_FUNCTION() idba_unset (INTEGER(handle), TRAIL(parameter))
F77_SUBROUTINE() idba_unsetall (INTEGER(handle))
F77_INTEGER_FUNCTION() idba_voglioquesto (INTEGER(handle), INTEGER(count))
QC functions
Functions used to manipulate QC data.

All these functions require some context data about the variable, which is automatically available when the variable just came as the result of an idba_dammelo() or has just been inserted with an idba_prendilo().

F77_INTEGER_FUNCTION() idba_ancora (INTEGER(handle), TRAIL(parameter))
F77_INTEGER_FUNCTION() idba_critica (INTEGER(handle))
F77_INTEGER_FUNCTION() idba_scusa (INTEGER(handle))
F77_INTEGER_FUNCTION() idba_spiegab (INTEGER(handle), CHARACTER(varcode), CHARACTER(value), TRAIL(result))
F77_INTEGER_FUNCTION() idba_spiegal (INTEGER(handle), INTEGER(ltype), INTEGER(l1), INTEGER(l2), TRAIL(result))
F77_INTEGER_FUNCTION() idba_spiegat (INTEGER(handle), INTEGER(ptype), INTEGER(p1), INTEGER(p2), TRAIL(result))
F77_INTEGER_FUNCTION() idba_voglioancora (INTEGER(handle), INTEGER(count))
Stop reading query results and start with a new query.

The query parameters of the last query are preserved for the next one.
handle Handle to a DBALLE session Functions used to read the output values of the DBALLE action routines

F77_INTEGER_FUNCTION() idba_enqb (INTEGER(handle), CHARACTER(parameter), TRAIL(parameter))
F77_INTEGER_FUNCTION() idba_enqc (INTEGER(handle), CHARACTER(parameter), TRAIL(value))
F77_INTEGER_FUNCTION() idba_enqd (INTEGER(handle), CHARACTER(parameter), TRAIL(parameter))
F77_INTEGER_FUNCTION() idba_enqi (INTEGER(handle), CHARACTER(parameter), TRAIL(parameter))
F77_INTEGER_FUNCTION() idba_enqr (INTEGER(handle), CHARACTER(parameter), TRAIL(parameter))
static dba_err lookup_var (dba_record rec, const char *name, dba_var *var)
Functions used to read the input values for the DBALLE action routines

F77_INTEGER_FUNCTION() idba_enqdate (INTEGER(handle), INTEGER(year), INTEGER(month), INTEGER(day), INTEGER(hour), INTEGER(min), INTEGER(sec))
F77_INTEGER_FUNCTION() idba_enqlevel (INTEGER(handle), INTEGER(ltype), INTEGER(l1), INTEGER(l2))
F77_INTEGER_FUNCTION() idba_enqtimerange (INTEGER(handle), INTEGER(ptype), INTEGER(p1), INTEGER(p2))
F77_INTEGER_FUNCTION() idba_setb (INTEGER(handle), CHARACTER(parameter), TRAIL(parameter))
F77_INTEGER_FUNCTION() idba_setc (INTEGER(handle), CHARACTER(parameter), TRAIL(value))
F77_INTEGER_FUNCTION() idba_setcontextana (INTEGER(handle))
F77_INTEGER_FUNCTION() idba_setd (INTEGER(handle), CHARACTER(parameter), TRAIL(parameter))
F77_INTEGER_FUNCTION() idba_setdate (INTEGER(handle), INTEGER(year), INTEGER(month), INTEGER(day), INTEGER(hour), INTEGER(min), INTEGER(sec))
F77_INTEGER_FUNCTION() idba_setdatemax (INTEGER(handle), INTEGER(year), INTEGER(month), INTEGER(day), INTEGER(hour), INTEGER(min), INTEGER(sec))
F77_INTEGER_FUNCTION() idba_setdatemin (INTEGER(handle), INTEGER(year), INTEGER(month), INTEGER(day), INTEGER(hour), INTEGER(min), INTEGER(sec))
F77_INTEGER_FUNCTION() idba_seti (INTEGER(handle), CHARACTER(parameter), TRAIL(parameter))
F77_INTEGER_FUNCTION() idba_setlevel (INTEGER(handle), INTEGER(ltype), INTEGER(l1), INTEGER(l2))
F77_INTEGER_FUNCTION() idba_setr (INTEGER(handle), CHARACTER(parameter), TRAIL(parameter))
F77_INTEGER_FUNCTION() idba_settimerange (INTEGER(handle), INTEGER(ptype), INTEGER(p1), INTEGER(p2))


static int usage_refcount = 0

Generated by  Doxygen 1.6.0   Back to index