libgda++



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.

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.

	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)


cheers




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