diff options
author | Jochen Dolze <vdr@dolze.de> | 2012-04-13 00:25:50 +0200 |
---|---|---|
committer | Jochen Dolze <vdr@dolze.de> | 2012-04-13 00:25:50 +0200 |
commit | 38dc897af5dc53fba5ce21a5aad55a6454effea5 (patch) | |
tree | a3bc9b0a7f22b1b7dcae02f0298313048b83876d /parse.cpp | |
parent | 5d943515babc18cba0576f21f4c89a389d5f60c0 (diff) | |
download | vdr-plugin-xmltv2vdr-38dc897af5dc53fba5ce21a5aad55a6454effea5.tar.gz vdr-plugin-xmltv2vdr-38dc897af5dc53fba5ce21a5aad55a6454effea5.tar.bz2 |
Improved sqlite handling
Diffstat (limited to 'parse.cpp')
-rw-r--r-- | parse.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -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); |