🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.multi-tier
Article #1745

Re: Passing complex data structure from server to client

#1745
From: 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
Technical Details
Message-ID: <7krfih$b0e11@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <374981B7.4D9096A1@artisansoftware.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fcd2b,3ab5773be8036822
X-Google-Attributes: gidfcd2b,public
From: "Jonathan McCallister" <cecil@Visual-Med.com>
Subject: Re: Passing complex data structure from server to client
Date: 1999/06/23
Message-ID: <7krfih$b0e11@forums.borland.com>
X-Deja-AN: 493076382
References: <374981B7.4D9096A1@artisansoftware.com>
Organization: Visual Med, Inc.
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
Newsgroups: borland.public.cppbuilder.database.multi-tier