IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4262 for trunk/psLib/src/db


Ignore:
Timestamp:
Jun 14, 2005, 3:47:30 PM (21 years ago)
Author:
evanalst
Message:

Update psDBChange to handle invalid arguments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/db/psDB.c

    r4256 r4262  
    1212 *  @author Joshua Hoblitt
    1313 *
    14  *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2005-06-15 01:01:08 $
     14 *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2005-06-15 01:47:30 $
    1616 *
    1717 *  Copyright 2005 Joshua Hoblitt, University of Hawaii
     
    159159bool psDBChange(psDB *dbh, const char *dbname)
    160160{
     161    // Verify database object is valid
     162    if(dbh == NULL) {
     163        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
     164                PS_ERRORTEXT_psDB_INVALID_PSDB);
     165        return false;
     166    }
     167
     168    // Attempt to select new database
    161169    if (mysql_select_db(dbh->mysql, dbname) != 0) {
    162         psError(PS_ERR_UNKNOWN, true, "Failed to change database.  Error: %s", mysql_error(dbh->mysql));
     170        psError(PS_ERR_UNKNOWN, true, PS_ERRORTEXT_psDB_FAILED_TO_CHANGE,
     171                mysql_error(dbh->mysql));
    163172
    164173        return false;
Note: See TracChangeset for help on using the changeset viewer.