Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 03-29-2010, 09:33 AM   #1
jjansen
J
jjansen can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterjjansen can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterjjansen can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterjjansen can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterjjansen can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterjjansen can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterjjansen can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterjjansen can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterjjansen can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterjjansen can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterjjansen can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
Posts: 188
Karma: 12590
Join Date: Mar 2009
Location: Canada
Device: SONY PRS 505/300, iRex DR800SG, Nook
Using SQL against Calibre database

Is there someway that I can achieve the following function against the Calibre database.

Update Calibre Set COMMENT = 'new text string' concat COMMENT
where publisher = 'Ramsay House'

I want to bulk add some text to the COMMENT field for a specific publishers records.

Thanks.......Jackie
jjansen is offline   Reply With Quote
Old 03-29-2010, 09:40 AM   #2
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,703
Karma: 6658935
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
This issue is discussed in the thread under this link. See in particular Kovid's answer near the end of the thread.

Good luck!
chaley is offline   Reply With Quote
Advert
Old 03-29-2010, 09:55 AM   #3
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by chaley View Post
This issue is discussed in the thread under this link. See in particular Kovid's answer near the end of the thread.

Good luck!
Kovid's answer provides the right clue, but there was a typo and a minor change needed to make it actually work. Try searching for a reply post I made to someone who wanted an SQL query to list all books with duplicate titles. It shows the changes needed in a working example.
Starson17 is offline   Reply With Quote
Old 03-29-2010, 10:14 AM   #4
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
I should point out that so far, I've only used the direct SQL to do queries, not change records. There are triggers in the SQL database that will run when done the way I described, but I'm not totally certain whether those triggers will deal with all issues that need to be dealt with.

I'm in the midst of cleaning up my large database, and one of the things I expect to need to do will be similar to what you want to do. I've written enough code to know how to do it by code using Kovid's modules. I'm not at home, but I believe the modules needed are in database2.py.

The way I'd do this in the code is to SQL search for the records that match the author, put the ids of those records into a list, do a loop through the list to read the metadata into a variable mi. mi.comments will be the old comments. concatenate the new text into mi.comments = mi.comments + 'New Text' then use the function in database2 that updates all the metadata for the specified index.

You might want to look at the code I uploaded for the merge record function in the bug tracker. It does a lot of that type of thing, including concatenating comments from multiple records. If I was doing it now, I'd set up the development environment and just briefly add the code I need to another function, then take it out when done, although I'm sure there's a way to write a little chunk of python code, put it in a script file and execute the script from the command line. Maybe Kovid will comment.
Starson17 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calibre 7.7 cant open database Patricia1066 Calibre 17 07-05-2010 10:23 AM
If Calibre can't find the database... guyanonymous Calibre 7 02-27-2010 02:48 PM
Reference Database in Calibre? nnxbtz Calibre 5 09-27-2009 06:16 PM
HELP! Please Please Please! (Calibre Database Crash) Abisha Calibre 7 06-10-2009 10:54 PM
Possible to get tags from the calibre database? GRiker Calibre 4 05-04-2009 02:30 PM


All times are GMT -4. The time now is 04:33 AM.


MobileRead.com is a privately owned, operated and funded community.