prepare.h

00001 /*
00002  * Copyright (C) 2005 RingCentral Inc.
00003  * Created by Dmitry Semyonov <dsemyonov@ringcentral.com>
00004  *
00005  *
00006  * This file is part of ser, a free SIP server.
00007  *
00008  * ser 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  * For a license to use the ser software under conditions
00014  * other than those described here, or to purchase support for this
00015  * software, please contact iptel.org by e-mail at the following addresses:
00016  *    info@iptel.org
00017  *
00018  * ser is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License 
00024  * along with this program; if not, write to the Free Software 
00025  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026  */
00027 
00028 #ifndef _PREPARE_H
00029 #define _PREPARE_H
00030 
00031 #include "../../db/db_key.h"
00032 #include "../../db/db_val.h"
00033 #include "../../db/db_op.h"
00034 
00035 
00036 void prepare_where(db_key_t* _k, db_op_t* _op, db_val_t* _v, int _n);
00037 
00038 /*
00039  * prepare_select(), prepare_insert(), prepare_delete(), and prepare_update()
00040  * functions automatically begin new statement. Other functions continue
00041  * to build current statement.
00042  */
00043 
00044 void prepare_select(db_key_t* _c, int _nc);
00045 void prepare_from(const char* _t);
00046 void prepare_order_by(db_key_t _o);
00047 
00048 void prepare_insert(const char* _t);
00049 void prepare_insert_columns(db_key_t* _k, int _n);
00050 void prepare_insert_values(db_val_t* _v, int _n);
00051 
00052 void prepare_delete(const char* _t);
00053 
00054 void prepare_update(const char* _t);
00055 void prepare_update_set(db_key_t* _k, db_val_t* _v, int _n);
00056 
00057 
00058 const char *prepared_sql(void);
00059 size_t prepared_sql_len(void);
00060 
00061 
00062 #endif /* _PREPARE_H */