Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Accessing SQLite databases within ZIP files

by wjw (Priest)
on Oct 01, 2017 at 15:24 UTC ( [id://1200470]=note: print w/replies, xml ) Need Help??


in reply to Accessing SQLite databases within ZIP files

If I understand this, you want to extract only the SQLite file from a zip file which may contain any number of other file types, operate on the SQLite DB, and then discard the SQLite DB you operated on (but not from the zip file). One question I would ask is whether or not the SQLite files conform to some sort of naming convention such as a common file name extension. If so, then using something as simple as Archive::Zip to extract the SQLite DB, as it has a simple interface to grab hold of the names of the members and even some searching using membersMatching( { regex => $regex } ).

I think that if disk space is an issue, then memory would be and issue also. Are the SQLite files that big? Being that you only have to extract the SQLite DB file and have complete control over where it goes, it should be pretty easy to identify, extract, operate on and then delete that single file. (But maybe I am missing the point?)

...the majority is always wrong, and always the last to know about it...

A solution is nothing more than a clearly stated problem...

Replies are listed 'Best First'.
Re^2: Accessing SQLite databases within ZIP files
by AppleFritter (Vicar) on Oct 01, 2017 at 18:05 UTC

    I think that if disk space is an issue, then memory would be and issue also.

    You'd think so! But I actually usually have less disk space available than I have RAM. The old adage that there isn't a HD you can fill to the brim with random bric-a-brac in three weeks' time is still true.

    That said — the SQLite DBs I've encountered so far aren't that big, no; on the order of (tens of) megabytes, which wouldn't be an issue even for me. OTOH there's no a priori reason they couldn't be (much) larger.

    Being that you only have to extract the SQLite DB file and have complete control over where it goes, it should be pretty easy to identify, extract, operate on and then delete that single file. (But maybe I am missing the point?)

    No, you got it nailed. I was really only asking because I'm too lazy to put in even that much work!

Re^2: Accessing SQLite databases within ZIP files
by holli (Abbot) on Oct 01, 2017 at 16:10 UTC
    I think that if disk space is an issue, then memory would be and issue also.
    Very good point you found there. Can I have it?


    holli

    You can lead your users to water, but alas, you cannot drown them.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1200470]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-19 17:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found