Changeset 23310 for trunk/ippTools/src/pxadmin.c
- Timestamp:
- Mar 12, 2009, 3:42:47 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/pxadmin.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/pxadmin.c
r18927 r23310 29 29 30 30 bool createMode(pxConfig *config); 31 bool createMirrorMode(pxConfig *config); 31 32 bool deleteMode(pxConfig *config); 32 33 static bool runMultipleStatments(pxConfig *config, const char *query); … … 53 54 } 54 55 break; 56 case PXADMIN_MODE_CREATE_MIRROR: 57 if (!createMirrorMode(config)) { 58 goto FAIL; 59 } 60 break; 55 61 case PXADMIN_MODE_DELETE: 56 62 if (!deleteMode(config)) { … … 86 92 87 93 psString query = pxDataGet("pxadmin_create_tables.sql"); 94 if (!query) { 95 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 96 return false; 97 } 98 99 // BEGIN 100 if (!psDBTransaction(config->dbh)) { 101 psError(PS_ERR_UNKNOWN, false, "database error"); 102 return false; 103 } 104 105 if (!runMultipleStatments(config, query)) { 106 if (!psDBRollback(config->dbh)) { 107 psError(PS_ERR_UNKNOWN, false, "database error"); 108 } 109 psError(PS_ERR_UNKNOWN, false, "database error"); 110 psFree(query); 111 return false; 112 } 113 psFree(query); 114 115 // COMMIT 116 if (!psDBCommit(config->dbh)) { 117 psError(PS_ERR_UNKNOWN, false, "database error"); 118 return false; 119 } 120 121 return true; 122 } 123 124 125 bool createMirrorMode(pxConfig *config) 126 { 127 PS_ASSERT_PTR_NON_NULL(config, false); 128 129 psString query = pxDataGet("pxadmin_create_mirror_tables.sql"); 88 130 if (!query) { 89 131 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
Note:
See TracChangeset
for help on using the changeset viewer.
