[mythtv-users] Converting scripts to not use the database directly

Paul Harrison mythtv at sky.com
Sun Nov 2 16:55:49 UTC 2014


On 02/11/14 16:40, Mike Rice wrote:
> On Sat, Nov 1, 2014 at 6:47 PM, Mike Rice <mikerice1969 at gmail.com 
> <mailto:mikerice1969 at gmail.com>> wrote:
>
>
>     I believe I have it generally working by using urlencoded data and
>     remapping the keys since as Bill mentioned they are different.  To
>     me this seems pretty dangerous.  Much more dangerous than using
>     mysql to set a single column.
>
>     As far as I can tell you need to supply each parameter to the
>     function:
>
>     bool Channel::UpdateDBChannel( uint  MplexID,
>                                    uint  SourceID,
>                                    uint  ChannelID,
>                                    const QString &CallSign,
>                                    const QString &ChannelName,
>                                    const QString &ChannelNumber,
>                                    uint  ServiceID,
>                                    uint  ATSCMajorChannel,
>                                    uint  ATSCMinorChannel,
>                                    bool  UseEIT,
>                                    bool  visible,
>                                    const QString &FrequencyID,
>                                    const QString &Icon,
>                                    const QString &Format,
>                                    const QString &XMLTVID,
>                                    const QString &DefaultAuthority )
>
>     If you don't supply the parameter it ends up zero and your table
>     is updated with a zero value for that column.  If I am careful I
>     can get this right now but if someone adds a parameter here and
>     does not add it with the same name in the GET function (or if my
>     script doesn't use those keys) it will be zero when I call the
>     function.
>
>
> To answer my own question.  The wsdl info describes all the parameters 
> to the routine.  So the script can build the parameter data by walking 
> the wsdl parameters and then only issue to POST call when we have data 
> for each parameter.  This would solve my concern about unspecified 
> fields getting zero values.  It's also safer than relying only on the 
> documentation.
>
> At some point when I get a better understanding of this stuff I will 
> update the Wiki with some examples.
>

It sounds like UpdateDBChannel has been implemented incorrectly it's not 
meant to update a value which was not specified.

Paul H.


More information about the mythtv-users mailing list