--- rawreader/src/sort.cpp 2006/09/01 10:56:23 1.1 +++ rawreader/src/sort.cpp 2006/12/10 12:52:52 1.3 @@ -1,12 +1,18 @@ ///////////////PAMELA PACKETS SORT/////////////////////////////////// #include "descript.h" +#include "flag.h" + void RunHeaderReader(char *buf); extern long int OBTtimesync; extern long int Timesync; +extern char MYSQL[80]; +extern char database[80]; +extern int print_flag; + struct Names { - char a[80]; /*Full name for mmm_nnnnn_counter_xx.bin*/ - char a_short[80]; /*Short name for mmm_nnnnn_counter_xx.bin*/ + char a[80]; /*Full name for nnnnn_mmm_xxx_AA.bin*/ + char a_short[80]; /*Short name for nnnnn_mmm_xxx_AA.bin*/ FILE *fo_a; }; @@ -21,6 +27,9 @@ char ql[80]; char tmp[80], tmp1[80], numer[10]; char arina[80]; + char connection[80]; + char query[500]; + long int orbit, route, count; // char buffer[10]; char *packet=new char[Nmax]; unsigned int type=0; /*PAMELA packet type*/ @@ -34,6 +43,8 @@ long int first[NumberPack+1]; /*First byte for PAMELA packets of given type*/ long int last[NumberPack+1]; /*Last byte for PAMELA packets of given type*/ long int temp=0; + long int time_differ=0; + int flag_time=0; int Hex_first[4]; int Hex_last[4]; int i=0, j=0, stop=0; @@ -47,11 +58,17 @@ first[i]=0; last[i]=0;} - Length=(int)(strlen(file_init)); + Length=(int)(strlen(file_init)); strncat(strcpy(tmp,"\0"),file_init,Length-8); strcat(strcpy(tmp1,path),"tmp.dat"); f_temp=fopen(tmp1,"wb+"); + stringstream oss; + + strcpy(connection,MYSQL); + strcat(connection,database); + TSQLServer *sqlServer = TSQLServer::Connect(connection, "pamelaprod", "rawprod"); + for (i=0;i0) cout<(error)<<"\n"; -// cout<(error).test(0)<<"\n"; if ( ( (bitset<8>(error).test(7))||(error==0)|| ((bitset<8>(error).test(0))&&(!bitset<8>(error).test(1))&&(!bitset<8>(error).test(2))&& (!bitset<8>(error).test(3))&&(!bitset<8>(error).test(4))&&(!bitset<8>(error).test(5))&& (!bitset<8>(error).test(6))) )&& (type>0)&&(type0)&&(fmod((float)(temp),(float)(10000.))==0.)&&(temp!=0)) cout<<"sorting "<Query(oss.str().c_str()); + +// Form the query string to write PAMELA packets number in Packets + query[0]='\0'; + for(i=0;i0) cout<Query(oss.str().c_str()); + fo_pam.close(); fo_arina.close(); fclose(fo_log);