SqliteRecord is one record in the SqliteRecordset object.
More...
#include <SqliteRecord.h>
SqliteRecord is one record in the SqliteRecordset object.
Definition at line 48 of file SqliteRecord.h.
◆ FieldCheckResult
◆ Record
◆ RecordCIterator
◆ FieldCheckCode
Enumerator |
---|
FIELD_CHECK_OK | |
FIELD_CHECK_BAD_NAME | |
FIELD_CHECK_BAD_TYPE | |
FIELD_CHECK_NULL_VAL | |
Definition at line 131 of file SqliteRecord.h.
◆ SqliteRecord() [1/3]
◆ SqliteRecord() [2/3]
SqliteRecord::SqliteRecord |
( |
| ) |
|
|
delete |
◆ SqliteRecord() [3/3]
◆ ~SqliteRecord()
SqliteRecord::~SqliteRecord |
( |
| ) |
|
|
override |
◆ addValue()
void SqliteRecord::addValue |
( |
const std::string & |
field, |
|
|
SqliteInp |
value |
|
) |
| |
Definition at line 103 of file SqliteRecord.cxx.
107 if(!
result)
throw std::runtime_error(
"Unexpected error when adding new value for the field " +
108 field +
". Duplicate field name?");
◆ checkField()
Definition at line 149 of file SqliteRecord.h.
165 return std::make_tuple(checkIt,checkCode);
◆ dump()
void SqliteRecord::dump |
( |
| ) |
const |
Dump to cout.
Definition at line 111 of file SqliteRecord.cxx.
113 boost::io::ios_all_saver saver (std::cout);
115 for(
const auto& [colName,colType] : *
m_def) {
122 auto recIt =
m_record.find(colName);
123 bool fieldNull = (recIt==
m_record.end());
124 std::cout <<
"[" << colName <<
" (";
127 std::cout <<
"int) : " << (fieldNull?
"NULL" :
std::to_string(std::get<int>(recIt->second))) <<
"]";
130 std::cout <<
"long) : " << (fieldNull?
"NULL" :
std::to_string(std::get<long>(recIt->second))) <<
"]";
133 std::cout <<
"float) : ";
138 std::cout << std::setprecision(10) << std::get<float>(recIt->second) <<
"]";
142 std::cout <<
"double) : ";
147 std::cout << std::setprecision(10) << std::get<double>(recIt->second) <<
"]";
151 std::cout <<
"string) : " << (fieldNull?
"NULL" : (
"\"" + std::get<std::string>(recIt->second)) +
"\"") <<
"]";
154 std::cout <<
"ERROR) : ]";
157 std::cout << std::endl;
◆ getDouble() [1/2]
double SqliteRecord::getDouble |
( |
const std::string & |
field | ) |
const |
|
overridevirtual |
Get double field value.
- Parameters
-
- Returns
- field value
Implements IRDBRecord.
Definition at line 52 of file SqliteRecord.cxx.
56 return std::get<double>(recIt->second);
◆ getDouble() [2/2]
double SqliteRecord::getDouble |
( |
const std::string & |
field, |
|
|
unsigned int |
index |
|
) |
| const |
|
overridevirtual |
Get array double field value.
- Parameters
-
field | [IN] field name |
index | [IN] index in the array |
- Returns
- field value
Implements IRDBRecord.
Definition at line 88 of file SqliteRecord.cxx.
◆ getFloat() [1/2]
float SqliteRecord::getFloat |
( |
const std::string & |
field | ) |
const |
|
overridevirtual |
◆ getFloat() [2/2]
float SqliteRecord::getFloat |
( |
const std::string & |
field, |
|
|
unsigned int |
index |
|
) |
| const |
|
overridevirtual |
Get array float field value.
- Parameters
-
field | [IN] field name |
index | [IN] index in the array |
- Returns
- field value
Implements IRDBRecord.
Definition at line 93 of file SqliteRecord.cxx.
◆ getInt() [1/2]
int SqliteRecord::getInt |
( |
const std::string & |
field | ) |
const |
|
overridevirtual |
Get int field value.
- Parameters
-
- Returns
- field value
Implements IRDBRecord.
Definition at line 36 of file SqliteRecord.cxx.
40 return std::get<int>(recIt->second);
◆ getInt() [2/2]
int SqliteRecord::getInt |
( |
const std::string & |
field, |
|
|
unsigned int |
index |
|
) |
| const |
|
overridevirtual |
Get array int field value.
- Parameters
-
field | [IN] field name |
index | [IN] index in the array |
- Returns
- field value
Implements IRDBRecord.
Definition at line 78 of file SqliteRecord.cxx.
◆ getLong() [1/2]
long SqliteRecord::getLong |
( |
const std::string & |
field | ) |
const |
|
overridevirtual |
◆ getLong() [2/2]
long SqliteRecord::getLong |
( |
const std::string & |
field, |
|
|
unsigned int |
index |
|
) |
| const |
|
overridevirtual |
Get array long field value.
- Parameters
-
field | [IN] field name |
index | [IN] index in the array |
- Returns
- field value
Implements IRDBRecord.
Definition at line 83 of file SqliteRecord.cxx.
◆ getString() [1/2]
const std::string & SqliteRecord::getString |
( |
const std::string & |
field | ) |
const |
|
overridevirtual |
Get string field value.
- Parameters
-
- Returns
- field value
Implements IRDBRecord.
Definition at line 68 of file SqliteRecord.cxx.
72 return std::get<std::string>(recIt->second);
75 throw std::runtime_error(
"Unexpected error in SqliteRecord::getString()");
◆ getString() [2/2]
const std::string & SqliteRecord::getString |
( |
const std::string & |
field, |
|
|
unsigned int |
index |
|
) |
| const |
|
overridevirtual |
Get array string field value.
- Parameters
-
field | [IN] field name |
index | [IN] index in the array |
- Returns
- field value
Implements IRDBRecord.
Definition at line 98 of file SqliteRecord.cxx.
◆ handleError()
Definition at line 168 of file SqliteRecord.h.
173 throw std::runtime_error(
"Wrong name for the field " +
field);
175 throw std::runtime_error(
"Wrong data type requested for the field " +
field);
177 throw std::runtime_error(
field +
" is NULL");
◆ isFieldNull()
bool SqliteRecord::isFieldNull |
( |
const std::string & |
field | ) |
const |
|
overridevirtual |
Check if the field value is NULL.
- Parameters
-
field | [IN] field name @retun TRUE if the field is NULL, FALSE otherwise |
Implements IRDBRecord.
Definition at line 29 of file SqliteRecord.cxx.
32 if(
m_def->find(
field)==
m_def->end())
throw std::runtime_error(
"Wrong name for the field "+
field);
◆ operator=()
◆ m_def
◆ m_record
The documentation for this class was generated from the following files: