libdballe  5.18
querybuf.h
Go to the documentation of this file.
00001 /*
00002  * db/querybuf - Buffer used to build SQL queries
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_QUERYBUF_H
00023 #define DBA_DB_QUERYBUF_H
00024 
00030 #include <string>
00031 
00032 namespace dballe {
00033 
00035 struct Querybuf : public std::string
00036 {
00037     bool list_first;
00038     char list_sep[10];
00039 
00046     Querybuf(size_t reserve = 512);
00047     ~Querybuf();
00048 
00050     void clear();
00051 
00059     void start_list(const char* sep);
00060 
00067     void appendf(const char* fmt, ...) __attribute__((format(printf, 2, 3)));
00068 
00078     void append_list(const char* str);
00079 
00089     void append_listf(const char* fmt, ...) __attribute__((format(printf, 2, 3)));
00090 };
00091 
00092 } // namespace dballe
00093 
00094 #endif