ThinSQLite++
A thin, safe and convenient modern C++ wrapper for SQLite API.
Loading...
Searching...
No Matches
cell Class Reference

A cell in a row. More...

Public Member Functions

 cell (const statement *owner, int idx) noexcept
 Construct a cell for a given statement and column index.
 
 cell (const std::unique_ptr< statement > &owner, int idx) noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
int type () const noexcept
 Default datatype of the cell.
 
const char * name () const noexcept
 Name of the cell's column.
 
template<class T >
value () const noexcept
 Cell's value.
 
const char * database_name () const noexcept
 Database that is the origin of the cell.
 
const char * table_name () const noexcept
 Table that is the origin of the cell.
 
const char * origin_name () const noexcept
 Table column that is the origin of the cell.
 
const char * declared_type () const noexcept
 Declared datatype of the cell.
 

Protected Attributes

const statement_owner
 
int _idx
 

Detailed Description

A cell in a row.

A cell represents a column value at a given index for the current row of a statement.

The statement it accesses is held by reference and must exist as long as this object is alive

#include <thinsqlitepp/statement.hpp>

Member Function Documentation

◆ type()

int type ( ) const
inlinenoexcept

Default datatype of the cell.

Equivalent to sqlite3_column_type

Returns
One of the SQLite fundamental datatypes
See also
statement::column_type

◆ name()

const char * name ( ) const
inlinenoexcept

Name of the cell's column.

Equivalent to sqlite3_column_name

The returned string pointer is valid until either the statement is destroyed or until the statement is automatically re-prepared by the first call to step() for a particular run or until the next call to column_name() on the same column.

See also
statement::column_name

◆ value()

template<class T >
T value ( ) const
inlinenoexcept

Cell's value.

Template Parameters
TDesired output type. Must be one of:
See also
statement::column_value

◆ database_name()

const char * database_name ( ) const
inlinenoexcept

Database that is the origin of the cell.

Equivalent to sqlite3_column_database_name

See also
statement::column_database_name

◆ table_name()

const char * table_name ( ) const
inlinenoexcept

Table that is the origin of the cell.

Equivalent to sqlite3_column_table_name

See also
statement::column_table_name

◆ origin_name()

const char * origin_name ( ) const
inlinenoexcept

Table column that is the origin of the cell.

Equivalent to sqlite3_column_origin_name

See also
statement::column_origin_name

◆ declared_type()

const char * declared_type ( ) const
inlinenoexcept

Declared datatype of the cell.

Equivalent to sqlite3_column_decltype

See also
statement::column_declared_type