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
help wanted
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="samuel337" data-source="post: 8159" data-attributes="member: 10347"><p><strong>Re: still to dumb</strong></p><p></p><p></p><p></p><p>Well first off, there is no DVD database so I'm going to use the video database as an example.</p><p></p><p>Another thing, in MP you can't use the existing code to clear the database (i.e. reference Databases.dll and use the functions in there) because there is no function to clear the database and you can't access the database variable directly (its not public). So you will need your own code to open the database connection:</p><p></p><p>[code]</p><p>function ClearDatabase() </p><p>{</p><p>SQLiteClient m_db=null;</p><p> Log.Write("opening video database");</p><p> try </p><p> {</p><p> // Open database</p><p> try</p><p> {</p><p> System.IO.Directory.CreateDirectory("database");</p><p> }</p><p> catch(Exception){}</p><p> m_db = new SQLiteClient(@"database\videodatabase2.db");</p><p> } </p><p> catch (Exception ex) </p><p> {</p><p> Log.Write("videodatabase exception err:{0} stack:{1}", ex.Message,ex.StackTrace);</p><p> }</p><p> </p><p> Log.Write("video database opened");</p><p></p><p>//now for each table, do this, replacing movie with the table name.</p><p>m_db.Execute("DELETE FROM movie");</p><p></p><p>//close and dispose of the database</p><p>m_db.Close();</p><p>m_db = null;</p><p>}</p><p>[/code]</p><p></p><p>EDIT:</p><p>whoops, forgot to tell you that you need to add the following statements at the top of the file:</p><p>[code]</p><p>using SQLite.NET;</p><p>using MediaPortal.Util;</p><p>[/code]</p><p></p><p>HTH</p><p></p><p>Sam</p></blockquote><p></p>
[QUOTE="samuel337, post: 8159, member: 10347"] [b]Re: still to dumb[/b] Well first off, there is no DVD database so I'm going to use the video database as an example. Another thing, in MP you can't use the existing code to clear the database (i.e. reference Databases.dll and use the functions in there) because there is no function to clear the database and you can't access the database variable directly (its not public). So you will need your own code to open the database connection: [code] function ClearDatabase() { SQLiteClient m_db=null; Log.Write("opening video database"); try { // Open database try { System.IO.Directory.CreateDirectory("database"); } catch(Exception){} m_db = new SQLiteClient(@"database\videodatabase2.db"); } catch (Exception ex) { Log.Write("videodatabase exception err:{0} stack:{1}", ex.Message,ex.StackTrace); } Log.Write("video database opened"); //now for each table, do this, replacing movie with the table name. m_db.Execute("DELETE FROM movie"); //close and dispose of the database m_db.Close(); m_db = null; } [/code] EDIT: whoops, forgot to tell you that you need to add the following statements at the top of the file: [code] using SQLite.NET; using MediaPortal.Util; [/code] HTH Sam [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
help wanted
Contact us
RSS
Top
Bottom