Index: trunk/phase3/includes/db/Database.php |
— | — | @@ -597,6 +597,14 @@ |
598 | 598 | } |
599 | 599 | |
600 | 600 | /** |
| 601 | + * Database specific translations like MySQL's UNIX_TIMESTAMP() to |
| 602 | + * something the DB can use. |
| 603 | + */ |
| 604 | + function translateSQLFunctions( $vars ) { |
| 605 | + return $vars; |
| 606 | + } |
| 607 | + |
| 608 | + /** |
601 | 609 | * Usually aborts on failure. If errors are explicitly ignored, returns success. |
602 | 610 | * |
603 | 611 | * @param $sql String: SQL query |
— | — | @@ -650,7 +658,7 @@ |
651 | 659 | } else { |
652 | 660 | $userName = ''; |
653 | 661 | } |
654 | | - $commentedSql = preg_replace( '/\s/', " /* $fname $userName */ ", $sql, 1 ); |
| 662 | + $commentedSql = $this->translateSQLFunctions( preg_replace( '/\s/', " /* $fname $userName */ ", $sql, 1 ) ); |
655 | 663 | # } else { |
656 | 664 | # $commentedSql = $sql; |
657 | 665 | # } |
Index: trunk/phase3/includes/db/DatabaseSqlite.php |
— | — | @@ -364,6 +364,15 @@ |
365 | 365 | } |
366 | 366 | |
367 | 367 | /** |
| 368 | + * Database specific translations like MySQL's UNIX_TIMESTAMP() to |
| 369 | + * something the DB can use. |
| 370 | + */ |
| 371 | + function translateSQLFunctions( $vars ) { |
| 372 | + return preg_replace( '/UNIX_TIMESTAMP\(([^()]+)\)/', 'strftime("%s",\1)', $vars ); |
| 373 | + } |
| 374 | + |
| 375 | + |
| 376 | + /** |
368 | 377 | * Based on generic method (parent) with some prior SQLite-sepcific adjustments |
369 | 378 | */ |
370 | 379 | function insert( $table, $a, $fname = 'DatabaseSqlite::insert', $options = array() ) { |