![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| Database Database problems or need to ask a question? maybe something to do with sql injections or a database software question. Database topics cover MySQL, PostgreSQL, Oracle, SQL Server or anything else related to databases. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| Hi Everyone, I have a php batch job that i'd like to run on two machines. The batch job creates reports and sends them to my users. Im trying to develop a way that the scripts wont send the same report to my users twice. Does anyone have some suggestions on how to block one script from reading the table while the other script is reading the table? so for instace: in my table i have : * reports -- id -- status I want job #1 to read reports where status = 0 and then send them out then update to status = 1. I dont want job #2 to be able to read the table in the mean time and run the same process. -d | |||
| Advertisements |
| | #2 | ||
| Hello, David Wang <dasn0wie@gmail.com> schrieb: > Does anyone have some suggestions on how to block one script from > reading the table while the other script is reading the table? Do you understand the concept of transactions? kind regards, Andreas | |||
| | #3 | ||
| starting a transaction here would not help me as i'm trying to disallow a read of that specific row. the only thing that i've seen that may work is locking the entire table, but im not sure if that is the correct approach. suggestions? -d On Jun 25, 11:22 am, Andreas Stieger <Andreas.Stie...@gmx.de> wrote: > Hello, > > David Wang <dasn0...@gmail.com> schrieb: > > > Does anyone have some suggestions on how to block one script from > > reading the table while the other script is reading the table? > > Do you understand the concept of transactions? > > kind regards, > Andreas | |||
| | #4 | ||
| David Wang <dasn0wie@gmail.com> wrote in news:1182789456.165433.6730 @d30g2000prg.googlegroups.com: > starting a transaction here would not help me as i'm trying to > disallow a read of that specific row. the only thing that i've seen > that may work is locking the entire table, but im not sure if that is > the correct approach. suggestions? sounds it... better remember to unlock it, though! | |||
| | #5 | ||
| On Jun 25, 12:37 pm, David Wang <dasn0...@gmail.com> wrote: > starting a transaction here would not help me as i'm trying to > disallow a read of that specific row. the only thing that i've seen > that may work is locking the entire table, but im not sure if that is > the correct approach. suggestions? > > -d > > On Jun 25, 11:22 am, Andreas Stieger <Andreas.Stie...@gmx.de> wrote: > > > > > Hello, > > > David Wang <dasn0...@gmail.com> schrieb: > > > > Does anyone have some suggestions on how to block one script from > > > reading the table while the other script is reading the table? > > > Do you understand the concept of transactions? > > > kind regards, > > Andreas- Hide quoted text - > > - Show quoted text - It sounds like a table lock (and yes, of course followed by an unlock) is what you need. If the total time your queries take while the table is locked is short then it shouldn't be a problem. | |||
| | #6 | ||
| Just wanted to give an update for other developers out there on what I did. To guarantee that each process didn't mash each other, i locked the table as well as did a select ... for update. it might be over kill but i got the best results with this and no mashing of data and no deadlock errors. thanks for all the suggestions! On Jun 28, 12:58 pm, Kevin Day <kda...@gmail.com> wrote: > On Jun 25, 12:37 pm, David Wang <dasn0...@gmail.com> wrote: > > > > > starting a transaction here would not help me as i'm trying to > > disallow a read of that specific row. the only thing that i've seen > > that may work is locking the entire table, but im not sure if that is > > the correct approach. suggestions? > > > -d > > > On Jun 25, 11:22 am, Andreas Stieger <Andreas.Stie...@gmx.de> wrote: > > > > Hello, > > > > David Wang <dasn0...@gmail.com> schrieb: > > > > > Does anyone have some suggestions on how to block one script from > > > > reading the table while the other script is reading the table? > > > > Do you understand the concept of transactions? > > > > kind regards, > > > Andreas- Hide quoted text - > > > - Show quoted text - > > It sounds like a table lock (and yes, of course followed by an unlock) > is what you need. If the total time your queries take while the table > is locked is short then it shouldn't be a problem. | |||
| Featured Websites | ||||
|
![]() |
| Tags: blocking, mysql, read |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) | Cteodor | Database | 0 | 07-01-2007 6:43 PM |
| GPS Blocking Exercise Cornwall UK June 2007 | Fred | GPS | 0 | 06-26-2007 12:04 AM |
| Blocking Devices | Rocketman | Bluetooth Software and Hardware | 0 | 06-17-2007 1:37 PM |
| Easy home based business.If you read nothing else,read this. | Helen | Building An Internet Business | 0 | 05-29-2007 2:30 AM |
| Easy home based business.If you read nothing else,read this. | Helen | Building An Internet Business | 0 | 05-29-2007 2:30 AM |
| Featured Websites | ||||
|