[mythtv] Services API for ChannelServices / Channel

Gary Buhrmaster gary.buhrmaster at gmail.com
Tue Nov 26 01:43:27 UTC 2019


On Mon, Nov 25, 2019 at 6:22 AM Bill Meek <keemllib at gmail.com> wrote:

> I *think* the attached is what Gary/Roger are suggesting. But when I
> 'signed on', a senior developer said there shouldn't be any SQL in the
> API code (but there was already.)

(parenthetical comment: even senior devs can find
that they have to make compromises in the real
world unless they are one of the few with infinite
time to refactor all the codes).

That is one approach, another is to test for whether
the value was provided (as Roger demonstrated in
his reference), and, if not, do not update the columns
(using conditional creation of the update SQL to not
update columns not provided).  Pseudo code follows.

And so can creating an entirely new endpoint,
although in this case I think that is overkill.

Any of those can work, so it would depend on what
makes sense as example going forward for other
new devs who are not otherwise familiar with their
requirements to maintain API compatibility (i.e.
the added code, whatever it will be, will typically
be copied for the next case).

As this is a question for the devs (they will have
to live with the solution going forward), I will defer
to them to decide which is the best way to propose
to fix the API breakage.

pseudo code:
    // existing code (before new columns)
    QString updateSQL
    MSqlBindings bindings;

    updateSQL = "Update table .... set column1 = :Column1, column2 = :Column2"
    bindings[":Column1"] = Value1
    bindings[":Column2"] = Value2

    // Added code
    if (m_parsedParams.contains("RegionId"))
       updateSQL += " set regionid = :RegionId ";
       bindings[":RegionId"] = RegionId;


More information about the mythtv-dev mailing list