[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: [mv] File Locking [tag export database]
Quoting Handytman@aol.com (Handytman@aol.com):
>
> Question: Do [tag export database] and [tag flag write] 'lock' the file
> before operating upon it?
Of course.
>
> Reason For Asking: I am trying to track inventory with MiniVend. The code on
> the 'report.html' page appears to update the 'qty' field in 'inventory.gdbm'
> but not the corresponding field in 'inventory.asc.' However, I want my client
> to be able to look at 'inventory.asc' and see up-to-date numbers. So...
> I could add [tag export inventory inventory.asc][/tag] to the report.html
> page. That (if I understand correctly) would rewrite 'inventory.asc' every
> time an order is placed, with updated quantities. The only fear I have is of
> near-simultaneous orders getting garbled data from an unlocked, open file.
>
> Then again, if I can safely rewrite 'inventory.asc' from the receipt page,
> why not just add a quantity field to 'products.asc' and rewrite *this* file
> with each order....Hmmm :o)
Don't use the products table. That would hold off all catalog accesses
while the write was in effect. Use a small outboard table.
SQL is best for this kind of stuff, though. While you can do some
read-write operations with MiniVend DBM databases, it won't scale to
busy (hundred thousand hits per day or more) catalogs.
--
Mike Heins http://www.minivend.com/ ___
Internet Robotics |_ _|____
I don't buy from direct 131 Willow Lane, Floor 2 | || _ \
telephone or email marketers. Oxford, OH 45056 | || |_) |
This makes it hard for <mikeh@minivend.com> |___| _ <
me to find a phone company. ;> 513.523.7621 FAX 7501 |_| \_\