local vs. client

Charles Yeomans yeomans at desuetude.com
Thu Mar 23 10:58:33 CST 2006


On Mar 22, 2006, at 11:32 PM, Robert Sneidar wrote:

> Just a quick confirmation, it looks like syntax between local and 
> remote connections is disparate enough that it would be a bad idea to 
> try to develop in local mode and then switch to remote later on. Am I 
> correct in this assumption? That is, if I intend my final product to 
> be a multiuser application, shouldn't I develop using client mode?

You can develop using either; I do.  One advantage is that there are 
bugs in the client-server setup that are not there when using a local 
database.  So it is sometimes useful to be able to use a local database 
to pin down the source of some problems.

The differences in your code can be isolated to two locations.  First 
is initialization and shutdown.  In my applications I have a property 
UseLocalDatabase as Boolean. Then my code looks like the following.

If UseLocalDatabase then
   Valentina.Init 4*1024*1024, MacSN, WindowsSN
Else
   Valentina.InitClient
End if

If UseLocalDatabase then
   Valentina.Shutdown
Else
   Valentina.ShutdownClient
End if

Second is VDatabase creation.  Again, I just test for local v. remote.

dim db as Database
If UseLocalDatabase then
   db = new VDatabase()
Else
   db = new VDatabase("192.168.0.128", userName, password)
End if

There are a couple of things to watch out for.  First, a local database 
is a lot faster.  You should be careful to write for the speed of the 
client-server version.  Second is that you must be more careful to 
specify parameters when calling VDatabase.SQLSelect.  Third, there is a 
lot more to go wrong with remote connections, so you have to write code 
that does not assume that the connection exists.

--------------
Charles Yeomans



More information about the Valentina mailing list