/usr/include/sqlite/command.hpp is in libvsqlitepp-dev 0.3.13-3.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | /*##############################################################################
VSQLite++ - virtuosic bytes SQLite3 C++ wrapper
Copyright (c) 2006-2014 Vinzenz Feenstra vinzenz.feenstra@gmail.com
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of virtuosic bytes nor the names of its contributors may
be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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 GUARD_SQLITE_COMMAND_HPP_INCLUDED
#define GUARD_SQLITE_COMMAND_HPP_INCLUDED
#include <boost/cstdint.hpp>
#include <boost/noncopyable.hpp>
#include <sqlite/connection.hpp>
#include <vector>
struct sqlite3_stmt;
namespace sqlite{
/** \brief \a null_type is an empty type used to represent NULL
* values
*/
struct null_type{};
/** \brief \a nil is used instead of NULL within the operator %
* syntax in this wrapper
*/
extern null_type nil;
/** \brief \a command is the base class of all sql command classes
* An object of this class is not copyable
*/
struct command : boost::noncopyable{
/** \brief \a command constructor
* \param con takes a reference to the database connection type
* \a connection
* \param sql is the SQL string. The sql string can contain placeholder
* the question mark '?' is used as placeholder the
* \a command::bind methods or command::operator% syntax must be
* used to replace the placeholders
*/
command(connection & con, std::string const & sql);
/** \brief \a command destructor
*/
virtual ~command();
/** \brief clear is used if you'd like to reuse a command object
*/
void clear();
/** \brief emit executes the sql command
* If you have used placeholders you must have replaced all
* placeholders
*/
bool emit();
/** \brief works exactly like the method \a command::emit
*
*/
bool operator()();
/** \brief binds NULL to the given 1 based index
*
*/
void bind(int idx);
/** \brief binds the 32-Bit integer v to the given 1 based index
* \param idx 1 based index of the placeholder within the sql statement
* \param v 32-Bit integer value which should replace the placeholder
*/
void bind(int idx, int v);
/** \brief binds the 64-Bit integer v to the given 1 based index
* \param idx 1 based index of the placeholder within the sql statement
* \param v 64-Bit integer value which should replace the placeholder
*/
void bind(int idx, boost::int64_t v);
/** \brief binds the double v to the given 1 based index
* \param idx 1 based index of the placeholder within the sql statement
* \param v double value which should replace the placeholder
*/
void bind(int idx, double v);
/** \brief binds the text/string v to the given 1 based index
* \param idx 1 based index of the placeholder within the sql statement
* \param v text/string value which should replace the placeholder
*/
void bind(int idx, std::string const & v);
/** \brief binds the binary/blob buf to the given 1 based index
* \param idx 1 based index of the placeholder within the sql statement
* \param buf binary/blob buf which should replace the placeholder
* \param buf_size size in bytes of the binary buffer
*/
void bind(int idx, void const * buf, size_t buf_size);
/** \brief binds the binary/blob v to the given 1 based index
* \param idx 1 based index of the placeholder within the sql statement
* \param v binary/blob buffer which should replace the placeholder
* v is a std::vector<unsigned char> const &
*/
void bind(int idx, std::vector<unsigned char> const & v);
/** \brief replacement for void command::bind(int idx);
* To use this operator% you have to use the global object
* \a nil
* Indexes are given automatically first call uses 1 as index, second 2
* and so on
* \param p should be \a nil
*/
command & operator % (null_type const & p);
/** \brief replacement for void command::bind(int idx,int);
* Indexes are given automatically first call uses 1 as index, second 2
* and so on
* \param p should be a 32-Bit integer
*/
command & operator % (int p);
/** \brief replacement for void command::bind(int idx,boost::int64_t);
* Indexes are given automatically first call uses 1 as index, second 2
* and so on
* \param p should be a 64-Bit integer
*/
command & operator % (boost::int64_t p);
/** \brief replacement for void command::bind(int idx,double);
* Indexes are given automatically first call uses 1 as index, second 2
* and so on
* \param p a double variable
*/
command & operator % (double p);
/** \brief replacement for void command::bind(int idx,std::string const&);
* Indexes are given automatically first call uses 1 as index, second 2
* and so on
* \param p should be a Zero Terminated C-style string (char * or
* char const*), or a std::string object,
*/
command & operator % (std::string const & p);
/** \brief replacement for void command::bind(int idx,std::vector<unsigned char> const&);
* Indexes are given automatically first call uses 1 as index, second 2
* and so on
* \param p a constant reference to a std::vector<unsigned char> object
* (For blob/binary data)
*/
command & operator % (std::vector<unsigned char> const & p);
protected:
void access_check();
bool step();
struct sqlite3 * get_handle();
private:
void prepare();
void finalize();
private:
connection & m_con;
std::string m_sql;
protected:
sqlite3_stmt * stmt;
private:
int last_arg_idx;
};
}
#endif //GUARD_SQLITE_COMMAND_HPP_INCLUDED
|