repinfo.h

Go to the documentation of this file.
00001 /*
00002  * DB-ALLe - Archive for punctual meteorological data
00003  *
00004  * Copyright (C) 2005,2006  ARPA-SIM <urpsim@smr.arpa.emr.it>
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00018  *
00019  * Author: Enrico Zini <enrico@enricozini.com>
00020  */
00021 
00022 #ifndef DBALLE_DB_REPINFO_H
00023 #define DBALLE_DB_REPINFO_H
00024 
00025 #ifdef  __cplusplus
00026 extern "C" {
00027 #endif
00028 
00035 #include <dballe/db/internals.h>
00036 
00037 struct _dba_db;
00038 
00040 struct _dba_db_repinfo_cache {
00042     DBALLE_SQL_C_UINT_TYPE id;
00043 
00045     char* memo;
00047     char* desc;
00049     DBALLE_SQL_C_UINT_TYPE prio;
00051     char* descriptor;
00053     DBALLE_SQL_C_UINT_TYPE tablea;
00054 
00056     char* new_memo;
00058     char* new_desc;
00060     DBALLE_SQL_C_UINT_TYPE new_prio;
00062     char* new_descriptor;
00064     DBALLE_SQL_C_UINT_TYPE new_tablea;
00065 };
00067 typedef struct _dba_db_repinfo_cache* dba_db_repinfo_cache;
00068 
00070 struct _dba_db_repinfo_memoidx {
00072     char memo[30];
00074     int id;
00075 };
00077 typedef struct _dba_db_repinfo_memoidx* dba_db_repinfo_memoidx;
00078 
00082 struct _dba_db_repinfo
00083 {
00085     struct _dba_db* db;
00086 
00088     dba_db_repinfo_cache cache;
00090     int cache_size;
00092     int cache_alloc_size;
00093 
00095     dba_db_repinfo_memoidx memo_idx;
00096 };
00098 typedef struct _dba_db_repinfo* dba_db_repinfo;
00099 
00110 dba_err dba_db_repinfo_create(dba_db db, dba_db_repinfo* ins);
00111 
00118 void dba_db_repinfo_delete(dba_db_repinfo ins);
00119 
00127 void dba_db_repinfo_invalidate_cache(dba_db_repinfo ins);
00128 
00142 dba_err dba_db_repinfo_get_id(dba_db_repinfo ri, const char* memo, int* id);
00143 
00156 dba_err dba_db_repinfo_has_id(dba_db_repinfo ri, int id, int* exists);
00157 
00168 dba_db_repinfo_cache dba_db_repinfo_get_by_id(dba_db_repinfo ri, int id);
00169 
00180 dba_db_repinfo_cache dba_db_repinfo_get_by_memo(dba_db_repinfo ri, const char* memo);
00181 
00198 dba_err dba_db_repinfo_update(dba_db_repinfo ri, const char* deffile, int* added, int* deleted, int* updated);
00199 
00200 #if 0
00201 void dba_db_repinfo_set_ident(dba_db_repinfo ins, const char* ident);
00202 dba_err dba_db_repinfo_get_id(dba_db_repinfo ins, int *id);
00203 dba_err dba_db_repinfo_insert(dba_db_repinfo ins, int *id);
00204 dba_err dba_db_repinfo_update(dba_db_repinfo ins);
00205 #endif
00206 
00207 
00208 #ifdef  __cplusplus
00209 }
00210 #endif
00211 
00212 /* vim:set ts=4 sw=4: */
00213 #endif

Generated on Fri Jun 22 13:06:52 2007 for libdballe-db by  doxygen 1.5.2