Re: libgda++
- From: Chris Wiegand <cdwiegand home com>
- To: gnome-db-list gnome org
- Subject: Re: libgda++
- Date: Sat, 28 Oct 2000 22:09:34 -0600
*PLEASE* replace the C++ bindings. Originally I thought that I knew enough
C++ to make decent wrappers, however, I haven't had the time or knowledge
to really make them good enough.
Sadly, I have recently gotten a new job, which has taken most of my time
the past 2 months. Although I would like to continue maintaining the MySQL
provider, and I plan to go back through that code to re-acquaint myself
with it, I simply don't have the know-how or time to really do a good C++
implementation - although I *am* willing to help write test code for one.
At 02:57 AM 10/23/00, rodrigo linuxave net wrote:
Laurent Marzullo wrote:
> Hello all,
>
> I've take a look at libgda c++ bindings and I've some comments:
> I don't know what is your plan for this library, so sorry if
> my comment already met some of your current work :-). If your not
> really working on it for now, I propose to do all the stuff that
> I write here myself.
> I've currently only look at gdaConnection.
>
C++ bindings seem to be abandoned, since there's been some time since last
time I had
news from Chris Wiegand, its author.
So, as I don't know too much about those C++ things, and if there are no
objections from
other people on the list, go on with it.
>
> 1) Using namespace.
> At least 1 namespace must be used, say GDA to hold all class
> from the three library (gda-common, gda-client, gda-server).
>
> Say just one for now, gda-client.
>
> ------------------------------------------------------------
> namespace GDA
> {
> namespace Client
> {
> class Connection;
> class Providers;
> ...
> }
> }
>
> 2) Using C++ features:
> I speak about GList* for gdaConnection::listProviders,
> gdaConnection::listDataSources, etc.
>
> Perhaps, it will be more in the c++ way to do :
>
> class Providers
> {
> public:
> class
providers_iterator : iterator_traits< ... >
> {
> operator ++;
> operator *;
> // etc ...
> };
>
> public
> providers_iterator begin();
> providers_iterator end();
> ....
> };
>
> same for DataSources.
>
> In this way, all algorithm define in the libstdc++-vx will be
ok for
> Providers. (I speak about find, copy, sort, etc...)
>
> 3) Connection.
> As I don't really like dynamic allocation, I thought of an object
> connection like this:
>
> namespace GDA
> {
> namespace Client
> {
> class
Connection : public Gda_Connection
> {
> public:
> Connection( CORBA_ORB );
> };
> }
> }
>
> In this way a structure of Gda_Connection will be in class
Connection.
> So I think of a function of the kind :
>
> // I saw that gda_connection_init alread exist ...
> void gda_connection_init( Gda_Connection* , CORBA_ORB );
>
> Wich will do exactly the same as gda_connection_new without
allocating
> memory.
>
well, here you've got a problem. Firstly, gda_connection_init is private in
gda-connection.c, because it should not be called outside of it. And
second, you really
need to call gda_connection_new, because Gda_Connection is a GtkObject, so
you really
need to do so to initialize GTK signals etc. So, I think you'll really need a
Gda_Connection *cnc member in your Connection class.
Other solution for not doing it this way would be to make your own GTK
object based on
Gda_Connection, but I guess you'll have to do something similar as I said
before, so I
don't think it's worthy
>
> and then, the constructor will be:
>
> GDA::Client::Connector::Connector( CORBA_ORB p_orb )
> {
> gda_connection_init( this , p_orb );
> }
>
> And then you will use it like :
> --------------------------------
> CORBA_ORB l_orb;
> CORBA_Environment l_env;
>
> CORBA_exception_init( &l_env );
> orb = gnome_CORBA_init( .... );
> CORBA_exception_free( &l_env );
>
> GDA::Client::Connection l_conn( orb );
> l_conn.Open( dbname , username , password );
>
> // And then for a record set :
> GDA::Client::RecordSet l_rs( l_conn );
>
> GDA::Client::RecordSet::recordset_iterator itr;
>
> // print them on cout or on any other container (perhaps
> // any GRID widget ... )
> copy( l_rs.begin( "SELECT * FROM testtable" ) , l_rs.end() ,
> ostream_iterator<string>( cout , "\n" );
>
> What do you think of this ? (I repeat, I could do it or help
doing it)
>
please do it! As I said, C++ bindings are unmaintained.
cheers
_______________________________________________
gnome-db-list mailing list
gnome-db-list gnome org
http://mail.gnome.org/mailman/listinfo/gnome-db-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]