Status & Roadmap
Authors & License
Funding U++
Search on this site

SourceForge.net Logo

SourceForge.net Logo

GitHub Logo

Discord Logo


U++ SQL Basics

Database Model

The database model is described by the user in schema (".sch") files. The user models the database and U++ SQL packages handle the creation/modification of the database.

Schema description files (.sch) and sql script files (.sql)

Each database should be described in a schema description file, which is a file with extension ".sch" and . describes what tables you want to have in the database. U++ SQL packages will take the schema, create ".sql" script files from it (containing DDL statements like 'create table'...) and execute them against the database to realize your database table structure (you do not need to write sql statements, U++ will generate them for you.)

To add this file to your Upp package, make sure your package is selected in the package list (located at the top-left of TheIDE), right-click on the white-space in the file list (underneath the package list at bottom-left), and select "Insert package directory file(s)". Then give the new name of your file (eg. "MyDatabase.sch") and click "Open". The new file will show up in your file list.

SQL Create, Read, Update, Delete (CRUD)

The four basic functions of database storage are all supported, with the ability to have U++ generate the sql statements for you. The SQL code written using U++ acts as a supplement for writing sql queries themselves. The code is much more descriptive and easier to read than SQL. In fact, sql scripts and query strings are generated by the U++ SQL classes, and you can view the generated queries with a simple method call.

Schema Update/Upgrade

The SQL packages also allow for database updates without losing your stored data. The main purpose is to allow incremental development of the model. This functionality is limited though, as it is implemented using "ALTER" sql commands and does not support removing columns or changing datatypes. Those functions have to be done manually.


Do you want to contribute?