* Add bookmark support for Samsung TVs.

This commit is contained in:
Justin Maggard
2011-08-05 20:36:54 +00:00
parent cdc93f680f
commit d5b77cbd46
7 changed files with 96 additions and 10 deletions

31
sql.c
View File

@ -20,6 +20,7 @@
#include <unistd.h>
#include "sql.h"
#include "upnpglobalvars.h"
#include "log.h"
int
@ -124,7 +125,7 @@ sql_get_int_field(sqlite3 *db, const char *fmt, ...)
}
char *
sql_get_text_field(void *db, const char *fmt, ...)
sql_get_text_field(sqlite3 *db, const char *fmt, ...)
{
va_list ap;
int counter, result, len;
@ -198,3 +199,31 @@ sql_get_text_field(void *db, const char *fmt, ...)
sqlite3_finalize(stmt);
return str;
}
int
db_upgrade(sqlite3 *db)
{
int db_vers;
int ret;
db_vers = sql_get_int_field(db, "PRAGMA user_version");
if (db_vers == DB_VERSION)
return 0;
if (db_vers < 1)
return -1;
if (db_vers < 5)
return 5;
if (db_vers < 6)
{
DPRINTF(E_WARN, L_DB_SQL, "Updating DB version to v%d.\n", DB_VERSION);
ret = sql_exec(db, "CREATE TABLE BOOKMARKS ("
"ID INTEGER PRIMARY KEY, "
"SEC INTEGER)");
if( ret != SQLITE_OK )
return 6;
}
sql_exec(db, "PRAGMA user_version = %d", DB_VERSION);
return 0;
}