TechTalkz.com Logo

Go Back   TechTalkz.com Technology & Computer Troubleshooting Forums > Software World > Programming

Notices

Change detection in MySQL.

Programming


Reply
 
Thread Tools Display Modes
Old 13-05-2009, 04:27 PM   #1
Junior Member (25+)
 
Join Date: Jan 2009
Posts: 48
Thanks: 13
Thanked 0 Times in 0 Posts
Rep Power: 0 amit_27 is an unknown quantity at this point


OS: Windows NT / Windows 2000


Change detection in MySQL.

Hi,

I am trying to build a application in C++ in which I can be able to flow data to MySQL and vice -versa.

I need to understand that how the update, any changes done in MySQL database will be known or immediately flown to other side?

What is the Change detection mechanism in MySQL?

What I am trying to understood is :
If I add some entry in Database it has immediately flown to other side.

Can you please shed some light on this?
amit_27 is offline   Reply With Quote
Old 13-05-2009, 04:52 PM   #2
ƒ(ψ)=ΘΊΧφ
 
bakuryu's Avatar
 
Join Date: May 2006
Location: India
Age: 23
Posts: 6,621
Thanks: 19
Thanked 645 Times in 603 Posts
Rep Power: 87 bakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant future


OS: Windows XP Windows Vista Windows 7


Send a message via Yahoo to bakuryu
Re: Change detection in MySQL.

Use a timer and query the table at interval of say 60 sec.
__________________
Please don't click here
bakuryu is offline   Reply With Quote
Thanked Users:
amit_27 (26-05-2009)
Old 13-05-2009, 04:54 PM   #3
Junior Member (25+)
 
Join Date: Jan 2009
Posts: 48
Thanks: 13
Thanked 0 Times in 0 Posts
Rep Power: 0 amit_27 is an unknown quantity at this point


OS: Windows NT / Windows 2000


Re: Change detection in MySQL.

In more details:

Is there any API, command for MySQL which will return the changes between given time period
Ex. suppose from 10.11 am to 14.00 pm

Or something like If given any range
From last change number 100 to onwords all changes.
amit_27 is offline   Reply With Quote
Old 13-05-2009, 05:03 PM   #4
ƒ(ψ)=ΘΊΧφ
 
bakuryu's Avatar
 
Join Date: May 2006
Location: India
Age: 23
Posts: 6,621
Thanks: 19
Thanked 645 Times in 603 Posts
Rep Power: 87 bakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant future


OS: Windows XP Windows Vista Windows 7


Send a message via Yahoo to bakuryu
Re: Change detection in MySQL.

If the table has any timestamp fields set to change itself on insert or update then you need to add them to your sql query with a where clause.
bakuryu is offline   Reply With Quote
Thanked Users:
amit_27 (26-05-2009)
Old 13-05-2009, 07:30 PM   #5
Junior Member (25+)
 
Join Date: Jan 2009
Posts: 48
Thanks: 13
Thanked 0 Times in 0 Posts
Rep Power: 0 amit_27 is an unknown quantity at this point


OS: Windows NT / Windows 2000


Re: Change detection in MySQL.

It is good if the table has timestamp field.

In such a cases where we don't have filed like this, and need to find out the all different changes (add, delete, modify, rename) done on number of tables.

I searched and tried to find out the same but not yet got the sufficient information.

Do we have any MySQL API which accepts some parameter and internally execute the command to return the changes?
amit_27 is offline   Reply With Quote
Old 14-05-2009, 02:38 PM   #6
ƒ(ψ)=ΘΊΧφ
 
bakuryu's Avatar
 
Join Date: May 2006
Location: India
Age: 23
Posts: 6,621
Thanks: 19
Thanked 645 Times in 603 Posts
Rep Power: 87 bakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant future


OS: Windows XP Windows Vista Windows 7


Send a message via Yahoo to bakuryu
Re: Change detection in MySQL.

You can use Triggers.
MySQL :: MySQL 5.0 Reference Manual :: 18.3 Using Triggers
bakuryu is offline   Reply With Quote
Thanked Users:
amit_27 (26-05-2009)
Old 14-05-2009, 02:43 PM   #7
Junior Member (25+)
 
Join Date: Jan 2009
Posts: 48
Thanks: 13
Thanked 0 Times in 0 Posts
Rep Power: 0 amit_27 is an unknown quantity at this point


OS: Windows NT / Windows 2000


Re: Change detection in MySQL.

Thanks.

Currently I am on the same track. I was just looking into triggers for changes in MySQL database.
amit_27 is offline   Reply With Quote
Old 15-05-2009, 12:32 PM   #8
Junior Member (25+)
 
Join Date: Jan 2009
Posts: 48
Thanks: 13
Thanked 0 Times in 0 Posts
Rep Power: 0 amit_27 is an unknown quantity at this point


OS: Windows NT / Windows 2000


Re: Change detection in MySQL.

Can you please tell me that If I want to use the latest version of MySQL with trigger facility then which will be better 5.0 or 6.0 or in between?
amit_27 is offline   Reply With Quote
Old 15-05-2009, 11:30 PM   #9
ƒ(ψ)=ΘΊΧφ
 
bakuryu's Avatar
 
Join Date: May 2006
Location: India
Age: 23
Posts: 6,621
Thanks: 19
Thanked 645 Times in 603 Posts
Rep Power: 87 bakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant futurebakuryu has a brilliant future


OS: Windows XP Windows Vista Windows 7


Send a message via Yahoo to bakuryu
Re: Change detection in MySQL.

Version 6 is still in Alpha stage and might go a lot of changes before it's finally released. You can use any version of Mysql 5, 5.1.34 or 5.2.3.0
bakuryu is offline   Reply With Quote
Thanked Users:
amit_27 (26-05-2009)
Old 18-05-2009, 03:57 PM   #10
Junior Member (25+)
 
Join Date: Jan 2009
Posts: 48
Thanks: 13
Thanked 0 Times in 0 Posts
Rep Power: 0 amit_27 is an unknown quantity at this point


OS: Windows NT / Windows 2000


Hi,

I have seen the IDENTITY property in MSSQL used like:
CREATE TABLE test(idencol INT IDENTITY(1,1), dupcol INT NOT NULL);


I need to create a same query in MySQL. I saw that there is AUTO_INCREMENT in MySQL. But not sure it is the one which I can use instead if identity.

Can you please confirm me or suggest me if I am wrong.
What can I used instead of IDENTITY?
Amit

I am trying to use the DECLARE in my trigger definition. I have just created trigger as:
CREATE TRIGGER t1 BEFORE INSERT ON account FOR EACH ROW
BEGIN
DECLARE done INT DEFAULT 0;
END
END;

But it is giving me error. i am using MySQL 5.1.34 version.
I have seen for a DECLARE statement in reference but it is given the same. I wonder why this is not working?

Error is :
-> BEGIN
-> DECLARE done INT DEFAULT 0;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '' at
line 3

Last edited by bakuryu; 18-05-2009 at 09:27 PM..
amit_27 is offline   Reply With Quote
Reply

Thread Tools
Display Modes



< Windows Help - MS Office Help - Hardware Support >


New To Site? Need Help?

All times are GMT +5.5. The time now is 09:13 AM.


vBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO
Copyright © 2005-2009, TechTalkz.com. All Rights Reserved - Privacy Policy
Valid XHTML 1.0 Transitional