home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Plugins
VB .NET Plugin: sqlite.dll Error
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="STSC" data-source="post: 7075" data-attributes="member: 10535"><p>OK. I know now what it doesn't work:</p><p></p><p>[code] private TVDatabase()</p><p> {</p><p> }</p><p></p><p> /// <summary></p><p> /// static constructor. Opens or creates the tv database from database\TVDatabaseV6.db</p><p> /// </summary></p><p> static TVDatabase()</p><p> {</p><p> lock (typeof(TVDatabase))</p><p> {</p><p> try </p><p> {</p><p> // Open database</p><p> Log.Write("opening tvdatabase");</p><p> System.IO.Directory.CreateDirectory("database");</p><p> //Upgrade();</p><p> m_db = new SQLiteClient(@"database\TVDatabaseV9.db");</p><p> CreateTables();</p><p></p><p> if (m_db!=null)</p><p> {</p><p> m_db.Execute("PRAGMA cache_size=8192\n");</p><p> m_db.Execute("PRAGMA synchronous='OFF'\n");</p><p> m_db.Execute("PRAGMA count_changes='OFF'\n");</p><p> }</p><p></p><p> } </p><p> catch (Exception ex) </p><p> {</p><p> Log.Write("TVDatabase exception err:{0} stack:{1}", ex.Message,ex.StackTrace);</p><p> }</p><p> Log.Write("tvdatabase opened");</p><p> }</p><p> }[/code]</p><p></p><p></p><p>[code]static public bool GetRecordings(ref ArrayList recordings)</p><p> {</p><p> lock (typeof(TVDatabase))</p><p> {</p><p> recordings.Clear();</p><p> try</p><p> {</p><p> if (null==m_db) return false;</p><p> string strSQL;</p><p> strSQL=String.Format("select * from channel,recording where recording.idChannel=channel.idChannel order by iStartTime");</p><p> SQLiteResultSet results;</p><p> results=m_db.Execute(strSQL);</p><p> if (results.Rows.Count== 0) return false;</p><p> for (int i=0; i < results.Rows.Count;++i)</p><p> {</p><p> long iStart=Int64.Parse(Get(results,i,"recording.iStartTime"));</p><p> long iEnd=Int64.Parse(Get(results,i,"recording.iEndTime"));</p><p> TVRecording rec=new TVRecording ();</p><p> rec.Channel=Get(results,i,"channel.strChannel");</p><p> rec.Start=iStart;</p><p> rec.End=iEnd;</p><p> rec.Canceled = Int64.Parse(Get(results,i,"recording.iCancelTime"));</p><p> rec.ID=Int32.Parse(Get(results,i,"recording.idRecording"));</p><p> rec.Title=Get(results,i,"recording.strProgram");</p><p> rec.RecType=(TVRecording.RecordingType)Int32.Parse(Get(results,i,"recording.iRecordingType"));</p><p> int iContectRec=Int32.Parse(Get(results,i,"recording.bContentRecording"));</p><p> if (iContectRec==1) rec.IsContentRecording=true;</p><p> else rec.IsContentRecording=false;</p><p> recordings.Add(rec);</p><p> }</p><p></p><p> return true;</p><p> }</p><p> catch(SQLiteException ex)</p><p> {</p><p> Log.Write("TVDatabase exception err:{0} stack:{1}", ex.Message,ex.StackTrace);</p><p> }</p><p> return false;</p><p> }</p><p> }[/code]</p><p></p><p>The reasen is that I can't initiate a new TVDatabase, which opens the database:</p><p></p><p>Should be like:</p><p>Dim tvb As New MediaPortal.TV.Database.TVDatabase</p><p></p><p>TVDatabase is private!!</p><p></p><p>But I have to insanciate m_db, in order to get it work.</p><p></p><p>Either [USER=10277]frodo[/USER] can change this or I have to program my own SQLite subroutines, but then I don't know if MP supports multi user access.</p><p></p><p>[USER=10277]frodo[/USER] Can you please give me a hint!</p><p></p><p>Thanks!!</p></blockquote><p></p>
[QUOTE="STSC, post: 7075, member: 10535"] OK. I know now what it doesn't work: [code] private TVDatabase() { } /// <summary> /// static constructor. Opens or creates the tv database from database\TVDatabaseV6.db /// </summary> static TVDatabase() { lock (typeof(TVDatabase)) { try { // Open database Log.Write("opening tvdatabase"); System.IO.Directory.CreateDirectory("database"); //Upgrade(); m_db = new SQLiteClient(@"database\TVDatabaseV9.db"); CreateTables(); if (m_db!=null) { m_db.Execute("PRAGMA cache_size=8192\n"); m_db.Execute("PRAGMA synchronous='OFF'\n"); m_db.Execute("PRAGMA count_changes='OFF'\n"); } } catch (Exception ex) { Log.Write("TVDatabase exception err:{0} stack:{1}", ex.Message,ex.StackTrace); } Log.Write("tvdatabase opened"); } }[/code] [code]static public bool GetRecordings(ref ArrayList recordings) { lock (typeof(TVDatabase)) { recordings.Clear(); try { if (null==m_db) return false; string strSQL; strSQL=String.Format("select * from channel,recording where recording.idChannel=channel.idChannel order by iStartTime"); SQLiteResultSet results; results=m_db.Execute(strSQL); if (results.Rows.Count== 0) return false; for (int i=0; i < results.Rows.Count;++i) { long iStart=Int64.Parse(Get(results,i,"recording.iStartTime")); long iEnd=Int64.Parse(Get(results,i,"recording.iEndTime")); TVRecording rec=new TVRecording (); rec.Channel=Get(results,i,"channel.strChannel"); rec.Start=iStart; rec.End=iEnd; rec.Canceled = Int64.Parse(Get(results,i,"recording.iCancelTime")); rec.ID=Int32.Parse(Get(results,i,"recording.idRecording")); rec.Title=Get(results,i,"recording.strProgram"); rec.RecType=(TVRecording.RecordingType)Int32.Parse(Get(results,i,"recording.iRecordingType")); int iContectRec=Int32.Parse(Get(results,i,"recording.bContentRecording")); if (iContectRec==1) rec.IsContentRecording=true; else rec.IsContentRecording=false; recordings.Add(rec); } return true; } catch(SQLiteException ex) { Log.Write("TVDatabase exception err:{0} stack:{1}", ex.Message,ex.StackTrace); } return false; } }[/code] The reasen is that I can't initiate a new TVDatabase, which opens the database: Should be like: Dim tvb As New MediaPortal.TV.Database.TVDatabase TVDatabase is private!! But I have to insanciate m_db, in order to get it work. Either [USER=10277]frodo[/USER] can change this or I have to program my own SQLite subroutines, but then I don't know if MP supports multi user access. [USER=10277]frodo[/USER] Can you please give me a hint! Thanks!! [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
VB .NET Plugin: sqlite.dll Error
Contact us
RSS
Top
Bottom