Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: System Function...script does not move until process ends.

by CountZero (Bishop)
on Apr 06, 2005 at 06:40 UTC ( [id://445196]=note: print w/replies, xml ) Need Help??


in reply to System Function...script does not move until process ends.

Is there a DBI/DBD-module for your database? If so, it is perhaps easier to connect to the database using DBI, extract the data you need and put them into a new database again using DBI.

CountZero

"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

  • Comment on Re: System Function...script does not move until process ends.

Replies are listed 'Best First'.
Re^2: System Function...script does not move until process ends.
by mobiGeek (Beadle) on Apr 06, 2005 at 18:39 UTC
    Though it might "feel" simpler to stick to Perl and use DBI, for the database in question the approach of going out to the system is likely the cleanest, safest and fastest.

    In a nutshell, what he is trying to do is:

    dbinit my_new_db.db dbunload my_old_db <<- this creates a file called "reload.sql" dbisql my_new_db.db read reload.sql
    throw in some error checking (exit codes, file/directory exists, etc...) and you've got a great rebuild/upgrade mechanism.

    I've done exactly this in Perl, Bash/Sh, and .CMD/.BAT.

      I see, but then I don't get it why the use of system seems such a problem.
      1. You initiate a new database,
      2. you stop the old one and unload its data,
      3. you reload the data into the new database.
      Seems pretty sequential to me and no need to go into running forks and such.

      Or am I missing a fine point here?

      CountZero

      "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

        Or am I missing a fine point here?

        According to what OP is trying to do and what mobigeek posted, to unload data from the old database you need to start the database again. The database (ie. dbeng9) and sql tool (ie. dbisql) are separate processes that have to run at the same time, hence it is not sequential.

        This being said, it is also possible to tell dbisql to automatically start the database itself. So while connecting to the database, dbisql will figure out that the database isn't actually running so it will launch it using the information you provide and then connect to it. See the "start" connection parameter in the online documentation.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://445196]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (1)
As of 2024-04-24 13:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found