aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
nanodbcParser_inl.h
Go to the documentation of this file.
1/***************************************************************************
2 * Copyright (c) 2005-2024 by Christophe GONZALES(_at_AMU) and Pierre-Henri WUILLEMIN(_at_LIP6) *
3 * info_at_agrum_dot_org *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
26
27#ifdef _ODBC
28
29# ifndef DOXYGEN_SHOULD_SKIP_THIS
30
32
33namespace gum {
34
35 namespace learning {
36
37 // return the current number line
38 INLINE std::size_t NanodbcParser::nbLine() const {
39 return _nb_line_ >= 1 ? _nb_line_ - 1 : std::size_t(0);
40 }
41
42
43 // returns the current parsed line.
44 INLINE
45 const std::vector< std::string >& NanodbcParser::current() const {
46 if (!_data_.empty()) { return _data_; }
47
48 GUM_ERROR(NullElement, "No parsed data")
49 }
50
51
53 INLINE std::size_t NanodbcParser::nbColumns() const { return std::size_t(_result_.columns()); }
54
55
57 INLINE std::string NanodbcParser::columnName(const std::size_t i) const {
58 return _result_.column_name(i);
59 }
60
61
62 } // namespace learning
63
64} // namespace gum
65
66# endif /* DOXYGEN_SHOULD_SKIP_THIS */
67
68#endif // _ODBC
std::size_t nbColumns() const
returns the number of columns in the query result
std::size_t nbLine() const
returns the current line number within the query
const std::vector< std::string > & current() const
returns the current parsed line.
std::string columnName(const std::size_t i) const
returns the name of the ith column
#define GUM_ERROR(type, msg)
Definition exceptions.h:72
include the inlined functions if necessary
Definition CSVParser.h:54
gum is the global namespace for all aGrUM entities
Definition agrum.h:46
Class for parsing SQL results using Nanodbc.