Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 38 total
Thread Making a Single-User Application Location Independent
Mon, May 21 2007 9:56 PMPermanent Link

"Alan Questell"
Although I'm doing this, the application still tries to access the data
subdirectory in the development directory when I move the EXE to another
location:

procedure Tdm.BBRollsEngineBeforeStart(Sender: TObject);
begin
 with BBRollsEngine do begin
   ConfigPath := ExtractFilePath(Application.ExeName)+'\Data\';
   TempTablesPath := GetTempTablesPath;
 end;
end;

procedure Tdm.DataModuleCreate(Sender: TObject);
begin
 BBRollsEngine.Active := True;
 BBRollsSession.Connected := True;
 db.Connected := True;
 qryMaster.Active := True;
 qryDetail.Active := True;
end;

Can someone post an example of how to make an application totally
independent of the directory?

TIA

Tue, May 22 2007 1:16 AMPermanent Link

David Puett
"Alan Questell" <alanq@pinehurst.net> wrote:

> Can someone post an example of how to make an application totally
> independent of the directory?

I use this with DBISAM4  (Keep in mind this could be the worst code ever written)

procedure TDM.DataModuleCreate(Sender: TObject);
begin
 DM.SecTrakkDB.Connected := False;
 DM.SecTrakkDB.Directory := '';
 DM.DBISAMSession1.RemoteAddress := '';
 CloseAllTables;
 end;

and the CloseAllTables procedure is

Procedure TDM.CloseAllTables;
var
 x : Integer;
begin
 with DM do
 begin
   for x := 0 to ComponentCount -1 do
   begin
     if Components[x] is TDBISAMTable then
     begin
     TwwDBISAMTable(Components[x]).Close;
     TwwDBISAMQuery(Components[x]).Close;
     end;
   end;
 end;
end;
Tue, May 22 2007 3:06 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Alan


What you need to do as well as setting the configpath is to create the new database. Remember the database does not use a relative path and just moving the tables isn't enough (I think - like the rest of us I'm still learning).

The best example we have so far is Tim's CDCollector - check it out.

Roy Lambert
Tue, May 22 2007 3:25 AMPermanent Link

Michael
Also check this link:

<a href="HERE" name="http://www.elevatesoft.com/scripts/newsgrp.dll?action=searchopenmsg&group=16&msg=1724&keywords=Data*%20path*%20code*#msg1724">HERE">http://www.elevatesoft.com/scripts/newsgrp.dll?action=searchopenmsg&group=16&msg=1724&keywords=Data*%20path*%20code*#msg1724">HERE</a>
Tue, May 22 2007 8:03 AMPermanent Link

Alan Questell
I'm using ElevateDB, so it's a different issue.

David Puett <dpuett@mac.com> wrote:

"Alan Questell" <alanq@pinehurst.net> wrote:

> Can someone post an example of how to make an application totally
> independent of the directory?

I use this with DBISAM4  (Keep in mind this could be the worst code ever written)

procedure TDM.DataModuleCreate(Sender: TObject);
begin
 DM.SecTrakkDB.Connected := False;
 DM.SecTrakkDB.Directory := '';
 DM.DBISAMSession1.RemoteAddress := '';
 CloseAllTables;
 end;

and the CloseAllTables procedure is

Procedure TDM.CloseAllTables;
var
 x : Integer;
begin
 with DM do
 begin
   for x := 0 to ComponentCount -1 do
   begin
     if Components[x] is TDBISAMTable then
     begin
     TwwDBISAMTable(Components[x]).Close;
     TwwDBISAMQuery(Components[x]).Close;
     end;
   end;
 end;
end;
Tue, May 22 2007 8:11 AMPermanent Link

Alan Questell
I'd seen where he recreated the database but I thought he was just making sure that they existed, but I was hoping that you could just install with
empty tables and get the path at runtime as we did with DBISAM.

What's the advantage of this mechanism?

There's one big disadvantage; you can't just take an application on a jump drive, stick it in any computer, and run it. Unless by chance, it's assigned
the same drive letter as the development machine.

In that case, what happens if the tables are there and I try to recreate them? And why should I need to recreate them if they're already there?


Roy Lambert <roy.lambert@skynet.co.uk> wrote:
What you need to do as well as setting the configpath is to create the new database. Remember the database does not use a relative path and just
moving the tables isn't enough (I think - like the rest of us I'm still learning).

The best example we have so far is Tim's CDCollector - check it out.

Roy Lambert
Tue, May 22 2007 8:52 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Alan

>I'd seen where he recreated the database but I thought he was just making sure that they existed, but I was hoping that you could just install with
>empty tables and get the path at runtime as we did with DBISAM.

The tables may be there but ElevateDB has to be told the database exists. Think of this as setting the path.

>What's the advantage of this mechanism?

Beats me SmileyI think Tim explained it once but it went in one ear, out the other and left little trace of itself in my head.

>There's one big disadvantage; you can't just take an application on a jump drive, stick it in any computer, and run it. Unless by chance, it's assigned
>the same drive letter as the development machine.

Isn't that the same for DBSIAM. The one big difference I can see is you HAVE to have somewhere to write the config files.

>In that case, what happens if the tables are there and I try to recreate them?

You'll get an error

>And why should I need to recreate them if they're already there?

You don't, only the database. ElevateDB will then read the catalog and figure out what tables should be there.

Roy Lambert

Tue, May 22 2007 10:12 AMPermanent Link

"Alan Questell"
Link doesn't work.

"Michael" <michael83815@roadrunner.com> wrote in message
news:EE856B99-1418-4B47-942D-C8736DF37EBC@news.elevatesoft.com...
> Also check this link:
>
> <a
> href="HERE" name="http://www.elevatesoft.com/scripts/newsgrp.dll?action=searchopenmsg&group=16&msg=1724&keywords=Data*%20path*%20code*#msg1724">HERE">http://www.elevatesoft.com/scripts/newsgrp.dll?action=searchopenmsg&group=16&msg=1724&keywords=Data*%20path*%20code*#msg1724">HERE</a>
>

Tue, May 22 2007 10:17 AMPermanent Link

"Alan Questell"

"Roy Lambert" <roy.lambert@skynet.co.uk> wrote in message
news:3DCAFDC4-ADED-43BD-868E-954F2492970D@news.elevatesoft.com...

In DBISAM, you could just get the application's path and then set the path
to the database and connect. It didn't matter what drive it was on.

>>And why should I need to recreate them if they're already there?

> You don't, only the database. ElevateDB will then read the catalog and
> figure out what tables should be there.

Okay, that kind of makes sense; let me play around with that.

Tue, May 22 2007 10:33 AMPermanent Link

Michael
Sorry just paste this in to your browser:

http://www.elevatesoft.com/scripts/newsgrp.dll?action=searchopenmsg&group=16&msg=1724&keywords=Data*%20path*%20code*#msg1724

"Alan Questell" <alanq@pinehurst.net> wrote:

Link doesn't work.

"Michael" <michael83815@roadrunner.com> wrote in message
news:EE856B99-1418-4B47-942D-C8736DF37EBC@news.elevatesoft.com...
> Also check this link:
>
> <a
> href="HERE" name="http://www.elevatesoft.com/scripts/newsgrp.dll?action=searchopenmsg&group=16&msg=1724&keywords=Data*%20path*%20code*#msg1724">HERE">http://www.elevatesoft.com/scripts/newsgrp.dll?action=searchopenmsg&group=16&msg=1724&keywords=Data*%20path*%20code*#msg1724">HERE</a>
>

Page 1 of 4Next Page »
Jump to Page:  1 2 3 4
Image