IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 18, 2009, 10:23:28 AM (17 years ago)
Author:
eugene
Message:

updated vysos branch from trunk

Location:
branches/eam_branches/20090820
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20090820

  • branches/eam_branches/20090820/ippTools/src/pxadmin.c

    r23310 r25870  
    22 * pxadmin.c
    33 *
    4  * Copyright (C) 2006-2008  Joshua Hoblitt
     4 * Copyright (C) 2006-2009  Joshua Hoblitt
    55 *
    66 * This program is free software; you can redistribute it and/or modify it
     
    3131bool createMirrorMode(pxConfig *config);
    3232bool deleteMode(pxConfig *config);
     33static bool insert_dbversion(pxConfig * config, const char *versionString);
    3334static bool runMultipleStatments(pxConfig *config, const char *query);
    3435
     
    113114    psFree(query);
    114115
     116    if (!insert_dbversion(config, PACKAGE_VERSION)) {
     117        psError(PS_ERR_UNKNOWN, false, "failed to set database version");
     118        return false;
     119    }
     120
    115121    // COMMIT
    116122    if (!psDBCommit(config->dbh)) {
     
    148154    }
    149155    psFree(query);
     156
     157    if (!insert_dbversion(config, PACKAGE_VERSION)) {
     158        psError(PS_ERR_UNKNOWN, false, "failed to set database version");
     159        return false;
     160    }
    150161
    151162    // COMMIT
     
    262273    return true;
    263274}
     275
     276#ifdef notdef
     277static bool update_dbversion(pxConfig * config, const char *versionString)
     278{
     279    psString query = pxDataGet("pxadmin_update_version.sql");
     280    if (!query) {
     281        psError(PS_ERR_UNKNOWN, false, "failed to retrieve SQL statement");
     282        psFree(query);
     283        return false;
     284    }
     285    if (!p_psDBRunQueryF(config->dbh, query, versionString)) {
     286        psError(PS_ERR_UNKNOWN, false, "database error");
     287        psFree(query);
     288        return false;
     289    }
     290    return true;
     291}
     292#endif
     293static bool insert_dbversion(pxConfig * config, const char *versionString)
     294{
     295    psString query = "INSERT INTO dbversion VALUES('%s', CURRENT_TIMESTAMP())";
     296    if (!query) {
     297        psError(PS_ERR_UNKNOWN, false, "failed to retrieve SQL statement");
     298        psFree(query);
     299        return false;
     300    }
     301    if (!p_psDBRunQueryF(config->dbh, query, versionString)) {
     302        psError(PS_ERR_UNKNOWN, false, "database error");
     303        psFree(query);
     304        return false;
     305    }
     306    return true;
     307}
Note: See TracChangeset for help on using the changeset viewer.