Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libcifpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
libcifpp
Commits
e44539ef
Unverified
Commit
e44539ef
authored
Nov 08, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Checks before building indices. Better error reporting
parent
a2f58501
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
2 deletions
+40
-2
src/category.cpp
+31
-0
src/datablock.cpp
+9
-2
No files found.
src/category.cpp
View file @
e44539ef
...
...
@@ -743,7 +743,38 @@ void category::set_validator(const validator *v, datablock &db)
m_cat_validator
=
m_validator
->
get_validator_for_category
(
m_name
);
if
(
m_cat_validator
!=
nullptr
)
{
std
::
set
<
std
::
string
>
missing
;
std
::
vector
<
uint16_t
>
kix
;
for
(
auto
k
:
m_cat_validator
->
m_keys
)
{
kix
.
push_back
(
get_column_ix
(
k
));
if
(
kix
.
back
()
>=
m_columns
.
size
())
missing
.
insert
(
k
);
}
// TODO: perhaps reintroduce the following check?
// if (missing.empty())
// {
// // First check if all records do have their mandatory fields
// for (auto r : *this)
// {
// for (auto ix : kix)
// {
// if (r[ix].empty())
// missing.insert(m_columns[ix].m_name);
// }
// }
// }
if
(
missing
.
size
()
==
1
)
throw
std
::
runtime_error
(
"Cannot construct index since the key field "
+
*
missing
.
begin
()
+
" in "
+
m_name
+
" is empty"
);
if
(
not
missing
.
empty
())
throw
std
::
runtime_error
(
"Cannot construct index since the key fields "
+
cif
::
join
(
missing
,
", "
)
+
" in "
+
m_name
+
" are empty"
);
m_index
=
new
category_index
(
this
);
}
}
else
m_cat_validator
=
nullptr
;
...
...
src/datablock.cpp
View file @
e44539ef
...
...
@@ -33,8 +33,15 @@ void datablock::set_validator(const validator *v)
{
m_validator
=
v
;
for
(
auto
&
cat
:
*
this
)
cat
.
set_validator
(
v
,
*
this
);
try
{
for
(
auto
&
cat
:
*
this
)
cat
.
set_validator
(
v
,
*
this
);
}
catch
(
const
std
::
exception
&
e
)
{
throw_with_nested
(
std
::
runtime_error
(
"Error while setting validator in datablock "
+
m_name
));
}
}
const
validator
*
datablock
::
get_validator
()
const
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment