• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

db.h

Go to the documentation of this file.
00001 /*
00002  * DB-ALLe - Archive for punctual meteorological data
00003  *
00004  * Copyright (C) 2005--2010  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 
00076 dba_err dba_db_create_generic(const char* config, dba_db* db);
00077 
00088 dba_err dba_db_create_from_file(const char* pathname, dba_db* db);
00089 
00104 dba_err dba_db_create_from_url(const char* url, dba_db* db);
00105 
00114 int dba_db_is_url(const char* str);
00115 
00127 dba_err dba_db_create_test(dba_db* db);
00128 
00138 void dba_db_delete(dba_db db);
00139 
00155 dba_err dba_db_reset(dba_db db, const char* repinfo_file);
00156 
00165 dba_err dba_db_delete_tables(dba_db db);
00166 
00188 dba_err dba_db_update_repinfo(dba_db db, const char* repinfo_file, int* added, int* deleted, int* updated);
00189 
00193 dba_err dba_db_rep_cod_from_memo(dba_db db, const char* memo, int* rep_cod);
00194 
00198 dba_err dba_db_rep_memo_from_cod(dba_db db, int rep_cod, const char** memo);
00199 
00212 dba_err dba_db_check_rep_cod(dba_db db, int rep_cod, int* valid);
00213 
00231 dba_err dba_db_ana_query(dba_db db, dba_record query, dba_db_cursor* cur, int* count);
00232 
00257 dba_err dba_db_insert(dba_db db, dba_record rec, int can_replace, int pseudoana_can_add, int* ana_id, int* context_id);
00258 
00280 dba_err dba_db_query(dba_db db, dba_record rec, dba_db_cursor* cur, int* count);
00281 
00293 dba_err dba_db_remove(dba_db db, dba_record rec);
00294 
00309 dba_err dba_db_remove_orphans(dba_db db);
00310 
00332 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);
00333 
00350 dba_err dba_db_qc_insert_or_replace(dba_db db, int id_context, dba_varcode id_var, dba_record attrs, int can_replace);
00351 
00369 dba_err dba_db_qc_insert(dba_db db, int id_context, dba_varcode id_var, dba_record attrs);
00370 
00387 dba_err dba_db_qc_insert_new(dba_db db, int id_context, dba_varcode id_var, dba_record attrs);
00388 
00407 dba_err dba_db_qc_remove(dba_db db, int id_context, dba_varcode id_var, dba_varcode* qcs, int qcs_size);
00408 
00409 #ifdef  __cplusplus
00410 }
00411 #endif
00412 
00413 /* vim:set ts=4 sw=4: */
00414 #endif

Generated on Wed Dec 8 2010 17:24:31 for libdballe by  doxygen 1.7.2