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 102 of file SqliteRecord.cxx.
106 if(!
result)
throw std::runtime_error(
"Unexpected error when adding new value for the field " +
107 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 110 of file SqliteRecord.cxx.
113 for(
const auto& [colName,colType] : *
m_def) {
120 auto recIt =
m_record.find(colName);
121 bool fieldNull = (recIt==
m_record.end());
122 std::cout <<
"[" << colName <<
" (";
125 std::cout <<
"int) : " << (fieldNull?
"NULL" :
std::to_string(std::get<int>(recIt->second))) <<
"]";
128 std::cout <<
"long) : " << (fieldNull?
"NULL" :
std::to_string(std::get<long>(recIt->second))) <<
"]";
131 std::cout <<
"float) : ";
136 std::cout << std::setprecision(10) << std::get<float>(recIt->second) <<
"]";
140 std::cout <<
"double) : ";
145 std::cout << std::setprecision(10) << std::get<double>(recIt->second) <<
"]";
149 std::cout <<
"string) : " << (fieldNull?
"NULL" : (
"\"" + std::get<std::string>(recIt->second)) +
"\"") <<
"]";
152 std::cout <<
"ERROR) : ]";
155 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 51 of file SqliteRecord.cxx.
55 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 87 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 92 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 35 of file SqliteRecord.cxx.
39 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 77 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 82 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 67 of file SqliteRecord.cxx.
71 return std::get<std::string>(recIt->second);
74 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 97 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 28 of file SqliteRecord.cxx.
31 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: