Changeset 41


Ignore:
Timestamp:
10/30/2008 10:45:34 PM (14 years ago)
Author:
marcus
Message:

r26 | stittgen | 2008-02-11 16:00:39 +0100 (Mo, 11 Feb 2008) | 1 line

sfd2db now checks the environment for SFDBREQSCRIPTFILE to determine the command for executing statements in a scriptfile (default is mysql).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • SH_SHM/trunk/source/seed_io/sfd2db.c

    r38 r41  
    33 *      ======== 
    44 * 
    5  * $Revision: 23 $, $Date: 2008-02-05 12:56:20 +0100 (Di, 05 Feb 2008) $ 
     5 * $Revision: 26 $, $Date: 2008-02-11 16:00:39 +0100 (Mo, 11 Feb 2008) $ 
    66 * 
    77 * reads lines from sfdfile and creates commands to insert into sfdb database 
     
    4242        char     abspath[cBcFileLth+1];     /* path to sfdfile */ 
    4343        char     sfdbreq[cBcLineLth+1];     /* request command to sfdb database */ 
     44        char     sfdbreqscriptfile[cBcLineLth+1];       /* request command to sfdb database for executing statements in a scriptfile*/ 
    4445        char     *env;                      /* pointer to environment */ 
    4546        char     shellcmd[cBcLongStrLth+1]; /* shell command */ 
     
    99100                strcpy( sfdbreq, env ); 
    100101        } /*endif*/ 
     102 
     103        env = (char *)getenv( "SFDBREQSCRIPTFILE" ); 
     104        if  (env == NULL)  { 
     105                strcpy( sfdbreqscriptfile, "mysql" ); 
     106        } else { 
     107                if  (strlen(env) > cBcLineLth)  { 
     108                        fprintf( stderr, "%s: SFDBREQSCRIPTFILE too long.  Abort.\n", argv[0] ); 
     109                        return 1; 
     110                } /*endif*/ 
     111                strcpy( sfdbreqscriptfile, env ); 
     112        } /*endif*/ 
     113 
    101114 
    102115        /* temporary file */ 
     
    325338                /*sprintf( shellcmd, "cat %s", tmpfile );*/ 
    326339                /*system( shellcmd );*/ 
    327                 sprintf( shellcmd, "sql sfdb <%s", tmpfile ); 
     340                sprintf( shellcmd, "%s sfdb < %s", sfdbreqscriptfile, tmpfile ); 
    328341                /*printf( "--> executing %s\n", shellcmd );*/ 
    329342                system( shellcmd ); 
Note: See TracChangeset for help on using the changeset viewer.