non programmatically SQLite

If used the non programmatically way: Insert/Database/New SQLite Database to add a database class. Xojo ask then for a path and creates the empty database file.
Is there a way to change this path later?. (move the database file to another folder)

you mean “copy it”… certainly… handle moving the database the same as you would any other file

I mean that when using the non programmatically SQL once the data file is created, if you move the file to another folder, when the xojo app you are using opens again, as the data file is not in the folder as expected it creates a new (end empty) database in the original folder.

Enric,

search where the code that opens the db file and modify the way open … opens the data base.

I never use the (SQLite) db this way.

There is not such code.

I also not use to use the (SQLite) db this way, I’m just trying to learn how it works that way.

In the menu “Insert Database” there is a “Select SQLite Database…” menu item at the bottom.

No, this don’t work and this would not be useful once the app is done.

Well, then you have to rephrase your question, because it seems that we all do not understand what you want.

It is not about code:

and not about the database editor in the IDE.

So what is your question about?

-> Eli

Is there a way to change this path later?. (move the database file to another folder)

You move the file as you move any other file on your computer and then select it via the “Select SQLite Database…” menu item.

Have you tried it?

You do not generate the application ?

You use Xojo in free mode (without license) ?

BTW: I think someone have to follow your steps to be able to give you a correct answer.

Yes, just now.

Imagine an app created using this way and its database has already some records.
Once the app is generated (compiled) you must install it on another computer.
You must also move to this new computer the database.sqlite file, and the app, on start, should know where you placed in this computer or ask for it.

When you do this you create a new database in the app, if original name was database1 another database class will be added as database2.
Even though this is not useful when deploying the compiled app.

How do you create one non programmatically SQLite ?

I found it ! It is in a SubMenu

Once the “project” is created, saved, built, fired, you cannot do anything with the application / db file.

So, I do not really understand the purpose.

If I understood your question:
You create the database and some data, then you compile the app, install it on another computer and you want the data you have inserted.

You can set the db file as resource, if in the new installation there is no data you can:
copy the file to the new location
open it and create a backup in the new location
create it by code in the new location e open the resource and copy the “old” data into the “new” db

There is no visible code as is in the .xojo_binary_project file.

There is something visible in the xml file, encrypted.

Using the Database Design Editor (my name, Xojo name ?) only allow you to make an approach to the data base, la FireMaker, but once you have created the .sqlite file, populated some entries, what will you do with that ?

Add Xojo code to ope the .sqlite file, display its contents, allow o add new, modify old or delete all. Being able to move the .sqlite file is not a step in the db understanding process.

You need to add a displayer (Listbox, but you can use a bunch of TextEdit Controls), code to open / read the .sqlite, and do everything (nearly) a db allows you to do.

One of the first things I do when I start a brand new project with a data base is to create a text file with data (string with Tab delimiters / a return to close a Record), then add code to import that text file.

This allows me to trash a .sqlite file if I make errors in the creation process.

The second method I add is the export to text file, then I populate the needed methods.

I think the link I shared earlier will allow you to understand how to code these.

The book: Introduction To Programming With Xojo also have a chapter about Data base.

Of course, a question here is welcome.

[quote=306562:@Enric Herrera]Imagine an app created using this way and its database has already some records.
Once the app is generated (compiled) you must install it on another computer.
You must also move to this new computer the database.sqlite file, and the app, on start, should know where you placed in this computer or ask for it.[/quote]
You need to do that in code. The path is hard-coded and there is no way to change that – assigning a folder item to SQLiteDatabase.DatabaseFile crashes the application.

AFAIK almost nobody uses this way of creating and using databases anymore. It dates back to the beginnings of REALbasic and I think it is kept by Xojo for existing projects. Personally I would recommend to do anything in SQL.