Changeset 4256 for trunk/psLib/src/db/psDB.c
- Timestamp:
- Jun 14, 2005, 3:01:08 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/db/psDB.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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.
