Changeset 6667

Show
Ignore:
Timestamp:
07/06/10 14:17:37 (3 years ago)
Author:
nikrou
Message:

Bug 1766 fixed : [PostgreSQL] unkown database function UNIX_TIMESTAMP()
Add a new function pwg_db_date_to_ts() to calculate a timestamp from a date
Merge from trunk

Location:
branches/2.1/include
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • branches/2.1/include/dblayer/functions_mysql.inc.php

    r6605 r6667  
    637637} 
    638638 
     639function pwg_db_date_to_ts($date)  
     640{ 
     641  return 'UNIX_TIMESTAMP('.$date.')'; 
     642} 
     643 
    639644// my_error returns (or send to standard output) the message concerning the 
    640645// error occured for the last mysql query. 
  • branches/2.1/include/dblayer/functions_pdo-sqlite.inc.php

    r6605 r6667  
    551551} 
    552552 
     553function pwg_db_date_to_ts($date)  
     554{ 
     555  return 'UNIX_TIMESTAMP('.$date.')'; 
     556} 
     557 
    553558// my_error returns (or send to standard output) the message concerning the 
    554559// error occured for the last mysql query. 
  • branches/2.1/include/dblayer/functions_pgsql.inc.php

    r6605 r6667  
    597597} 
    598598 
     599function pwg_db_date_to_ts($date)  
     600{ 
     601  return 'EXTRACT(EPOCH FROM '.$date.')'; 
     602} 
     603 
    599604// my_error returns (or send to standard output) the message concerning the 
    600605// error occured for the last pgsql query. 
  • branches/2.1/include/dblayer/functions_sqlite.inc.php

    r6605 r6667  
    562562} 
    563563 
     564function pwg_db_date_to_ts($date)  
     565{ 
     566  return 'UNIX_TIMESTAMP('.$date.')'; 
     567} 
     568 
    564569// my_error returns (or send to standard output) the message concerning the 
    565570// error occured for the last mysql query. 
  • branches/2.1/include/functions_session.inc.php

    r6364 r6667  
    176176DELETE 
    177177  FROM '.SESSIONS_TABLE.' 
    178   WHERE UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(expiration) > ' 
     178  WHERE '.pwg_db_date_to_ts('NOW()').' - '.pwg_db_date_to_ts('expiration').' > ' 
    179179  .$conf['session_length'].' 
    180180;';