[mythtv] Services API for ChannelServices / Channel

Bill Meek keemllib at gmail.com
Tue Nov 26 02:00:32 UTC 2019


On 11/25/19 7:43 PM, Gary Buhrmaster wrote:
> 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;

Right, I'm using the m_parsedParms... solution. And in line SQL to get the existing values
and the existing call to SourceUtil::UpdateSource(). Testing now.

Fun fact: this endpoint broke mythfilldatabase if a user had a grabber
because the configpath gets set to "" rather than NULL. mythfilldatabase
depends on the NULL case to develop the path to the file automatically.
If ConfigPath=someValidPath, then it's OK.

-- 
Bill


More information about the mythtv-dev mailing list