Hi
Sorry if this sounds like my previous NaN question, but it's not quite the same...
I want to conditionally insert null values into a table, but I'm getting zeros inserted,
not nulls.
I mistakenly thought I could initialise my variable to your defined mysqlpp::null value
and then set it based on my threshold value.
SSQLS looked like a nice solution until I discovered that I can't have more than 25
columns (feel free to correct me if I'm wrong - which is highly possible!). Many of my
tables have much more than 25 columns.
Here's a piece of code with my simplistic approach...
mysqlpp::Null myfloatfield(mysqlpp::null);
if (condition) myfloatfield = 10.0;
try { Connection conn(false); conn.connect("db", "localhost", "user", "password");
Query query = conn.query();
query << "INSERT INTO test_float " << "VALUES (" << "\""
<< myfloatfield << "\"" << ");";
query.execute();...etc
mysql> select * from test_float;+------+| id |+------+| 0 |
+------+
1 row in set (0.00 sec)
I know I can insert "null" as part of the query, but I need to do this conditionally
without having to construct multiple queries.
Thanks in advance,
Ken
_________________________________________________________________
Beyond Hotmail — see what else you can do with Windows Live.
http://clk.atdmt.com/UKM/go/134665375/direct/01/