Changeset 25929
- Timestamp:
- Oct 22, 2009, 4:51:58 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
-
dbconfig/changes.txt (modified) (1 diff)
-
dbconfig/publish.md (modified) (1 diff)
-
ippTools/share/pubtool_definerun.sql (modified) (2 diffs)
-
ippTools/share/pubtool_pending.sql (modified) (2 diffs)
-
ippTools/share/pubtool_revert.sql (modified) (1 diff)
-
ippTools/share/pxadmin_create_tables.sql (modified) (1 diff)
-
ippTools/src/pubtool.c (modified) (3 diffs)
-
ippTools/src/pubtool.h (modified) (1 diff)
-
ippTools/src/pubtoolConfig.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/dbconfig/changes.txt
r25913 r25929 1422 1422 -- Vesion 1.1.57 1423 1423 1424 -- add changes for 1.1.57 here. Then uncomment the following before commiting 1424 ALTER TABLE publishClient ADD COLUMN active TINYINT DEFAULT 0 AFTER client_id; 1425 1426 1425 1427 1426 1428 -- UPDATE dbversion set schema_version = '1.1.57', updated= CURRENT_TIMESTAMP(); -
trunk/dbconfig/publish.md
r25256 r25929 3 3 publishClient METADATA 4 4 client_id S64 0 # Primary Key AUTO_INCREMENT 5 active BOOL TRUE 5 6 product STR 64 6 7 stage STR 64 -
trunk/ippTools/share/pubtool_definerun.sql
r24512 r25929 11 11 JOIN diffRun 12 12 WHERE publishClient.stage = 'diff' 13 AND publishClient.active = 1 13 14 AND diffRun.state = 'full' 14 15 -- WHERE hook %s … … 21 22 JOIN camRun 22 23 WHERE publishClient.stage = 'camera' 24 AND publishClient.active = 1 23 25 AND camRun.state = 'full' 24 26 -- WHERE hook %s -
trunk/ippTools/share/pubtool_pending.sql
r24707 r25929 24 24 JOIN rawExp USING(exp_id) 25 25 WHERE publishClient.stage = 'diff' 26 AND publishClient.active = 1 26 27 AND publishRun.state = 'new' 27 28 AND diffRun.state = 'full' … … 43 44 JOIN rawExp USING(exp_id) 44 45 WHERE publishClient.stage = 'camera' 46 AND publishClient.active = 1 45 47 AND publishRun.state ='new' 46 48 AND camRun.state = 'full' -
trunk/ippTools/share/pubtool_revert.sql
r24512 r25929 3 3 WHERE publishDone.pub_id = publishRun.pub_id 4 4 AND publishRun.client_id = publishClient.client_id 5 AND publishClient.active = 1 5 6 AND publishDone.fault != 0 -
trunk/ippTools/share/pxadmin_create_tables.sql
r25913 r25929 1485 1485 CREATE TABLE publishClient ( 1486 1486 client_id BIGINT AUTO_INCREMENT, -- unique identifier 1487 active TINYINT DEFAULT 0, -- whether we should worry about this or not 1487 1488 product VARCHAR(64), -- product name 1488 1489 stage VARCHAR(64) NOT NULL, -- stage of interest (chip, camera, diff, etc.) -
trunk/ippTools/src/pubtool.c
r25256 r25929 32 32 33 33 static bool defineclientMode(pxConfig *config); 34 static bool updateclientMode(pxConfig *config); 34 35 static bool definerunMode(pxConfig *config); 35 36 static bool pendingMode(pxConfig *config); … … 57 58 switch (config->mode) { 58 59 MODECASE(PUBTOOL_MODE_DEFINECLIENT, defineclientMode); 60 MODECASE(PUBTOOL_MODE_UPDATECLIENT, updateclientMode); 59 61 MODECASE(PUBTOOL_MODE_DEFINERUN, definerunMode); 60 62 MODECASE(PUBTOOL_MODE_PENDING, pendingMode); … … 94 96 PXOPT_LOOKUP_STR(comment, config->args, "-comment", false, false); 95 97 96 if (!publishClientInsert(config->dbh, 0, product, stage, workdir, comment)) { 97 psError(PS_ERR_UNKNOWN, false, "Database error"); 98 return false; 99 } 98 if (!publishClientInsert(config->dbh, 0, 0, product, stage, workdir, comment)) { 99 psError(PS_ERR_UNKNOWN, false, "Database error"); 100 return false; 101 } 102 103 return true; 104 } 105 106 static bool updateclientMode(pxConfig *config) 107 { 108 PS_ASSERT_PTR_NON_NULL(config, false); 109 110 psMetadata *where = psMetadataAlloc(); // WHERE conditions 111 PXOPT_COPY_S64(config->args, where, "-client_id", "client_id", "=="); 112 PXOPT_COPY_STR(config->args, where, "-product", "product", "=="); 113 PXOPT_COPY_STR(config->args, where, "-stage", "stage", "=="); 114 PXOPT_COPY_STR(config->args, where, "-comment", "comment", "LIKE"); 115 116 PXOPT_LOOKUP_BOOL(active, config->args, "-active", false); 117 PXOPT_LOOKUP_BOOL(inactive, config->args, "-inactive", false); 118 119 if ((!active && !inactive) || (active && inactive)) { 120 psError(PS_ERR_UNKNOWN, false, "Must specify one, and only one, of -active and -inactive."); 121 psFree(where); 122 return false; 123 } 124 125 psString query = NULL; // Query to run 126 psStringAppend(&query, "UPDATE publishRun SET active = %d", active ? 1 : 0); 127 128 if (psListLength(where->list)) { 129 psString clause = psDBGenerateWhereConditionSQL(where, NULL); 130 psStringAppend(&query, "\n AND %s", clause); 131 psFree(clause); 132 } 133 psFree(where); 134 135 if (!p_psDBRunQuery(config->dbh, query)) { 136 psError(PS_ERR_UNKNOWN, false, "Database error"); 137 psFree(query); 138 return false; 139 } 140 psFree(query); 141 142 long numUpdated = psDBAffectedRows(config->dbh); 143 psLogMsg("pubtool", PS_LOG_INFO, "%ld rows updated.", numUpdated); 100 144 101 145 return true; -
trunk/ippTools/src/pubtool.h
r24512 r25929 26 26 PUBTOOL_MODE_NONE = 0x0, 27 27 PUBTOOL_MODE_DEFINECLIENT, 28 PUBTOOL_MODE_UPDATECLIENT, 28 29 PUBTOOL_MODE_DEFINERUN, 29 30 PUBTOOL_MODE_PENDING, -
trunk/ippTools/src/pubtoolConfig.c
r25256 r25929 50 50 psMetadataAddStr(defineclientArgs, PS_LIST_TAIL, "-comment", 0, "define comment", NULL); 51 51 52 // -updateclient 53 psMetadata *updateclientArgs = psMetadataAlloc(); 54 psMetadataAddStr(updateclientArgs, PS_LIST_TAIL, "-client_id", 0, "search by client_id", NULL); 55 psMetadataAddStr(updateclientArgs, PS_LIST_TAIL, "-stage", 0, "search by stage", NULL); 56 psMetadataAddStr(updateclientArgs, PS_LIST_TAIL, "-product", 0, "search by product", NULL); 57 psMetadataAddStr(updateclientArgs, PS_LIST_TAIL, "-comment", 0, "search by comment (LIKE)", NULL); 58 psMetadataAddBool(updateclientArgs, PS_LIST_TAIL, "-active", 0, "set to active state", NULL); 59 psMetadataAddBool(updateclientArgs, PS_LIST_TAIL, "-inactive", 0, "set to inactive state", NULL); 60 52 61 // -definerun 53 62 psMetadata *definerunArgs = psMetadataAlloc(); … … 85 94 86 95 PXOPT_ADD_MODE("-defineclient", "", PUBTOOL_MODE_DEFINECLIENT, defineclientArgs); 96 PXOPT_ADD_MODE("-updateclient", "", PUBTOOL_MODE_UPDATECLIENT, updateclientArgs); 87 97 PXOPT_ADD_MODE("-definerun", "", PUBTOOL_MODE_DEFINERUN, definerunArgs); 88 98 PXOPT_ADD_MODE("-pending", "", PUBTOOL_MODE_PENDING, pendingArgs);
Note:
See TracChangeset
for help on using the changeset viewer.
