Subject RFC: The Server client (about Gateways...)
Author m_theologos
Hi,

[This is rather a draft about how can be achieved a server-to-server
communications with a first concrete application: cross-database
queries.]

We saw in the poll organized by foundation that the inter-database
queries was in a relatively high position in the users preferences.
(Also, I need this feature, but for the time being I simulate it).

You know better than me that the IO with the storage is virtual. Ie.
the engine using an abstract layer (located in VIO AFAIK) gets the
records from different sources: main database file, secondary files,
cache, depending where the requested record is located (or cached).

Also, you know better than me that the Server-client comunication is
also virtual. Ie. the engine can communicate using different
protocols: TCP/IP, XNet (ie. local) aso.

Perhaps, you can do a "personal client" for the server, ie. a normal
client which instead throwing the records in a desktop/web
application will make available these records in a, let's say,
temporary table (or in a more optimized structure) which after this
can be joined, selected etc.

An example:

Let's presume that we are on SERVER-A, using FDB1. Issuing:

CREATE GATEWAY G1 SERVER-B:C:\MyFDBDir\FDB2 USERNAME SYSDBA PASSWORD
'masterkey';

- will log us on that database. The general syntax would be (subiect
to change, of course... ):

CREATE GATEWAY <name> <filespec> [USERNAME <string> PASSWORD <string>]

- if the credentials are not supplied then will be used the current
ones. (perhaps is better to have CREATE GATEWAY to define it,
(DIS)CONNECT TO GATEWAY <name> to (dis)connect to/from it).

So, we are there. After this, issuing:

SELECT T1.Field1, T1.Field2, T1.Field3, T2.FieldA, T2.FieldB
FROM Table1 T1, G1:Table2 T2
WHERE T1.Key1=T2.KeyA;

Will issue internally on the gateway G1, (in the worst case, I don't
take in consideration any optimizations) 'Select KeyA, FieldA, FieldB
From Table2 Order KeyA', bring the records in a temporary table in
our base, and do the join locally.

Of course the Select mecanism can be greatly optimized/improved.

Also, please note that the remote Inserts/Updates are IMHO much
easier to handle, I'm thinking now at Insert..Into.. From Select..
giving to user a very high degree of power/flexibility.

What do you say? It is possible?

Also, if each server has a "personal client" then other things can be
implemented. I thinking now at clustering/inter-server replication
(every data which the main server receives will be rerouted through
his client to other members of the cluster).

HTH,

m. Th.