| 1658 | Int_t PamelaDBOperations::insertPamelaGL_TIMESYNC(){ | Int_t PamelaDBOperations::insertPamelaGL_TIMESYNC(){ | 
| 1659 | // | // | 
| 1660 | Int_t signal = 0; | Int_t signal = 0; | 
| 1661 | UInt_t idresof = 0; | //  UInt_t idresof = 0; | 
| 1662 |  | idresof = 0; | 
| 1663 | stringstream   oss; | stringstream   oss; | 
| 1664 | TSQLResult *result = 0; | TSQLResult *result = 0; | 
| 1665 | TSQLRow *row = 0; | TSQLRow *row = 0; | 
| 1973 | // | // | 
| 1974 | if ( chewbacca ){ | if ( chewbacca ){ | 
| 1975 | oss.str(""); | oss.str(""); | 
| 1976 | oss << " SELECT ID FROM GL_TIMESYNC where TIMESYNC="<<chlastts<<" AND OBT0="<<chobtts*1000<<" limit 1;"; | oss << " SELECT ID FROM GL_TIMESYNC where TIMESYNC="<<chlastts<<" AND OBT0="<<chobtts*1000<<" and ID_RESURS_OFFSET="<< idresof <<" limit 1;"; // 10RED BUG!!!! without 'and ID_RESURS_OFFSET="<< idresof ' this query is not enough to ensure finding the correct line in GL_TIMSYNC... | 
| 1977 | if ( debug ) printf(" %s \n",oss.str().c_str()); | if ( debug ) printf(" %s \n",oss.str().c_str()); | 
| 1978 | result = conn->Query(oss.str().c_str()); | result = conn->Query(oss.str().c_str()); | 
| 1979 | // | // | 
| 5746 | // --------------------------------------------------------------------- | // --------------------------------------------------------------------- | 
| 5747 | UInt_t idtimesync = 0; | UInt_t idtimesync = 0; | 
| 5748 | oss.str(""); | oss.str(""); | 
| 5749 | oss << " SELECT ID FROM GL_TIMESYNC where TIMESYNC="<<chlastts<<" AND OBT0="<<chobtts*1000<<" limit 1;"; | oss << " SELECT ID FROM GL_TIMESYNC where TIMESYNC="<<chlastts<<" AND OBT0="<<chobtts*1000<<" and ID_RESURS_OFFSET="<< idresof <<" limit 1;"; // 10RED BUG!!!! without 'and ID_RESURS_OFFSET="<< idresof ' this query is not enough to ensure finding the correct line in GL_TIMSYNC... | 
| 5750 | if ( debug ) printf(" %s \n",oss.str().c_str()); | if ( debug ) printf(" %s \n",oss.str().c_str()); | 
| 5751 | result = conn->Query(oss.str().c_str()); | result = conn->Query(oss.str().c_str()); | 
| 5752 | if ( !result ) throw -3; | if ( !result ) throw -3; |