🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.database.multi-tier
2 messages
2 total messages Started by Steve Pietrykoski Mon, 24 May 1999 00:00
Passing complex data structure from server to client
#1713
Author: Steve Pietrykoski
Date: Mon, 24 May 1999 00:00
15 lines
1328 bytes
Hello all,

I have a tree structure that I am building on a server, based on a
database table.  I don't want to build this tree on each client from the
database table directly, because this could be time consuming.  I want
to pass part (or all) of this tree from the server to a client, but I am
not sure how to do this.  One idea is to add to the server interface
(which I can do) so that the client can initiate a process on the server
which will use a remote event to keep passing tree nodes back to the
client until all have been passed.  Unfortunately, I can't find any
information on remote events.  If you have any suggestions on another
approach, or can point me in the direction of how to use remote events,
I would be very grateful.

Steve Pietrykoski
Re: Passing complex data structure from server to client
#1745
Author: Jonathan McCallister
Date: Wed, 23 Jun 1999 00:00
72 lines
2925 bytes
Steve Pietrykoski <steve@artisansoftware.com> wrote in message
news:374981B7.4D9096A1@artisansoftware.com...
> Hello all,
>
> I have a tree structure that I am building on a server, based on a
> database table.  I don't want to build this tree on each client from the
> database table directly, because this could be time consuming.  I want
> to pass part (or all) of this tree from the server to a client, but I am
> not sure how to do this.  One idea is to add to the server interface
> (which I can do) so that the client can initiate a process on the server
> which will use a remote event to keep passing tree nodes back to the
> client until all have been passed.  Unfortunately, I can't find any
> information on remote events.  If you have any suggestions on another
> approach, or can point me in the direction of how to use remote events,
> I would be very grateful.
>
> Steve Pietrykoski

If you are trying to get an entire TTreeView configuration sent over from
server to client here is what you can do:

Add a function to your midas server application TLB that has a Variant
output parameter.

Build your TTreeView on the server and when you're done, call
TTreeView->SaveToFile("somefile.dat")

Now make a TStringList and load the somefile.dat into it.

Turn the TStringList into a Variant Array and return:

STDMETHODIMP TMyModImpl::GetTreeView(TVariant *Value)
{
 /* Make TStringlist and load somefile.dat into it */

 Variant v;
 v = VarArrayFromStrings(TStringList);

 *Value = VARIANT(v);
}

On the client side, make a TStringList and do:

void TMyForm::SomeFunction()
{
 Variant MyVariant;
 TStringList *MyStringList = new TStringList;

 MyVariant = Socket->AppServer.Exec(Function("GetTreeView"));

 if ( MyVariant.IsArray() )
 {
  for(int i=0; i < MyVariant.ArrayHighBound()+1, i++)
   MyStringList->Add(MyVariant.GetElement(i));
 }

 /* Call TStringList->SaveToFile("somefile.dat")

 Finally call TTreeView->LoadFromFile("somefile.dat") and viola. */
}


We're just starting out with Midas so forgive me if this does not work for
you :-)  We are also using a TTreeView in our application and we are simply
sending the actual files made from calling TTreeView->SaveToFile() back and
forth (we don't need to generate the view from reading a database).


Jonathan McCallister
Chief Programmer
Visual Med
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads