Author: ralfbecker
New Revision: 31985
URL: http://www.egroupware.org/viewvc/egroupware?rev=31985&view=rev
Log:
new method to abstract MySQL function unix_timestamp (convert db timestamp to integer)
Modified:
trunk/phpgwapi/inc/class.egw_db.inc.php
Modified: trunk/phpgwapi/inc/class.egw_db.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/trunk/phpgwapi/inc/class.egw_db.inc.php?rev=31985&r1=31984&r2=31985&view=diff
— trunk/phpgwapi/inc/class.egw_db.inc.php (original)
+++ trunk/phpgwapi/inc/class.egw_db.inc.php Thu Sep 9 11:06:13 2010
@@ -1233,6 +1233,28 @@
}
/**
-
- Convert a DB specific timestamp in a unix timestamp stored as integer, like MySQL: UNIX_TIMESTAMP(ts)
-
-
- @param string $expr name of an integer column or integer expression
-
- @return string SQL expression of type timestamp
- */
- function unix_timestamp($expr)
- {
-
switch($this->Type) -
{ -
case 'mysql': -
return "UNIX_TIMESTAMP($expr)"; -
case 'pgsql': -
return "DATE_PART('epoch',$expr)"; -
case 'mssql': -
return "DATEDIFF(second,'1970-01-01',($expr))"; -
} - }
- /**
- Convert a unix timestamp stored as integer in the db into a db timestamp, like MySQL: FROM_UNIXTIME(ts)
- @param string $expr name of an integer column or integer expression
This SF.net Dev2Dev email is sponsored by:
Show off your parallel programming skills.
Enter the Intel® Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs