Re: MDB & postgresql timestamptz

From: Date: Mon, 16 Jun 2003 10:53:58 +0000
Subject: Re: MDB & postgresql timestamptz
References: 1  Groups: php.pear.dev php.pear.general 
Request: Send a blank email to pear-dev+get-17512@lists.php.net to get a copy of this message
Lukas Smith wrote:
From: Jeroen Houben [mailto:jeroen@terena.nl] Sent: Monday, June 16, 2003 11:59 AM
I'm trying to insert data into a Postgresql table with a timestamptz (with timezone) field. Here's my query:
       $doc_id = $db->nextId('documents_id');
       $db->query('INSERT INTO documents VALUES
       ('.
       $db->getIntegerValue($doc_id).','.
       $db->getTextValue($_FILES['file']['name']).','.
       $db->getIntegerValue($_FILES['file']['size']).','.
       $db->getTextValue($_FILES['file']['type']).','.
       $db->getTextValue($_POST['description']).','.
       $db->getTimestampValue(mktime())
       .')');
The error I get is: [nativecode = ERROR: Bad timestamp external representation '1055756194' ] Timestamptz values look like this in Postgresql: 2002-05-30
13:53:48+02,
which is different from mysql IIRC correctly. I could not find any method in MDB that converts timestamps to this format.
As far as I know there is no way to represent timezone data in the MDB format since this is also not available in Metabase .. You would have to store this data in a separate field.
Okay fair enough, but it also doesn't work for normal timestamps. Inserting like this won't work on a normal timestamp field... $db->getTimestampValue(mktime()) Jeroen

« previous php.pear.dev (#17512) next »