Mailing List Archive

Ticket #13420: DB Error in mythtv-setup and QString initialization
#13420: DB Error in mythtv-setup and QString initialization
-------------------------------------+-------------------------------------
Reporter: Klaas de Waal | Owner: (none)
Type: Patch - Bug Fix | Status: new
Priority: minor | Milestone: needs_triage
Component: MythTV - Channel | Version: Master Head
Scanner | Keywords: DVB channelscan QString
Severity: medium | initialization
Ticket locked: 0 |
-------------------------------------+-------------------------------------
A channelscan with mythtv-setup gives the following error messages, one
for each channel:

{{{
DB Error (MSqlQuery):
Query was:
INSERT INTO channelscan_channel ( scanid, transportid,
mplex_id, source_id, channel_id, callsign,
service_name, chan_num, service_id,
atsc_major_channel, atsc_minor_channel, use_on_air_guide, hidden,
hidden_in_guide, freqid, icon, tvformat,
xmltvid, pat_tsid, vct_tsid,
vct_chan_tsid, sdt_tsid, orig_netid, netid,
si_standard, in_channels_conf, in_pat, in_pmt,
in_vct, in_nit, in_sdt,
is_encrypted, is_data_service, is_audio_service,
is_opencable, could_be_opencable, decryption_status,
default_authority ) VALUES ( ?, ?,
?, ?, ?, ?, ?, ?,
?, ?,?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?,
?,?, ? );
Bindings were:
:ATSC_MAJOR_CHANNEL=0, :ATSC_MINOR_CHANNEL=0, :CALLSIGN="Penthouse HD1",
:CHANNEL_ID=0, :CHAN_NUM="792", :COULD_BE_OPENCABLE=false,
:DECRYPTION_STATUS=2,
:DEFAULT_AUTHORITY=NULL, :FREQID="", :HIDDEN=false,
:HIDDEN_IN_GUIDE=false,
:ICON=NULL, :IN_CHANNELS_CONF=false, :IN_NIT=true, :IN_PAT=true,
:IN_PMT=true,
:IN_SDT=true, :IN_VCT=false, :IS_AUDIO_SERVICE=false,
:IS_DATA_SERVICE=false,
:IS_ENCRYPTED=true, :IS_OPEBCABLE=false, :MPLEX_ID=43, :NETID=5555,
:ORIG_NETID=1536, :PAT
2019-03-03 21:20:13.973048 E Original query failed, but resend with empty
strings in place of NULL strings worked.
}}}

This message is caused by database access with QString variables which are
NULL. There is an error catching mechanism present that replaces each NULL
strings with an empty string. The last line in the message above states
that this is done and that then the database access succeeded.\\

This problem is caused by the recent change to move initialization to the
header files. This in itself should and does not make any difference,
however, the initializations for the QString members of ChannelInsertInfo
in channelinfo.cpp/.h have been lost in this process.

This can be found in the following commit:\\
https://github.com/MythTV/mythtv/commit/4d5526816f5c5d5ddbf52f960b597afbf5b31fea
#diff-0500d09455f90efc1704bfbb28b33aab


The obvious solution is to restore the initialization of
ChannelInsertinfo.

A patch for this is attached.

--
Ticket URL: <https://code.mythtv.org/trac/ticket/13420>
MythTV <http://www.mythtv.org>
MythTV Media Center
Re: Ticket #13420: DB Error in mythtv-setup and QString initialization [ In reply to ]
#13420: DB Error in mythtv-setup and QString initialization
-------------------------------------------------+-------------------------
Reporter: Klaas de Waal | Owner: (none)
Type: Patch - Bug Fix | Status: new
Priority: minor | Milestone:
| needs_triage
Component: MythTV - Channel Scanner | Version: Master
| Head
Severity: medium | Resolution:
Keywords: DVB channelscan QString | Ticket locked: 0
initialization |
-------------------------------------------------+-------------------------
Changes (by Klaas de Waal):

