Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread EDBScript.Database
Mon, Aug 4 2008 12:37 PMPermanent Link

"David Cornelius"
I'm ready to deploy my first EDB application, and my first database
application with replication.  I've got it almost all the way there:
conversion from an old FoxPro for DOS system, backed up and copied to a
remote store on the server, restored to the server, then backed up and
copied to several user "out" stores.

Now, the new users are ready to download and install their local copies
of the database that will replicate with the server.  They don't have
any EDB database on their machine.  They will download an install
program which will put the new application on their computer and
temporarily install a setup program.

This setup program will let them choose a user previously entered from
the server database, then runs a script to create a local and remote
store, copy the prepared database backup from the remote to the local
store, and restore the backup to a new local database.  (Notice the
many similarities to the laptop demo on the Elevate home page??)

Choosing a user from the server database works OK.  Then the remote
database is disconnected.  Here's where my question comes in: I now
need to connect to a local session and run a script which creates a new
local database and restores the backup to it.  Running the script in
EDB Manager works just fine.  Using the EDBScript component requires
connecting to a pre-existing database.  I don't want to connect to the
remote database because I want the script to create the database
locally.  But I cannot clear the database name, or I get an error.

Do I have to create the database separately, using the session
component perhaps?  Is this the one case where a script can be run in
EDB Manager, but not through the EDBScript component?


I'm using Delphi 2006 with EDB 2.01 b3.


Thanks,

--
David Cornelius
CorneliusConcepts.com
Mon, Aug 4 2008 2:28 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

David,

<< Do I have to create the database separately, using the session component
perhaps? >>

Yes, you'll have to create the database using the TEDBSession.Execute
method.  It's a one-off call, and then you can open the database and run
scripts against it.

<< Is this the one case where a script can be run in EDB Manager, but not
through the EDBScript component? >>

No, EDB Manager uses the same VCL components as you do.  If you want to run
a script before a database is created, you can do so by running the script
agains the Configuration database.  The big issue with this type of
scenario, and why we don't do it with the replication example, is that you
can't create a database in a script and also switch to it using the USE
statement.  The reason for this is that the USE statement requires that the
database exist when the script is compiled in order to be able to bind any
procedure or function references using the proper database metadata.

--
Tim Young
Elevate Software
www.elevatesoft.com

Mon, Aug 4 2008 4:55 PMPermanent Link

"David Cornelius"
> Yes, you'll have to create the database using the TEDBSession.Execute
> method.  It's a one-off call, and then you can open the database and run
> scripts against it.

OK--no problem.

> << Is this the one case where a script can be run in EDB Manager, but not
> through the EDBScript component? >>
>
> No, EDB Manager uses the same VCL components as you do.  If you want to
> run a script before a database is created, you can do so by running the
> script agains the Configuration database.  The big issue with this type of
> scenario, and why we don't do it with the replication example, is that you
> can't create a database in a script and also switch to it using the USE
> statement.  The reason for this is that the USE statement requires that
> the database exist when the script is compiled in order to be able to bind
> any procedure or function references using the proper database metadata.

Ah!  That makes sense.  Thanks for the info.  (I supposed I should've looked
at the code for EDB Manager!)

Tomorrow is the "big day" my customer goes live!  I think I have everything
ready now.

--
David Cornelius
CorneliusConcepts.com
Image