Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
resultsetmetadata.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file resultsetmetadata.h
1 /*
2  This file is part of libodbc++.
3 
4  Copyright (C) 1999-2000 Manush Dodunekov <manush@stendahls.net>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING. If not, write to
18  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  Boston, MA 02111-1307, USA.
20 */
21 
22 #ifndef __ODBCXX_RESULTSETMETADATA_H
23 #define __ODBCXX_RESULTSETMETADATA_H
24 
25 #include <RDBC/odbc++/setup.h>
26 #include <RDBC/odbc++/types.h>
27 #include <RDBC/odbc++/resultset.h>
28 
29 namespace odbc {
30 
31  class ResultSet;
32  class DriverInfo;
33 
36  friend class ResultSet;
37  friend class Statement;
38  private:
40 
41  int numCols_;
42  std::vector<ODBCXX_STRING> colNames_;
43  std::vector<int> colTypes_;
44  std::vector<int> colPrecisions_;
45  std::vector<int> colScales_;
46 #if ODBCVER >= 0x0300
47  std::vector<int> colLengths_;
48 #endif
49 
50  //internal stuff
52 
53  //yes, both constructor and destructor are meant to be private
56 
57  //driver info
58  const DriverInfo* _getDriverInfo() const {
59  return resultSet_->_getDriverInfo();
60  }
61 
62  //these fetch info about a column
63  int _getNumericAttribute(unsigned int col, SQLUSMALLINT attr);
64  ODBCXX_STRING _getStringAttribute(unsigned int col, SQLUSMALLINT attr, unsigned int maxlen =255);
65 
66  //this loads the above values
67  void _fetchColumnInfo();
68 
69  public:
71  enum {
72  columnNoNulls = SQL_NO_NULLS,
73  columnNullable = SQL_NULLABLE,
74  columnNullableUnknown = SQL_NULLABLE_UNKNOWN
75  };
76 
78  int getColumnCount() const;
79 
83  const ODBCXX_STRING& getColumnName(int column) const;
84 
89  int getColumnType(int column) const;
90 
94  int getPrecision(int column) const;
95 
99  int getScale(int column) const;
100 
104  int getColumnDisplaySize(int column);
105 
109  ODBCXX_STRING getCatalogName(int column);
110 
114  ODBCXX_STRING getColumnLabel(int column);
115 
119  ODBCXX_STRING getColumnTypeName(int column);
120 
124  ODBCXX_STRING getSchemaName(int column);
125 
129  ODBCXX_STRING getTableName(int column);
130 
134  bool isAutoIncrement(int column);
135 
139  bool isCaseSensitive(int column);
140 
144  bool isCurrency(int column);
145 
149  bool isDefinitelyWritable(int column);
150 
154  int isNullable(int column);
155 
159  bool isReadOnly(int column);
160 
164  bool isSearchable(int column);
165 
169  bool isSigned(int column);
170 
174  bool isWritable(int column);
175  };
176 
177 
178 
179 }; // namespace odbc
180 
181 
182 #endif // __ODBCXX_RESULTSETMETADATA_H