* Attachment "20190303-channelinsertinfo-init.patch" added.

Restore initialization of QString members of ChannelInsertInfo

--
Ticket URL: <https://code.mythtv.org/trac/ticket/13420>
MythTV <http://www.mythtv.org>
MythTV Media Center
Re: Ticket #13420: DB Error in mythtv-setup and QString initialization [ In reply to ]
#13420: DB Error in mythtv-setup and QString initialization
-------------------------------------------------+-------------------------
Reporter: Klaas de Waal | Owner: David
| Hampton
Type: Patch - Bug Fix | Status:
| assigned
Priority: minor | Milestone:
| needs_triage
Component: MythTV - Channel Scanner | Version: Master
| Head
Severity: medium | Resolution:
Keywords: DVB channelscan QString | Ticket locked: 0
initialization |
-------------------------------------------------+-------------------------
Changes (by Klaas de Waal):

* owner: (none) => David Hampton
* status: new => assigned


--
Ticket URL: <https://code.mythtv.org/trac/ticket/13420#comment:1>
MythTV <http://www.mythtv.org>
MythTV Media Center
Re: Ticket #13420: DB Error in mythtv-setup and QString initialization [ In reply to ]
#13420: DB Error in mythtv-setup and QString initialization
-------------------------------------------------+-------------------------
Reporter: Klaas de Waal | Owner: David
| Hampton
Type: Patch - Bug Fix | Status: closed
Priority: minor | Milestone:
| needs_triage
Component: MythTV - Channel Scanner | Version: Master
| Head
Severity: medium | Resolution: fixed
Keywords: DVB channelscan QString | Ticket locked: 0
initialization |
-------------------------------------------------+-------------------------
Changes (by David Hampton <mythtv@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"fcc1aa52245c5b6bc852e43f26182aef8d3a3269/mythtv"
fcc1aa522/mythtv]:
{{{
#!CommitTicketReference repository="mythtv"
revision="fcc1aa52245c5b6bc852e43f26182aef8d3a3269"
Catch and fix uninitialized QStrings passed to SQL code.

Most of Qt5 treats an uninitialized string and an empty string as the
same thing. QSqlQuery doesn't, storing NULL for the former and "" for
the latter. Add a new function for storing a non-null database field
that will store both of these QStrings as "".

Fixes #13420
}}}

--
Ticket URL: <https://code.mythtv.org/trac/ticket/13420#comment:2>
MythTV <http://www.mythtv.org>
MythTV Media Center
Re: Ticket #13420: DB Error in mythtv-setup and QString initialization [ In reply to ]
#13420: DB Error in mythtv-setup and QString initialization
-------------------------------------------------+-------------------------
Reporter: Klaas de Waal | Owner: David
| Hampton
Type: Patch - Bug Fix | Status: closed
Priority: minor | Milestone:
| needs_triage
Component: MythTV - Channel Scanner | Version: Master
| Head
Severity: medium | Resolution: fixed
Keywords: DVB channelscan QString | Ticket locked: 0
initialization |
-------------------------------------------------+-------------------------

Comment (by jpilk):

Line 355 in channelinfo.cpp looks like a preexisting typo ?

query.bindValue(":IS_OPEBCABLE", m_is_opencable);

--
Ticket URL: <https://code.mythtv.org/trac/ticket/13420#comment:3>
MythTV <http://www.mythtv.org>
MythTV Media Center
Re: Ticket #13420: DB Error in mythtv-setup and QString initialization [ In reply to ]
#13420: DB Error in mythtv-setup and QString initialization
-------------------------------------------------+-------------------------
Reporter: Klaas de Waal | Owner: David
| Hampton
Type: Patch - Bug Fix | Status: closed
Priority: minor | Milestone:
| needs_triage
Component: MythTV - Channel Scanner | Version: Master
| Head
Severity: medium | Resolution: fixed
Keywords: DVB channelscan QString | Ticket locked: 0
initialization |
-------------------------------------------------+-------------------------

