Client Server Database Access the xBase Way
Posted: Thu Aug 14, 2008 2:33 am
Hi all
Because I need my application to run reasonably efficiently across a VPN I need to move to a client server architecture. That seemed to mean that I would have to move to an SQL based solution. That should be quite possible but whilst I can use SQL and have done so in the past (but not from xBase) I don't like its fundamental architecture. So I have been trying to think of an alternative. (I also looked into getting fast data connections but the cost here was prohibitive.)
Whilst its early days I am quite excited about the prospect of getting the performance I need in a client server architecture but using xBase both ends. I have started with some socket code and written queries to be run on the server at the request of the client and the results returned. I was concerned about the format in which to transmit the data. My initial thought was to use xml - although that involves quite some overhead both in terms of the volume of data to be transmitted as well as encoding and decoding.
But then I hit upon using a multi level array and using HB_Serialize() to encode in binary form and HB_Deserialize() to decode it. And its working very nicely! Furthermore by returning property name property value pairs in an array (actually a sub array of the return array), given that my classes have actual properties rather than simulated ones I should be able to simply call __ObjSetValueList() to update all single value properties in my calling (client) object. (This last bit has not been tested in my socket programs but is a technique I am already successfully using.)
Currently the server has a QUERY class from which I derive a class for a particular query. This may not be the best architecture. I have to look at whether QUERY should be subclassed into single record type queries and list type queries. Also whether or not particular queries should be sub classes or parameterised objects. Also if a QUERY object should be able to call other queries and incorporate their data in its return.
I don't know if anyone else is interested in pursuing such an approach but if so I'm more than happy to share ideas, code whatever. My code is developed on a Linux platform but should run with little or no change on a Windows platform.
Regards
xProgrammer
Because I need my application to run reasonably efficiently across a VPN I need to move to a client server architecture. That seemed to mean that I would have to move to an SQL based solution. That should be quite possible but whilst I can use SQL and have done so in the past (but not from xBase) I don't like its fundamental architecture. So I have been trying to think of an alternative. (I also looked into getting fast data connections but the cost here was prohibitive.)
Whilst its early days I am quite excited about the prospect of getting the performance I need in a client server architecture but using xBase both ends. I have started with some socket code and written queries to be run on the server at the request of the client and the results returned. I was concerned about the format in which to transmit the data. My initial thought was to use xml - although that involves quite some overhead both in terms of the volume of data to be transmitted as well as encoding and decoding.
But then I hit upon using a multi level array and using HB_Serialize() to encode in binary form and HB_Deserialize() to decode it. And its working very nicely! Furthermore by returning property name property value pairs in an array (actually a sub array of the return array), given that my classes have actual properties rather than simulated ones I should be able to simply call __ObjSetValueList() to update all single value properties in my calling (client) object. (This last bit has not been tested in my socket programs but is a technique I am already successfully using.)
Currently the server has a QUERY class from which I derive a class for a particular query. This may not be the best architecture. I have to look at whether QUERY should be subclassed into single record type queries and list type queries. Also whether or not particular queries should be sub classes or parameterised objects. Also if a QUERY object should be able to call other queries and incorporate their data in its return.
I don't know if anyone else is interested in pursuing such an approach but if so I'm more than happy to share ideas, code whatever. My code is developed on a Linux platform but should run with little or no change on a Windows platform.
Regards
xProgrammer