Re: mysql error message

From: Christian Holm Christensen (cholm@hehi03.nbi.dk)
Date: Fri Aug 10 2001 - 04:42:53 EDT

  • Next message: Djamel Ouerdane: "Re: mysql error message"

    Hi Djam et Flemming and others,
     
    On Thu, 9 Aug 2001 13:57:15 -0400
    "Flemming Videbaek" <videbaek@sgs1.hirg.bnl.gov> wrote
    concerning ": Re: mysql error message":
    > This is one for Christian,
    
    Uh? 
    
    > Here is my hunch
    > 
    > In the BrDbQuery ie the abc for the DB access there are internal
    > array's Char_t buf[1024] that are used  retrieve and insert data. I
    > believe that each Float takes 4 bytes (stored as HEX just like the
    > string you enclose) thus 320 #RICH tubes * 4 > 1024
    
    The Char_t buf[1024] in BrDbQuery is not at fault here.  The problem,
    as the error message suggests: 
    
    > > Warning in <Format>: string truncated: 201, 26, 997264044, 997275037,...
    
    is in ROOT's Format function.  This overflow of the internal buffer
    truncates the string (BLOB of data) you want to write, so that the
    final "'" is missing, causeing a SQL syntax error:
    
    > > Error in <TMySQLServer::Query>: You have an error in your SQL syntax near
    > ?
    > ''35DE8143C10A9A433DCA844358E9874342708D43069196439C848543141E834310A88A43A6
    > DB9D4'
    > > at line 1
    
    
    > > The software I use works perfectly for C1 and is general so that RICH
    > > should give no problem. I can't figure out this...
    > > Does someone have an idea?
    
    As Flemming points out: 
    
      C1:   32 tubes * 4 chars / tube + 1 char  = 129  chars 
      RICH: 320 tubes * 4 chars / tube + 1 char = 1281 chars
    
    [The + 1 char is for the string terminator '\0'].  Please note that
    the buffer used by Format is something like 2048 chars, so you may say
    that the array is big enough, but do remember more stuff actually goes
    into the string. 
    
    My guess is, that it comes from 
    
      BrDbQuery* BrDbRevision::Insert(void) 
    
    where 
     
     const Char_t*  Form(const Char_t* format, ...) 
    
    used, and one of the arguments is 
    
      BrDb::Addr2String(fArray, fBytes) 
    
    which can be rather long.  
    
    Could you, Djam, please try to see if it is indeed in that method you
    get the message from? Use gdb and break in the above method.  Thanks.
    If this is indeed where the problem pops up, I may have an idea of how
    to solve it. 
    
    Yours, 
    
    Christian  -----------------------------------------------------------
    Holm Christensen                             Phone:  (+45) 35 35 96 91 
      Sankt Hansgade 23, 1. th.                  Office: (+45) 353  25 305 
      DK-2200 Copenhagen N                       Web:    www.nbi.dk/~cholm    
      Denmark                                    Email:       cholm@nbi.dk
    



    This archive was generated by hypermail 2b30 : Fri Aug 10 2001 - 04:44:16 EDT