Changeset 8627 for trunk/psLib/src/db/psDB.c
- Timestamp:
- Aug 25, 2006, 6:34:28 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/db/psDB.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/db/psDB.c
r8610 r8627 12 12 * @author Joshua Hoblitt 13 13 * 14 * @version $Revision: 1.8 7$ $Name: not supported by cvs2svn $15 * @date $Date: 2006-08-26 0 0:32:39$14 * @version $Revision: 1.88 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2006-08-26 04:34:28 $ 16 16 * 17 17 * Copyright (C) 2005-2006 Joshua Hoblitt, University of Hawaii … … 157 157 if (!psDBExplicitTrans(dbh, false)) { 158 158 psError(PS_ERR_UNKNOWN, true, 159 "failed to set transaction type ", mysql_error(mysql));159 "failed to set transaction type. Error: %s", mysql_error(mysql)); 160 160 161 161 mysql_close(mysql); … … 1103 1103 // convert NaNs to NULL and set the buffer_length for strings 1104 1104 1105 if ( (char *)item->data.V) {1105 if (item->data.str) { 1106 1106 // will handle the case of "" as a NULL database value 1107 bind[i].buffer_length = (unsigned long)strlen( (char *)item->data.V);1107 bind[i].buffer_length = (unsigned long)strlen(item->data.str); 1108 1108 bind[i].length = &bind[i].buffer_length; 1109 1109 bind[i].buffer = psStringCopy(item->data.V); 1110 bind[i].is_null = * (char *)item->data.V== '\0'1110 bind[i].is_null = *item->data.str == '\0' 1111 1111 ? (my_bool *)&isNull 1112 1112 : NULL; … … 1124 1124 // make a copy of the psTime so we don't modify user data when we 1125 1125 // try to do the conversion 1126 if ( (char *)item->data.V) {1126 if (item->data.str) { 1127 1127 psTime *time = (psTime *)item->data.V; 1128 1128 struct tm *tmTime = psTimeToTM(time); … … 1252 1252 } else if (item->type == PS_DATA_STRING) { 1253 1253 // + column name + _ + varchar( + length + ) 1254 psStringAppend(&query, "%s VARCHAR(%s)", item->name, (char *)item->data.V);1254 psStringAppend(&query, "%s VARCHAR(%s)", item->name, item->data.str); 1255 1255 } else { 1256 1256 psError(PS_ERR_BAD_PARAMETER_TYPE, true, … … 1634 1634 // + column name + _ + like + _ + ' + value + ' 1635 1635 // check for NULL and empty ("") strings 1636 if (item->data.V == NULL || * (char *)item->data.V== '\0') {1636 if (item->data.V == NULL || *item->data.str == '\0') { 1637 1637 psStringAppend(&query, "%s IS NULL", item->name); 1638 1638 } else { … … 1642 1642 // very large TEXT columns that really shouldn't be 1643 1643 // used in a where clause... 1644 psStringAppend(&query, "%s LIKE '%s'", item->name, (char *)item->data.V);1644 psStringAppend(&query, "%s LIKE '%s'", item->name, item->data.str); 1645 1645 } else { 1646 psStringAppend(&query, "%s = '%s'", item->name, (char *)item->data.V);1646 psStringAppend(&query, "%s = '%s'", item->name, item->data.str); 1647 1647 } 1648 1648 }
Note:
See TracChangeset
for help on using the changeset viewer.
