Changeset 4279
- Timestamp:
- Jun 15, 2005, 3:48:18 PM (21 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 4 edited
-
dataIO/psDB.c (modified) (5 diffs)
-
dataIO/psFileUtilsErrors.dat (modified) (1 diff)
-
dataIO/psFileUtilsErrors.h (modified) (2 diffs)
-
db/psDB.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/dataIO/psDB.c
r4271 r4279 12 12 * @author Joshua Hoblitt 13 13 * 14 * @version $Revision: 1.2 5$ $Name: not supported by cvs2svn $15 * @date $Date: 2005-06-1 5 19:52:21$14 * @version $Revision: 1.26 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2005-06-16 01:48:18 $ 16 16 * 17 17 * Copyright 2005 Joshua Hoblitt, University of Hawaii … … 255 255 psPtr data; // copy of result field 256 256 257 // Generate SQL query string 257 258 query = psDBGenerateSelectRowSQL(tableName, col, NULL, limit); 258 259 if (!query) { 259 psError(PS_ERR_UNEXPECTED_NULL, false, "Query generation failed.");260 psError(PS_ERR_UNEXPECTED_NULL, false, PS_ERRORTEXT_psDB_QUERY_GEN_FAIL); 260 261 return NULL; 261 262 } 262 263 264 // Execut SQL query string 263 265 if (!p_psDBRunQuery(dbh, query)) { 264 psError(PS_ERR_UNKNOWN, false, "Query execution failed.");266 psError(PS_ERR_UNKNOWN, false, PS_ERRORTEXT_psDB_SEL_COL_FAIL); 265 267 psFree(query); 266 268 return NULL; 267 269 } 268 269 270 psFree(query); 270 271 272 // Obtain query result and check for no data condition 271 273 result = mysql_store_result(dbh->mysql); 274 272 275 if (!result) { 273 276 // no result set … … 277 280 // then something bad has happened. 278 281 if (fieldCount != 0) { 279 psError(PS_ERR_UNEXPECTED_NULL, true, "Query returned no data. Error: %s", mysql_error(dbh->mysql)); 282 psError(PS_ERR_UNEXPECTED_NULL, true, PS_ERRORTEXT_psDB_QUERY_NO_DATA, 283 mysql_error(dbh->mysql)); 280 284 return NULL; 281 285 } 282 286 } 283 287 288 // Get number of rows returned in result 284 289 rowCount = mysql_num_rows(result); 285 290 … … 290 295 column->n = 0; 291 296 297 // Fetch each result 292 298 while ((row = mysql_fetch_row(result))) { 293 299 // get the first element of lengths array that is part of the … … 309 315 } 310 316 317 // Clean up mysql memory 311 318 mysql_free_result(result); 312 319 -
trunk/psLib/src/dataIO/psFileUtilsErrors.dat
r4271 r4279 65 65 psDB_SQL_QUERY_FAIL Failed to execute SQL query. Error: %s 66 66 psDB_TABLE_DROP_FAIL Failed to drop table. 67 psDB_SEL_COL_FAIL Failed to select column. 68 psDB_QUERY_NO_DATA Query returned no data. Error: %s 67 69 # 68 70 -
trunk/psLib/src/dataIO/psFileUtilsErrors.h
r4271 r4279 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-06-1 5 19:52:21$9 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-06-16 01:48:18 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 84 84 #define PS_ERRORTEXT_psDB_SQL_QUERY_FAIL "Failed to execute SQL query. Error: %s" 85 85 #define PS_ERRORTEXT_psDB_TABLE_DROP_FAIL "Failed to drop table." 86 #define PS_ERRORTEXT_psDB_SEL_COL_FAIL "Failed to select column." 87 #define PS_ERRORTEXT_psDB_QUERY_NO_DATA "Query returned no data. Error: %s" 86 88 //~End 87 89 -
trunk/psLib/src/db/psDB.c
r4271 r4279 12 12 * @author Joshua Hoblitt 13 13 * 14 * @version $Revision: 1.2 5$ $Name: not supported by cvs2svn $15 * @date $Date: 2005-06-1 5 19:52:21$14 * @version $Revision: 1.26 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2005-06-16 01:48:18 $ 16 16 * 17 17 * Copyright 2005 Joshua Hoblitt, University of Hawaii … … 255 255 psPtr data; // copy of result field 256 256 257 // Generate SQL query string 257 258 query = psDBGenerateSelectRowSQL(tableName, col, NULL, limit); 258 259 if (!query) { 259 psError(PS_ERR_UNEXPECTED_NULL, false, "Query generation failed.");260 psError(PS_ERR_UNEXPECTED_NULL, false, PS_ERRORTEXT_psDB_QUERY_GEN_FAIL); 260 261 return NULL; 261 262 } 262 263 264 // Execut SQL query string 263 265 if (!p_psDBRunQuery(dbh, query)) { 264 psError(PS_ERR_UNKNOWN, false, "Query execution failed.");266 psError(PS_ERR_UNKNOWN, false, PS_ERRORTEXT_psDB_SEL_COL_FAIL); 265 267 psFree(query); 266 268 return NULL; 267 269 } 268 269 270 psFree(query); 270 271 272 // Obtain query result and check for no data condition 271 273 result = mysql_store_result(dbh->mysql); 274 272 275 if (!result) { 273 276 // no result set … … 277 280 // then something bad has happened. 278 281 if (fieldCount != 0) { 279 psError(PS_ERR_UNEXPECTED_NULL, true, "Query returned no data. Error: %s", mysql_error(dbh->mysql)); 282 psError(PS_ERR_UNEXPECTED_NULL, true, PS_ERRORTEXT_psDB_QUERY_NO_DATA, 283 mysql_error(dbh->mysql)); 280 284 return NULL; 281 285 } 282 286 } 283 287 288 // Get number of rows returned in result 284 289 rowCount = mysql_num_rows(result); 285 290 … … 290 295 column->n = 0; 291 296 297 // Fetch each result 292 298 while ((row = mysql_fetch_row(result))) { 293 299 // get the first element of lengths array that is part of the … … 309 315 } 310 316 317 // Clean up mysql memory 311 318 mysql_free_result(result); 312 319
Note:
See TracChangeset
for help on using the changeset viewer.
