Changeset 17855
- Timestamp:
- May 29, 2008, 12:08:43 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/pxadmin.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/pxadmin.c
r17854 r17855 2 2 * pxadmin.c 3 3 * 4 * Copyright (C) 2006 Joshua Hoblitt4 * Copyright (C) 2006-2008 Joshua Hoblitt 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify it … … 29 29 30 30 bool deleteMode(pxConfig *config); 31 static bool runMultipleStatments(pxConfig *config, const char *query); 31 32 32 33 int main(int argc, char **argv) … … 94 95 } 95 96 97 if (!runMultipleStatments(config, query)) { 98 if (!psDBRollback(config->dbh)) { 99 psError(PS_ERR_UNKNOWN, false, "database error"); 100 } 101 psError(PS_ERR_UNKNOWN, false, "database error"); 102 psFree(query); 103 return false; 104 } 105 psFree(query); 106 107 // COMMIT 108 if (!psDBCommit(config->dbh)) { 109 psError(PS_ERR_UNKNOWN, false, "database error"); 110 return false; 111 } 112 113 return true; 114 } 115 116 static bool runMultipleStatments(pxConfig *config, const char *query) 117 { 118 PS_ASSERT_PTR_NON_NULL(config, false); 119 PS_ASSERT_PTR_NON_NULL(query, false); 120 96 121 // loop over all statements in string 97 122 psList *statements = psStringSplit(query, ";", false); 98 psFree(query);99 123 100 124 psString q = NULL; … … 102 126 while ((q = psListGetAndIncrement(iter))) { 103 127 if (!p_psDBRunQuery(config->dbh, q)) { 104 if (!psDBRollback(config->dbh)) {105 psError(PS_ERR_UNKNOWN, false, "database error");106 }107 128 psError(PS_ERR_UNKNOWN, false, "database error"); 108 129 psFree(iter); … … 114 135 psFree(statements); 115 136 116 // COMMIT117 if (!psDBCommit(config->dbh)) {118 psError(PS_ERR_UNKNOWN, false, "database error");119 return false;120 }121 122 137 return true; 123 138 }
Note:
See TracChangeset
for help on using the changeset viewer.
