Re: libgdamm select returns only NULL values



On Mon, 2007-10-29 at 14:49 +0000, Alex Biddle wrote:
> > 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

Would you like to take the investigation one step further? You could try
doing this with the C API, which isn't too difficult. Then we could be
sure that it's not in the C++ binding, and we could get the libgda
maintainer to fix it (he generally does).

-- 
murrayc murrayc com
www.murrayc.com
www.openismus.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]