Skip to content

Commit

Permalink
Services API: Add/UpdateRecordSchedule, prevent DB Errors when timest…
Browse files Browse the repository at this point in the history
…amps aren't passed

Because they aren't required for SearchTypes other than None and Manual,
the start/end date/time, weren't being validated. If StartTime and EndTime
prarmeters weren't passed, then when an INSERT/UPDATE was done, the NULL
fields caused a DB Error and the API returned -1 ({"uint": "4294967295"}.)

This fix allows NULLs in the start/end date/time in the record table.

Fixes #13056
  • Loading branch information
Bill Meek committed Jun 17, 2017
1 parent 7d2be78 commit a296331
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mythtv/bindings/perl/MythTV.pm
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ package MythTV;
# schema version supported in the main code. We need to check that the schema
# version in the database is as expected by the bindings, which are expected
# to be kept in sync with the main code.
our $SCHEMA_VERSION = "1347";
our $SCHEMA_VERSION = "1348";

# NUMPROGRAMLINES is defined in mythtv/libs/libmythtv/programinfo.h and is
# the number of items in a ProgramInfo QStringList group used by
Expand Down
2 changes: 1 addition & 1 deletion mythtv/bindings/python/MythTV/static.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""

OWN_VERSION = (0,28,-1,0)
SCHEMA_VERSION = 1347
SCHEMA_VERSION = 1348
NVSCHEMA_VERSION = 1007
MUSICSCHEMA_VERSION = 1018
PROTO_VERSION = '91'
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythbase/mythversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
* mythtv/bindings/php/MythBackend.php
*/

#define MYTH_DATABASE_VERSION "1347"
#define MYTH_DATABASE_VERSION "1348"


MBASE_PUBLIC const char *GetMythSourceVersion();
Expand Down
13 changes: 13 additions & 0 deletions mythtv/libs/libmythtv/dbcheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3392,6 +3392,19 @@ NULL
return false;
}

if (dbver == "1347")
{
const char *updates[] = {
"ALTER TABLE record MODIFY COLUMN startdate DATE DEFAULT NULL",
"ALTER TABLE record MODIFY COLUMN enddate DATE DEFAULT NULL",
"ALTER TABLE record MODIFY COLUMN starttime TIME DEFAULT NULL",
"ALTER TABLE record MODIFY COLUMN endtime TIME DEFAULT NULL",
NULL
};
if (!performActualUpdate(updates, "1348", dbver))
return false;
}

return true;
}

Expand Down

0 comments on commit a296331

Please sign in to comment.