Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Find Out Last Modified Time of MySQL Table

Find Out Last Modified Time of MySQL Table
Thread Tools
Mac Elite
Join Date: Nov 2003
Location: Rockville, MD
Status: Offline
Reply With Quote
May 31, 2007, 09:02 PM
 
I want to know when a particular MySQL table was last updated. How do I form a query to do that? I imagine it has something to do with retrieving the create_time row of the SHOW STATUS table (because I use InnoDB, that I believe is the modified date, believe it or not -- I think it's a bug).

Any ideas?

EDIT: I came up with this PHP code:
[codex]<?php
mysql_connect("localhost","user","password");
$result = mysql_query("SHOW TABLE STATUS FROM db_name LIKE 'tbl_name';");

while($array = mysql_fetch_array($result)) {
echo 'Table: ' . $array[Name] . '<br />
Create Time: ' . $array[Create_time];
}

?> [/codex]So I more or less answered my own question. Weird, though, that Create_time in an InnoDB table appears to actually be the time of modification, not creation. I wonder if that's an acknowledged bug?
(Last edited by selowitch; Jun 3, 2007 at 03:18 PM. )
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:28 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2