Page 1 of 1

wxDatabase - A couple of thoughts

Posted: Mon Oct 19, 2015 9:57 am
by iwbnwif
It is good to see the new examples coming along in wxDatabase.

The pity for me is that I use Firebird and that has been dropped since the days of wxDatabaseLayer.

I would quite like to have a go at adding Firebird back in, but I would want to use IBPP rather than directly using the (horrible!) Interbase C API. In effect the wxFirebirdDatabase would be a thinish wrapper around IBPP. Later I might also look at the Firebird 3 OO API.

Of course this would mean including IBPP within the wxDatabase project, are there any thoughts or concerns about this?

Also I appreciate it is a rather big (and possibly wholly unuseful) change, but I was wondering if it might be worth considering using wxAny in the resultset, in fact a resultset could derive from wxVector<wxVector<wxAny> >.

The reason is that I rather like range based for's :wink: and it would then be possible to do something like:

Code: Select all

  wxDatabaseResultSet resultSet;

  pDatabase->RunQueryWithResults ("SELECT * FROM Names;", resultSet);
  
  for (wxDatabaseRow row : resultSet)
  {
    people.push_back ( myPerson (
    	row.Field("ID").As<int>(), // ID
    	row.Field("NAME").As<wxString>(), // name
    	));
  }
I appreciate that there are a number of problems with this approach, but just wanted to throw it out there ...

Re: wxDatabase - A couple of thoughts

Posted: Tue Oct 20, 2015 11:14 am
by evstevemd
Thanks for your kind words.
wxDB comes from DatabaseLayer which was basically written for 2.8 and misses much of the goodies of 3.x
My current task is making sure every supported backend builds fine and is at least usable.
I will appreciate if you log your suggestions for using new data structures as Git issues so that when I start updating them I will not miss that.

I will appreciate more testing of the library and help from community as am not that much expert ;)