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 Talk
Synchronizing client databases
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="Anthony Vaughan" data-source="post: 1269310" data-attributes="member: 153283"><p>Hi ajs</p><p></p><p>I am starting a new thread in reply to the following from a thread in the MP2 forum:</p><p></p><p><-- FanartHandler when start automatically search all new pictures and put it to db, dn have rowid in Image table, and TimeStamp (if i remember its time when picture added in db). --></p><p></p><p>The image database does have a time stamp column but it is only a date and is, therefore, not unique. There is also an id column, but it is of type TEXT and is also not unique. What I think would help would be a autoincrement column and I can't see one in the image table.</p><p></p><p>Here's a bit of code that shows what I'm talking about.</p><p></p><p>var maxID = listTo.Max(o => o.idPath);</p><p>foreach (path item in listFrom.Skip((int)maxID))</p><p>{</p><p>list.Add(item);</p><p>}</p><p></p><p>We have two lists From and To. I find the highest id in list To then start to read the From list from the record after the highest To ID and add each item to the To list. This works because the ID is numeric and written to the table in arrival mode. This technique wouldn't be needed for a table with a few records. However, when there are thousands of records, like in the image table, this technique massively reduces resource use and the time to process the data.</p><p></p><p>Here's what I have to do when we don't have an autoincrement ID.</p><p></p><p>foreach (path item in listFrom)</p><p>{</p><p>single = listTo.Find(delegate (path d) { return (d.idPath == item.idPath); });</p><p>if (single == null)</p><p>{</p><p>list.Add(item);</p><p>}</p><p>}</p><p></p><p>Here, we have to read every record in the From list and check, for each From record, whether it exists in the To list, and if it doesn't exist add the From record to the To list. I hope you can appreciate how great the difference between the two options is.</p><p></p><p>I will go ahead without the autoincrement column but if one could be added it would be great. The wonderful thing about having autoincrement fields in tables is that you don't have to reference them in your code because the database engine processes these fields automatically. However, you do have to add the field to your column definitions for the table.</p><p></p><p>Tony</p></blockquote><p></p>
[QUOTE="Anthony Vaughan, post: 1269310, member: 153283"] Hi ajs I am starting a new thread in reply to the following from a thread in the MP2 forum: <-- FanartHandler when start automatically search all new pictures and put it to db, dn have rowid in Image table, and TimeStamp (if i remember its time when picture added in db). --> The image database does have a time stamp column but it is only a date and is, therefore, not unique. There is also an id column, but it is of type TEXT and is also not unique. What I think would help would be a autoincrement column and I can't see one in the image table. Here's a bit of code that shows what I'm talking about. var maxID = listTo.Max(o => o.idPath); foreach (path item in listFrom.Skip((int)maxID)) { list.Add(item); } We have two lists From and To. I find the highest id in list To then start to read the From list from the record after the highest To ID and add each item to the To list. This works because the ID is numeric and written to the table in arrival mode. This technique wouldn't be needed for a table with a few records. However, when there are thousands of records, like in the image table, this technique massively reduces resource use and the time to process the data. Here's what I have to do when we don't have an autoincrement ID. foreach (path item in listFrom) { single = listTo.Find(delegate (path d) { return (d.idPath == item.idPath); }); if (single == null) { list.Add(item); } } Here, we have to read every record in the From list and check, for each From record, whether it exists in the To list, and if it doesn't exist add the From record to the To list. I hope you can appreciate how great the difference between the two options is. I will go ahead without the autoincrement column but if one could be added it would be great. The wonderful thing about having autoincrement fields in tables is that you don't have to reference them in your code because the database engine processes these fields automatically. However, you do have to add the field to your column definitions for the table. Tony [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Talk
Synchronizing client databases
Contact us
RSS
Top
Bottom