[Gambas-user] Re; MySQL "timestamp"

Paul Horechuk horechuk at ...981...
Tue Jul 17 17:11:41 CEST 2007


On July 17, 2007, Gareth Bult wrote:
> Hi,
>
> Here goes .. (it's pretty basic)
>
> -- MySQL dump 10.11
> --
> -- Host: localhost    Database: axis
> -- ------------------------------------------------------
> -- Server version       5.0.38-Ubuntu_0ubuntu1-log
>
> /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
> /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
> /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
> /*!40101 SET NAMES utf8 */;
> /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
> /*!40103 SET TIME_ZONE='+00:00' */;
> /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
> /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS,
> FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE,
> SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET
> @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
>
> --
> -- Table structure for table `cache`
> --
>
> DROP TABLE IF EXISTS `cache`;
> CREATE TABLE `cache` (
>   `id` int(11) NOT NULL,
>   `camera` tinyint(1) NOT NULL,
>   `stamp` timestamp NULL default NULL,
>   `event` enum('End','Start') default NULL,
>   `image` mediumblob,
>   KEY `event` (`event`)
> ) ENGINE=MyISAM AUTO_INCREMENT=712 DEFAULT CHARSET=latin1;
>
> ---- Table structure for table `frames`
> --
> DROP TABLE IF EXISTS `frames`;
> CREATE TABLE `frames` (  `id` int(11) NOT NULL auto_increment,  `camera`
> tinyint(1) NOT NULL,  `stamp` timestamp NOT NULL default
> CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,  `event`
> enum('End','Start') default NULL,  `image` mediumblob,  PRIMARY KEY 
> (`id`),  KEY `event` (`event`)) ENGINE=MyISAM AUTO_INCREMENT=712 DEFAULT
> CHARSET=latin1;
>
> ---- Dumping data for table `frames`
> --LOCK TABLES `frames` WRITE;
> /*!40000 ALTER TABLE `frames` DISABLE KEYS */;
> INSERT INTO `frames` VALUES (1,0,'2007-07-16 16:55:40',NULL,NULL)
> /*!40000 ALTER TABLE `frames` ENABLE KEYS */;
> UNLOCK TABLES;
> /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
> /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
> /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
> /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
> /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
> /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
> /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
> /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
> -- Dump completed on 2007-07-17 14:04:45
>
> --
> Gareth Bult, Encryptec Limited
> Tel: 0845 25 77033, Mob: 07891 389657
> Email: gareth at ...1689...
> Statements made are at all times subject to Encryptec's Terms and
> Conditions of Business, which are available upon request.
>
> ----- Original Message -----
> From: "Benoit Minisini" <gambas at ...1...>
> To: "mailing list for gambas users" <gambas-user at lists.sourceforge.net>
> Sent: Tuesday, July 17, 2007 2:36:20 PM (GMT) Europe/London
> Subject: Re: [Gambas-user] Re; MySQL "timestamp"
>
> On mardi 17 juillet 2007, Gareth Bult wrote:
> > Hi,
> >
> > Is there a trick to using a MySQL "timestamp" field from inside Gambas

Pardon me for jumping in here, but aren't timestamps supposed to be returned 
as longint? They should like something like 1184670240 = Jul 17, 2007 @ 
11:04:00. Whenever I worked with timestamps, I had to write a class to 
convert either way. I understand mysql can convert as a sql command. I 
found this on the web: 
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html
which has a number of functions dealing with conversions.

> > ?
> >
> > It seems to recognise a timestamp as a date type, but reads it looks
> > totally corrupt.
> >
> > Using;
> > $resultSet = connection.Exec("SELECT id,camera,event,image,stamp FROM
> > cache WHERE id = &1",id)
> >
> > In the debugger I see (for example);
> >
> > $resultSet!stamp gives 01/01/-4801 -276:-2:-37
> > (as opposed to 16-07-2007 17:55:40)
> >
> > .. "Date" fields seem to work fine ..
> >
> > ??
> >
> > tia
> > Gareth.
>
> According to the source code, the "timestamp" are managed, as the other
> date/time MySQL datatypes.
>
> Can you send me your database, or at least the table with just the
> offending record, in SQL text dump format?
>
> Thanks in advance.



-- 
Paul Horechuk
      Think Free 
Use Open Source Software




More information about the User mailing list