Re: [gnome-db] Re: GRAND MASTER PLAN

A simple example, in C++ this time.

Let us say we have a C++ object:

class MeinBlau {
		char * get_blaupunkt (void);
		void set_blaupunkt (char *);
		double blaupunkt;

Let us say we have a "Grand Master DB Interface". I want to prostrate myself before the Grand Master and say:

"Oh grand master, in your infinite wisdom, there is an SQL database
somewhere, and it has a table with a record with UUID=123.  Please
copy that SQL database record into my object MeinBlau."

I want to do the above with one subroutine call:
grand_master_copy_from_sql (MeinBlau *myobj, char *Use_the_sql_driver);

There is an assumption that at some earlier time, I made declarative
statements that explained which sql table fields get hooked up
to get_/set_blaupunkt.

I want to go on:

"Oh grand master, in your infinite wisdom, I know that there is
another SQL user out there who is editing and modfying this database.
Please always make sure that my object is kept in sync with that
database.  Please provide me with an event or a callback or means
of polling such changes made by others."

"Oh, and by the way, when I change *my* instance of this object,
please notify these distant, remote, other users on the other side of the planet that my copy now contains the most recent data, and please put that data back into the sql db for me."

Now, because the grand master has the buddha-nature,  it can satisfy
these requests if I substitute the words "gtk widget" for "sql database"
in the above prostrations.  Or the words "abiword document". The
word "sql" simply helps identify the data source.

Now in fact, I have many instances of class MeinBlau, and I need to
perform a set of operations on it.  I want to be able to say:

"Oh grand master, I have many pointers to many instances of MienBlau in my bag, but I am blind and cannot find the ones I need. Can you
help me find those with blau>2.5 ? Oh, and grandmaster, I know that
not all such instances are in my bag. Some are very far away, in a remote database. So can you please search over those too, and hand me pointers to those as well? (oh yeah, and keep them in sync too)"

I knew there was majic involved.

But you can make it more complex.

grand_master_copy_from_sql (&someobj, "select ae,aa.e from ae,aa where ae.c>'3' and ae.b=aa.b");

and then for extra trickness
grand_master_copy_from_myotherobj (&myobj, another_unrelatedobj);
So you can make MeinPad's from MeinBlau's.

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