diff options
author | David Teirney <david@teirney.net> | 2012-06-20 23:11:06 +1200 |
---|---|---|
committer | David Teirney <david@teirney.net> | 2012-06-20 23:11:06 +1200 |
commit | b7e6a36d09b43689184280000e2409fb28d6e34c (patch) | |
tree | 435cb2e336cedab69a6ad7fdd53d411418c8f226 /lib/cmyth | |
parent | 716c438dc78f4b331e15060abbbd3cdcc7da661e (diff) |
[libcmyth] Add cmyth_update_bookmark_setting method from upstream.
Diffstat (limited to 'lib/cmyth')
-rw-r--r-- | lib/cmyth/include/cmyth/cmyth.h | 1 | ||||
-rw-r--r-- | lib/cmyth/libcmyth/mythtv_mysql.c | 25 |
2 files changed, 26 insertions, 0 deletions
diff --git a/lib/cmyth/include/cmyth/cmyth.h b/lib/cmyth/include/cmyth/cmyth.h index fe26346cf4..7d7f87efbe 100644 --- a/lib/cmyth/include/cmyth/cmyth.h +++ b/lib/cmyth/include/cmyth/cmyth.h @@ -1056,6 +1056,7 @@ extern cmyth_freespace_t cmyth_freespace_create(void); */ extern long long cmyth_get_bookmark(cmyth_conn_t conn, cmyth_proginfo_t prog); extern int cmyth_get_bookmark_offset(cmyth_database_t db, long chanid, long long mark); +extern int cmyth_update_bookmark_setting(cmyth_database_t, cmyth_proginfo_t); extern int cmyth_get_bookmark_mark(cmyth_database_t, cmyth_proginfo_t, long long); extern int cmyth_set_bookmark(cmyth_conn_t conn, cmyth_proginfo_t prog, long long bookmark); diff --git a/lib/cmyth/libcmyth/mythtv_mysql.c b/lib/cmyth/libcmyth/mythtv_mysql.c index 358cde8fe5..3e7e4be084 100644 --- a/lib/cmyth/libcmyth/mythtv_mysql.c +++ b/lib/cmyth/libcmyth/mythtv_mysql.c @@ -665,6 +665,31 @@ fill_program_recording_status(cmyth_conn_t conn, char * msg) } return err; } +int +cmyth_update_bookmark_setting(cmyth_database_t db, cmyth_proginfo_t prog) +{ + MYSQL_RES *res = NULL; + const char *query_str = "UPDATE recorded SET bookmark = 1 WHERE chanid = ? AND starttime = ?"; + cmyth_mysql_query_t * query; + char starttime[CMYTH_TIMESTAMP_LEN + 1]; + + cmyth_timestamp_to_string(starttime, prog->proginfo_rec_start_ts); + query = cmyth_mysql_query_create(db,query_str); + if (cmyth_mysql_query_param_long(query, prog->proginfo_chanId) < 0 + || cmyth_mysql_query_param_str(query, starttime) < 0 ) { + cmyth_dbg(CMYTH_DBG_ERROR,"%s, binding of query parameters failed! Maybe we're out of memory?\n", __FUNCTION__); + ref_release(query); + return -1; + } + res = cmyth_mysql_query_result(query); + ref_release(query); + if (res == NULL) { + cmyth_dbg(CMYTH_DBG_ERROR, "%s, finalisation/execution of query failed!\n", __FUNCTION__); + return -1; + } + mysql_free_result(res); + return (1); +} int cmyth_get_bookmark_mark(cmyth_database_t db, cmyth_proginfo_t prog, long long bk) |