[MDB] About types conversions

From: Date: Sat, 30 Aug 2003 14:56:08 +0000
Subject: [MDB] About types conversions
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-7499@lists.php.net to get a copy of this message
Hi, Although I understand the general purpose of data type conversion, I have some questions, keeping in mind that I want my code to run on every DMBS supported by MDB: 1/ If I want to insert the current DateTime in a timestamp field, I thought that I just could use in my sql statement : $sql = "INSERT INTO mytable ( field1, timestamp, field2) VALUES (value1, '" . MDB_Date::mdbNow() . "', value2)"; so that the datetime is already in the good MDB timestamp type. But in http://www.php-mag.net/itr/online_artikel/psecom,id,283,nodeid,114.html ('Write once - run anywhere'), I see that a unix time variable is first converted to MDB time stamp with 'unix2Mdbstamp' and then again with 'getTimestampValue'. Does it mean that an MDB timestamp is not sufficient to provide each DBMS driver the proper value and instead I had to write my sql statement like this ? : $sql = "INSERT INTO mytable ( field1, timestamp, field2) VALUES (value1, '" . getTimestampValue(MDB_Date::mdbNow()) . "', value2)"; /2- In MDB tutorial, it is said that "text and integer result data do not need to be converted" in a result set. But in the same PHP magazine article above it is said that only integer does not need to be converted, but we are adviced to convert all types ? Thanks Thierry Bothorel

« previous php.pear.general (#7499) next »