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
Area 51 - Testing Area
Centralised database in My Video, My Pictures and folder settings
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="regeszter" data-source="post: 1124919" data-attributes="member: 15874"><p>If Trakt uses the <a href="https://github.com/MediaPortal/MediaPortal-1/blob/master/mediaportal/Databases/Video/VideoDatabase.cs#L702" target="_blank">ExecuteSql() </a>or the <a href="https://github.com/MediaPortal/MediaPortal-1/blob/master/mediaportal/Databases/Video/VideoDatabase.cs#L707" target="_blank">ExecuteRuleSql() </a>it won't work because the EF can not run sql without declare the return type.</p><p>If the Trakt uses API where the method run a "free hand sql" like</p><p></p><p>GetMoviesByFilter(string sql, out ArrayList movies, bool actorTable, bool movieinfoTable, bool genreTable, bool usergroupTable)</p><p></p><p>It will run but with strict conditions.</p><p></p><p>A sample:</p><p></p><p>original code</p><p></p><p>[code]strSQL = String.Format("SELECT * FROM path WHERE strPath = '{0}'", strPath);</p><p></p><p>SQLiteResultSet results = m_db.Execute(strSQL);</p><p></p><p>if (results.Rows.Count > 0)</p><p>{</p><p> int lPathId;</p><p> Int32.TryParse(DatabaseUtility.Get(results, 0, "idPath"), out lPathId);</p><p> return lPathId;</p><p>}[/code]</p><p></p><p>with EF LINQ query:</p><p></p><p>[code]var query = (from sql in _connection.paths</p><p> where sql.idPath == pathID</p><p> select sql).FirstOrDefault<>();</p><p></p><p>if (query == null)</p><p>{</p><p> return;</p><p>}</p><p></p><p>string path = query.strPath;[/code]</p></blockquote><p></p>
[QUOTE="regeszter, post: 1124919, member: 15874"] If Trakt uses the [URL='https://github.com/MediaPortal/MediaPortal-1/blob/master/mediaportal/Databases/Video/VideoDatabase.cs#L702']ExecuteSql() [/URL]or the [URL='https://github.com/MediaPortal/MediaPortal-1/blob/master/mediaportal/Databases/Video/VideoDatabase.cs#L707']ExecuteRuleSql() [/URL]it won't work because the EF can not run sql without declare the return type. If the Trakt uses API where the method run a "free hand sql" like GetMoviesByFilter(string sql, out ArrayList movies, bool actorTable, bool movieinfoTable, bool genreTable, bool usergroupTable) It will run but with strict conditions. A sample: original code [code]strSQL = String.Format("SELECT * FROM path WHERE strPath = '{0}'", strPath); SQLiteResultSet results = m_db.Execute(strSQL); if (results.Rows.Count > 0) { int lPathId; Int32.TryParse(DatabaseUtility.Get(results, 0, "idPath"), out lPathId); return lPathId; }[/code] with EF LINQ query: [code]var query = (from sql in _connection.paths where sql.idPath == pathID select sql).FirstOrDefault<>(); if (query == null) { return; } string path = query.strPath;[/code] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Area 51 - Testing Area
Centralised database in My Video, My Pictures and folder settings
Contact us
RSS
Top
Bottom