Comment (by David Hampton):

Yes, but a consistent typo (the same in two places) so it worked properly.
:-)

--
Ticket URL: <https://code.mythtv.org/trac/ticket/13420#comment:4>
MythTV <http://www.mythtv.org>
MythTV Media Center
Re: Ticket #13420: DB Error in mythtv-setup and QString initialization [ In reply to ]
#13420: DB Error in mythtv-setup and QString initialization
-------------------------------------------------+-------------------------
Reporter: Klaas de Waal | Owner: David
| Hampton
Type: Patch - Bug Fix | Status: closed
Priority: minor | Milestone:
| needs_triage
Component: MythTV - Channel Scanner | Version: Master
| Head
Severity: medium | Resolution: fixed
Keywords: DVB channelscan QString | Ticket locked: 0
initialization |
-------------------------------------------------+-------------------------

Comment (by David Hampton <mythtv@…>):

In [changeset:"19a51cb4052152e5429962f6ee65e2f6dc4592bb/mythtv"
19a51cb405/mythtv]:
{{{
#!CommitTicketReference repository="mythtv"
revision="19a51cb4052152e5429962f6ee65e2f6dc4592bb"
Catch and fix uninitialized QStrings passed to SQL code.

Most of Qt5 treats an uninitialized string and an empty string as the
same thing. QSqlQuery doesn't, storing NULL for the former and "" for
the latter. Add a new function for storing a non-null database field
that will store both of these QStrings as "".

Fixes #13420
}}}

--
Ticket URL: <https://code.mythtv.org/trac/ticket/13420#comment:5>
MythTV <http://www.mythtv.org>
MythTV Media Center
Re: Ticket #13420: DB Error in mythtv-setup and QString initialization [ In reply to ]
#13420: DB Error in mythtv-setup and QString initialization
-------------------------------------------------+-------------------------
Reporter: Klaas de Waal | Owner: David
| Hampton
Type: Patch - Bug Fix | Status: closed
Priority: minor | Milestone: 31.0
Component: MythTV - Channel Scanner | Version: Master
| Head
Severity: medium | Resolution: fixed
Keywords: DVB channelscan QString | Ticket locked: 0
initialization |
-------------------------------------------------+-------------------------
Changes (by Stuart Auchterlonie):

* milestone: needs_triage => 31.0


--
Ticket URL: <https://code.mythtv.org/trac/ticket/13420#comment:6>
MythTV <http://www.mythtv.org>
MythTV Media Center
Re: Ticket #13420: DB Error in mythtv-setup and QString initialization [ In reply to ]
#13420: DB Error in mythtv-setup and QString initialization
-------------------------------------------------+-------------------------
Reporter: Klaas de Waal | Owner: David
| Hampton
Type: Patch - Bug Fix | Status: closed
Priority: minor | Milestone: 31.0
Component: MythTV - Channel Scanner | Version: Master
| Head
Severity: medium | Resolution: fixed
Keywords: DVB channelscan QString | Ticket locked: 0
initialization |
-------------------------------------------------+-------------------------

Comment (by Klaas de Waal <kdewaal@…>):

In [changeset:"28e98a80ed6cf5595732eb3f17a703316c9a4b2c/mythtv"
28e98a80ed/mythtv]:
{{{
#!CommitTicketReference repository="mythtv"
revision="28e98a80ed6cf5595732eb3f17a703316c9a4b2c"
More use of bindValueNoNull to fix DB error messages about null values.

Use the bindValueNoNull for all QString variables that are used for
database access in ChannelUtil::CreateChannel and
ChannelUtil::UpdateChannel.
Remove existing code to check for null because bindValueNoNull is now
used.

Refs #13420
}}}

--
Ticket URL: <https://code.mythtv.org/trac/ticket/13420#comment:7>
MythTV <http://www.mythtv.org>
MythTV Media Center