moaxcp / download-magic

Automatically exported from code.google.com/p/project-penny
0 stars 0 forks source link

Add multiple words/links to DAO #73

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Add methods that will add lists of words and links.

Parsing a file is very slow. This is caused by the IO required to add 
individual words to the DB. Add these methods to speed up the DB inserts.

This is not the only requirement. EventList and property change support fires 
for each individual add. There has to be a way to group these adds together and 
send them to the DB. I believe this can be done using DownloadSaver.

In DownloadSaver.listChanged() the loop goes through listChanges. The 
words/links can be put into a list and when the loop is finished they can be 
added to the db.

The other requirement is in the Parser. The parser only adds individual 
words/links to the EventList. I believe this means that listChanges will only 
have one element. The parser needs to queue up the words/links into a list and 
then add them to the download's word/link list using list.addAll().

This will break the idea of saving everything in real time if the program 
crashes while it is downloading and building this list. Because of this the 
user should be aware and the size of the list being built should be a setting 
for the Parser.

Original issue reported on code.google.com by moa...@gmail.com on 24 Jan 2013 at 11:33

GoogleCodeExporter commented 9 years ago
Insert multiple rows: 
http://docs.oracle.com/javadb/10.4.2.1/devguide/cdevtricks807337.html

Derby supports the complete SQL-92 VALUES clause; this is very handy in several 
cases.

The first useful case is that it can be used to insert multiple rows:

INSERT INTO OneColumnTable VALUES 1,2,3,4,5,6,7,8

INSERT INTO TwoColumnTable VALUES
    (1, 'first row'),
    (2, 'second row'),
    (3, 'third row')
Dynamic parameters reduce the number of times execute requests are sent across:

ij> -- send 5 rows at a time:
ij> PREPARE p1 AS 'INSERT INTO ThreeColumnTable VALUES 
(?,?,?), (?,?,?), (?,?,?), (?,?,?), (?,?,?)';
ij> EXECUTE p1 USING 'VALUES (''1st'',1,1,''2nd'',2,2,''3rd'',
3,3,''4th'',4,4,''5th'',5,5)';

Original comment by moa...@gmail.com on 24 Jan 2013 at 1:10

GoogleCodeExporter commented 9 years ago

Original comment by moa...@gmail.com on 25 Jan 2013 at 10:30

GoogleCodeExporter commented 9 years ago

Original comment by moa...@gmail.com on 31 Jan 2013 at 11:22