Changeset 28106
- Timestamp:
- May 26, 2010, 9:12:02 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
-
dbconfig/pstamp.md (modified) (1 diff)
-
ippTools/share/pxadmin_create_tables.sql (modified) (1 diff)
-
ippTools/src/pstamptool.c (modified) (3 diffs)
-
ippTools/src/pstamptool.h (modified) (1 diff)
-
ippTools/src/pstamptoolConfig.c (modified) (2 diffs)
-
pstamp/scripts/pstamp_insert_request.pl (modified) (1 diff)
-
pstamp/scripts/pstamp_webrequest.pl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/dbconfig/pstamp.md
r27874 r28106 59 59 fault S16 0 60 60 END 61 62 pstampWebRequest METADATA 63 num S64 0 # Primary Key AUTO_INCREMENT 64 END -
trunk/ippTools/share/pxadmin_create_tables.sql
r28096 r28106 1401 1401 ) ENGINE=innodb DEFAULT CHARSET=latin1; 1402 1402 1403 CREATE TABLE pstampWebRequest ( 1404 num BIGINT AUTO_INCREMENT, 1405 PRIMARY KEY(num) 1406 ) ENGINE=innodb DEFAULT CHARSET=latin1; 1407 1403 1408 CREATE TABLE distTarget ( 1404 1409 target_id BIGINT AUTO_INCREMENT, -
trunk/ippTools/src/pstamptool.c
r27969 r28106 53 53 static bool updatedependentMode(pxConfig *config); 54 54 static bool revertdependentMode(pxConfig *config); 55 static bool getwebrequestnumMode(pxConfig *config); 55 56 56 57 # define MODECASE(caseName, func) \ … … 95 96 MODECASE(PSTAMPTOOL_MODE_UPDATEDEPENDENT, updatedependentMode); 96 97 MODECASE(PSTAMPTOOL_MODE_REVERTDEPENDENT, revertdependentMode); 98 MODECASE(PSTAMPTOOL_MODE_GETWEBREQUESTNUM, getwebrequestnumMode); 97 99 default: 98 100 psAbort("invalid option (this should not happen)"); … … 1334 1336 return true; 1335 1337 } 1338 1339 static bool getwebrequestnumMode(pxConfig *config) 1340 { 1341 PS_ASSERT_PTR_NON_NULL(config, false); 1342 1343 if (!pstampWebRequestInsert(config->dbh, 0 )) { 1344 psError(PS_ERR_UNKNOWN, false, "failed to insert pstampWebRequest"); 1345 return false; 1346 } 1347 1348 psS64 req_id = psDBLastInsertID(config->dbh); 1349 1350 printf("%" PRId64 "\n", req_id); 1351 1352 return true; 1353 } -
trunk/ippTools/src/pstamptool.h
r27874 r28106 48 48 PSTAMPTOOL_MODE_UPDATEDEPENDENT, 49 49 PSTAMPTOOL_MODE_REVERTDEPENDENT, 50 PSTAMPTOOL_MODE_GETWEBREQUESTNUM, 50 51 } pstamptoolMode; 51 52 -
trunk/ippTools/src/pstamptoolConfig.c
r27874 r28106 235 235 psMetadataAddBool(projectArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 236 236 237 // -getwebrequestnum 238 psMetadata *getwebrequestnumArgs = psMetadataAlloc(); 239 237 240 psMetadata *argSets = psMetadataAlloc(); 238 241 psMetadata *modes = psMetadataAlloc(); … … 264 267 PXOPT_ADD_MODE("-modproject", "", PSTAMPTOOL_MODE_MODPROJECT, modprojectArgs); 265 268 PXOPT_ADD_MODE("-project", "", PSTAMPTOOL_MODE_PROJECT, projectArgs); 269 PXOPT_ADD_MODE("-getwebrequestnum","", PSTAMPTOOL_MODE_GETWEBREQUESTNUM, getwebrequestnumArgs); 266 270 267 271 if (!pxGetOptions(stderr, argc, argv, config, modes, argSets)) { -
trunk/pstamp/scripts/pstamp_insert_request.pl
r27211 r28106 114 114 115 115 exit 0; 116 117 # Temporary hack 118 # webrequest number is stored in a file in the current directory 119 # 120 # get this number from the database 116 # Ask the database for the next web request number 121 117 sub get_webreq_num 122 118 { 123 my $filename = "$workdir/webreq_num.txt"; 124 if (! open IN, "+< $filename" ) { 125 my $initial_num = 1; 126 open IN, "> $filename" or die "can't open $filename"; 127 print IN "$initial_num\n" or die "failed to initialize $filename"; 128 close IN; 129 return $initial_num; 119 my $command = "$pstamptool -getwebrequestnum"; 120 $command .= " -dbname $dbname" if $dbname; 121 $command .= " -dbserver $dbserver" if $dbserver; 122 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 123 run(command => $command, verbose => $verbose); 124 unless ($success) { 125 print STDERR @$stderr_buf; 126 die("Unable to perform pstamptool -getwebrequestnum: $error_code"); 127 } 128 my $webreq_num = ${$stdout_buf}[0]; 129 chomp $webreq_num; 130 131 if (!$webreq_num) { 132 die("pstamptool -getwebreqnum returned no value"); 130 133 } 131 134 132 my $webreq_num = <IN>; 133 chomp $webreq_num; 135 # print STDERR "webreq_num $webreq_num\n"; 134 136 135 print STDERR "$webreq_num\n" if $verbose;136 137 my $next = $webreq_num + 1;138 truncate IN, 0;139 seek IN, 0, 0;140 print IN "$next\n";141 142 close IN;143 137 return $webreq_num; 144 138 } -
trunk/pstamp/scripts/pstamp_webrequest.pl
r27355 r28106 23 23 24 24 my $host = hostname(); 25 my $verbose = 0;25 my $verbose = 1; 26 26 my $dbname; 27 27 my $dbserver; … … 152 152 exit 0; 153 153 154 # Temporary hack 155 # webrequest number is stored in a file in the current directory 156 # 154 # Ask the database for the next web request number 157 155 sub get_webreq_num 158 156 { 159 my $filename = "webreq_num.txt"; 160 if (! open IN, "+< $filename" ) { 161 my $initial_num = 1; 162 open IN, "> $filename" or die "can't open $filename"; 163 print IN "$initial_num\n" or die "failed to initialize $filename"; 164 close IN; 165 return $initial_num; 157 my $command = "$pstamptool -getwebrequestnum"; 158 $command .= " -dbname $dbname" if $dbname; 159 $command .= " -dbserver $dbserver" if $dbserver; 160 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 161 run(command => $command, verbose => $verbose); 162 unless ($success) { 163 print STDERR @$stderr_buf; 164 die("Unable to perform pstamptool -getwebrequestnum: $error_code"); 165 } 166 my $webreq_num = ${$stdout_buf}[0]; 167 chomp $webreq_num; 168 169 if (!$webreq_num) { 170 die("pstamptool -getwebreqnum returned no value"); 166 171 } 167 172 168 my $webreq_num = <IN>; 169 chomp $webreq_num; 173 # print STDERR "webreq_num $webreq_num\n"; 170 174 171 print STDERR "$webreq_num\n" if $verbose;172 173 my $next = $webreq_num + 1;174 truncate IN, 0;175 seek IN, 0, 0;176 print IN "$next\n";177 178 close IN;179 175 return $webreq_num; 180 176 }
Note:
See TracChangeset
for help on using the changeset viewer.
