WordPress / sqlite-database-integration

Feature Plugin to add SQLite support to WordPress. Under Development.
GNU General Public License v2.0
223 stars 37 forks source link

Add support for `CURRENT_TIMESTAMP()` calls with parentheses #151

Closed JanJakes closed 1 month ago

JanJakes commented 1 month ago

While SQLite does support CURRENT_TIMESTAMP function calls natively, it doesn't support calling the function with parentheses in the form of CURRENT_TIMESTAMP().

This pull request removes the parentheses after CURRENT_TIMESTAMP keyword for all types of queries.

The following types of queries will now work:

SELECT
    current_timestamp AS t1,
    CURRENT_TIMESTAMP AS t2,
    current_timestamp() AS t3,
    CURRENT_TIMESTAMP() AS t4;

INSERT INTO _dates (option_name, option_value) VALUES ('first', current_timestamp());

UPDATE _dates SET option_value = CURRENT_TIMESTAMP();

DELETE FROM _dates WHERE option_value = CURRENT_TIMESTAMP();

Closes https://github.com/WordPress/sqlite-database-integration/pull/129.

adamziel commented 1 month ago

Thank you!