Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-332

Memory option for Sqlite driver does nothing

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 2.2.2, 2.3
    • Fix Version/s: None
    • Component/s: Drivers
    • Security Level: All
    • Labels:
      None
    • Environment:
      PHP Version 5.3.10
      SQLite Library 3.7.9
      Doctrine 2.3.x-dev
      Dbal 2.3.x-dev
      Symfony 2.1 RC2

      Description

      I'm trying to configure a "memory" sqlite database, as described here: http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#pdo-sqlite

      So here is my configuration (config_test.yml) :

      Unable to find source-code formatter for language: yml. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
       
      doctrine:
          dbal:
              driver:    pdo_sqlite
              memory:    true
              user:      db_user
              password:  db_pwd
              charset:   UTF8
      

      I'm then running

      ./app/console doctrine:database:create --env=test

      and the result is a "myBdName" db file (the filename contains the quote!!) in my root folder.

      I don't understand why the file http://www.doctrine-project.org/api/dbal/2.3/source-class-Doctrine.DBAL.Schema.SqliteSchemaManager.html#46 is creating a path option with my DB name, if I comment the line 57, everything seems fine (no more file created).

      I have seen some memory related options in the Doctrine test suite so maybe I'm doing it wrong, and in that case that's a documentation issue I can work on.

      Thx,
      Damien

        Activity

        Damien ALEXANDRE created issue -
        Hide
        Benjamin Eberlei added a comment -

        You cannot create an in memory database using Symfonys database:create. The in memory database will be closed when the request ends. So its completly useless this way. You have to recreate it in every request that you want to use it. It is just good for one request.

        Show
        Benjamin Eberlei added a comment - You cannot create an in memory database using Symfonys database:create. The in memory database will be closed when the request ends. So its completly useless this way. You have to recreate it in every request that you want to use it. It is just good for one request.
        Benjamin Eberlei made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Invalid [ 6 ]
        Hide
        Damien ALEXANDRE added a comment -

        My example with "app/console" is misleading,
        what I want to do is building a memory SQLite database on the fly and run some code right after it (in a phpunit test).

        The issue here is that there is an option documented (first link) that doesn't work / is not implemented (second link). And a physic file is generated, it should not.

        As your answer seems to be based on the mistaken impression that I wanted to use volatile database in a persistent way, I'm reopening this issue.

        Thanks for your time.
        Damien.

        Show
        Damien ALEXANDRE added a comment - My example with "app/console" is misleading, what I want to do is building a memory SQLite database on the fly and run some code right after it (in a phpunit test). The issue here is that there is an option documented (first link) that doesn't work / is not implemented (second link). And a physic file is generated, it should not. As your answer seems to be based on the mistaken impression that I wanted to use volatile database in a persistent way, I'm reopening this issue. Thanks for your time. Damien.
        Damien ALEXANDRE made changes -
        Resolution Invalid [ 6 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Hide
        Benjamin Eberlei added a comment -

        Try removing the user/password keys. memory database connection works for me, this seems to be a configuration issue.

        If you want to create an in memory db for testing then you have to create the schema with SchemaTool inside the phpunit tests.

        Show
        Benjamin Eberlei added a comment - Try removing the user/password keys. memory database connection works for me, this seems to be a configuration issue. If you want to create an in memory db for testing then you have to create the schema with SchemaTool inside the phpunit tests.
        Hide
        Benjamin Eberlei added a comment -

        No feedback on potential fix, this issue is either misconfiguration or wrong use of the API. I couldn't reproduce this and it works for me (TM).

        Show
        Benjamin Eberlei added a comment - No feedback on potential fix, this issue is either misconfiguration or wrong use of the API. I couldn't reproduce this and it works for me (TM).
        Benjamin Eberlei made changes -
        Status Reopened [ 4 ] Closed [ 6 ]
        Resolution Invalid [ 6 ]

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DBAL-332, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Damien ALEXANDRE
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: