Boost logo

Boost :

From: Martin Adrian (adrianm_at_[hidden])
Date: 2006-12-06 03:17:56


Some comments:

1. Can you please make soci work with something else than the "C" locale.

Currently the Session use the global locale for streaming values which will not
work since most (all?) locales use a thousand separator which is not allowed in
SQL.

For me
sql << "insert into soci_test (id) values (" << 1234 << ")";

becomes
"insert into soci_test (id) values (1 234)"

I see two ways of solving it:
a. Let the backend assign the locale required for sql-statements.
This is the best solution since the backend can query the database to find out
decimal separator and date format.

b. Add an .imbue member to the session object.

----
2. I find the "into" handling a bit inconvenient in its current shape:
a. I have to create an indicator variable for each parameter.
eIndicator inda, indb, indc, ...;
sql << "select a,b,c,d... FROM tbl", into(vara, inda), into(varb, indb)...
if (inda == eNull) vara = "";
if (indb == eNull) varb = -1;
why not have a "intonull" expression that take a second nullValue argument:
sql << "select a,b,c,d... from tbl", intonull(vara, ""), intonull(varb, -1)...
2. Don't understand why "NoData" is part of the indicator. Shouldn't it be part
of the statement?
something like:
sql << "select x from tbl", into(a);
if (!sql.empty())
  // something was fetched
or
sql << "update tbl set x = 2 where y = 3";
if (sql.rowsaffected() == 0)
  // not found

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk