[mythtv-users] Converting scripts to not use the database directly
Mike Rice
mikerice1969 at gmail.com
Sun Nov 2 01:47:25 UTC 2014
On Sat, Nov 1, 2014 at 9:22 AM, Bill Meek <keemllib at gmail.com> wrote:
> On 11/01/2014 10:41 AM, Mike Rice wrote:
>
>> I figure I am not preparing the data correctly. It is here:
>> http://pastebin.com/wx2eifB7 if anyone wants to take a look and offer
>> corrections.
>>
>>
> And I speak even less Perl. The problem is that the keys in
> the answer to the 1st query don't match those required by
> the next POST, ChanId vs. ChannelID. Adjusting for that,
> it works. Argggggggggggg.
>
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.
I guess my script would need to abort if the ProtoVer changes then go in
and look at the source to see if I am okay.
Is it a bug that the keys do not match between GetChannelInfoList and
UpdateDBChannel? Or am I going about this incorrectly?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mythtv.org/pipermail/mythtv-users/attachments/20141101/5ae1aa0c/attachment.html>
More information about the mythtv-users
mailing list