Computer Webmaster Gaming Console Graphics Forum

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.

MK PitStop Main Earn $25 Earn Money Posting Extras Members Blogs Image Hosting User Pages
Go Back   Computer Webmaster Gaming Console Graphics Forum > Webmaster Forum > Website Coding > Database
Register FAQ/Rules Become A V.I.P. Member Search Today's Posts Mark Forums Read

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.

Google
Closed Thread
 
LinkBack Thread Tools Display Modes
Old 07-02-2007, 10:59 AM   #1
David Wang
 
David Wang's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default blocking mysql to read

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

 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Advertisements
Old 07-02-2007, 10:59 AM   #2
Andreas Stieger
 
Andreas Stieger's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default blocking mysql to read

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

 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 07-02-2007, 10:59 AM   #3
David Wang
 
David Wang's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default blocking mysql to read

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



 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 07-02-2007, 10:59 AM   #4
Good Man
 
Good Man's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default blocking mysql to read

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!

 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 07-02-2007, 11:00 AM   #5
Kevin Day
 
Kevin Day's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default blocking mysql to read

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.

 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 07-02-2007, 11:00 AM   #6
David Wang
 
David Wang's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default blocking mysql to read

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.



 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Featured Websites
Free Space
Free Space
Free Space Free Space
Closed Thread
Tags: , ,




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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




All times are GMT +1. The time now is 12:11 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.0.0
Cheap Computers
MK PitStop Copyright 2005 - 2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98