Changeset 4279 for trunk/psLib/src/dataIO/psDB.c
- Timestamp:
- Jun 15, 2005, 3:48:18 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/dataIO/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
Note:
See TracChangeset
for help on using the changeset viewer.
