[Gambas-user] [Gambas Bug Tracker] Bug #1108: sqlite path when used with name does not create db in the given path

bugtracker at ...3416... bugtracker at ...3416...
Wed May 24 17:38:54 CEST 2017


http://gambaswiki.org/bugtracker/edit?object=BUG.1108&from=L21haW4-

Comment #2 by Tobias BOEGE:

You forgot to set $conexionsqli.Host = Application.Path before calling Databases.Add(). (Where did you expect the database to go without giving it a host?) Try this:

Public Function getConexion()
  ' Clear directory
  Try Kill Application.Path & "/test"

  $conexionsqli = New Connection
  $conexionsqli.Type = "sqlite3"
  ' "Connect" to the host (i.e. the directory where we create the database)
  $conexionsqli.Host = Application.Path
  ' There is no database yet, so set Name = Null
  $conexionsqli.Name = Null
  $conexionsqli.Open()
  ' Add the database and close the connection
  $conexionsqli.Databases.Add("test")
  $conexionsqli.Close()
  ' Afterwards we can select the now-existing database
  $conexionsqli.Name = "test"
  $conexionsqli.Open()
End

Tobias BOEGE changed the state of the bug to: Invalid.






More information about the User mailing list