aGrUM  0.13.2
gum::learning::NanodbcParser< ALLOC > Class Template Reference

Class for parsing SQL results using Nanodbc. More...

#include <nanodbcParser.h>

Public Member Functions

Constructors / Destructors
 NanodbcParser (const ALLOC< std::string > &alloc=ALLOC< std::string >())
 Default constructor: create a parser without being connected. More...
 
 NanodbcParser (nanodbc::connection &connection, const std::string &query, const ALLOC< std::string > &alloc=ALLOC< std::string >())
 constructor that executes an SQL query if the connection is active More...
 
virtual ~NanodbcParser ()
 destructor More...
 
Accessors / Modifiers
bool next ()
 Gets the next line of the SQL stream and parses it. More...
 
const std::vector< std::string, ALLOC< std::string > > & current () const
 returns the current parsed line. More...
 
std::size_t nbLine () const
 returns the current line number within the query More...
 
std::size_t nbColumns () const
 returns the number of columns in the query result More...
 
std::string columnName (const std::size_t i) const
 returns the name of the ith column More...
 
void useNewQuery (nanodbc::connection &connexion, const std::string &query)
 start a new query More...
 

Public Types

using allocator_type = ALLOC< std::string >
 type for the allocators passed in arguments of methods More...
 

Detailed Description

template<template< typename > class ALLOC = std::allocator>
class gum::learning::NanodbcParser< ALLOC >

Class for parsing SQL results using Nanodbc.

This class should probably not be used by itself. It is essentially used by Class DBInitializerFromSQL.

Definition at line 54 of file nanodbcParser.h.

Member Typedef Documentation

template<template< typename > class ALLOC = std::allocator>
using gum::learning::NanodbcParser< ALLOC >::allocator_type = ALLOC<std::string>

type for the allocators passed in arguments of methods

Definition at line 58 of file nanodbcParser.h.

Constructor & Destructor Documentation

template<template< typename > class ALLOC = std::allocator>
gum::learning::NanodbcParser< ALLOC >::NanodbcParser ( const ALLOC< std::string > &  alloc = ALLOC< std::string >())

Default constructor: create a parser without being connected.

template<template< typename > class ALLOC = std::allocator>
gum::learning::NanodbcParser< ALLOC >::NanodbcParser ( nanodbc::connection &  connection,
const std::string &  query,
const ALLOC< std::string > &  alloc = ALLOC< std::string >() 
)

constructor that executes an SQL query if the connection is active

Parameters
connectiona nanODBC connection to a SQL database
querya string containing an SQL query
allocThe allocator that will be used by all methods
template<template< typename > class ALLOC = std::allocator>
virtual gum::learning::NanodbcParser< ALLOC >::~NanodbcParser ( )
virtual

destructor

Member Function Documentation

template<template< typename > class ALLOC = std::allocator>
std::string gum::learning::NanodbcParser< ALLOC >::columnName ( const std::size_t  i) const

returns the name of the ith column

template<template< typename > class ALLOC = std::allocator>
const std::vector<std::string,ALLOC<std::string> >& gum::learning::NanodbcParser< ALLOC >::current ( ) const

returns the current parsed line.

Exceptions
NullElementis raised if there is no data.
template<template< typename > class ALLOC = std::allocator>
std::size_t gum::learning::NanodbcParser< ALLOC >::nbColumns ( ) const

returns the number of columns in the query result

template<template< typename > class ALLOC = std::allocator>
std::size_t gum::learning::NanodbcParser< ALLOC >::nbLine ( ) const

returns the current line number within the query

template<template< typename > class ALLOC = std::allocator>
bool gum::learning::NanodbcParser< ALLOC >::next ( )

Gets the next line of the SQL stream and parses it.

Returns
false if there is no next line.
template<template< typename > class ALLOC = std::allocator>
void gum::learning::NanodbcParser< ALLOC >::useNewQuery ( nanodbc::connection &  connexion,
const std::string &  query 
)

start a new query


The documentation for this class was generated from the following file: