db.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 DBA_DB_H
00023 #define DBA_DB_H
00024 
00025 #ifdef  __cplusplus
00026 extern "C" {
00027 #endif
00028 
00029 #include <dballe/core/record.h>
00030 #include <dballe/core/var.h>
00031 #include <dballe/db/cursor.h>
00032 
00042 #ifndef DBA_DB_DEFINED
00043 #define DBA_DB_DEFINED
00044 typedef struct _dba_db* dba_db;
00045 #endif
00046 
00062 dba_err dba_db_create(const char* dsn, const char* user, const char* password, dba_db* db);
00063 
00073 void dba_db_delete(dba_db db);
00074 
00090 dba_err dba_db_reset(dba_db db, const char* repinfo_file);
00091 
00100 dba_err dba_db_delete_tables(dba_db db);
00101 
00123 dba_err dba_db_update_repinfo(dba_db db, const char* repinfo_file, int* added, int* deleted, int* updated);
00124 
00128 dba_err dba_db_rep_cod_from_memo(dba_db db, const char* memo, int* rep_cod);
00129 
00142 dba_err dba_db_check_rep_cod(dba_db db, int rep_cod, int* valid);
00143 
00161 dba_err dba_db_ana_query(dba_db db, dba_record query, dba_db_cursor* cur, int* count);
00162 
00187 dba_err dba_db_insert(dba_db db, dba_record rec, int can_replace, int pseudoana_can_add, int* ana_id, int* context_id);
00188 
00210 dba_err dba_db_query(dba_db db, dba_record rec, dba_db_cursor* cur, int* count);
00211 
00223 dba_err dba_db_remove(dba_db db, dba_record rec);
00224 
00239 dba_err dba_db_remove_orphans(dba_db db);
00240 
00262 dba_err dba_db_qc_query(dba_db db, int id_context, dba_varcode id_var, const dba_varcode* qcs, size_t qcs_size, dba_record attrs, int* count);
00263 
00280 dba_err dba_db_qc_insert_or_replace(dba_db db, int id_context, dba_varcode id_var, dba_record attrs, int can_replace);
00281 
00299 dba_err dba_db_qc_insert(dba_db db, int id_context, dba_varcode id_var, dba_record attrs);
00300 
00317 dba_err dba_db_qc_insert_new(dba_db db, int id_context, dba_varcode id_var, dba_record attrs);
00318 
00337 dba_err dba_db_qc_remove(dba_db db, int id_context, dba_varcode id_var, dba_varcode* qcs, int qcs_size);
00338 
00339 #ifdef  __cplusplus
00340 }
00341 #endif
00342 
00343 /* vim:set ts=4 sw=4: */
00344 #endif

Generated on Thu Aug 30 14:59:08 2007 for libdballe-db by  doxygen 1.5.3