Changeset 4256
- Timestamp:
- Jun 14, 2005, 3:01:08 PM (21 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 4 edited
-
dataIO/psDB.c (modified) (4 diffs)
-
dataIO/psFileUtilsErrors.dat (modified) (1 diff)
-
dataIO/psFileUtilsErrors.h (modified) (2 diffs)
-
db/psDB.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/dataIO/psDB.c
r4128 r4256 12 12 * @author Joshua Hoblitt 13 13 * 14 * @version $Revision: 1.2 1$ $Name: not supported by cvs2svn $15 * @date $Date: 2005-06- 07 02:29:44$14 * @version $Revision: 1.22 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2005-06-15 01:01:08 $ 16 16 * 17 17 * Copyright 2005 Joshua Hoblitt, University of Hawaii … … 35 35 #include "psError.h" 36 36 #include "psString.h" 37 37 #include "psFileUtilsErrors.h" 38 38 39 39 typedef struct … … 99 99 } 100 100 101 // Connect to host and mySql server with specified database 101 102 if (!mysql_real_connect(mysql, host, user, passwd, dbname, 0, NULL, 0)) { 102 psError(PS_ERR_UNKNOWN, true, "Failed to connect to database. Error: %s", mysql_error(mysql)); 103 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 104 PS_ERRORTEXT_psDB_FAILED_TO_CONNECT,mysql_error(mysql)); 103 105 104 106 mysql_close(mysql); … … 116 118 void psDBCleanup(psDB *dbh) 117 119 { 118 mysql_close(dbh->mysql); 119 dbh->mysql = NULL; 120 psFree(dbh); 121 122 // ASC WARNING NOTE: the psDBSQLToPTypeTableCleanup cleanup routine 123 // needs to be called first because it refers to 124 // psDBGetPTypeToSQLTable ... 125 psDBSQLToPTypeTableCleanup(); 126 psDBMySQLToSQLTableCleanup(); 127 psDBPTypeToSQLTableCleanup(); 128 psDBPTypeToMySQLTableCleanup(); 120 // Check if argument dbh is NULL 121 if(dbh == NULL) { 122 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 123 PS_ERRORTEXT_psDB_INVALID_PSDB); 124 } else { 125 126 // Attempt to close specified database connection 127 mysql_close(dbh->mysql); 128 dbh->mysql = NULL; 129 psFree(dbh); 130 131 // ASC WARNING NOTE: the psDBSQLToPTypeTableCleanup cleanup routine 132 // needs to be called first because it refers to 133 // psDBGetPTypeToSQLTable ... 134 psDBSQLToPTypeTableCleanup(); 135 psDBMySQLToSQLTableCleanup(); 136 psDBPTypeToSQLTableCleanup(); 137 psDBPTypeToMySQLTableCleanup(); 138 } 129 139 } 130 140 -
trunk/psLib/src/dataIO/psFileUtilsErrors.dat
r3271 r4256 57 57 psFits_FITS_Z_SMALL Current FITS HDU has %d z-planes, but z-plane %d was specified. 58 58 # 59 psDB_INVALID_PSDB Invalid psDB has been specified. 60 psDB_FAILED_TO_CONNECT Failed to connect to database. Error: %s 61 # 62 -
trunk/psLib/src/dataIO/psFileUtilsErrors.h
r4162 r4256 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.1 4$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-06- 08 23:40:45$9 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-06-15 01:01:08 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 76 76 #define PS_ERRORTEXT_psFits_IMAGE_UPDATE_TYPE_MISMATCH "Can not update a %s image given a %s image." 77 77 #define PS_ERRORTEXT_psFits_FITS_Z_SMALL "Current FITS HDU has %d z-planes, but z-plane %d was specified." 78 #define PS_ERRORTEXT_psDB_INVALID_PSDB "Invalid psDB has been specified." 79 #define PS_ERRORTEXT_psDB_FAILED_TO_CONNECT "Failed to connect to database. Error: %s" 78 80 //~End 79 81 -
trunk/psLib/src/db/psDB.c
r4128 r4256 12 12 * @author Joshua Hoblitt 13 13 * 14 * @version $Revision: 1.2 1$ $Name: not supported by cvs2svn $15 * @date $Date: 2005-06- 07 02:29:44$14 * @version $Revision: 1.22 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2005-06-15 01:01:08 $ 16 16 * 17 17 * Copyright 2005 Joshua Hoblitt, University of Hawaii … … 35 35 #include "psError.h" 36 36 #include "psString.h" 37 37 #include "psFileUtilsErrors.h" 38 38 39 39 typedef struct … … 99 99 } 100 100 101 // Connect to host and mySql server with specified database 101 102 if (!mysql_real_connect(mysql, host, user, passwd, dbname, 0, NULL, 0)) { 102 psError(PS_ERR_UNKNOWN, true, "Failed to connect to database. Error: %s", mysql_error(mysql)); 103 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 104 PS_ERRORTEXT_psDB_FAILED_TO_CONNECT,mysql_error(mysql)); 103 105 104 106 mysql_close(mysql); … … 116 118 void psDBCleanup(psDB *dbh) 117 119 { 118 mysql_close(dbh->mysql); 119 dbh->mysql = NULL; 120 psFree(dbh); 121 122 // ASC WARNING NOTE: the psDBSQLToPTypeTableCleanup cleanup routine 123 // needs to be called first because it refers to 124 // psDBGetPTypeToSQLTable ... 125 psDBSQLToPTypeTableCleanup(); 126 psDBMySQLToSQLTableCleanup(); 127 psDBPTypeToSQLTableCleanup(); 128 psDBPTypeToMySQLTableCleanup(); 120 // Check if argument dbh is NULL 121 if(dbh == NULL) { 122 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 123 PS_ERRORTEXT_psDB_INVALID_PSDB); 124 } else { 125 126 // Attempt to close specified database connection 127 mysql_close(dbh->mysql); 128 dbh->mysql = NULL; 129 psFree(dbh); 130 131 // ASC WARNING NOTE: the psDBSQLToPTypeTableCleanup cleanup routine 132 // needs to be called first because it refers to 133 // psDBGetPTypeToSQLTable ... 134 psDBSQLToPTypeTableCleanup(); 135 psDBMySQLToSQLTableCleanup(); 136 psDBPTypeToSQLTableCleanup(); 137 psDBPTypeToMySQLTableCleanup(); 138 } 129 139 } 130 140
Note:
See TracChangeset
for help on using the changeset viewer.
