Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Hi All:

Im a novice and many times I come up with alternatives that are not always the wisest way to go about something..

I need advise regarding how to save some info that needs to be retrieved and changed often, (every 20 seconds or so), and dont want to used MySQL or any other database requering Structured query language.

If I save each record in a single Flat File, it would need to be opened, read, and rewritten, which I assume is not the fastest technique.. If I save all records in a single flat file, (one record per line), reading the whole file into memory every 20 seconds and change what's needed may not be the best way to go either, knowing there could be 15.000 lines or more... so I thought perhaps I could save each record in a different directory name.

Example:

I need to save name, username, time, and two other numerical parameters, so I would call my directory:

JohnSmith_jhon99_10:30:01_345_765

Then split the directory name into array values and change what's needed, 20 seconds later the name of the directory could look like this:

JohnSmith_jhon99_10:30:21_465_112

Is the above method a feasible solution..??

What would happen if more than one need to change the directory name at the same time. I know that in a flat file system you can lock the file with flock and change the data without worries, but what is used in the case of directory names..??

Thanx for your input
VirtualWeb

------------------------------------
ADDENDUM September 18th

Thanx for all the input

The reason why I was trying to come up with an alternative to a proper database is because i dont know how to install one in my Windows PC environment.

I have read query language tutorials and is, (as you pointed out), very easy but dont know how do I install the simplest database, how do I test my scripts locally, how to move it to the server for final installation.

Since I discarded the idea of renaming directories, I continue this conversation on node Query Language with Flat Files
http://perlmonks.org/?node_id=796175


In reply to Flock to Rename Directory by virtualweb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (6)
    As of 2020-01-23 11:10 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Notices?