Announcement

Collapse
No announcement yet.

Adding fields to a database

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Adding fields to a database



    I actually spent quite some time researching a bug in MvLOCKFILE.
    I've posted this before, but never received a response.
    <A HREF ="http://www.mvdevelopment.com/mvlists2/10/88999.html">http://www.mvdevelopment.com/mvlists2/10/88999.html</A>

    I've posted the test script I used here:
    <A HREF ="http://www.becoded.com/lockfile_test.txt">http://www.becoded.com/lockfile_test.txt</A>

    To my knowledge, the problem I encountered still exists.

    -Brian
    Burns Enterprises


    From: MvMarkus <[email protected]>
    Date: Mon, 14 Feb 2005 20:37:44 +0100
    Subject: RE: [meu] Adding fields to a database
    To: Patrick Locke <[email protected]>, Sandy Rozhon
    <[email protected]>, Miva Userlist <[email protected]>

    Unless you have an index on the serial column, a relatively secure and easy
    way to increment a record is to rely on the physical order of the records in
    the db. For this, you don't use an index.

    MvOpen DB -> without <- any indices
    MvLockfile
    MvGO db row=bottom
    MvASSIGN =l.lastID VALUE=d.serial_column
    MvSetIndex all indices
    MvASSIGN =d.serial_column Value=l.lastID+1
    MvASSIGN = all other columns....
    MvADD
    /MvLockfile

    One should not rely on the built-in locking mechanism of MvADD/MvUPDATE and
    instead lock the table manually with MvLOCKFILE, because the function
    (especially opening the indices) might be quite I/O expensive (slow).

    Obviously, this technique only works as long as the table is not physically
    reorganized. In that case, it's better to use an index on d.serial_column
    and/or do a lookup to check if the value already exists before adding a new
    one.

    Markus

    -----Original Message-----
    From: [email protected] [mailto:[email protected]] On Behalf
    Of Patrick Locke
    Sent: Montag, 14. Februar 2005 20:31
    To: Sandy Rozhon; Miva Userlist
    Subject: Re: [meu] Adding fields to a database

    I am not familiar with the database you are building but if it is not
    updated by many people you can use alias.d.recno for this. I have some dbs
    that I am the only one that updates the information and i use this method
    all the time to update information. But with multiple people being able to
    update, it sometimes can cause problems.

    Patrick
    ----- Original Message -----
    From: "Sandy Rozhon" <[email protected]>
    To: "Miva Userlist" <[email protected]>
    Sent: Saturday, February 12, 2005 1:58 PM
    Subject: [meu] Adding fields to a database

    > I'm a newcomer to programming Miva databases. All my previous
    > experience was on flat files.
    >
    > So my first effort to create, add, and delete records has been
    > successful, but now I see that having some sort of serial number on
    > each record might make it easier to do editing and/or deleting of a
    > specific record. Is it possible to add a new field, or do I have to
    > go through the creation process all over again? If so, what happens
    > to the data I've already collected?
    >
    > Are there approved ways of doing this sort of thing?
    >
    > Sandy

Working...
X