Discussion:
[soci-users] Indicators, nulls and soci::rowset<soci::row>
Rodrigo Madera
2013-09-03 15:33:59 UTC
Permalink
Hello all,

I'm having the problem discussed in [1]. Actually, I've ran into this
problem a few times in the past and now, after some years, I come here to
ask:

Does SOCI already support rowset<row> with some values being null?

I wish to do stupid things (don't ask) like: SELECT * FROM SOMETABLE, and
dynamically display values, nulls (when null), and.. well, use the data.

Thanks for any pointers,
Rodrigo

[1]
http://soci.6940.n7.nabble.com/SOCI-users-Problem-with-rowset-td1029.html
Rodrigo Madera
2013-09-03 16:20:42 UTC
Permalink
Never mind...

I started playing with the internals and debugging for fun, and I saw
a (undocumented?) method that gives me just what I need:

...
for (auto itr = rowset.begin(); itr != rowset.end(); ++itr) {
const soci::row& row = *itr;

for (size_t i=0; i<row.size(); ++i) {
const soci::column_properties& properties =
row.get_properties(i);
const auto& indicator = row.get_indicator(i);
...

If this were documented, it could help others! Maybe if the
documentation were a Wiki?

Well... Thanks anyway for such a nice lib!

Regards,
Rodrigo


On Tue, Sep 3, 2013 at 12:33 PM, Rodrigo Madera
Post by Rodrigo Madera
Hello all,
I'm having the problem discussed in [1]. Actually, I've ran into this
problem a few times in the past and now, after some years, I come here to
Does SOCI already support rowset<row> with some values being null?
I wish to do stupid things (don't ask) like: SELECT * FROM SOMETABLE, and
dynamically display values, nulls (when null), and.. well, use the data.
Thanks for any pointers,
Rodrigo
[1]
http://soci.6940.n7.nabble.com/SOCI-users-Problem-with-rowset-td1029.html
Ricardo Fabiano de Andrade
2013-09-03 16:29:16 UTC
Permalink
Hi,

You can find an explanation about this functionality right here:
http://soci.sourceforge.net/doc/3.2/exchange.html#dynamic

Regards,
Ricardo
Post by Rodrigo Madera
Never mind...
I started playing with the internals and debugging for fun, and I saw
...
for (auto itr = rowset.begin(); itr != rowset.end(); ++itr) {
const soci::row& row = *itr;
for (size_t i=0; i<row.size(); ++i) {
const soci::column_properties& properties =
row.get_properties(i);
const auto& indicator = row.get_indicator(i);
...
If this were documented, it could help others! Maybe if the
documentation were a Wiki?
Well... Thanks anyway for such a nice lib!
Regards,
Rodrigo
On Tue, Sep 3, 2013 at 12:33 PM, Rodrigo Madera
Post by Rodrigo Madera
Hello all,
I'm having the problem discussed in [1]. Actually, I've ran into this
problem a few times in the past and now, after some years, I come here to
Does SOCI already support rowset<row> with some values being null?
I wish to do stupid things (don't ask) like: SELECT * FROM SOMETABLE, and
dynamically display values, nulls (when null), and.. well, use the data.
Thanks for any pointers,
Rodrigo
[1]
http://soci.6940.n7.nabble.com/SOCI-users-Problem-with-rowset-td1029.html
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
soci-users mailing list
https://lists.sourceforge.net/lists/listinfo/soci-users
Rodrigo Madera
2013-09-03 16:32:19 UTC
Permalink
No you can't, Ricardo.

In that example there is no mention of indicators for dynamic binding.

Please read my whole message, paisano.

Rodrigo

On Tue, Sep 3, 2013 at 1:29 PM, Ricardo Fabiano de Andrade
Post by Ricardo Fabiano de Andrade
Hi,
http://soci.sourceforge.net/doc/3.2/exchange.html#dynamic
Regards,
Ricardo
Post by Rodrigo Madera
Never mind...
I started playing with the internals and debugging for fun, and I saw
...
for (auto itr = rowset.begin(); itr != rowset.end(); ++itr) {
const soci::row& row = *itr;
for (size_t i=0; i<row.size(); ++i) {
const soci::column_properties& properties =
row.get_properties(i);
const auto& indicator = row.get_indicator(i);
...
If this were documented, it could help others! Maybe if the
documentation were a Wiki?
Well... Thanks anyway for such a nice lib!
Regards,
Rodrigo
On Tue, Sep 3, 2013 at 12:33 PM, Rodrigo Madera
Post by Rodrigo Madera
Hello all,
I'm having the problem discussed in [1]. Actually, I've ran into this
problem a few times in the past and now, after some years, I come here to
Does SOCI already support rowset<row> with some values being null?
I wish to do stupid things (don't ask) like: SELECT * FROM SOMETABLE, and
dynamically display values, nulls (when null), and.. well, use the data.
Thanks for any pointers,
Rodrigo
[1]
http://soci.6940.n7.nabble.com/SOCI-users-Problem-with-rowset-td1029.html
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
soci-users mailing list
https://lists.sourceforge.net/lists/listinfo/soci-users
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
soci-users mailing list
https://lists.sourceforge.net/lists/listinfo/soci-users
Mateusz Loskot
2013-09-03 16:50:00 UTC
Permalink
Post by Rodrigo Madera
Never mind...
I started playing with the internals and debugging for fun, and I saw
...
for (auto itr = rowset.begin(); itr != rowset.end(); ++itr) {
const soci::row& row = *itr;
for (size_t i=0; i<row.size(); ++i) {
const soci::column_properties& properties =
row.get_properties(i);
const auto& indicator = row.get_indicator(i);
...
If this were documented, it could help others!
Rodrigo,

This method is implemented in the API reference:
http://soci.sourceforge.net/doc/3.2/reference.html

I agree, it could have been more visible and actually used in the examples.
Post by Rodrigo Madera
Maybe if the documentation were a Wiki?
Please, feel encouraged to submit pull requests with patches
improving the documentation or simply report issue if anything is unclear
https://github.com/soci/soci

There is also Wiki at https://github.com/soci/soci/wiki
However, I'm personally not fan of Wiki-based documentation.
IMHO, Git-based patches are better as they are easier to maintain history
of docs and keep them consistent with versioned/current codebase.

But, feel free to use Wiki to incubate some examples, extend the FAQ,
use it as SOCI scratchpad, etc.
Later, such Wiki-based examples may become part of docs.

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
"Participation in this whole process is a form of torture" ~~ Szalony
Mateusz Loskot
2013-09-03 22:41:44 UTC
Permalink
Post by Mateusz Loskot
Post by Rodrigo Madera
I started playing with the internals and debugging for fun, and I saw
...
for (auto itr = rowset.begin(); itr != rowset.end(); ++itr) {
const soci::row& row = *itr;
for (size_t i=0; i<row.size(); ++i) {
const soci::column_properties& properties =
row.get_properties(i);
const auto& indicator = row.get_indicator(i);
...
If this were documented, it could help others!
Rodrigo,
http://soci.sourceforge.net/doc/3.2/reference.html
I agree, it could have been more visible and actually used in the examples.
Test case as an example + a tiny update in docs
https://github.com/SOCI/soci/commit/d9808ee5bf758f707a5b99c417871c5390d15b1b

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
"Participation in this whole process is a form of torture" ~~ Szalony
Loading...