MySQL++  3.3.0
field_types.h
Go to the documentation of this file.
1 
4 /***********************************************************************
5  Copyright (c) 1998 by Kevin Atkinson, (c) 1999, 2000 and 2001 by
6  MySQL AB, and (c) 2004-2007 by Educational Technology Resources, Inc.
7  Others may also hold copyrights on code in this file. See the CREDITS
8  file in the top directory of the distribution for details.
9 
10  This file is part of MySQL++.
11 
12  MySQL++ is free software; you can redistribute it and/or modify it
13  under the terms of the GNU Lesser General Public License as published
14  by the Free Software Foundation; either version 2.1 of the License, or
15  (at your option) any later version.
16 
17  MySQL++ is distributed in the hope that it will be useful, but WITHOUT
18  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
20  License for more details.
21 
22  You should have received a copy of the GNU Lesser General Public
23  License along with MySQL++; if not, write to the Free Software
24  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
25  USA
26 ***********************************************************************/
27 
28 #ifndef MYSQLPP_FIELD_TYPES_H
29 #define MYSQLPP_FIELD_TYPES_H
30 
31 #include "type_info.h"
32 
33 #include <vector>
34 
35 namespace mysqlpp {
36 
37 #if !defined(DOXYGEN_IGNORE)
38 // Make Doxygen ignore this
39 class MYSQLPP_EXPORT ResultBase;
40 #endif
41 
43 class FieldTypes : public std::vector<mysql_type_info>
44 {
45 public:
47  FieldTypes() { }
48 
50  FieldTypes(const ResultBase* res)
51  {
52  init(res);
53  }
54 
56  FieldTypes(int i) :
57  std::vector<mysql_type_info>(i)
58  {
59  }
60 
63  {
64  init(res);
65  return *this;
66  }
67 
73  {
74  insert(begin(), i, mysql_type_info());
75  return *this;
76  }
77 
78 private:
79  void init(const ResultBase* res);
80 };
81 
82 } // end namespace mysqlpp
83 
84 #endif
A vector of SQL field types.
Definition: field_types.h:44
FieldTypes()
Default constructor.
Definition: field_types.h:47
FieldTypes(const ResultBase *res)
Create list of field types from a result set.
Definition: field_types.h:50
FieldTypes & operator=(const ResultBase *res)
Initialize field list based on a result set.
Definition: field_types.h:62
FieldTypes(int i)
Create fixed-size list of uninitialized field types.
Definition: field_types.h:56
Base class for StoreQueryResult and UseQueryResult.
Definition: result.h:111
SQL field type information.
Definition: type_info.h:159
Declares classes that provide an interface between the SQL and C++ type systems.