dbcassa_table.h

00001 /*
00002  * $Id$
00003  *
00004  * Copyright (C) 2012 1&1 Internet Development
00005  *
00006  * This file is part of Kamailio, a free SIP server.
00007  *
00008  * Kamailio is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version
00012  *
00013  * Kamailio is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License 
00019  * along with this program; if not, write to the Free Software 
00020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  * 
00022  * History:
00023  * --------
00024  * 2012-01 initial version (Anca Vamanu)
00025  * 
00026  */
00027 
00028 
00029 #ifndef _DBCASSA_LIB_H_
00030 #define _DBCASSA_LIB_H_
00031 
00032 #include "../../str.h"
00033 #include "../../lib/srdb1/db_val.h"
00034 
00035 #define DBCASSA_DELIM     ':'
00036 #define DBCASSA_DELIM_C   ' '
00037 #define DBCASSA_DELIM_R   '\n'
00038 
00039 typedef struct _dbcassa_column
00040 {
00041         str name;
00042         db_type_t type;
00043         int flag;
00044         struct _dbcassa_column *next;
00045 } dbcassa_column_t, *dbcassa_column_p;
00046 
00047 typedef struct _dbcassa_table
00048 {
00049         str dbname;
00050         str name;
00051         int hash;
00052         time_t mt;
00053         int nrcols;
00054         int key_len;
00055         int seckey_len;
00056         dbcassa_column_p cols;
00057         dbcassa_column_p *key;
00058         dbcassa_column_p *sec_key;
00059         dbcassa_column_p ts_col; /* timestamp col- special col used as the timestamp for the row */
00060         struct _dbcassa_table *next;
00061 } dbcassa_table_t, *dbcassa_table_p;
00062 
00063 void dbcassa_lock_release(dbcassa_table_p tbc);
00064 dbcassa_table_p dbcassa_db_get_table(const str* dbn, const str* tbn);
00065 int dbcassa_read_table_schemas(void);
00066 void dbcassa_destroy_htable(void);
00067 
00068 #endif