Skip to content
Snippets Groups Projects
Unverified Commit cf3ef220 authored by dlacoste-esrf's avatar dlacoste-esrf Committed by GitHub
Browse files

Merge pull request #19 from jjdmol/image_support_insert_query_fix

Fix looping over image vector elements when constructing pqxx query.
parents ba7eee3b 5fddccf1
Branches
No related tags found
No related merge requests found
...@@ -208,11 +208,17 @@ public: ...@@ -208,11 +208,17 @@ public:
// In case of image, unwrap the vector. // In case of image, unwrap the vector.
assert(value.dim_x != 0); assert(value.dim_x != 0);
assert(value.dim_x * value.dim_y <= value.size());
std::stringstream result; std::stringstream result;
result << "{"; result << "{";
for(std::size_t i = 0; i != value.size() % value.dim_x; ++i) for(std::size_t i = 0; i != value.dim_y; ++i)
{ {
if (i > 0)
{
result << ",";
}
result << "{" << separated_list(",", std::next(value.begin(), i * value.dim_x), std::next(value.begin(), (i+1) * value.dim_x)) << "}"; result << "{" << separated_list(",", std::next(value.begin(), i * value.dim_x), std::next(value.begin(), (i+1) * value.dim_x)) << "}";
} }
result << "}"; result << "}";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment