return !preg_match( '/^(?:SELECT|BEGIN|COMMIT|SET|SHOW|\(SELECT)\b/i', $sql );
}
+ /**
+ * Database specific translations like MySQL's UNIX_TIMESTAMP() to
+ * something the DB can use.
+ */
+ function translateSQLFunctions( $vars ) {
+ return $vars;
+ }
+
/**
* Usually aborts on failure. If errors are explicitly ignored, returns success.
*
} else {
$userName = '';
}
- $commentedSql = preg_replace( '/\s/', " /* $fname $userName */ ", $sql, 1 );
+ $commentedSql = $this->translateSQLFunctions( preg_replace( '/\s/', " /* $fname $userName */ ", $sql, 1 ) );
# } else {
# $commentedSql = $sql;
# }
return parent::makeSelectOptions( $options );
}
+ /**
+ * Database specific translations like MySQL's UNIX_TIMESTAMP() to
+ * something the DB can use.
+ */
+ function translateSQLFunctions( $vars ) {
+ return preg_replace( '/UNIX_TIMESTAMP\(([^()]+)\)/', 'strftime("%s",\1)', $vars );
+ }
+
+
/**
* Based on generic method (parent) with some prior SQLite-sepcific adjustments
*/