IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 17, 2009, 12:08:50 PM (17 years ago)
Author:
beaumont
Message:

merged with head

Location:
branches/cnb_branches/cnb_branch_20090301
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/cnb_branches/cnb_branch_20090301

  • branches/cnb_branches/cnb_branch_20090301/ippTools/src/pxadmin.c

    r18927 r23352  
    2929
    3030bool createMode(pxConfig *config);
     31bool createMirrorMode(pxConfig *config);
    3132bool deleteMode(pxConfig *config);
    3233static bool runMultipleStatments(pxConfig *config, const char *query);
     
    5354            }
    5455            break;
     56        case PXADMIN_MODE_CREATE_MIRROR:
     57            if (!createMirrorMode(config)) {
     58                goto FAIL;
     59            }
     60            break;
    5561        case PXADMIN_MODE_DELETE:
    5662            if (!deleteMode(config)) {
     
    8692
    8793    psString query = pxDataGet("pxadmin_create_tables.sql");
     94    if (!query) {
     95        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     96        return false;
     97    }
     98
     99    // BEGIN
     100    if (!psDBTransaction(config->dbh)) {
     101        psError(PS_ERR_UNKNOWN, false, "database error");
     102        return false;
     103    }
     104
     105    if (!runMultipleStatments(config, query)) {
     106        if (!psDBRollback(config->dbh)) {
     107                psError(PS_ERR_UNKNOWN, false, "database error");
     108        }
     109        psError(PS_ERR_UNKNOWN, false, "database error");
     110        psFree(query);
     111        return false;
     112    }
     113    psFree(query);
     114
     115    // COMMIT
     116    if (!psDBCommit(config->dbh)) {
     117        psError(PS_ERR_UNKNOWN, false, "database error");
     118        return false;
     119    }
     120
     121    return true;
     122}
     123
     124
     125bool createMirrorMode(pxConfig *config)
     126{
     127    PS_ASSERT_PTR_NON_NULL(config, false);
     128
     129    psString query = pxDataGet("pxadmin_create_mirror_tables.sql");
    88130    if (!query) {
    89131        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
Note: See TracChangeset for help on using the changeset viewer.