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
Development
Submit: code patches (MediaPortal/TV-Server/etc.)
optimize listview controls filling in TVSetup - Channel list for groups
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="Vasilich" data-source="post: 762938" data-attributes="member: 97516"><p>[CODE] public IList<TuningDetail> ReferringTuningDetail()</p><p> {</p><p> //select * from 'foreigntable'</p><p> SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (TuningDetail));</p><p></p><p> // where foreigntable.foreignkey = ourprimarykey</p><p> sb.AddConstraint(Operator.Equals, "idChannel", idChannel);</p><p></p><p> // passing true indicates that we'd like a list of elements, i.e. that no primary key</p><p> // constraints from the type being retrieved should be added to the statement</p><p> SqlStatement stmt = sb.GetStatement(true);</p><p></p><p> // execute the statement/query and create a collection of User instances from the result set</p><p> return ObjectFactory.GetCollection<TuningDetail>(stmt.Execute());</p><p></p><p> // TODO In the end, a GentleList should be returned instead of an arraylist</p><p> //return new GentleList( typeof(TuningDetail), this );</p><p> }[/CODE]</p><p>this code is really like "select * from TuningDetails where idChannel = :idChannel". there is anyway only one record can be returned. So we need to ask e.g. "select * from TuningDetails where isTV = true" once, put the result in a dictionary, and then ask dictionary when filling listviews - i believe dictionary search in memory is faster than thousands of sql queries...</p></blockquote><p></p>
[QUOTE="Vasilich, post: 762938, member: 97516"] [CODE] public IList<TuningDetail> ReferringTuningDetail() { //select * from 'foreigntable' SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof (TuningDetail)); // where foreigntable.foreignkey = ourprimarykey sb.AddConstraint(Operator.Equals, "idChannel", idChannel); // passing true indicates that we'd like a list of elements, i.e. that no primary key // constraints from the type being retrieved should be added to the statement SqlStatement stmt = sb.GetStatement(true); // execute the statement/query and create a collection of User instances from the result set return ObjectFactory.GetCollection<TuningDetail>(stmt.Execute()); // TODO In the end, a GentleList should be returned instead of an arraylist //return new GentleList( typeof(TuningDetail), this ); }[/CODE] this code is really like "select * from TuningDetails where idChannel = :idChannel". there is anyway only one record can be returned. So we need to ask e.g. "select * from TuningDetails where isTV = true" once, put the result in a dictionary, and then ask dictionary when filling listviews - i believe dictionary search in memory is faster than thousands of sql queries... [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Development
Submit: code patches (MediaPortal/TV-Server/etc.)
optimize listview controls filling in TVSetup - Channel list for groups
Contact us
RSS
Top
Bottom