Re: libgdamm select returns only NULL values
- From: "Alex Biddle" <heuristic gmail com>
- To: "Murray Cumming" <murrayc murrayc com>
- Cc: gtkmm-list gnome org
- Subject: Re: libgdamm select returns only NULL values
- Date: Mon, 29 Oct 2007 14:49:11 +0000
> I have never used dump_as_string(). Do you have more luck when modifying
> one of the examples in the libgdamm tarball?
>
> --
> murrayc murrayc com
> www.murrayc.com
> www.openismus.com
>
Thanks for the reply Murray,
Here's the test code:
[create Sqlite3 database]
sqlite> create table example (
...> id INTEGER PRIMARY KEY,
...> example_col TEXT);
sqlite> insert into example (example_col) values ("Foo");
sqlite> insert into example (example_col) values ("Bar");
sqlite> select * from example;
1|Foo
2|Bar
[main body of code]
Glib::RefPtr<Gnome::Gda::Connection> connection =
client->open_connection_from_string("SQLite",
"DB_NAME=example;DB_DIR=.", " ", " ");
Glib::RefPtr<Gnome::Gda::DataModel> model =
connection->execute_select_command("SELECT * FROM example");
int col_num = model->get_n_columns();
int row_num = model->get_n_rows();
for (int col = 0; col < col_num; col++)
{
for (int row = 0; row < row_num; row++)
{
Gnome::Gda::Value val = model->get_value_at(col, row);
std::cout << val.to_string() << std::endl;
}
}
std::cout << model->dump_as_string() << std::endl;
[everything compiles, execution provides the following:]
NULL
NULL
NULL
NULL
id | example_col
-----+------------
NULL | NULL
NULL | NULL
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]