Changeset 35351
- Timestamp:
- Apr 3, 2013, 12:32:10 PM (13 years ago)
- Location:
- branches/eam_branches/ipp-20130307/Ohana/src/dvopsps/src
- Files:
-
- 4 edited
-
insert_detections_dvopsps.c (modified) (3 diffs)
-
insert_detections_dvopsps_catalog.c (modified) (8 diffs)
-
insert_objects_dvopsps_catalog.c (modified) (2 diffs)
-
mysql_dvopsps.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20130307/Ohana/src/dvopsps/src/insert_detections_dvopsps.c
r35221 r35351 57 57 } 58 58 59 int status = TRUE; 59 60 // select measurements for each populated catalog 60 61 for (i = 0; i < skylist[0].Nregions; i++) { … … 86 87 // NOTE: this is where the real action happens 87 88 if (SAVE_REMOTE && HOST_ID) { 88 append_detections_dvopsps_catalog (&catalog); 89 if (!append_detections_dvopsps_catalog (&catalog)) { 90 fprintf (stderr, "ERROR: failure to append detections to output catalog\n"); 91 status = FALSE; 92 } 89 93 } else { 90 insert_detections_dvopsps_catalog (&catalog, mysqlReal); 94 if (!insert_detections_dvopsps_catalog (&catalog, mysqlReal)) { 95 fprintf (stderr, "ERROR: failure to insert detections into mysql database\n"); 96 status = FALSE; 97 } 91 98 } 92 99 … … 97 104 98 105 if (SAVE_REMOTE && HOST_ID) { 99 save_detections_dvopsps (); 100 } 101 102 return (TRUE); 106 if (!save_detections_dvopsps ()) { 107 fprintf (stderr, "ERROR: failure to save output file with detections\n"); 108 status = FALSE; 109 } 110 } 111 112 return (status); 103 113 } 104 114 -
branches/eam_branches/ipp-20130307/Ohana/src/dvopsps/src/insert_detections_dvopsps_catalog.c
r35221 r35351 74 74 int save_detections_dvopsps () { 75 75 76 int status = TRUE; 77 76 78 if (!DetectionsSave (RESULT_FILE, detections, Ndetections)) { 77 79 fprintf (stderr, "failed to save detection file %s\n", RESULT_FILE); 80 status = FALSE; 78 81 } 79 82 80 83 free (detections); 81 84 Ndetections = 0; 82 return ( TRUE);85 return (status); 83 86 } 84 87 … … 101 104 int Ninsert = 0; 102 105 106 int status = TRUE; 107 103 108 // NOTE for testing, just do a few objects 104 109 if (!mysql) { … … 115 120 116 121 // XXX check return status 117 insert_detections_mysql_value (&buffer, &average[i], &measure[m+j]); 122 if (!insert_detections_mysql_value (&buffer, &average[i], &measure[m+j])) { 123 fprintf (stderr, "failure to insert detections in mysql\n"); 124 status = FALSE; 125 } 118 126 119 127 if (buffer.Nbuffer > MAX_BUFFER) { 120 insert_detections_mysql_commit (&buffer, mysql); 128 if (!insert_detections_mysql_commit (&buffer, mysql)) { 129 fprintf (stderr, "failure to insert detections in mysql (commit)\n"); 130 status = FALSE; 131 } 121 132 if (DEBUG) fprintf (stderr, "inserted %d rows\n", Ninsert); 122 133 Ninsert = 0; … … 134 145 } 135 146 } 136 insert_detections_mysql_commit (&buffer, mysql); 147 if (!insert_detections_mysql_commit (&buffer, mysql)) { 148 fprintf (stderr, "failure to insert detections in mysql (commit)\n"); 149 status = FALSE; 150 } 151 137 152 if (VERBOSE) fprintf (stderr, "inserted %d rows\n", Ninsert); 138 153 FreeIOBuffer (&buffer); 154 155 if (!status) { 156 MARKTIME("-- failed to insert "OFF_T_FMT" rows in %f sec\n", found, dtime); 157 return (FALSE); 158 } 139 159 140 160 MARKTIME("-- inserted "OFF_T_FMT" rows in %f sec, skipped %d without IDs\n", found, dtime, missingID); … … 188 208 PrintIOBuffer (buffer, "%lu, ", average->extID); // objID 189 209 PrintIOBuffer (buffer, "%u, ", measure->dbFlags); // flags 210 190 211 float zp = code->C * 0.001 + code->K * (measure->airmass - 1) - measure->Mcal; 191 212 float exptime = pow(10.0, 0.4 * measure->dt); … … 211 232 MYSQL_RES *result; 212 233 234 int status = TRUE; 235 213 236 // check that the last two chars are ,\n and replace with ;\n 214 237 if (!strcmp(&buffer->buffer[buffer->Nbuffer-2], ",\n")) { … … 222 245 if (mysql) { 223 246 if (DEBUG) fprintf (stderr, "%s\n", buffer->buffer); 224 int status = mysql_query(mysql, buffer->buffer);225 if ( status) {247 int mysqlStatus = mysql_query(mysql, buffer->buffer); 248 if (mysqlStatus) { 226 249 fprintf (stderr, "error with insert:\n"); 227 250 fprintf (stderr, "%s\n", mysql_error(mysql)); 228 251 fprintf (stderr, "Nbuffer: %d\n", buffer->Nbuffer); 252 status = FALSE; 229 253 } 230 254 result = mysql_store_result (mysql); … … 234 258 } 235 259 236 return TRUE;237 } 260 return status; 261 } -
branches/eam_branches/ipp-20130307/Ohana/src/dvopsps/src/insert_objects_dvopsps_catalog.c
r35221 r35351 96 96 97 97 PrintIOBuffer (&buffer, "CREATE TABLE %s_cpt (" 98 "RA FLOAT, "99 "DEC_ FLOAT, "100 "RA_ERR REAL, "101 "DEC_ERR REAL, "102 "U_RA REAL, "103 "U_DEC REAL, "104 "V_RA_ERR REAL, "105 "V_DEC_ERR REAL, "106 "PAR REAL, "107 "PAR_ERR REAL, "108 "CHISQ_POS REAL, "109 "CHISQ_PM REAL, "110 "CHISQ_PAP REAL, "98 "RA DOUBLE, " 99 "DEC_ DOUBLE, " 100 "RA_ERR FLOAT, " 101 "DEC_ERR FLOAT, " 102 "U_RA FLOAT, " 103 "U_DEC FLOAT, " 104 "V_RA_ERR FLOAT, " 105 "V_DEC_ERR FLOAT, " 106 "PAR FLOAT, " 107 "PAR_ERR FLOAT, " 108 "CHISQ_POS FLOAT, " 109 "CHISQ_PM FLOAT, " 110 "CHISQ_PAP FLOAT, " 111 111 "MEAN_EPOCH INT, " 112 112 "TIME_RANGE INT, " 113 "PSF_QF REAL, "114 "PSF_QF_PERF REAL, "115 "STARGAL_SEP REAL, "113 "PSF_QF FLOAT, " 114 "PSF_QF_PERF FLOAT, " 115 "STARGAL_SEP FLOAT, " 116 116 "NUMBER_POS SMALLINT, " 117 117 "NMEASURE SMALLINT, " … … 152 152 153 153 PrintIOBuffer (&buffer, "CREATE TABLE %s_cps (" 154 "MAG REAL, "155 "MAG_AP REAL, "156 "MAG_KRON REAL, "157 "MAG_KRON_ERR REAL, "158 "MAG_ERR REAL, "159 "MAG_CHI REAL, "160 "FLUX_PSF REAL, "161 "FLUX_PSF_ERR REAL, "162 "FLUX_KRON REAL, "163 "FLUX_KRON_ERR REAL, "154 "MAG FLOAT, " 155 "MAG_AP FLOAT, " 156 "MAG_KRON FLOAT, " 157 "MAG_KRON_ERR FLOAT, " 158 "MAG_ERR FLOAT, " 159 "MAG_CHI FLOAT, " 160 "FLUX_PSF FLOAT, " 161 "FLUX_PSF_ERR FLOAT, " 162 "FLUX_KRON FLOAT, " 163 "FLUX_KRON_ERR FLOAT, " 164 164 "FLAGS INT, " 165 165 "NCODE SMALLINT, " -
branches/eam_branches/ipp-20130307/Ohana/src/dvopsps/src/mysql_dvopsps.c
r35098 r35351 58 58 // dump_result (connection); 59 59 60 sprintf (query, "show variables like 'max_allowed_packet';");61 if (mysql_query (connection, query)) {62 fprintf (stderr, "failed to set max_allowed_packet\n");63 fprintf (stderr, "%s\n", mysql_error (connection));64 return NULL;65 }66 dump_result (connection);60 // sprintf (query, "show variables like 'max_allowed_packet';"); 61 // if (mysql_query (connection, query)) { 62 // fprintf (stderr, "failed to set max_allowed_packet\n"); 63 // fprintf (stderr, "%s\n", mysql_error (connection)); 64 // return NULL; 65 // } 66 // dump_result (connection); 67 67 68 68 if (0) {
Note:
See TracChangeset
for help on using the changeset viewer.
