📄 database.h
字号:
/* librecord2 - Record Object manipulation and storage library 2 * * Authors: YE Nan <nan.ye@orange-ftgroup.com> * * This software and associated documentation files (the "Software") * are copyright (C) 2005 LiPS Linux Phone Standards Forum [FranceTelecom] * All Rights Reserved. * * A copyright license is hereby granted for redistribution and use of * the Software in source and binary forms, with or without modification, * provided that the following conditions are met: * - Redistributions of source code must retain the above copyright notice, * this copyright license and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright * notice, this copyright license and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - Neither the name of LiPS nor the names of its Members may be used * to endorse or promote products derived from the Software without * specific prior written permission. * * A patent license for any Necessary Claims owned by Members of LiPS Forum * to make, have made, use, import, offer to sell, lease and sell or otherwise * distribute any implementation compliant with the any specification adopted * by the LiPS Forumcan be obtained from the respective Members on reasonable * and non-discriminatory terms and conditions and under reciprocity, as * regulated in more detail in the Internal Policy of the LiPS Forum. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER, ITS MEMBERS AND CONTRIBUTORS * "AS IS", AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE * AND NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER, * ITS MEMBERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */#ifndef __RECORD_DATABASE_H#define __RECORD_DATABASE_H#include <glib.h>#include <template.h>#include <record.h>#ifdef __cplusplusextern "C" {#endif /* __cplusplus */typedef struct _RecordDB RecordDB;typedef struct _RecordDBElement RecordDBElement;typedef struct _RecordDBRelation RecordDBRelation;typedef enum { DB_ERROR_NONE, ///< Error none DB_ERROR_FAILED, ///< DB operation failure DB_ERROR_BUSY, ///< DB concurrency failure DB_ERROR_ARG_NULL, ///< Arguments invalid or NULL DB_ERROR_RESULT_NULL, ///< Empty results set DB_ERROR_NOT_EXIST, ///< DB file NOT exist DB_ERROR_UNSUPPORTED, ///< Unsupported features} RecordDBError;typedef enum { DB_TRANS_IMMEDIATE, ///< Immediate trascation DB_TRANS_DEFERRED, ///< Deferred trascation DB_TRANS_EXCLUSIVE, ///< Exclusive trascation} RecordDBTransType;RecordDB * record_db_new (const gchar *db_fname);void record_db_free (RecordDB *db);RecordDBError record_db_open (RecordDB *db);RecordDBError record_db_close (RecordDB *db);RecordDBError record_db_trans_begin (RecordDB *db);RecordDBError record_db_trans_begin_extend (RecordDB *db, RecordDBTransType type);RecordDBError record_db_trans_commit (RecordDB *db); RecordDBElement * record_db_element_new (RecordDB *db, const gchar *element_name, const FieldTemplate *template);void record_db_element_free (RecordDBElement *element);RecordDBError record_db_element_add_record (RecordDBElement *element, Record *record);RecordDBError record_db_element_remove_record (RecordDBElement *element, guint32 id);RecordDBError record_db_element_remove_records (RecordDBElement *element, guint nr_ids, guint32 ids[]);RecordDBError record_db_element_update_record (RecordDBElement *dbelement, Record *record); RecordDBError record_db_element_get_record (RecordDBElement *element, Record **record, guint32 id);RecordDBError record_db_element_get_records (RecordDBElement *element, Iterator **iter, const Record *sample, gboolean fuzzy, gboolean intersect);RecordDBError record_db_element_get_records_count (RecordDBElement *element, const Record *sample, gboolean fuzzy, gboolean intersect, guint *count);RecordDBError record_db_element_get_records_extentions (RecordDBElement *element, Iterator **iter, const Record *sample, gboolean fuzzy, gboolean intersect, const gchar *ext_sql_str);const FieldTemplate * record_db_element_get_template (const RecordDBElement *element);RecordDB * record_db_element_get_db (const RecordDBElement *element);RecordDBRelation * record_db_relation_new (RecordDB *db, const gchar *element_name1, const gchar *element_name2);void record_db_relation_free (RecordDBRelation *relation);RecordDBError record_db_relation_add (RecordDBRelation *relation, guint32 id1, guint32 id2);RecordDBError record_db_relation_get (RecordDBRelation *relation, Iterator **iter, guint32 id, gboolean isid1);RecordDBError record_db_relation_remove (RecordDBRelation *relation, guint32 id1, guint32 id2);#ifdef __cplusplus}#endif /* __cplusplus */#endif /* __RECORD_DATABASE_H *//*vi:ts=2:nowrap:ai:expandtab*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -