Menu

update on info field in ipaddradd

Matt
2014-04-28
2014-04-30
  • Matt

    Matt - 2014-04-28

    Hi all,

    I am using v4.92a with mysql 5.5.13-enterprise-commercial-advanced-log MySQL Enterprise Server - Advanced Edition (Commercial).

    I am trying to write directly into the ipplan mysql database from a script that extracts information from various devices.
    Most of this info should go into ipaddradd.info, which should be fine due to its datatype.

    Now, even though the string-content of the info-field looks like it is composed of some variables plus the actual string, I thought that I’d figured out what it means.

    e.g.:
    a:1:{s:4:"info";s:50:"<AUTOINSERT-START>whatever
    info
    <AUTOINSERT-END>”;}

    Here, 50 seems to be the stringlength of what you actually want to see in the “Additional information” field in the webinterface. The other values never change throughout the table, so I assumed it to be save to be left aside and just copy them in.

    I’d expect to see just that on the website:

    ---Additional information-----------
    <AUTOINSERT-START>whatever
    info
    <AUTOINSERT-END>
    --------------------------------

    However, when I do an update on the table:

    update ipaddradd set info='a:1:{s:4:"info";s:50:" <AUTOINSERT-START>whatever
    info
    <AUTOINSERT-END>";}' where ipaddr=176356937 and baseindex=62

    then what I actually see on the webinterface is this:

    ---Additional information-----------
    a:1:{s:4:"info";s:50:" <AUTOINSERT-START>whatever
    info
    <AUTOINSERT-END>";}
    --------------------------------

    When I copy the string for the actual information, paste it into the Additional-information field on the webinterface and hit submit, the string in the value-field in the database stays exactly the same. Only the webinterface now supresses the prefix/suffix ('a:1:{s:4:"info";s:50:") as expected and only shows the info I am interested in.

    I couldn’t find any triggers on the table, neither could I see any functions, so I can’t quite figure how this happens.
    Can anyone give me a hint?

    Thanks in advance and best regards,

    Matt

     
  • Matt

    Matt - 2014-04-30

    Hi all,
    Already fixed this - there was a problem in the way I calculated the total length of the string.
    That actually did the trick:

    update ipaddradd set info='a:1:{s:4:"info";s:48:"<AUTOINSERT-START>whatever
    info
    <AUTOINSERT-END>";}' where ipaddr=176356937 and baseindex=62

    Cheers, Matt

     

Log in to post a comment.