I currently have a web app that has an SQLite database controlling user SQLite databases. When new users subscribe, a new SQLite databases file is added using sqlClientDB.CreateDatabaseFile & then sqlClientDB.SQLExecute ("create table… to create the tables & fields etc.
My question is, how, using Xojo, do you add a new PostgreSQL data file for a new user? I am fine with tables & fields etc, but unless I missing something, Xojo doesn’t have CreateDatabaseFile method like it does for SQLite.
LIke nearly all database systems, you can create any object using sql. Use the CREATE DATABASE command to create a new database. You’ll need to refer to the postgresql documentation for the full syntax/options.
createdb is a command line utility that just runs the CREATE DATABASE sql query.
You don’t have a Connect line in your sample code (If mDB.Connect Then…).
You will need to connect to an existing database first before executing any queries. You can connect to the default postgres db, then create the new db, then start a new connection to that database.