Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lock/Flock with DBI 1

Status
Not open for further replies.

perlone

Programmer
May 20, 2001
438
US
Hello,

I'm creating a program where users gets to add a review about a specific product, so far I created normal like when they add the 'comments', it adds to the database. I'm using mySQL for database and I was wondering if anyone could show me how to lock something with DBI. Thank You.
 
Hi there,

When you're using The DBI you don't need to use flock() - The DBI handles that sort of thing for you.

Mike

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

It's like this; even samurai have teddy bears, and even teddy bears get drunk.
 
oh thanks. That makes my life alot easier :)
 
MikeLacey - I've been using three of the DBI modules (Xbase, mySql, and ODBC) and flock() I've had to explicitly call it. I don't think it's automatic because DBI would then be making assunmptions that it has no business making! Flock() is not absolutely necessary but should be used as a matter of good programming. For database "reads" (unless you expect a zillion hits) flock() isn't necessary but should be used for all other database functions.

There's always a better way. The fun is trying to find it!
 
tviman,

I respectfully disagree.

When, for instance, using ORACLE or SQL/Server via The DBI you're actually connecting to the database via Oracle's own software, or Microsoft's.

The database client software requests locks from the database server software, which then locks records/tables within the database.

I can also find no mention of flock() in The DBI documentation.

I'm happy to be proved wrong of course.

Mike

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

It's like this; even samurai have teddy bears, and even teddy bears get drunk.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top