summaryrefslogtreecommitdiff
path: root/parse.cpp
diff options
context:
space:
mode:
authorJochen Dolze <vdr@dolze.de>2012-04-13 00:25:50 +0200
committerJochen Dolze <vdr@dolze.de>2012-04-13 00:25:50 +0200
commit38dc897af5dc53fba5ce21a5aad55a6454effea5 (patch)
treea3bc9b0a7f22b1b7dcae02f0298313048b83876d /parse.cpp
parent5d943515babc18cba0576f21f4c89a389d5f60c0 (diff)
downloadvdr-plugin-xmltv2vdr-38dc897af5dc53fba5ce21a5aad55a6454effea5.tar.gz
vdr-plugin-xmltv2vdr-38dc897af5dc53fba5ce21a5aad55a6454effea5.tar.bz2
Improved sqlite handling
Diffstat (limited to 'parse.cpp')
-rw-r--r--parse.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/parse.cpp b/parse.cpp
index 969c728..042f6ad 100644
--- a/parse.cpp
+++ b/parse.cpp
@@ -564,7 +564,13 @@ int cParse::Process(cEPGExecutor &myExecutor,char *buffer, int bufsize)
"starrating text, video text, audio text, season int, episode int, mixing int," \
"srcidx int," \
"PRIMARY KEY(src, channelid, eventid)" \
- ")";
+ ");" \
+ "CREATE UNIQUE INDEX IF NOT EXISTS idx1 on epg (eventid, src); " \
+ "CREATE UNIQUE INDEX IF NOT EXISTS idx2 on epg (eventid, channelid); " \
+ "CREATE UNIQUE INDEX IF NOT EXISTS idx3 on epg (eventid, channelid, src); " \
+ "CREATE UNIQUE INDEX IF NOT EXISTS idx4 on epg (starttime, title, channelid); " \
+ "CREATE INDEX IF NOT EXISTS idx5 on epg (starttime, src); " \
+ "BEGIN";
char *errmsg;
if (sqlite3_exec(db,sql,NULL,NULL,&errmsg)!=SQLITE_OK)
@@ -655,13 +661,12 @@ int cParse::Process(cEPGExecutor &myExecutor,char *buffer, int bufsize)
if (!FetchEvent(node)) // sets xevent
{
- source->Dlog("failed to fetch event");
+ source->Tlog("failed to fetch event");
node=node->next;
xmlFree(channelid);
continue;
}
- char *errmsg;
const char *sql=xevent.GetSQL(source->Name(),source->Index(),(const char *) channelid);
if (sqlite3_exec(db,sql,NULL,NULL,&errmsg)!=SQLITE_OK)
{
@@ -679,6 +684,13 @@ int cParse::Process(cEPGExecutor &myExecutor,char *buffer, int bufsize)
break;
}
}
+
+ if (sqlite3_exec(db,"COMMIT",NULL,NULL,&errmsg)!=SQLITE_OK)
+ {
+ source->Elog("sqlite3: %s",errmsg);
+ sqlite3_free(errmsg);
+ }
+
sqlite3_close(db);
xmlFreeDoc(xmltv);