Skip to content

Adding support for the mode query parameter in Sqlite (PHP 8.1) #2052

@swiffer

Description

@swiffer

PHP Sqlite allows setting mode and cache parameters. While adding support for cache was straight forward I struggled a little bit with the mode parameter and the options that are currently possible.

Currently for a sqlite connection you can set name and memory options. If memory has been set to anything name is overwritten to :memory:.

https://github.com/cakephp/phinx/blob/master/tests/Phinx/Config/ConfigTest.php#L344

What is the benefit of having the memory option and not specifying :memory: in the name directly?

PHP 8.1+ adds support for using mode query parameter when creating a connection. Wouldn't it be better to keep the name or use the name specified in memory if not true as name for the database?

https://github.com/cakephp/phinx/blob/master/src/Phinx/Db/Adapter/SQLiteAdapter.php#L159

                if($options['memory'] !== true && PHP_VERSION_ID >= 80100) {
                    $options['name'] = $options['memory'];
                    $params[] = 'mode=memory';
                } else {
                    $options['name'] = static::MEMORY;
                }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions