Changeset 4428 for trunk/psLib/src/db
- Timestamp:
- Jun 29, 2005, 9:40:23 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/db/psDB.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/db/psDB.c
r4393 r4428 12 12 * @author Joshua Hoblitt 13 13 * 14 * @version $Revision: 1.3 5$ $Name: not supported by cvs2svn $15 * @date $Date: 2005-06-2 5 02:44:14$14 * @version $Revision: 1.36 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2005-06-29 19:40:23 $ 16 16 * 17 17 * Copyright 2005 Joshua Hoblitt, University of Hawaii … … 52 52 static char *psDBGenerateInsertRowSQL(const char *tableName, const psMetadata *row); 53 53 static char *psDBGenerateUpdateRowSQL(const char *tableName, const psMetadata *where, const psMetadata *values); 54 static char *psDBGenerateDeleteRowSQL(const char *tableName, const psMetadata *where );54 static char *psDBGenerateDeleteRowSQL(const char *tableName, const psMetadata *where, unsigned long long limit); 55 55 static char *psDBGenerateWhereSQL(const psMetadata *where); 56 56 static char *psDBGenerateSetSQL(const psMetadata *set … … 778 778 } 779 779 780 psS64 psDBDeleteRows(psDB *dbh, const char *tableName, const psMetadata *where )780 psS64 psDBDeleteRows(psDB *dbh, const char *tableName, const psMetadata *where, unsigned long long limit) 781 781 { 782 782 char *query; … … 790 790 791 791 // Create SQL statement string 792 query = psDBGenerateDeleteRowSQL(tableName, where );792 query = psDBGenerateDeleteRowSQL(tableName, where,limit); 793 793 if (!query) { 794 794 psError(PS_ERR_UNEXPECTED_NULL, false, "Query generation failed."); … … 1130 1130 } 1131 1131 1132 static char *psDBGenerateDeleteRowSQL(const char *tableName, const psMetadata *where )1132 static char *psDBGenerateDeleteRowSQL(const char *tableName, const psMetadata *where, unsigned long long limit) 1133 1133 { 1134 1134 char *query = NULL; 1135 1135 char *whereSQL; 1136 char *limitString; 1136 1137 1137 1138 // delete all rows if where is NULL … … 1148 1149 } 1149 1150 1151 psStringAppend(&query, "DELETE FROM %s %s", tableName, whereSQL); 1152 1150 1153 // Complete delete SQL command string 1151 psStringAppend(&query, "DELETE FROM %s %s", tableName, whereSQL); 1154 // treat limit == 0 as "no limit" 1155 if (limit) { 1156 limitString = psDBIntToString(limit); 1157 psStringAppend(&query, " LIMIT %s", limitString); 1158 psFree(limitString); 1159 } 1152 1160 psFree(whereSQL); 1153 1161
Note:
See TracChangeset
for help on using the changeset viewer.
